A method, apparatus, electronic device, and medium for knowledge graph version management
By identifying and updating entities and their relationships in a knowledge graph, the problem of resource waste is solved, and efficient version management and data tracking are achieved.
Patent Information
- Application Number
- CN202511483662.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-10-17
AI Technical Summary
Existing knowledge graph version management technologies are wasteful in terms of resource consumption. Static mode cannot obtain historical data, while time-series dynamic update method consumes a lot of computing and storage resources.
By identifying entities and relationships in the knowledge material, the system searches the historical versions of the knowledge graph to see if the entity exists. If it does not exist, it is created in the latest version. If it exists, the system copies and updates the entity and its relationships, and creates new relationships based on the identified relationships.
It enables rapid tracking of the evolution of knowledge graph data, reduces resource consumption, and improves the efficiency and accuracy of version management.
Smart Images

Figure CN120996035B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graph technology, and in particular to a method, apparatus, device and medium for knowledge graph version management. Background Technology
[0002] Knowledge graphs are a technology that integrates multi-source data and stores complex data information through a symbolic form of triples (entity-relationship-entity). However, their construction and maintenance require frequent iterations. The updating and maintenance of knowledge graphs introduces the issue of version management for knowledge nodes. Traditional version management techniques for knowledge graphs are divided into two modes: static maintenance and time-series dynamic updates.
[0003] In existing solutions, static knowledge graphs only retain the current state of the knowledge graph and cannot obtain historical data. In contrast, time-series dynamic knowledge graphs achieve version management by taking snapshots of the knowledge graph at a certain time granularity. This method consumes a lot of computing and storage resources, resulting in a huge waste of resources. Summary of the Invention
[0004] This invention provides a knowledge graph version management method, device, electronic device, and medium to reduce resource consumption and quickly track the evolution of data sources.
[0005] According to one aspect of the present invention, a knowledge graph version management method is provided, comprising:
[0006] The acquired knowledge material is parsed to identify multiple first entities contained in the knowledge material and the first relationships of the first entities;
[0007] If the first entity exists in the second entity of a historical version of the knowledge graph, then create the first entity in the latest version of the knowledge graph and use the newly created entity as the third entity in the latest version of the knowledge graph. If the first entity exists, then obtain the fourth entity in the knowledge graph with the largest historical version number. The fourth entity is the second entity in the same historical version of the knowledge graph as the first entity.
[0008] The fourth entity is copied into the latest version of the knowledge graph as the fifth entity in the latest version of the knowledge graph, and the attributes of the fifth entity are updated.
[0009] The second relation of the fourth entity is copied into the latest version of the knowledge graph and used as the third relation of the fifth entity;
[0010] Based on the first relationship identified for the first entity, a new relationship is created for the fifth entity;
[0011] Based on the first relation of the first entity identified, a fourth relation of the third entity is created in the latest version of the knowledge graph.
[0012] Optionally, after copying the fourth entity into the latest version of the knowledge graph as the fifth entity in the latest version of the knowledge graph and updating the attributes of the fifth entity, the method further includes:
[0013] A fifth relationship is created between the fifth entity and the fourth entity, and the fifth relationship is updated.
[0014] Optionally, the step of parsing the acquired knowledge material to identify multiple first entities contained in the knowledge material and the first relationships of the first entities includes:
[0015] The rule-based matching method performs dictionary matching on the knowledge material to identify the first entity in the knowledge material;
[0016] And / or, based on a large model, parse the input knowledge material to identify the first entity in the knowledge material;
[0017] The knowledge materials are preprocessed to obtain data in a predetermined format. The preprocessed data is then input into a trained relationship recognition model to identify the first relationship between the first entities.
[0018] Optionally, copying the fourth entity to the latest version of the knowledge graph as the fifth entity in the latest version of the knowledge graph, and updating the attributes of the fifth entity, includes:
[0019] The fourth entity and all its attributes are copied to obtain the fifth entity and its attributes. The version number of the fifth entity is set to the latest version number. The attributes marked as del in the attributes of the fifth entity are deleted, and the status of the other attributes is set to old.
[0020] The attributes of the fifth entity are updated based on the parsed attributes of the first entity, and new attributes are added.
[0021] Optionally, the step of adding a new relationship to the fifth entity based on the identified first relationship of the first entity includes:
[0022] Based on the first relation of the first entity identified, the fifth relation of the fifth entity is determined. Based on the new relation added by the fifth relation compared to the third relation, a new relation of the fifth entity is created in the latest version of the knowledge graph.
[0023] Optionally, creating a fourth relation for the third entity in the latest version of the knowledge graph based on the identified first relation of the first entity includes:
[0024] Based on the first relationship of the first entity identified, the fourth relationship of the third entity is determined, and the fourth relationship of the third entity is created in the latest version of the knowledge graph.
[0025] Optionally, it also includes: detecting whether the number of entities with the same number in the latest version of the knowledge graph is 1; if not, comparing the attribute differences of at least two entities with the same number;
[0026] Based on attribute differences between at least two entities with the same ID, delete at least one entity and its attributes, or merge at least two entities with the same ID.
[0027] According to another aspect of the present invention, a knowledge graph version management device is provided, comprising:
[0028] The parsing module is used to parse the acquired knowledge material to identify multiple first entities contained in the knowledge material and the first relationships of the first entities;
[0029] The retrieval module is used to search whether the first entity exists in the second entity of the historical version of the knowledge graph; if the first entity does not exist, the first entity is created in the latest version of the knowledge graph, and the newly created entity is used as the third entity in the latest version of the knowledge graph; if the first entity exists, the fourth entity in the knowledge graph with the largest historical version number is obtained; the fourth entity is the second entity in the historical version of the knowledge graph that is the same as the first entity.
[0030] The entity update module is used to copy the fourth entity into the latest version of the knowledge graph, making it the fifth entity in the latest version of the knowledge graph, and to update the attributes of the fifth entity.
[0031] The first relation update module is used to copy the second relation of the fourth entity into the latest version of the knowledge graph, as the third relation of the fifth entity;
[0032] The second relationship update module is used to create a new relationship for the fifth entity based on the first relationship of the first entity that has been identified;
[0033] The third relation update module is used to create a fourth relation for the third entity in the latest version of the knowledge graph based on the first relation of the first entity identified.
[0034] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0035] At least one processor; and
[0036] A memory communicatively connected to the at least one processor; wherein,
[0037] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the knowledge graph version management method according to any embodiment of the present invention.
[0038] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the knowledge graph version management method according to any embodiment of the present invention.
[0039] The technical solution of this invention identifies multiple first entities and their first relationships within knowledge materials; searches for the existence of first entities in historical versions of the knowledge graph; if no first entity exists, it creates a first entity in the latest version of the knowledge graph, using the newly created entity as a third entity in the latest version; based on the identified first relationship of the first entity, it creates a fourth relationship of the third entity in the latest version of the knowledge graph; if a first entity exists, it obtains the fourth entity from the knowledge graph with the largest historical version number; copies the fourth entity to the latest version of the knowledge graph as a fifth entity, and updates the attributes of the fifth entity; copies the second relationship of the fourth entity to the latest version of the knowledge graph as a third relationship of the fifth entity; and creates a new relationship for the fifth entity based on the identified first relationship of the first entity. This allows for rapid observation of the evolution of entities in different versions of the knowledge graph.
[0040] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a flowchart of a knowledge graph version management method provided in Embodiment 1 of the present invention;
[0043] Figure 2 This is a flowchart of a knowledge graph version management method provided in Embodiment 2 of the present invention;
[0044] Figure 3 This is a schematic diagram illustrating the updating of the latest version of the entity and entity attributes in one embodiment of the present invention;
[0045] Figure 4 This is a structural diagram of a knowledge graph version management device according to Embodiment 3 of the present invention;
[0046] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the knowledge graph version management method of this invention. Detailed Implementation
[0047] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0048] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0049] Example 1
[0050] Figure 1 This is a flowchart illustrating a knowledge graph version management method provided in Embodiment 1 of the present invention. Figure 1 As shown, the method includes:
[0051] S101. The acquired knowledge material is parsed to identify multiple first entities contained in the knowledge material and the first relationships of the first entities.
[0052] Among them, knowledge materials are the change delivery documents of general software systems. That is, when it is necessary to change the knowledge graph, the entities and relationships in the updated version of the knowledge graph can be extracted based on the knowledge materials.
[0053] In a knowledge graph, entities are the most basic "nodes," representing distinguishable, independent, concrete or abstract things in the real world. Relationships are the "edges" connecting different entities, used to describe the associations or interactions between them. In this embodiment, the first entity refers to multiple knowledge entities included in the knowledge material, such as knowledge entities in the financial field: "margin trading information query," "account," etc. The first relationship of the first entity refers to all relationships associated with the first entity.
[0054] S102. Check if the first entity exists in the second entity of the historical version knowledge graph; if the first entity does not exist, create the first entity in the latest version knowledge graph and use the newly created entity as the third entity in the latest version knowledge graph; if the first entity exists, obtain the fourth entity in the knowledge graph with the largest historical version number; the fourth entity is the second entity in the historical version knowledge graph that is the same as the first entity.
[0055] The historical versions of the knowledge graph are arranged in ascending order of version number, such as V1.1, V1.2, V1.3, V2.1, V2.2, V2.3, etc. V1.1 could be the initial version number of the knowledge graph, and V2.3 could be the last version number. In this embodiment, the knowledge graph to be updated is the latest version number.
[0056] The second entity in the historical version knowledge graph refers to all entities contained in all historical versions of the knowledge graph. In this embodiment, after obtaining all the first entities parsed from the knowledge material, a search is performed in the second entity to see if an entity with the same name exists for each first entity. If no entity with the same name as the first entity is found in the second entity, a new entity is created in the latest version of the knowledge graph, serving as the third entity in the latest version. The third entity is the first entity not included in the second entity. If an entity with the same name as the first entity is found in the second entity, then all historical versions of the knowledge graph with the same name as the first entity are found, and further, the historical version number closest to the current version number with the same name as the first entity is found, serving as the fourth entity.
[0057] S103. Copy the fourth entity to the latest version of the knowledge graph as the fifth entity in the latest version of the knowledge graph, and update the attributes of the fifth entity.
[0058] The fourth entity and all its attributes can be copied to obtain the fifth entity and its attributes in the latest version of the knowledge graph. In other words, the fifth entity is the same as the fourth entity.
[0059] Additionally, the attributes of the fifth entity obtained through copying can be updated accordingly. For example, the state of each attribute can be modified, or the attributes of the fifth entity can be updated or added based on the attributes of the first entity parsed from the knowledge material.
[0060] S104. Copy the second relation of the fourth entity to the latest version of the knowledge graph as the third relation of the fifth entity.
[0061] The second relation refers to the relation of the fourth entity in the knowledge graph with the largest historical version number among all historical versions of the first entity. In this embodiment, the second relation of the fourth entity can be directly copied to the latest version of the knowledge graph as the third relation of the fifth entity. That is, the entity that appears in the historical version and is the same as the first entity in the knowledge graph of the most recent version, as well as the relation of that entity, is directly copied to the latest version of the knowledge graph as the fifth entity and the third relation of the fifth entity.
[0062] S105. Based on the first relationship of the first entity identified, create a new relationship for the fifth entity.
[0063] The system can compare the first relation of the first entity obtained by parsing the knowledge material with the third relation of the fifth entity that is identical to the first entity to determine the relations that need to be added in the third relation, and then create new relations for the fifth entity. For example, if the first entity "margin trading information query" has first relations including A, B, and C, and the fifth entity "margin trading information query" has third relations including "B, C, and D", then the relation "A" that exists in the first relation but not in the third relation of the entity "margin trading information query" will be added to the relations of the fifth entity, so that the final relations of the fifth entity are "A, B, C, and D".
[0064] S106. Based on the first relation of the first entity identified, create a fourth relation of the third entity in the latest version of the knowledge graph.
[0065] Based on the first relation of the first entity obtained by parsing the knowledge material, and to determine the first entity that is the same as the third entity, the first relation of the determined first entity can be directly used as the fourth relation of the third entity, and then created in the latest version of the knowledge graph.
[0066] The technical solution of this invention identifies multiple first entities and their first relationships within knowledge materials; searches for the existence of first entities in historical versions of the knowledge graph; if no first entity exists, it creates a first entity in the latest version of the knowledge graph, using the newly created entity as a third entity in the latest version; based on the identified first relationship of the first entity, it creates a fourth relationship of the third entity in the latest version of the knowledge graph; if a first entity exists, it obtains the fourth entity from the knowledge graph with the largest historical version number; copies the fourth entity to the latest version of the knowledge graph as a fifth entity, and updates the attributes of the fifth entity; copies the second relationship of the fourth entity to the latest version of the knowledge graph as a third relationship of the fifth entity; and creates a new relationship for the fifth entity based on the identified first relationship of the first entity. This allows for rapid observation of the evolution of entities in different versions of the knowledge graph.
[0067] Example 2
[0068] Figure 2 A flowchart of a knowledge graph version management method provided in Embodiment 2 of the present invention is shown below. Figure 2 As shown, the method includes:
[0069] S201. The acquired knowledge material is parsed to identify multiple first entities contained in the knowledge material and the first relationships of the first entities.
[0070] In this embodiment, common change delivery documents of the software system are first obtained. The initial knowledge materials in the input files are categorized into several types, such as Word, Excel, SQL, XML, INI, and YML. Different parsing methods are used for different knowledge material types, and different parsing rules are designed for different system deliverable material types and file content formats. Each parsing step determines the appropriate parsing rule based on the combination of the upgrade package and the file name.
[0071] Specifically, files to be processed can be filtered according to preset paths and named regular expressions, and then pushed to different parsing queues based on file type. Different parsing rules are set for different file types according to their characteristics: for example, ini and yml files need to be read line by line, directly parsed into key-value pairs, and then matched by dictionary; word files need to be matched by parameter dictionary using a large model and obtain their corresponding values; excel files need to be filtered and parsed according to the set regular expressions, parsed into key-value pairs line by line, and then matched by dictionary; the first step in parsing sql files is to split the file into sql statements by the semicolon ";", then filter the statements to be processed based on the keywords insert and update, then filter the relevant tables based on table keywords (such as param%, config%, dict%, etc.), and then generate key-value pairs from the values content for matching with relevant dictionaries; Xml files are parsed into objects by general DOM parsing rules, and elements and attributes are parsed step by step, and then matched with the corresponding dictionaries based on the object name and type.
[0072] In one embodiment, the acquired knowledge material is parsed to identify multiple first entities contained in the knowledge material and first relationships among the first entities, including:
[0073] The method of rule matching is used to perform dictionary matching on knowledge materials to identify the first entity in the knowledge materials; and / or, the input knowledge materials are parsed based on a large model to identify the first entity in the knowledge materials; the knowledge materials are preprocessed to obtain data in a predetermined format, and the preprocessed data is input into a trained relation recognition model to identify the first relationship between the first entities.
[0074] Specifically, some accurate entities can be initially identified through rule-based and dictionary-based methods. An entity dictionary is built based on the accumulation of engineering design and database fields in the early stage. Then, the dictionary matching method is used to match the parsed material to identify accurate entities.
[0075] Then, prompting engineering is used as a supplement to the dictionary matching scheme to identify incremental entities. Prompting engineering leverages a large model to parse the input text corpus, extracting and summarizing the entities that appear within it, thus achieving the recognition effect. Since the entities identified by this scheme are fuzzy matches, manual review is required for confirmation. After review, the entities must be added to the entity dictionary.
[0076] In this embodiment, cue engineering is used to fill in gaps in the dictionary coverage for certain cases. This complementary approach improves entity recognition accuracy while maintaining high recall. Furthermore, cue engineering can help us discover new entities or variant expressions not listed in the initial dictionary, thus expanding the thesaurus.
[0077] This embodiment also includes entity disambiguation of the acquired first entity. Specifically, a thesaurus can be used to preprocess the knowledge material text. Entities are matched using a pre-built thesaurus and knowledge base. Synonyms in the text are uniformly replaced with standard expressions, which reduces the diversity of entity references and lowers the complexity of entity links. For example, when processing text to construct a knowledge graph, "margin trading" and "shortcuts" are first unified into "margin trading" using a thesaurus.
[0078] Then, entity linking is performed. By comparing the relevance of the mentions to the candidate entities (such as contextual similarity, entity popularity, etc.), the most suitable entity is selected as the final linking result. To ensure the accuracy of the linking results, the identified entities can also be manually reviewed for confirmation. For example, when determining the entity that "parameter" refers to in the text, if the candidate entity has "parameter" in a function interface and "parameter" as a system, combined with the description of system setting parameters in the context, it is more likely to link "parameter" to the system "parameter" entity.
[0079] For identifying the first relation of the first entity, the data in the knowledge material can be preprocessed. This includes operations such as text segmentation, part-of-speech tagging, and named entity recognition, transforming the text into a form acceptable to the model. Then, LSTM encodes each word in the input sentence, learning the contextual information of the words and using it as feature representation. In this process, LSTM acts like a feature detector, responsible for mining various useful features from the text. Next, the extracted features are input into the CRF layer. The CRF layer, by learning from the relation database built based on previous engineering experience, can identify whether its feature sequences conform to semantics. Based on the features mined by the feature detector, a score is assigned to the label at each position. Considering the label sequence scores of the entire sentence, the sequence with the highest score is selected as the final annotation result. The sequence is then compared with the entity database and the relation database to mine the entity relationship. Finally, based on the type of relationship (added, changed, etc.), it is determined whether manual secondary confirmation is required.
[0080] S202. Check if the first entity exists in the second entity of the historical version of the knowledge graph; if the first entity does not exist, create the first entity in the latest version of the knowledge graph and use the newly created entity as the third entity in the latest version of the knowledge graph; if the first entity exists, obtain the fourth entity in the knowledge graph with the largest historical version number; the fourth entity is the second entity in the historical version of the knowledge graph that is the same as the first entity.
[0081] Check if the first entity exists in the previous version of the knowledge graph. If the first entity does not exist in the previous version of the knowledge graph, then search if the first entity exists in other historical versions of the knowledge graph. If the first entity does not exist in any historical versions of the knowledge graph, then create the first entity in the latest version of the knowledge graph.
[0082] To create a new entity, you can configure the corresponding attributes according to the entity's design; set the new entity's status to curr (current version), and set the corresponding entity relationships for the newly created entity. For example, you can obtain entities and relationships by parsing the interface documentation; for example, if you obtain funcA(String param1, int param2, float param3), then you can construct an entity of interface type funcA, an entity with input parameter type String and field type named param1, an entity with input parameter type int and field type named param1, and an entity with input parameter type float and field type named param3; and establish relationships between the funcA entity and the three input parameter entities, with the relationship type being inParam. For example, by parsing and modifying a single document, entities and relationships can be obtained: For instance, the description in the single document T20230101 is "involving interface functions: 1001-LS_Access_XX information modification, 1002-LS_Access_XX information deletion, 1003-LS_Access_XX information query". After relationship extraction, the relationship between the single entity T20230101 and the entities interface 1001, interface 1002, and interface 1003 can be established, with the relationship type being involve.
[0083] By obtaining the relationships of entities from these documents, the first relationship of the first entity can be created in the latest version, while setting the state of the first relationship to curr (current).
[0084] S203. Copy the fourth entity and all its attributes to obtain the fifth entity and its attributes. Set the version number of the fifth entity to the latest version number. Delete the attributes marked as del in the attributes of the fifth entity and set the status of all other attributes to old.
[0085] If the first entity of the new input already exists in a historical version of the knowledge graph (either curr / his / del), then the fifth entity needs to be updated in the latest version of the knowledge graph based on the fourth entity. The entity's location in the knowledge graph is found based on the entity code (different entities have different numbers, and the same entity in all historical versions has the same number).
[0086] First, copy the fourth entity to obtain the fifth entity. Then, change the node state of the fifth entity to curr (current), which is the latest version, and change the node state of the fourth entity to his (his).
[0087] like Figure 3 As shown, Figure 3 The fourth entity, "Margin Trading Information Query," includes three attributes: String param1, int param2, and float param3. The latest attributes of its first entity, also "Margin Trading Information Query," include String param1, long param2, and float param4. Therefore, the updated fifth entity, "Margin Trading Information Query," has the following attributes: String param1, long param2, float param3, and float param4. Specifically, the data type of attribute param2 in the fifth entity has been changed from int to long. The original attribute param3 from the fourth entity "Margin Trading Information Query" has been retained, and the attribute param4 from the first entity "Margin Trading Information Query" has been added, resulting in the updated fifth entity.
[0088] S204. Update the corresponding attributes in the fifth entity based on the parsed attributes of the first entity, and add new attributes.
[0089] The properties of the fourth entity are copied to obtain the properties of the fifth entity. Then, properties marked as "del" in the fifth entity are deleted, and the status of all other properties is set to "old". Furthermore, based on the properties of the first entity parsed from the knowledge material, the properties of the fifth entity that are identical to those of the first entity are updated or added. Specifically, properties that have changed in the fifth entity are marked as "update", newly added properties are marked as "new", and deprecated properties are marked as "del". For example, for the fourth entity, funcA, whose properties are (String param1, int param2, float param3), the updated properties of the fifth entity funcA are (String param1, long param2, float param4).
[0090] S205. Copy the second relation of the fourth entity to the latest version of the knowledge graph as the third relation of the fifth entity.
[0091] In this embodiment, the second relation of the fourth entity can be directly copied into the latest version of the knowledge graph as the third relation of the fifth entity. That is, the entity that appeared in the historical version and is the same as the first entity in the knowledge graph of the most recent version, as well as the relation of that entity, can be directly copied into the latest version of the knowledge graph as the fifth entity and the third relation of the fifth entity.
[0092] S206. Create a fifth relationship between the fifth entity and the fourth entity, wherein the fifth relationship is an update.
[0093] In this embodiment, a fifth relationship can be created between the fifth entity and the fourth entity. This fifth relationship is an update, which allows us to observe the evolution of entities in different versions of the knowledge graph.
[0094] S207. Based on the first relationship of the first entity identified, determine the fifth relationship of the fifth entity, and based on the new relationship added by the fifth relationship compared with the third relationship, create a new relationship of the fifth entity in the latest version of the knowledge graph.
[0095] The system can compare the first relation of the first entity obtained by parsing the knowledge material with the third relation of the fifth entity that is identical to the first entity to determine the relations that need to be added in the third relation, and then create new relations for the fifth entity. For example, if the first entity "margin trading information query" has first relations including A, B, and C, and the fifth entity "margin trading information query" has third relations including "B, C, and D", then the relation "A" that exists in the first relation but not in the third relation of the entity "margin trading information query" will be added to the relations of the fifth entity, so that the final relations of the fifth entity are "A, B, C, and D".
[0096] S208. Based on the first relationship of the first entity identified, determine the fourth relationship of the third entity, and create the fourth relationship of the third entity in the latest version of the knowledge graph.
[0097] Based on the first relation of the first entity obtained by parsing the knowledge material, and to determine the first entity that is the same as the third entity, the first relation of the determined first entity can be directly used as the fourth relation of the third entity, and then created in the latest version of the knowledge graph.
[0098] S209. Based on the attribute differences of at least two entities with the same number, delete at least one entity and its attributes, or merge at least two entities with the same number.
[0099] When two operators process the same entity simultaneously, multiple states may exist for the same entity with the same ID. This scenario constitutes a knowledge conflict in a knowledge graph and requires manual intervention.
[0100] Specifically, when knowledge is updated, a conflict detection mechanism is triggered with each knowledge processing operation. New entities added in the current task (either newly created or updated) are added to the conflict detection queue. During conflict detection, the entities to be detected in the queue are first retrieved. Then, all entities in the current knowledge graph with the state "(curr)" are queried by their ID. If the number is 1, it's normal; if the number exceeds 1, a conflict has occurred and needs to be resolved. Conflict resolution requires manual intervention. Two or more entity nodes with the state "(curr)" and their respective attributes are displayed, and the differences are highlighted on the page for comparison. The manual decision on the conflict resolution method is then made.
[0101] The data conflict resolution scheme includes: when only one entity among the displayed entity nodes is valid and the information of other entity nodes is useless, the valid entity node to be retained is determined manually; the status of other entity nodes is marked as (del), and their corresponding relationships are also marked as (del). When multiple entities among the displayed entity nodes are valid, the information of these entities needs to be merged.
[0102] The merging process includes: manually selecting entity nodes and their attributes to be retained (each attribute can only be selected once), and selecting relationships to be retained (only one of the same relationship can be retained). Based on the conflicting entity nodes, obtain the entity node with the previous version history (it should be the same); copy and generate a new entity node, set the new entity's status to (curr) and increment the version number by 1, delete the attributes marked with (del), set other attributes to (old), copy its contained relationships to this entity, and mark the relationships as (curr). Then, update or add the manually selected attributes to this entity node; updated attributes are marked with (update), newly added attributes with (new), and attributes to be deleted with (del). Next, update the relationships of this node according to the manually selected relationships to be retained, and modify the relationship status accordingly. Entity nodes whose attributes are adopted are marked with (del), and their corresponding relationships are also marked with (del). Entity nodes whose attributes are not adopted are marked with (del), and their corresponding relationships are also marked with (del).
[0103] S210. When an anomaly occurs during the version update of the knowledge graph, the version update of the knowledge graph shall be rolled back.
[0104] When a version upgrade encounters a problem and needs to be rolled back, or when an error occurs in the processing of a knowledge source, the corresponding software change knowledge graph needs to be rolled back accordingly.
[0105] In this embodiment, a two-phase commit approach can be used to manage transactions in a distributed system. Each data source processing operation is defined as a transaction. Two-phase commit ensures that all changes to the knowledge graph resulting from this data source processing are either fully committed or fully rolled back. Each time a change operation is performed on the knowledge graph, a corresponding operation statement (redo log) is generated. Simultaneously, the version control module generates a specific operation log entry (undo log) to implement the knowledge graph operation statement that will have a rollback effect on this operation. The undo log operation statements are inserted into the operation cancellation queue according to their generation sequence and transaction number. If a transaction needs to be rolled back, the operation statement in the operation cancellation queue is retrieved by transaction number and executed for rollback processing. If transactions are stacked, manual selection is required to determine whether multiple transactions need to be rolled back in sequence; otherwise, data errors will occur.
[0106] Example 3
[0107] Figure 4 This is a schematic diagram of a knowledge graph version management device provided in Embodiment 3 of the present invention. Figure 4 As shown, the device includes:
[0108] The parsing module 401 is used to parse the acquired knowledge material to identify multiple first entities contained in the knowledge material and the first relationships of the first entities;
[0109] The retrieval module 402 is used to retrieve whether the first entity exists in the second entity of the historical version of the knowledge graph; if the first entity does not exist, the first entity is created in the latest version of the knowledge graph, and the newly created entity is used as the third entity in the latest version of the knowledge graph; if the first entity exists, the fourth entity in the knowledge graph with the largest historical version number is obtained; the fourth entity is the second entity in the historical version of the knowledge graph that is the same as the first entity.
[0110] The entity update module 403 is used to copy the fourth entity to the latest version of the knowledge graph, so as the fifth entity in the latest version of the knowledge graph, and update the attributes of the fifth entity;
[0111] The first relation update module 404 is used to copy the second relation of the fourth entity into the latest version of the knowledge graph as the third relation of the fifth entity;
[0112] The second relationship update module 405 is used to create a new relationship for the fifth entity based on the first relationship of the first entity identified;
[0113] The third relation update module 406 is used to create a fourth relation of the third entity in the latest version of the knowledge graph based on the first relation of the first entity identified.
[0114] The knowledge graph version management device provided in this embodiment of the invention can execute the knowledge graph version management method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0115] Example 4
[0116] Figure 5 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0117] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0118] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0119] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a knowledge graph version management method.
[0120] In some embodiments, a knowledge graph version management method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the knowledge graph version management method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a knowledge graph version management method by any other suitable means (e.g., by means of firmware).
[0121] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0122] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0123] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0124] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0125] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0126] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0127] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0128] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A knowledge graph version management method, characterized in that, The method comprises the following steps: analyzing the obtained knowledge material to identify a plurality of first entities contained in the knowledge material and a first relationship of the first entities; retrieving whether the first entities exist in second entities of a historical version knowledge graph; if the first entities do not exist, creating the first entities in a latest version knowledge graph, taking the newly created entities as third entities in the latest version knowledge graph; if the first entities exist, obtaining fourth entities in a knowledge graph with the largest historical version number; the fourth entities are the second entities in the same historical version knowledge graph as the first entities; the second entities of the historical version knowledge graph refer to all entities contained in all historical version knowledge graphs; the third entities are the first entities not contained in the second entities; the fourth entities are entities with the same name as the first entities in the knowledge graph with the historical version number closest to the current version number; copying the fourth entities to the latest version knowledge graph as fifth entities in the latest version knowledge graph, and updating attributes of the fifth entities; copying second relationships of the fourth entities to the latest version knowledge graph as third relationships of the fifth entities; creating new relationships of the fifth entities based on the identified first relationships of the first entities; creating fourth relationships of the third entities in the latest version knowledge graph based on the identified first relationships of the first entities. 2.The knowledge graph version management method of claim 1, wherein, After the step of copying the fourth entities to the latest version knowledge graph as the fifth entities in the latest version knowledge graph, and updating the attributes of the fifth entities, the method further comprises the following step: creating a fifth relationship between the fifth entities and the fourth entities, and the fifth relationship is an update. 3.The knowledge graph version management method of claim 1, wherein, The step of analyzing the obtained knowledge material to identify a plurality of first entities contained in the knowledge material and a first relationship of the first entities comprises the following steps: performing dictionary matching on the knowledge material based on a rule matching method to identify the first entities in the knowledge material; and / or, performing analysis on the input knowledge material based on a large model to identify the first entities in the knowledge material; preprocessing the knowledge material to obtain data in a predetermined format, and inputting the preprocessed data into a trained relationship identification model to identify the first relationships between the first entities. 4.The knowledge graph version management method of claim 1, wherein, The step of copying the fourth entities to the latest version knowledge graph as the fifth entities in the latest version knowledge graph, and updating the attributes of the fifth entities comprises the following steps: copying the fourth entities and all attributes of the fourth entities to obtain the fifth entities and attributes of the fifth entities, setting a version number of the fifth entities as the latest version number, deleting attributes marked as del in the attributes of the fifth entities, and setting states of other attributes as old; updating corresponding attributes of the fifth entities based on the analyzed attributes of the first entities, and adding new attributes. 5.The knowledge graph version management method of claim 1, wherein, The step of creating new relationships of the fifth entities based on the identified first relationships of the first entities comprises the following steps: determine a fifth relationship of the fifth entity based on the first relationship of the first entity, and create a new relationship of the fifth entity in the latest version of the knowledge graph based on a relationship newly added by the fifth relationship compared with the third relationship. 6.The knowledge graph version management method of claim 1, wherein, The creating of the fourth relationship of the third entity in the latest version of the knowledge graph based on the first relationship of the first entity comprises: determine a fourth relationship of the third entity based on the first relationship of the first entity, and create the fourth relationship of the third entity in the latest version of the knowledge graph. 7.The knowledge graph version management method of claim 1, wherein, Further comprising: detect whether the number of entities with the same number in the latest version of the knowledge graph is 1; if not, compare attribute differences of at least two entities with the same number; based on the attribute differences of the at least two entities with the same number, delete at least one entity and attributes of the entity, or merge the at least two entities with the same number.
8. A knowledge graph version management apparatus, characterized by comprising: comprise: a parsing module configured to parse the obtained knowledge material to identify a plurality of first entities and first relationships of the first entities contained in the knowledge material; a retrieval module configured to retrieve whether the first entities exist in second entities of a historical version of the knowledge graph; if the first entities do not exist, create the first entities in a latest version of the knowledge graph, and take the newly created entities as third entities in the latest version of the knowledge graph; if the first entities exist, obtain a fourth entity in a historical version of the knowledge graph with the largest historical version number; the fourth entity is the second entity in the same historical version of the knowledge graph as the first entity; the second entity of the historical version of the knowledge graph refers to all entities contained in all historical versions of the knowledge graph; the third entity is a first entity not contained in the second entity; the fourth entity is an entity with the same name as the first entity in the knowledge graph of the historical version number closest to the current version number; an entity updating module configured to copy the fourth entity to the latest version of the knowledge graph as a fifth entity in the latest version of the knowledge graph, and update attributes of the fifth entity; a first relationship updating module configured to copy a second relationship of the fourth entity to the latest version of the knowledge graph as a third relationship of the fifth entity; a second relationship updating module configured to create a new relationship of the fifth entity based on the first relationship of the first entity; a third relationship updating module configured to create a fourth relationship of the third entity in the latest version of the knowledge graph based on the first relationship of the first entity.
9. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the knowledge graph version management method in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing the processor to implement the knowledge graph version management method in any one of claims 1-7 when executed.
Citation Information
Patent Citations
Entity relationship storage method and device
CN110580293A
Intelligent question answering method, system and equipment based on aircraft knowledge graph and medium
CN115599899A