CN113127494A - Method and device for updating knowledge graph - Google Patents

Method and device for updating knowledge graph Download PDF

Info

Publication number
CN113127494A
CN113127494A CN201911399071.2A CN201911399071A CN113127494A CN 113127494 A CN113127494 A CN 113127494A CN 201911399071 A CN201911399071 A CN 201911399071A CN 113127494 A CN113127494 A CN 113127494A
Authority
CN
China
Prior art keywords
entity
attribute
relationship
update
knowledge graph
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911399071.2A
Other languages
Chinese (zh)
Other versions
CN113127494B (en
Inventor
张淯易
高雪松
陈维强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Co Ltd
Original Assignee
Hisense Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Co Ltd filed Critical Hisense Co Ltd
Priority to CN201911399071.2A priority Critical patent/CN113127494B/en
Publication of CN113127494A publication Critical patent/CN113127494A/en
Application granted granted Critical
Publication of CN113127494B publication Critical patent/CN113127494B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for updating a knowledge graph, wherein the method comprises the following steps: acquiring updating demand information of the knowledge graph; the updating demand information is used for indicating the updating content of the knowledge graph needing to be updated; determining an updating instruction of the updating content mapping according to the updating content indicated by the updating demand information; the updating instruction is as follows: an operation instruction for establishing a mapping relation with the updated content in advance; and executing the updating instruction on the knowledge graph to update the knowledge graph.

Description

Method and device for updating knowledge graph
Technical Field
The invention relates to the field of knowledge graphs and public safety, in particular to a knowledge graph updating method and device.
Background
A knowledge graph can be used to describe various entities and concepts that exist in the real world, as well as relationships between them. Through the knowledge map, the information of the internet can be expressed into a form closer to the human cognitive world, and a mode for better organizing, managing and utilizing mass information is provided. When the information described by the knowledge graph is continuously updated, the knowledge graph is also updated.
In the prior art, a method for updating the knowledge graph is that a technician inputs operation commands of the knowledge graph one by one and manually updates the knowledge graph. Obviously, when the content of the knowledge graph needing to be updated is more, the technician easily neglects to input or incorrectly inputs the command, so that the updating of the knowledge graph is wrong. In addition, this way of manually updating the knowledge-graph is inefficient and can severely lag the generation of a new knowledge-graph. Therefore, in the prior art, a method for automatically updating the knowledge graph is not available, which is not beneficial to the real-time maintenance of the knowledge graph and is a problem to be solved urgently.
Disclosure of Invention
The application provides a knowledge graph updating method and a knowledge graph updating device, and solves the problem that the knowledge graph cannot be automatically updated in the prior art.
In a first aspect, the present application provides a method for updating a knowledge graph, including: acquiring updating demand information of the knowledge graph; the updating demand information is used for indicating the updating content of the knowledge graph needing to be updated; determining an updating instruction of the updating content mapping according to the updating content indicated by the updating demand information; the updating instruction is as follows: an operation instruction for establishing a mapping relation with the updated content in advance; and executing the updating instruction on the knowledge graph to update the knowledge graph.
In the method, firstly, the updating demand information indicating the updating content of the knowledge graph is obtained, and the mapping relation is established between the updating content and the operation instruction in advance, so that the updating instruction mapped by the updating content can be automatically determined according to the updating content indicated by the updating demand information, and the updating instruction is executed on the knowledge graph, thereby providing the method for automatically updating the knowledge graph.
In an alternative embodiment, the update content includes: first update object information and a first update mode of the knowledge graph; the determining, according to the update content indicated by the update requirement information, an update instruction of the update content mapping includes: if the first update object information of the knowledge graph in the update content comprises a first entity, a first attribute and/or a second attribute, and the first update mode is as follows: adding entities and entity attributes; or, modifying entity attributes of the entity; or, deleting the entity or deleting the entity attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the first entity and entity attributes to the knowledge-graph; or, modifying the entity attribute of the first entity; or, deleting the first entity and entity attributes from the knowledge-graph; if the first update object information of the knowledge graph comprises the first attribute and the second attribute, the second attribute is an attribute used for replacing the first attribute; if the first update object information of the knowledge-graph includes the first attribute but not the second attribute, the first attribute is an attribute that needs to be deleted from the attributes of the first entity; and if the first updating object information of the knowledge graph does not comprise the first attribute but comprises the second attribute, the second attribute is an attribute for being added to the first entity.
In the method, the first update object information and the first update mode are specifically defined in the update content, and when the first update object information includes the first entity, the first attribute and/or the second attribute, and the first update mode is to add, modify or delete the entity and the entity attribute, the update instructions mapped with the first update object information can be determined to sequentially add, modify and delete the entity attribute of the first entity, so that the relationship between the first update object information, the first update mode and the update instructions is established, and an automatic update means of the first update object information and the first update mode is provided.
In an alternative embodiment, the executing the update instruction on the knowledge-graph to update the knowledge-graph includes: determining whether the first entity already exists in the knowledge-graph and whether the first attribute exists in an attribute of the first entity; if the first updating mode is to add an entity and an entity attribute, and the first entity does not exist in the knowledge graph, determining that the first attribute does not exist in the attribute of the first entity, adding the first entity to the knowledge graph, and taking the second attribute as an attribute of the first entity; or if the first updating mode is to modify entity attributes of the entities, the first entity exists in the knowledge graph, and the first attribute exists in the attributes of the first entity, updating the first attribute to the second attribute, so as to update the attributes of the first entity; or if the first updating mode is to delete an entity and the first entity exists in the knowledge graph, deleting the first entity and all attributes of the first entity; and if the first updating mode is to delete the entity attribute, the first entity exists in the knowledge graph, and the first attribute exists in the attribute of the first entity, deleting the first attribute from the attribute of the first entity.
In the method, when the update content comprises first update object information and a first update mode, different operations are respectively executed for the condition whether the first entity exists in the knowledge graph and/or whether the first attribute exists in the attribute of the first entity by executing the update instruction, thereby providing a refined method for automatically updating the knowledge graph.
In an alternative embodiment, the update content includes: second update object information and a second update mode of the knowledge graph; the determining, according to the update content indicated by the update requirement information, an update instruction of the update content mapping includes: if the second update object information of the knowledge graph in the update content includes an entity relationship, a third attribute and/or a fourth attribute of a second entity and a third entity, and the second update mode is as follows: adding entity relationships and relationship attributes; or, modifying the relationship attribute of the entity relationship; or, deleting the entity relationship or deleting the relationship attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the entity relationship and relationship attribute of the second entity and the third entity to the knowledge graph; or, modifying the relationship attribute of the entity relationship between the second entity and the third entity; or deleting the entity relationship and relationship attribute of the second entity and the third entity from the knowledge-graph; if the second update object information of the knowledge graph comprises the third attribute and the fourth attribute, the fourth attribute is an attribute used for replacing the third attribute; if the second update object information of the knowledge graph includes the third attribute but not the fourth attribute, the third attribute is an attribute that needs to be deleted from the relationship attributes of the entity relationship; and if the second update object information of the knowledge graph does not include the third attribute but includes the fourth attribute, the fourth attribute is a relationship attribute for adding to the entity relationship.
In the above manner, the second update object information and the second update mode are specifically defined in the update content, and when the second update object information includes the entity relationship, the third attribute, and/or the fourth attribute of the second entity and the third entity, and the first update mode is to add, modify, or delete the entity relationship and the relationship attribute, the update instructions mapped with the second update object information and the second update mode can be determined to be sequentially adding, modifying, and deleting the entity relationship and the relationship attribute of the second entity and the third entity, so that the relationship between the second update object information and the second update mode and the update instruction is established, and an automatic update means of the second update object information and the second update mode is provided.
In an alternative embodiment, the executing the update instruction on the knowledge-graph to update the knowledge-graph includes: determining whether the entity relationship already exists in the knowledge-graph and whether the third attribute exists in an attribute of the entity relationship; if the second updating mode is the newly added entity relationship and the relationship attribute, and the entity relationship between the second entity and the third entity does not exist in the knowledge graph, determining that the third attribute does not exist in the attribute of the entity relationship, and adding an edge to the second entity and the third entity in the knowledge graph, thereby newly adding the entity relationship between the second entity and the third entity to the knowledge graph, and using the fourth attribute as an attribute of the entity relationship between the second entity and the third entity; or if the second updating manner is that the relationship attribute of the entity relationship is modified, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the attribute of the entity relationship between the second entity and the third entity, updating the third attribute to the fourth attribute, so as to update the relationship attribute of the entity relationship between the second entity and the third entity; or, if the second update mode is the deletion of the entity relationship, and the entity relationship between the second entity and the third entity exists in the knowledge graph, deleting the corresponding edge of the entity relationship between the second entity and the third entity in the knowledge graph, thereby deleting the entity relationship between the second entity and the third entity and all relationship attributes of the entity relationship; and if the second updating mode is deleting the relationship attribute, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the relationship attribute of the entity relationship between the second entity and the third entity, deleting the third attribute from the relationship attribute of the entity relationship between the second entity and the third entity.
In the above manner, when the update content includes the second update object information and the second update mode, different operations are respectively executed when the update instruction is executed for the case that whether the entity relationship between the second entity and the third entity already exists in the knowledge graph and/or whether the third attribute exists in the attribute of the entity relationship between the second entity and the third entity, thereby providing a refined method for automatically updating the knowledge graph.
In a second aspect, the present application provides an apparatus for knowledge-graph updating, comprising: the acquisition module is used for acquiring the update demand information of the knowledge graph; the updating demand information is used for indicating the updating content of the knowledge graph needing to be updated; the processing module is used for determining an updating instruction mapped by the updating content according to the updating content indicated by the updating demand information; the updating instruction is as follows: an operation instruction for establishing a mapping relation with the updated content in advance; and the execution module is used for executing the updating instruction on the knowledge graph and updating the knowledge graph.
In an alternative embodiment, the update content includes: first update object information and a first update mode of the knowledge graph; the processing module is specifically configured to: if the first update object information of the knowledge graph in the update content comprises a first entity, a first attribute and/or a second attribute, and the first update mode is as follows: adding entities and entity attributes; or, modifying entity attributes of the entity; or, deleting the entity or deleting the entity attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the first entity and entity attributes to the knowledge-graph; or, modifying the entity attribute of the first entity; or, deleting the first entity and entity attributes from the knowledge-graph; if the first update object information of the knowledge graph comprises the first attribute and the second attribute, the second attribute is an attribute used for replacing the first attribute; if the first update object information of the knowledge-graph includes the first attribute but not the second attribute, the first attribute is an attribute that needs to be deleted from the attributes of the first entity; and if the first updating object information of the knowledge graph does not comprise the first attribute but comprises the second attribute, the second attribute is an attribute for being added to the first entity.
In an optional implementation manner, the execution module is specifically configured to: determining whether the first entity already exists in the knowledge-graph and whether the first attribute exists in an attribute of the first entity; if the first updating mode is to add an entity and an entity attribute, and the first entity does not exist in the knowledge graph, determining that the first attribute does not exist in the attribute of the first entity, adding the first entity to the knowledge graph, and taking the second attribute as an attribute of the first entity; or if the first updating mode is to modify entity attributes of the entities, the first entity exists in the knowledge graph, and the first attribute exists in the attributes of the first entity, updating the first attribute to the second attribute, so as to update the attributes of the first entity; or if the first updating mode is to delete an entity and the first entity exists in the knowledge graph, deleting the first entity and all attributes of the first entity; and if the first updating mode is to delete the entity attribute, the first entity exists in the knowledge graph, and the first attribute exists in the attribute of the first entity, deleting the first attribute from the attribute of the first entity.
In an alternative embodiment, the update content includes: second update object information and a second update mode of the knowledge graph; the execution module is specifically configured to: if the second update object information of the knowledge graph in the update content includes an entity relationship, a third attribute and/or a fourth attribute of a second entity and a third entity, and the second update mode is as follows: adding entity relationships and relationship attributes; or, modifying the relationship attribute of the entity relationship; or, deleting the entity relationship or deleting the relationship attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the entity relationship and relationship attribute of the second entity and the third entity to the knowledge graph; or, modifying the relationship attribute of the entity relationship between the second entity and the third entity; or deleting the entity relationship and relationship attribute of the second entity and the third entity from the knowledge-graph; if the second update object information of the knowledge graph comprises the third attribute and the fourth attribute, the fourth attribute is an attribute used for replacing the third attribute; if the second update object information of the knowledge graph includes the third attribute but not the fourth attribute, the third attribute is an attribute that needs to be deleted from the relationship attributes of the entity relationship; and if the second update object information of the knowledge graph does not include the third attribute but includes the fourth attribute, the fourth attribute is a relationship attribute for adding to the entity relationship.
In an optional implementation manner, the execution module is specifically configured to: determining whether the entity relationship already exists in the knowledge-graph and whether the third attribute exists in an attribute of the entity relationship; if the second updating mode is the newly added entity relationship and the relationship attribute, and the entity relationship between the second entity and the third entity does not exist in the knowledge graph, determining that the third attribute does not exist in the attribute of the entity relationship, and adding an edge to the second entity and the third entity in the knowledge graph, thereby newly adding the entity relationship between the second entity and the third entity to the knowledge graph, and using the fourth attribute as an attribute of the entity relationship between the second entity and the third entity; or if the second updating manner is that the relationship attribute of the entity relationship is modified, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the attribute of the entity relationship between the second entity and the third entity, updating the third attribute to the fourth attribute, so as to update the relationship attribute of the entity relationship between the second entity and the third entity; or, if the second update mode is the deletion of the entity relationship, and the entity relationship between the second entity and the third entity exists in the knowledge graph, deleting the corresponding edge of the entity relationship between the second entity and the third entity in the knowledge graph, thereby deleting the entity relationship between the second entity and the third entity and all relationship attributes of the entity relationship; and if the second updating mode is deleting the relationship attribute, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the relationship attribute of the entity relationship between the second entity and the third entity, deleting the third attribute from the relationship attribute of the entity relationship between the second entity and the third entity.
For the advantages of the second aspect and the embodiments of the second aspect, reference may be made to the advantages of the first aspect and the embodiments of the first aspect, which are not described herein again.
In a third aspect, the present application provides a computer device comprising a program or instructions for executing the method according to the first aspect and the embodiments of the first aspect.
In a fourth aspect, the present application provides a storage medium comprising a program or instructions for executing the method according to the first aspect and the embodiments of the first aspect.
Drawings
FIG. 1 is a schematic diagram of a knowledge-graph structure provided in an embodiment of the present application;
FIG. 2 is a flow chart illustrating steps of a method for updating a knowledge-graph according to an embodiment of the present disclosure;
fig. 3 is a schematic flow chart illustrating specific steps of a new requirement in a method for updating a knowledge graph according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating specific steps of modifying a requirement in a knowledge-graph updating method according to an embodiment of the present application;
fig. 5 is a flowchart illustrating specific steps of removing a requirement in a method for updating a knowledge graph according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus for updating a knowledge graph according to an embodiment of the present application.
Detailed Description
In order to better understand the technical solutions, the technical solutions will be described in detail below with reference to the drawings and the specific embodiments of the specification, and it should be understood that the specific features in the embodiments and examples of the present application are detailed descriptions of the technical solutions of the present application, but not limitations of the technical solutions of the present application, and the technical features in the embodiments and examples of the present application may be combined with each other without conflict.
The construction of the knowledge graph is realized according to an ontology, concepts, entities and relations in an objective world are described in a graph structured form in the construction, complex and abstract data information is expressed into a form which is closer to a human cognitive world, and a transaction organization structure in the real world is tried to be restored. This requirement makes the construction of entities and relationships in a knowledge graph generally follow real-world consensus and specifications.
A knowledge graph can be used to describe various entities and concepts that exist in the real world, as well as relationships between them. Due to the relevance of the entities in the knowledge graph, the entity and the entity can show the real-world object association rule in the graph in a mode of establishing an edge. A knowledge graph is typically a pictorial database of some information base. For example, when the knowledge graph is applied in the public safety field to establish a public safety knowledge graph, the public safety knowledge graph needs to be established according to data of a public safety information system, and the information updating iteration of the public safety information system needs to be kept synchronous, namely, the consistency of knowledge is met. And the knowledge graph system should not be isolated, so that the knowledge (data) in the knowledge graph system is out of date, which makes the application of the knowledge graph difficult to fall on the ground and run for a long time.
For example, in a public security business system, a list of key personnel having a potential threat or a significant impact on the society is recorded, and the data of the list includes social basic information of the key personnel and some internal specific information in the public security system, such as key personnel types. For a public security service system, basic information of a key person and internal information of the public security are one piece of data. However, for the knowledge graph, the underlying data is stored in a manner of entity and relationship, and the corresponding piece of data needs to extract a plurality of entities from the underlying data, assign attributes to each entity, and connect the entities according to the relationship of the real world.
As shown in table 1, if there is one of the following police system records:
Figure BDA0002347038060000091
TABLE 1
For the knowledge graph, in the step of extracting knowledge, the three entities of people, vehicles and mobile phones are extracted according to the set and the category of the objects of the public security database. The name, the sex, the age, the identity card number and the mobile phone number of the entity are extracted as the entity according to the social attribute of the person, and the identity card number is the unique id of the entity of the person. The 'LuBXXXX' is extracted as an entity according to the social attribute of 'vehicle', the license plate number and the vehicle color of the entity are the attributes of the 'LuBXXXX', and the license plate number is the unique id of the entity of the 'LuBXXXX'. The phone number 136XXXXXXXX is also extracted as an entity.
Meanwhile, the vehicle "Shandong BXXXXXX" and the person "Wangwu" have a dependent relationship between people and vehicles, and the mobile phone number 136 XXXXXXXXX and the person "Wangwu" also have a person-mobile phone association relationship. Finally, because entities such as 'Wangpu', 'LuBXXXX' and the like have upper-layer father node relations, the graph extracted from the data in the table should show that as shown in FIG. 1, a knowledge graph synchronizes new data in a public security system, 3 entities and 5 edges need to be created (the number is established on the premise that only three entities and two relations exist in the data.)
The knowledge graph has the characteristics of an entity and an edge, so that not only can attributes be stored on the entity, but also data can be recorded on the edge. However, when the information described by the knowledge-graph is continuously updated, the knowledge-graph is also updated accordingly. At present, the method of updating the knowledge graph is that a technician inputs operation commands of the knowledge graph one by one and manually updates the knowledge graph. Obviously, this approach easily renders the updating of the knowledge-graph erroneous and inefficient, and can severely lag the generation of a new knowledge-graph. At present, no method for automatically updating the knowledge graph exists, and the method is not beneficial to real-time maintenance of the knowledge graph.
For example, existing police knowledge-graph applications always require engineers with knowledge-graph development experience to manually update knowledge-graphs in the face of data updates. The process is embodied as follows: the map engineer manually obtains the data from the public security department (for example, the data is stored in excel and copied out of a public security database system), firstly, Wangwu, Lu B1234 and 13612345678 are retrieved from a database, and the ids of the three entities are obtained and are respectively marked as id1, id2 and id 3. And retrieving the obtained broad class: the ids of the three entities, namely the person, the vehicle and the mobile phone, are respectively marked as idA, idB and idC. And adding edges between the entity ids respectively by taking human experience as precedent or according to the clear requirement of the public security police officer. I.e. manually enter 5 build edge commands. The pseudo code of the edge establishing command is as follows:
AddEdge (id1, id2, Attribute 1, Attribute 2 …)
AddEdge (id1, id3, Attribute 1, Attribute 2 …)
AddEdge (id1, idA, Attribute 1, Attribute 2 …)
AddEdge (id2, idB, Attribute 1, Attribute 2 …)
AddEdge (id3, idC, Attribute 1, Attribute 2 …)
The five sentence commands correspond to the five edges shown in the figure, in other words, the number of codes of the added edges is the same as that of the created edges according to different rules of the data manually input each time. Query id1-3, A-C also requires 6 commands. It can be seen from this that: under the condition of complete function of the graph database, an engineer needs to manually input 11 commands to complete the updating of one record. Therefore, in the current public security knowledge graph application, the updating function is usually similar to the nominal function.
To this end, the present application provides a knowledge-graph updating method, as shown in fig. 2.
Step 201: and acquiring the updating demand information of the knowledge graph.
Step 202: and determining an updating instruction of the updating content mapping according to the updating content indicated by the updating demand information.
Step 203: and executing the updating instruction on the knowledge graph to update the knowledge graph.
The update requirement information in step 201 is used to indicate that the knowledge-graph needs to be updated. The update requirement information of step 201 may be generated according to an operation initiated by an operator on the knowledge-graph. For example, the operator may have a corresponding device id or account id for recording the identity of the initiating operator and the authorization to perform the auditing operation in the background. The update requirement information may include a value characterizing that new data needs to be added, and entity information, which is a unique id characterizing an object that should be constructed as an entity. For example, the identity card number, license plate number and mobile phone number of Wang Wu can be used as the main key field in the information database. The entity attributes may then be in all input fields of the information database. The knowledge graph is initially constructed by extracting fields belonging to the corresponding entities and entering the fields into the corresponding entities for storage as attributes.
In step 202, the update instruction is: and the operation instruction is used for establishing a mapping relation with the updated content in advance. That is to say, the operation instruction corresponding to one piece of update demand information in advance can be found only according to the piece of update demand information, and manual entry operation for one piece is not needed.
In an optional implementation manner of step 202, in an optional implementation manner, the update content includes: first update object information and a first update mode of the knowledge graph; step 202 may specifically be:
if the first update object information of the knowledge graph in the update content comprises a first entity, a first attribute and/or a second attribute, and the first update mode is as follows: adding entities and entity attributes; or, modifying entity attributes of the entity; or, deleting the entity or deleting the entity attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the first entity and entity attributes to the knowledge-graph; or, modifying the entity attribute of the first entity; or, deleting the first entity and entity attributes from the knowledge-graph.
If the first update object information of the knowledge graph comprises the first attribute and the second attribute, the second attribute is an attribute used for replacing the first attribute; if the first update object information of the knowledge-graph includes the first attribute but not the second attribute, the first attribute is an attribute that needs to be deleted from the attributes of the first entity; and if the first updating object information of the knowledge graph does not comprise the first attribute but comprises the second attribute, the second attribute is an attribute for being added to the first entity.
For example, the format of the first update object information is (K, K _1, K _2), where K denotes the first entity, K _1 denotes the first attribute, and K _2 denotes the second attribute, where K may also be expressed by a unique attribute of the first entity, such as the unique attribute being an identity number in a human entity. According to different situations that whether k _1 and k _2 are empty or not, k _1 and k _2 have different functions respectively, and different updating instructions can be mapped by combining different contents in the first updating mode. For example, when the first update object information includes k _1 and k _2, k _2 is used to replace the attribute of k _1, and particularly, when k _1 and k _2 are the unique attributes of the first entity, for example, for the update requirement, the identification number (the unique id of the person entity) cannot be changed, and the other attributes can be changed, and it is necessary to search whether the person exists in the knowledge graph through the identification number. When the first update object information includes k _1 and does not include k _2, then k _1 is an attribute that needs to be deleted from the attributes of the first entity; when the first update object information includes k _2 and does not include k _1, k _2 is an attribute that needs to be added to the attribute of the first entity.
It should be noted that, for the knowledge-graph, the first entity in the updated content in step 201 may already exist in the knowledge-graph, but there is a change in the value of the individual attribute. In order to ensure the entity uniqueness of the knowledge graph, original entities are reserved, and attributes and relationships of the entities are updated. The core idea of the process is as follows: and traversing the entity in the data, and if the entity exists, updating the attribute value of the entity to be the attribute value in the data. If the entity does not exist, the entity is created. The specific traversal manner is not limited, and for example, traversal may be started from an entity with an entity type of "person". Specifically, the optional implementation of step 203 corresponding to the above optional implementation of step 202 is:
determining whether the first entity already exists in the knowledge-graph and whether the first attribute exists in an attribute of the first entity; if the first updating mode is to add an entity and an entity attribute, and the first entity does not exist in the knowledge graph, determining that the first attribute does not exist in the attribute of the first entity, adding the first entity to the knowledge graph, and taking the second attribute as an attribute of the first entity; or if the first updating mode is to modify entity attributes of the entities, the first entity exists in the knowledge graph, and the first attribute exists in the attributes of the first entity, updating the first attribute to the second attribute, so as to update the attributes of the first entity; or if the first updating mode is to delete an entity and the first entity exists in the knowledge graph, deleting the first entity and all attributes of the first entity; and if the first updating mode is to delete the entity attribute, the first entity exists in the knowledge graph, and the first attribute exists in the attribute of the first entity, deleting the first attribute from the attribute of the first entity.
When the first update object information comprises K, K _1 and K _2 and K and K _1 are determined to be absent in the knowledge graph, if the first update mode is to add an entity and an entity attribute and K is absent, adding K _2 to K attributes; when the first update object information comprises K, K _1 and K _2 and K and K _1 are determined to exist in the knowledge graph, if the first update mode is to modify the entity and the entity attribute, then K1 is updated to K _ 2; when the first update object information includes K, k _1 and/or k _2, if the first update mode is deleting an entity and the first entity exists in the knowledge graph, deleting the first entity and all attributes of the first entity; when the first update object information includes K, K _1, if the first update mode is to delete an entity attribute, and K exists in the knowledge graph, and K _1 exists in an attribute of K, then K _1 is deleted from the attribute of K.
In another alternative implementation of step 202, the updating content includes: second update object information and a second update mode of the knowledge graph; the specific execution of step 202 may be:
if the second update object information of the knowledge graph in the update content includes an entity relationship, a third attribute and/or a fourth attribute of a second entity and a third entity, and the second update mode is as follows: adding entity relationships and relationship attributes; or, modifying the relationship attribute of the entity relationship; or, deleting the entity relationship or deleting the relationship attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the entity relationship and relationship attribute of the second entity and the third entity to the knowledge graph; or, modifying the relationship attribute of the entity relationship between the second entity and the third entity; or deleting the entity relationship and the relationship attribute of the second entity and the third entity from the knowledge-graph.
If the second update object information of the knowledge graph comprises the third attribute and the fourth attribute, the fourth attribute is an attribute used for replacing the third attribute; if the second update object information of the knowledge graph includes the third attribute but not the fourth attribute, the third attribute is an attribute that needs to be deleted from the relationship attributes of the entity relationship; and if the second update object information of the knowledge graph does not include the third attribute but includes the fourth attribute, the fourth attribute is a relationship attribute for adding to the entity relationship.
For example, the format of the second update object information is (T-L, m _1, m _2), T represents the second entity, L represents the third entity, m _1 represents the third attribute, m _2 represents the fourth attribute, where T may be represented by the unique attribute of the second entity, and L may also be represented by the unique attribute of the third entity. According to different conditions that m _1 and m _2 are empty or not, m _1 and m _2 have different functions respectively, and different updating instructions can be mapped by combining different contents in the second updating mode. For example, when the first update object information includes m _1 and m _2, m _2 is used to replace the attribute of m _1, and particularly, when m _1 and m _2 are the unique attributes of the first entity, for example, the identification number (the unique id of the person entity) cannot be changed for the update requirement, and the other attributes can be changed, so that it is necessary to search whether the person exists in the knowledge graph through the identification number. When the second update object information includes m _1 and does not include m _2, then m _1 is an attribute that needs to be deleted from the attributes of the first entity; when the second update object information includes m _2 and does not include m _1, then m _2 is an attribute that needs to be added to the attributes of the second entity.
The optional implementation of step 203 corresponding to the above optional implementation of step 202 is:
determining whether the entity relationship already exists in the knowledge-graph and whether the third attribute exists in an attribute of the entity relationship.
If the second updating mode is the newly added entity relationship and the relationship attribute, and the entity relationship between the second entity and the third entity does not exist in the knowledge graph, determining that the third attribute does not exist in the attribute of the entity relationship, and adding an edge to the second entity and the third entity in the knowledge graph, thereby newly adding the entity relationship between the second entity and the third entity to the knowledge graph, and using the fourth attribute as an attribute of the entity relationship between the second entity and the third entity.
For example, when the second update object information includes T-L, m _1 and m _2 and it is determined that T-L and m _1 do not exist in the knowledge graph, if the second update mode is to add the new entity relationship and relationship attribute, an edge is added between T and L. It should be noted that when the method is combined with the method of adding the entity and the attribute of the entity, a specific process may be to add T and L first, and then add an edge between T and L.
Or if the second updating manner is that the relationship attribute of the entity relationship is modified, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the attribute of the entity relationship between the second entity and the third entity, updating the third attribute to the fourth attribute, thereby updating the relationship attribute of the entity relationship between the second entity and the third entity.
For example, when the second update object information includes T-L, m _1 and m _2, and T-L and m _1 are determined to exist in the knowledge-graph, if the second update mode is to modify entity relationships and relationship attributes, m _1 is modified to m _ 2. It should be noted that when the method is combined with the method of modifying the entity and the attribute of the entity, a specific process may be to modify the entity to T and/or L first, and then modify the entity relationship between T and L.
Or, if the second update mode is the deletion of the entity relationship, and the entity relationship between the second entity and the third entity exists in the knowledge graph, deleting the corresponding edge of the entity relationship between the second entity and the third entity in the knowledge graph, thereby deleting the entity relationship between the second entity and the third entity and all relationship attributes of the entity relationship; and if the second updating mode is deleting the relationship attribute, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the relationship attribute of the entity relationship between the second entity and the third entity, deleting the third attribute from the relationship attribute of the entity relationship between the second entity and the third entity.
For example, when the second update object information includes T-L and it is determined that T-L exists in the knowledge-graph, if the second update is to delete the entity relationship and the relationship attribute, then T-L and all relationship attributes are deleted. Or, the entity relationship is not deleted, only the relationship attribute of the entity relationship is deleted, and when the second update object information includes T-L and m _1 and it is determined that T-L exists in the knowledge graph, if the second update mode is to delete the entity relationship and the relationship attribute, then all the relationship attributes m _1 of T-L are deleted.
Combining steps 201 to 203 and an optional implementation manner, the method for updating the knowledge graph in steps 201 to 203 is described in detail below with reference to fig. 3 to 5.
Fig. 3 shows that the update content indicated by the update requirement information is a new entity and an entity attribute and/or an entity relationship and a relationship attribute (the requirement of such update requirement information is a new requirement for short).
For example, according to the records of the public security system shown in table 1, entity wang and \ or entity car a and \ or entity mobile phone a and \ or the entity relationship between entity wang and entity car a and \ or the entity relationship between entity wang and entity mobile phone a are added to the knowledge graph, the license plate number of car a is shangxxxxx, and the mobile phone number of mobile phone a is 136 XXXXXXXX. And inquiring whether the Wang Wu exists in the knowledge graph or not, if so, adding the attribute of the Wang Wu entity, and if not, creating the Wang Wu entity and storing the entity attribute. Inquiring whether the vehicle A exists in the knowledge map, if so, increasing the attribute of the vehicle A entity, and if not, creating the vehicle A entity and storing the entity attribute; and inquiring whether the vehicle A and the king five are connected in the knowledge map, and if not, adding a side between the king five and the vehicle A entity. Inquiring whether the mobile phone A exists in the knowledge graph or not, if so, increasing the attribute of the entity of the mobile phone A, and if not, creating the entity of the mobile phone A and storing the entity attribute; and inquiring whether the mobile phone A and the Wangwu are connected in the knowledge map, and if not, adding a side between the Wangwu and the mobile phone A entity.
The above-described embodiments are merely illustrative. In other embodiments, the entity may also be preferentially traversed according to a preset entity type, or traversed through a preset entity type, such as a preset entity type being a person. For example, if the entity does not belong to a person, (in this example, the entity is a car or phone), then a determination is made as to whether the entity is connected to a person entity in the data: if the connection relationship exists, not operating (or updating the attribute on the edge); if the connection relation does not exist, the edges of the entity and the entity of the person in the corresponding data are increased. After this step, the process of the next entity is performed. The newly added requirement process can be from a public security client to initiate an updating request, and the newly added/updated process and the judgment process of the entity and the relation of the knowledge graph in the newly added requirement process are automatically executed.
Fig. 4 shows that the update content indicated by the update requirement information is a modified entity and an entity attribute and/or an entity relationship and a relationship attribute (for short, the requirement of such update requirement information is a modification requirement).
For example, the public security system record shown in table 2 is modified into the public security system record shown in table 3, and the entity relationship between entity wang and/or entity car a and/or entity mobile phone a and/or the entity relationship between entity wang and entity car a and/or the entity relationship between entity wang and entity mobile phone a are modified in the knowledge graph, the license plate number of car a is shangxxxx, and the mobile phone number of mobile phone a is 136 xxxxxxxxxx; in addition, the modified license plate number of the vehicle B is LuyYY, and the mobile phone number of the mobile phone A is 138 XXXXXXXXX. Like fig. 3, when the data of the public security service system needs to be updated, it is only the operation of eliminating/updating the original data for the system itself. However, the service logic of the public security knowledge graph which needs to be updated synchronously is also very different.
Such as: for data in previous public security information systems:
Figure BDA0002347038060000171
TABLE 2
The current public security information system update data is as follows:
Figure BDA0002347038060000172
TABLE 3
For this modification requirement, there are two main points: 1. because the police knowledge-graph is based on a graph database, the data therein is not necessarily consistent with the data in the police information system. 2. Knowledge maps are used to describe and characterize the real world, so data deleted in the police information system (e.g., directly delete ruxxxx, change car of wangwu to ruyyyy) becomes in the knowledge map to require deletion of the edge of wangwu to ruxxxx, then newly adding the edge of wangwu to ruyyyy. And deleting the entity of the robust XXXX. Therefore, the public security information system needs to send the old data and the new data (data to be modified) to the map service backend at the same time. The map service backend is modified by the flow shown in fig. 4: for modification requirements, the identification number (unique id of the human entity) is not changeable, and the rest of the attributes can be changed. The identity number is used to search whether the person exists in the map, if so, the information of the entity is modified (for example, the age of the person is modified to be 22), and if not, the person entity is never created, and naturally, no other edge is connected with the person entity. Then a jump is made directly to the new entity flow shown in fig. 3.
Fig. 5 shows that the update content indicated by the update requirement information is a deleted entity and an entity attribute and/or an entity relationship and a relationship attribute (for short, the requirement of such update requirement information is a deletion requirement).
If the input old data contains the information of the vehicle, whether the vehicle (such as Lu XXXX) exists in the knowledge graph is searched, if the vehicle exists in the knowledge graph, whether the old vehicle (Lu XXXXXX) is connected with the person (Wangpu) needs to be inquired, and if the vehicle is connected, the side needs to be deleted. Next, it is queried whether a new vehicle (uyyy) in the data to be updated exists in the knowledge-graph, and if so, the color attribute of the vehicle (uyyy) is updated to be blue. Next, it is queried whether the new car is connected to the person (wang wu), and if not, a side is added between the two entities. If not, the vehicle entity is created and an edge is added between the new vehicle and the two entities of the person (wang wu). Finally, the mobile phone and other entities in the data are operated in the same way: inquiring whether the old entity exists, deleting the relation between the old entity and the person, updating the attribute of the new entity, and connecting the new entity and the person. If the public security information system requires to delete the data shown in table 3, it is necessary for the public security information system to delete the record of the person, the operation flow for the knowledge graph is shown in fig. 5, and the entity relationship between the person and other entities is also deleted. Specifically, whether the person exists in the knowledge graph is queried, and if so, the key person type is cleared. Then go through other entities in the data, check whether these entities (car, mobile phone) are connected with the person, if so, delete the edge between the two entities.
As shown in fig. 6, the present application provides an apparatus for updating a knowledge-graph, comprising: an obtaining module 601, configured to obtain update requirement information of a knowledge graph; the updating demand information is used for indicating the updating content of the knowledge graph needing to be updated; a processing module 602, configured to determine, according to the update content indicated by the update requirement information, an update instruction mapped by the update content; the updating instruction is as follows: an operation instruction for establishing a mapping relation with the updated content in advance; the executing module 603 is configured to execute the update instruction on the knowledge graph to update the knowledge graph.
In an alternative embodiment, the update content includes: first update object information and a first update mode of the knowledge graph; the processing module 602 is specifically configured to: if the first update object information of the knowledge graph in the update content comprises a first entity, a first attribute and/or a second attribute, and the first update mode is as follows: adding entities and entity attributes; or, modifying entity attributes of the entity; or, deleting the entity or deleting the entity attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the first entity and entity attributes to the knowledge-graph; or, modifying the entity attribute of the first entity; or, deleting the first entity and entity attributes from the knowledge-graph; if the first update object information of the knowledge graph comprises the first attribute and the second attribute, the second attribute is an attribute used for replacing the first attribute; if the first update object information of the knowledge-graph includes the first attribute but not the second attribute, the first attribute is an attribute that needs to be deleted from the attributes of the first entity; and if the first updating object information of the knowledge graph does not comprise the first attribute but comprises the second attribute, the second attribute is an attribute for being added to the first entity.
In an optional implementation manner, the executing module 603 is specifically configured to: determining whether the first entity already exists in the knowledge-graph and whether the first attribute exists in an attribute of the first entity; if the first updating mode is to add an entity and an entity attribute, and the first entity does not exist in the knowledge graph, determining that the first attribute does not exist in the attribute of the first entity, adding the first entity to the knowledge graph, and taking the second attribute as an attribute of the first entity; or if the first updating mode is to modify entity attributes of the entities, the first entity exists in the knowledge graph, and the first attribute exists in the attributes of the first entity, updating the first attribute to the second attribute, so as to update the attributes of the first entity; or if the first updating mode is to delete an entity and the first entity exists in the knowledge graph, deleting the first entity and all attributes of the first entity; and if the first updating mode is to delete the entity attribute, the first entity exists in the knowledge graph, and the first attribute exists in the attribute of the first entity, deleting the first attribute from the attribute of the first entity.
In an alternative embodiment, the update content includes: second update object information and a second update mode of the knowledge graph; the executing module 603 is specifically configured to: if the second update object information of the knowledge graph in the update content includes an entity relationship, a third attribute and/or a fourth attribute of a second entity and a third entity, and the second update mode is as follows: adding entity relationships and relationship attributes; or, modifying the relationship attribute of the entity relationship; or, deleting the entity relationship or deleting the relationship attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the entity relationship and relationship attribute of the second entity and the third entity to the knowledge graph; or, modifying the relationship attribute of the entity relationship between the second entity and the third entity; or deleting the entity relationship and relationship attribute of the second entity and the third entity from the knowledge-graph; if the second update object information of the knowledge graph comprises the third attribute and the fourth attribute, the fourth attribute is an attribute used for replacing the third attribute; if the second update object information of the knowledge graph includes the third attribute but not the fourth attribute, the third attribute is an attribute that needs to be deleted from the relationship attributes of the entity relationship; and if the second update object information of the knowledge graph does not include the third attribute but includes the fourth attribute, the fourth attribute is a relationship attribute for adding to the entity relationship.
In an optional implementation manner, the executing module 603 is specifically configured to: determining whether the entity relationship already exists in the knowledge-graph and whether the third attribute exists in an attribute of the entity relationship; if the second updating mode is the newly added entity relationship and the relationship attribute, and the entity relationship between the second entity and the third entity does not exist in the knowledge graph, determining that the third attribute does not exist in the attribute of the entity relationship, and adding an edge to the second entity and the third entity in the knowledge graph, thereby newly adding the entity relationship between the second entity and the third entity to the knowledge graph, and using the fourth attribute as an attribute of the entity relationship between the second entity and the third entity; or if the second updating manner is that the relationship attribute of the entity relationship is modified, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the attribute of the entity relationship between the second entity and the third entity, updating the third attribute to the fourth attribute, so as to update the relationship attribute of the entity relationship between the second entity and the third entity; or, if the second update mode is the deletion of the entity relationship, and the entity relationship between the second entity and the third entity exists in the knowledge graph, deleting the corresponding edge of the entity relationship between the second entity and the third entity in the knowledge graph, thereby deleting the entity relationship between the second entity and the third entity and all relationship attributes of the entity relationship; and if the second updating mode is deleting the relationship attribute, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the relationship attribute of the entity relationship between the second entity and the third entity, deleting the third attribute from the relationship attribute of the entity relationship between the second entity and the third entity.
Embodiments of the present application provide a computer device, which includes a program or instructions, when executed, to perform a method for updating a knowledge graph and any optional method provided by embodiments of the present application.
The embodiment of the application provides a storage medium, which comprises a program or an instruction, and when the program or the instruction is executed, the program or the instruction is used for executing the knowledge graph updating method and any optional method provided by the embodiment of the application.
Finally, it should be noted that: as will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method for updating a knowledge graph, comprising:
acquiring updating demand information of the knowledge graph; the updating demand information is used for indicating the updating content of the knowledge graph needing to be updated;
determining an updating instruction of the updating content mapping according to the updating content indicated by the updating demand information; the updating instruction is as follows: an operation instruction for establishing a mapping relation with the updated content in advance;
and executing the updating instruction on the knowledge graph to update the knowledge graph.
2. The method of claim 1, wherein updating the content comprises: first update object information and a first update mode of the knowledge graph; the determining, according to the update content indicated by the update requirement information, an update instruction of the update content mapping includes:
if the first update object information of the knowledge graph in the update content comprises a first entity, a first attribute and/or a second attribute, and the first update mode is as follows: adding entities and entity attributes; or, modifying entity attributes of the entity; or, deleting the entity or deleting the entity attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the first entity and entity attributes to the knowledge-graph; or, modifying the entity attribute of the first entity; or, deleting the first entity and entity attributes from the knowledge-graph;
if the first update object information of the knowledge graph comprises the first attribute and the second attribute, the second attribute is an attribute used for replacing the first attribute; if the first update object information of the knowledge-graph includes the first attribute but not the second attribute, the first attribute is an attribute that needs to be deleted from the attributes of the first entity; and if the first updating object information of the knowledge graph does not comprise the first attribute but comprises the second attribute, the second attribute is an attribute for being added to the first entity.
3. The method of claim 2, wherein the executing the update instructions on the knowledge-graph to update the knowledge-graph comprises:
determining whether the first entity already exists in the knowledge-graph and whether the first attribute exists in an attribute of the first entity;
if the first updating mode is to add an entity and an entity attribute, and the first entity does not exist in the knowledge graph, determining that the first attribute does not exist in the attribute of the first entity, adding the first entity to the knowledge graph, and taking the second attribute as an attribute of the first entity; alternatively, the first and second electrodes may be,
if the first updating mode is to modify entity attributes of the entities, the first entity exists in the knowledge graph, and the first attribute exists in the attributes of the first entity, updating the first attribute to the second attribute, so as to update the attributes of the first entity; alternatively, the first and second electrodes may be,
if the first updating mode is to delete an entity and the first entity exists in the knowledge graph, deleting the first entity and all attributes of the first entity; and if the first updating mode is to delete the entity attribute, the first entity exists in the knowledge graph, and the first attribute exists in the attribute of the first entity, deleting the first attribute from the attribute of the first entity.
4. A method according to any one of claims 1-3, wherein updating the content comprises: second update object information and a second update mode of the knowledge graph; the determining, according to the update content indicated by the update requirement information, an update instruction of the update content mapping includes:
if the second update object information of the knowledge graph in the update content includes an entity relationship, a third attribute and/or a fourth attribute of a second entity and a third entity, and the second update mode is as follows: adding entity relationships and relationship attributes; or, modifying the relationship attribute of the entity relationship; or, deleting the entity relationship or deleting the relationship attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the entity relationship and relationship attribute of the second entity and the third entity to the knowledge graph; or, modifying the relationship attribute of the entity relationship between the second entity and the third entity; or deleting the entity relationship and relationship attribute of the second entity and the third entity from the knowledge-graph;
if the second update object information of the knowledge graph comprises the third attribute and the fourth attribute, the fourth attribute is an attribute used for replacing the third attribute; if the second update object information of the knowledge graph includes the third attribute but not the fourth attribute, the third attribute is an attribute that needs to be deleted from the relationship attributes of the entity relationship; and if the second update object information of the knowledge graph does not include the third attribute but includes the fourth attribute, the fourth attribute is a relationship attribute for adding to the entity relationship.
5. The method of claim 4, wherein the executing the update instructions on the knowledge-graph to update the knowledge-graph comprises:
determining whether the entity relationship already exists in the knowledge-graph and whether the third attribute exists in an attribute of the entity relationship;
if the second updating mode is the newly added entity relationship and the relationship attribute, and the entity relationship between the second entity and the third entity does not exist in the knowledge graph, determining that the third attribute does not exist in the attribute of the entity relationship, and adding an edge to the second entity and the third entity in the knowledge graph, thereby newly adding the entity relationship between the second entity and the third entity to the knowledge graph, and using the fourth attribute as an attribute of the entity relationship between the second entity and the third entity; alternatively, the first and second electrodes may be,
if the second updating manner is that the relationship attribute of the entity relationship is modified, the entity relationship of the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the attribute of the entity relationship of the second entity and the third entity, updating the third attribute to the fourth attribute, so as to update the relationship attribute of the entity relationship of the second entity and the third entity; alternatively, the first and second electrodes may be,
if the second updating mode is the deletion of the entity relationship, and the entity relationship between the second entity and the third entity exists in the knowledge graph, deleting the corresponding edges of the entity relationship between the second entity and the third entity in the knowledge graph, thereby deleting the entity relationship between the second entity and the third entity and all relationship attributes of the entity relationship; and if the second updating mode is deleting the relationship attribute, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the relationship attribute of the entity relationship between the second entity and the third entity, deleting the third attribute from the relationship attribute of the entity relationship between the second entity and the third entity.
6. An apparatus for knowledge-graph updating, comprising:
the acquisition module is used for acquiring the update demand information of the knowledge graph; the updating demand information is used for indicating the updating content of the knowledge graph needing to be updated;
the processing module is used for determining an updating instruction mapped by the updating content according to the updating content indicated by the updating demand information; the updating instruction is as follows: an operation instruction for establishing a mapping relation with the updated content in advance;
and the execution module is used for executing the updating instruction on the knowledge graph and updating the knowledge graph.
7. The apparatus of claim 6, wherein the update content comprises: first update object information and a first update mode of the knowledge graph; the processing module is specifically configured to:
if the first update object information of the knowledge graph in the update content comprises a first entity, a first attribute and/or a second attribute, and the first update mode is as follows: adding entities and entity attributes; or, modifying entity attributes of the entity; or, deleting the entity or deleting the entity attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the first entity and entity attributes to the knowledge-graph; or, modifying the entity attribute of the first entity; or, deleting the first entity and entity attributes from the knowledge-graph;
if the first update object information of the knowledge graph comprises the first attribute and the second attribute, the second attribute is an attribute used for replacing the first attribute; if the first update object information of the knowledge-graph includes the first attribute but not the second attribute, the first attribute is an attribute that needs to be deleted from the attributes of the first entity; and if the first updating object information of the knowledge graph does not comprise the first attribute but comprises the second attribute, the second attribute is an attribute for being added to the first entity.
8. The apparatus of claim 7, wherein the execution module is specifically configured to:
determining whether the first entity already exists in the knowledge-graph and whether the first attribute exists in an attribute of the first entity;
if the first updating mode is to add an entity and an entity attribute, and the first entity does not exist in the knowledge graph, determining that the first attribute does not exist in the attribute of the first entity, adding the first entity to the knowledge graph, and taking the second attribute as an attribute of the first entity; alternatively, the first and second electrodes may be,
if the first updating mode is to modify entity attributes of the entities, the first entity exists in the knowledge graph, and the first attribute exists in the attributes of the first entity, updating the first attribute to the second attribute, so as to update the attributes of the first entity; alternatively, the first and second electrodes may be,
if the first updating mode is to delete an entity and the first entity exists in the knowledge graph, deleting the first entity and all attributes of the first entity; and if the first updating mode is to delete the entity attribute, the first entity exists in the knowledge graph, and the first attribute exists in the attribute of the first entity, deleting the first attribute from the attribute of the first entity.
9. The apparatus of any of claims 6-8, wherein the update content comprises: second update object information and a second update mode of the knowledge graph; the execution module is specifically configured to:
if the second update object information of the knowledge graph in the update content includes an entity relationship, a third attribute and/or a fourth attribute of a second entity and a third entity, and the second update mode is as follows: adding entity relationships and relationship attributes; or, modifying the relationship attribute of the entity relationship; or, deleting the entity relationship or deleting the relationship attribute, and then determining that the update instructions of the update content mapping respectively correspond to: adding the entity relationship and relationship attribute of the second entity and the third entity to the knowledge graph; or, modifying the relationship attribute of the entity relationship between the second entity and the third entity; or deleting the entity relationship and relationship attribute of the second entity and the third entity from the knowledge-graph;
if the second update object information of the knowledge graph comprises the third attribute and the fourth attribute, the fourth attribute is an attribute used for replacing the third attribute; if the second update object information of the knowledge graph includes the third attribute but not the fourth attribute, the third attribute is an attribute that needs to be deleted from the relationship attributes of the entity relationship; and if the second update object information of the knowledge graph does not include the third attribute but includes the fourth attribute, the fourth attribute is a relationship attribute for adding to the entity relationship.
10. The apparatus of claim 9, wherein the execution module is specifically configured to:
determining whether the entity relationship already exists in the knowledge-graph and whether the third attribute exists in an attribute of the entity relationship;
if the second updating mode is the newly added entity relationship and the relationship attribute, and the entity relationship between the second entity and the third entity does not exist in the knowledge graph, determining that the third attribute does not exist in the attribute of the entity relationship, and adding an edge to the second entity and the third entity in the knowledge graph, thereby newly adding the entity relationship between the second entity and the third entity to the knowledge graph, and using the fourth attribute as an attribute of the entity relationship between the second entity and the third entity; alternatively, the first and second electrodes may be,
if the second updating manner is that the relationship attribute of the entity relationship is modified, the entity relationship of the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the attribute of the entity relationship of the second entity and the third entity, updating the third attribute to the fourth attribute, so as to update the relationship attribute of the entity relationship of the second entity and the third entity; alternatively, the first and second electrodes may be,
if the second updating mode is the deletion of the entity relationship, and the entity relationship between the second entity and the third entity exists in the knowledge graph, deleting the corresponding edges of the entity relationship between the second entity and the third entity in the knowledge graph, thereby deleting the entity relationship between the second entity and the third entity and all relationship attributes of the entity relationship; and if the second updating mode is deleting the relationship attribute, the entity relationship between the second entity and the third entity exists in the knowledge graph, and the third attribute exists in the relationship attribute of the entity relationship between the second entity and the third entity, deleting the third attribute from the relationship attribute of the entity relationship between the second entity and the third entity.
CN201911399071.2A 2019-12-30 2019-12-30 Method and device for updating knowledge graph Active CN113127494B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911399071.2A CN113127494B (en) 2019-12-30 2019-12-30 Method and device for updating knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911399071.2A CN113127494B (en) 2019-12-30 2019-12-30 Method and device for updating knowledge graph

Publications (2)

Publication Number Publication Date
CN113127494A true CN113127494A (en) 2021-07-16
CN113127494B CN113127494B (en) 2022-10-11

Family

ID=76768976

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911399071.2A Active CN113127494B (en) 2019-12-30 2019-12-30 Method and device for updating knowledge graph

Country Status (1)

Country Link
CN (1) CN113127494B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345647A (en) * 2018-01-18 2018-07-31 北京邮电大学 Domain knowledge map construction system and method based on Web
CN108920588A (en) * 2018-06-26 2018-11-30 北京光年无限科技有限公司 A kind of knowledge mapping update method and system for human-computer interaction
CN109657065A (en) * 2018-10-31 2019-04-19 百度在线网络技术(北京)有限公司 Knowledge mapping processing method, device and electronic equipment
CN110222127A (en) * 2019-06-06 2019-09-10 中国电子科技集团公司第二十八研究所 The converging information method, apparatus and equipment of knowledge based map
CN110275894A (en) * 2019-06-24 2019-09-24 恒生电子股份有限公司 A kind of update method of knowledge mapping, device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345647A (en) * 2018-01-18 2018-07-31 北京邮电大学 Domain knowledge map construction system and method based on Web
CN108920588A (en) * 2018-06-26 2018-11-30 北京光年无限科技有限公司 A kind of knowledge mapping update method and system for human-computer interaction
CN109657065A (en) * 2018-10-31 2019-04-19 百度在线网络技术(北京)有限公司 Knowledge mapping processing method, device and electronic equipment
CN110222127A (en) * 2019-06-06 2019-09-10 中国电子科技集团公司第二十八研究所 The converging information method, apparatus and equipment of knowledge based map
CN110275894A (en) * 2019-06-24 2019-09-24 恒生电子股份有限公司 A kind of update method of knowledge mapping, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113127494B (en) 2022-10-11

Similar Documents

Publication Publication Date Title
CN110781236A (en) Method for constructing government affair big data management system
CN112749194A (en) Visualized data processing method and device, electronic equipment and readable storage medium
CN113434623B (en) Fusion method based on multi-source heterogeneous space planning data
CN111026874A (en) Data processing method and server of knowledge graph
CN103810212A (en) Automated database index creation method and system
CN106970958B (en) A kind of inquiry of stream file and storage method and device
CN104199881A (en) Database cluster, data query method and data synchronism method and device
CN104679827A (en) Big data-based public information association method and mining engine
CN101882135B (en) Data processing method and device
US20130054539A1 (en) Database Record Repair
CN105556517A (en) Smart search refinement
CN105095436A (en) Automatic modeling method for data of data sources
CN113672692B (en) Data processing method, data processing device, computer equipment and storage medium
CN112925899B (en) Ordering model establishment method, case clue recommendation method, device and medium
CN113553458A (en) Data export method and device in graph database
EP2742443B1 (en) Database record repair
CN113127494B (en) Method and device for updating knowledge graph
US20230350878A1 (en) Automated database updating and curation
CN116028467A (en) Intelligent service big data modeling method, system, storage medium and computer equipment
CN115269713A (en) Data visualization method, system, computer equipment and medium
CN115034917A (en) Screening method and device for social security fund release data risk information
CN111414364B (en) User information generation method and device and electronic equipment
CN110851431B (en) Data processing method and device for data center station
CN113902531A (en) Automatic generation system, method, electronic device and storage medium for bid document
CN114020719A (en) License data migration method applied to heterogeneous database

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant