CN112948593A - Knowledge graph generation method, device, equipment and medium - Google Patents

Knowledge graph generation method, device, equipment and medium Download PDF

Info

Publication number
CN112948593A
CN112948593A CN202110292913.5A CN202110292913A CN112948593A CN 112948593 A CN112948593 A CN 112948593A CN 202110292913 A CN202110292913 A CN 202110292913A CN 112948593 A CN112948593 A CN 112948593A
Authority
CN
China
Prior art keywords
graph
node
edge
knowledge
information
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.)
Pending
Application number
CN202110292913.5A
Other languages
Chinese (zh)
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.)
Beijing Zhongjing Huizhong Technology Co ltd
Original Assignee
Beijing Zhongjing Huizhong Technology 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 Beijing Zhongjing Huizhong Technology Co ltd filed Critical Beijing Zhongjing Huizhong Technology Co ltd
Priority to CN202110292913.5A priority Critical patent/CN112948593A/en
Publication of CN112948593A publication Critical patent/CN112948593A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation

Landscapes

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

Abstract

A method, apparatus, device and medium for generating a knowledge-graph, the knowledge-graph comprising a plurality of nodes and at least one relational edge, the relational edge being capable of representing a relationship between two associated nodes, the method comprising: configuring a unique identifier for each node and configuring a unique identifier for each relation edge according to a preset rule; and modifying or deleting any node or any relation edge based on the corresponding unique identification.

Description

Knowledge graph generation method, device, equipment and medium
Technical Field
The present disclosure relates to the field of artificial intelligence technologies, and in particular, to a method, an apparatus, a device, and a medium for generating a knowledge graph.
Background
The knowledge graph is a directed graph structure, describes entities, events or concepts existing in the real world and relations among the entities, the events or the concepts, and provides support for applications such as automatic question answering and information retrieval. The knowledge-graph includes a plurality of nodes and a plurality of directed edges. Each node represents an entity, each entity being an instance of an abstract concept, called entity type, such as: people, cities, etc. Different nodes can be associated through directed edges, and the directed edges can represent the association attributes between the related nodes.
The approaches described in this section are not necessarily approaches that have been previously conceived or pursued. Unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section. Similarly, unless otherwise indicated, the problems mentioned in this section should not be considered as having been acknowledged in any prior art.
Disclosure of Invention
After the knowledge graph is constructed, the analysis can be performed through a series of starting points, the analyzed nodes and edges can form one path or a plurality of paths, and one or a plurality of paths can be constructed into a sub-graph. The subgraph resulting from the analysis can be stored for display. In the related art, if the knowledge graph is changed, the sub-graph obtained by analysis cannot be put into the knowledge graph again for further analysis.
According to an aspect of the present disclosure, there is provided a method for generating a knowledge-graph, the knowledge-graph including a plurality of nodes and at least one relationship edge, the relationship edge being capable of representing a relationship between two associated nodes, the method comprising: configuring a unique identifier for each node and configuring a unique identifier for each relation edge according to a preset rule; and modifying or deleting any node or any relation edge based on the corresponding unique identification.
According to an aspect of the present disclosure, there is provided a knowledge-graph query method, the knowledge-graph including a plurality of nodes and at least one relationship edge, the relationship edge being capable of representing a relationship between two associated nodes, each node having a unique identifier and each relationship edge having a unique identifier, the query method including: obtaining a first sub-graph associated with one or more preset nodes from the knowledge graph; in response to receiving the update request, comparing information of each of a plurality of nodes in the first sub-graph with information of a corresponding node in the knowledge-graph based on the corresponding unique identifier to determine update data of the node, and comparing information of each relationship edge of at least one relationship edge in the first sub-graph with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge; and updating the first subgraph based on the updating data of the nodes in the first subgraph and the updating data of at least one relation edge in the first subgraph to obtain a second subgraph.
According to an aspect of the present disclosure, there is provided a generation apparatus of a knowledge-graph, the knowledge-graph including a plurality of nodes and at least one relationship edge, the relationship edge being capable of representing a relationship between two associated nodes, the generation apparatus including: the identification configuration unit is configured for configuring a unique identification for each node and configuring a unique identification for each relation edge according to a preset rule; and the editing unit is configured to modify or delete any node or any relation edge based on the corresponding unique identifier.
According to an aspect of the present disclosure, there is provided a query apparatus of a knowledge-graph, the knowledge-graph including a plurality of nodes and at least one relationship edge, the relationship edge being capable of representing a relationship between two associated nodes, each node having a unique identifier and each relationship edge having a unique identifier, the query apparatus including: an acquisition unit configured to acquire a first sub-graph associated with one or more preset nodes from a knowledge graph; a determining unit configured to, in response to receiving the update request, compare information of each of a plurality of nodes in the first sub-graph with information of a corresponding node in the knowledge-graph based on the respective unique identifier to determine update data of the node, and compare information of each of at least one relationship edge in the first sub-graph with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge; and the updating unit is configured to update the first subgraph based on the updating data of the plurality of nodes in the first subgraph and the updating data of at least one relation edge in the first subgraph to obtain a second subgraph.
According to an aspect of the present disclosure, there is provided a computer device including: a memory, a processor and a computer program stored on the memory, wherein the processor is configured to execute the computer program to implement the steps of the above method.
According to an aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described method.
According to an aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program realizes the steps of the above-mentioned method when executed by a processor.
These and other aspects of the disclosure will be apparent from and elucidated with reference to the embodiments described hereinafter.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the embodiments and, together with the description, serve to explain the exemplary embodiments. The illustrated embodiments are for purposes of example only and do not limit the scope of the claims. Throughout the drawings, identical reference numbers designate similar, but not necessarily identical, elements.
Further details, features and advantages of the disclosure are disclosed in the following description of exemplary embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a flow diagram illustrating a method of knowledge-graph generation in accordance with an illustrative embodiment;
FIG. 2 is a flow diagram illustrating a knowledge-graph query method in accordance with an illustrative embodiment;
FIG. 3A shows a schematic block diagram of a knowledge-graph generation apparatus according to an example embodiment;
FIGS. 3B and 3C are schematic diagrams illustrating a knowledge-graph according to an exemplary embodiment;
FIG. 4 is a schematic block diagram illustrating a knowledge-graph querying device in accordance with an illustrative embodiment;
FIG. 5 is a block diagram illustrating an exemplary computer device that can be used with the exemplary embodiments.
Detailed Description
In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, the timing relationship, or the importance relationship of the elements, and such terms are used only to distinguish one element from another. In some examples, a first element and a second element may refer to the same instance of the element, and in some cases, based on the context, they may also refer to different instances.
The terminology used in the description of the various described examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the elements may be one or more. As used herein, the term "plurality" means two or more, and the term "based on" should be interpreted as "based, at least in part, on". Further, the terms "and/or" and at least one of "… …" encompass any and all possible combinations of the listed items.
Before describing exemplary embodiments of the present disclosure, a number of terms used herein are first explained.
1. Knowledge graph
The knowledge graph is a directed graph structure, describes entities, events or concepts existing in the real world and relations among the entities, the events or the concepts, and provides support for applications such as automatic question answering and information retrieval. The knowledge-graph includes a plurality of nodes and a plurality of directed edges. Each node represents an entity, each entity being an instance of an abstract concept, called entity type, such as: people, cities, etc. Different nodes can be associated through directed edges, and the directed edges can represent the association attributes between the related nodes.
2. Knowledge mapping
And establishing a mapping relation between the structural information extracted from the basic data and the entities, attributes and interrelations among the entities in the created knowledge graph.
3. Knowledge fusion
Knowledge is fused with description information about the same entity or concept from multiple sources, and heterogeneous data integration and disambiguation are performed on knowledge from different data sources under unified specifications.
A knowledge graph is a data structure that abstracts the dependencies of transactions in the real world into only two types, entities (nodes) and relationships (edges). Through the abstraction, complicated things are simplified, only the relevance of the things is concerned, and other attributes can be temporarily ignored.
After the knowledge graph is constructed, the knowledge graph can be analyzed through a series of starting points, the analyzed nodes and edges can form one path or a plurality of paths, and one or a plurality of paths can be constructed into a sub-graph. The subgraph resulting from the analysis can be stored for display. In some application scenarios, it is desirable to replace the stored subgraph into the original knowledge-graph for further analysis. In the related art, the sub-graph obtained through analysis is mapped to a corresponding node in the knowledge graph through node information, and if data in the original knowledge graph may have moved or changed, the sub-graph obtained through analysis cannot be mapped to the original knowledge graph. For example, the information of a certain node in the sub-graph obtained by analysis is a name, and after the sub-graph is obtained by analysis, if the name of the node in the knowledge graph is changed, the node cannot be mapped to the corresponding node in the knowledge graph based on the information of the node in the sub-graph, so that the sub-graph cannot be put back into the knowledge graph for further analysis.
In order to solve the technical problem, the present disclosure provides a method for generating a knowledge graph, which configures a unique identifier for each node and a unique identifier for each relationship edge according to a preset rule, and modifies or deletes any node or any relationship edge based on the corresponding unique identifiers. Therefore, any node or any relation edge of the knowledge graph can be modified or deleted based on the corresponding unique identifier to generate a new knowledge graph, the new knowledge graph is mapped with the nodes and the relation edges in the original knowledge graph through the corresponding unique identifier, and a sub-graph obtained by analyzing based on the original knowledge graph can be further analyzed by placing the unique identifier into the new knowledge graph, so that the flexibility of the knowledge graph can be enhanced, and a user can conveniently modify or delete the knowledge graph locally.
By using the technical scheme disclosed by the invention, the case to be analyzed can be saved and shared by the user of the knowledge graph. Furthermore, after taking the case, others can continue to analyze and expand to construct a new subgraph. Therefore, subgraphs analyzed from the knowledge graph spectrum can be multiplexed, expanded and enhanced, and the analysis result can form a new knowledge base.
Exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
FIG. 1 is a flow diagram illustrating a method 100 of knowledge-graph generation in accordance with an illustrative embodiment. The knowledge-graph may include a plurality of nodes and at least one relational edge capable of representing a relationship between two associated nodes. As shown in fig. 1, the method for generating the knowledge-graph may include: s101, configuring a unique identifier for each node and configuring a unique identifier for each relation edge according to a preset rule; and S102, modifying or deleting any node or any relation edge based on the corresponding unique identifier. Therefore, any node or any relation edge of the knowledge graph can be modified or deleted based on the corresponding unique identifier to generate a new knowledge graph, so that the flexibility of using the knowledge graph can be enhanced, and a user can conveniently modify or delete the knowledge graph locally.
According to some embodiments, the step S101 of configuring a unique identifier for each node according to a preset rule and configuring a unique identifier for each relationship edge may include: before data of any node and data of any relation edge are imported into the knowledge graph, a unique identifier of the node is generated according to a preset rule and added into information of the node, and a unique identifier of the relation edge is generated according to a preset rule and added into information of the relation edge. Therefore, by importing the unique identifier into the node information and the edge information, each edge and each node are guaranteed to contain the unique identifier. It can be understood that, after the data of the node and the data of the relationship edge are imported into the knowledge graph, unique identifiers may be configured for the successfully imported node and relationship edge, respectively.
According to some embodiments, the unique identification of each node and the unique identification of each relational edge are generated using a snowflake algorithm. The snowflake algorithm is a distributed unique ID algorithm, and can realize that codes are locally and globally unique. It is to be understood that the unique identifiers of the nodes and the relational edges are not limited to being generated by using the snowflake algorithm, and any algorithm that can implement locally and globally unique codes can be used to generate the unique identifiers of the nodes and the relational edges.
FIG. 2 is a flow diagram illustrating a method of knowledge-graph querying in accordance with an illustrative embodiment.
According to another aspect of the present disclosure, there is also provided a query method of a knowledge-graph, the knowledge-graph may include a plurality of nodes and at least one relationship edge, the relationship edge may represent a relationship between two associated nodes, each node has a unique identifier and each relationship edge has a unique identifier. As shown in fig. 2, the query method 200 may include: step S201, acquiring a first sub-graph associated with one or more preset nodes from a knowledge graph; step 202, in response to receiving the update request, comparing information of each node in the plurality of nodes in the first sub-graph with information of a corresponding node in the knowledge-graph based on the corresponding unique identifier to determine update data of the node, and comparing information of each relationship edge in at least one relationship edge in the first sub-graph with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge; and step 203, updating the first subgraph based on the updating data of the plurality of nodes in the first subgraph and the updating data of at least one relation edge in the first subgraph to obtain a second subgraph. Therefore, under the condition that the knowledge graph is ensured to be updated, the method is convenient for the user to realize personalized query and further convenient for the user to operate.
According to some embodiments, the knowledge-graph query method may further comprise: based on the updating request, acquiring at least one newly added node associated with at least one node in the first subgraph and at least one newly added relation edge associated with the at least one newly added node from the knowledge graph; and updating the first sub-graph based on the information of at least one newly added node and the information of at least one newly added relation edge in the knowledge graph to obtain a second sub-graph. Therefore, the new query result is fused to the previous result so as to perfect and expand the first subgraph and realize further analysis on the basis of the previous query result.
According to some embodiments, the step S201 of obtaining a first sub-graph associated with one or more preset nodes from the knowledge-graph may include: and acquiring data of the first sub-graph, wherein the data of the first sub-graph can comprise node information, side information, statistical information and a preview graph.
According to some embodiments, comparing the information of each of the plurality of nodes in the first subgraph with the information of the corresponding node in the knowledge-graph in step S202 to determine the update data of the node may include: and in response to the comparison result indicating that the information of the node in the knowledge-graph is different from the information of the node in the first sub-graph, taking the information of the node in the knowledge-graph as the update data of the node. Therefore, the new query result is fused with the previous result to perfect and expand the query result, and the operation of the user is further facilitated.
For example, taking a third node in the first sub-graph as an example, the information of the third node in the first sub-graph includes that the marital status is not married. When further analysis is needed based on the first sub-graph, searching information of a corresponding node Zusanli in the knowledge graph based on the unique identifier of Zusanli, and if the marital state of Zusanli in the knowledge graph is married, the update data of Zusanli comprises that the marital state is married.
According to some embodiments, comparing the information of each of the plurality of nodes in the first subgraph with the information of the corresponding node in the knowledge-graph to determine the update data of the node in step S202 may further include: and in response to the comparison result indicating that the node in the knowledge-graph is deleted, taking the information of the node in the first sub-graph as the update data of the node. Therefore, original data of the previous query result of the user is reserved, and the original data is prevented from being lost after the data is updated.
For example, still taking a certain node in the first sub-graph as an example, when further analysis needs to be performed based on the first sub-graph, the information of the corresponding node in the knowledge-graph is searched based on the unique identifier of the node in the node three, and if the node in the knowledge-graph is deleted, the information about the node in the first sub-graph is still retained.
According to some embodiments, the step S202 of comparing the information of each relationship edge of the at least one relationship edge with the information of the corresponding relationship edge in the knowledge-graph to determine the update data of the relationship edge may include: and in response to the comparison result indicating that the information of the relation edge in the knowledge graph is different from the information of the relation edge in the first sub-graph, taking the information of the relation edge in the knowledge graph as the update data of the relation edge. The new query result is fused with the previous result to perfect and expand the query result, so that the operation of a user is further facilitated.
For example, taking a marriage relation with a certain relation edge in the first sub-image as zhang san and lie si as an example, the marriage relation with zhang san and lie si in the first sub-image is "zhang san and lie si are a couple relation with each other". When further analysis is needed based on the first subgraph, the information of the corresponding relation 'Zhang III and Li IV are mutual couple relation' in the knowledge graph is searched based on the unique identifier of the marriage relation, and if the relation edge in the knowledge graph becomes divorce relation, the marriage relation edge is updated to divorce relation data.
According to some embodiments, the step S202 of comparing the information of each relationship edge of the at least one relationship edge with the information of the corresponding relationship edge in the knowledge-graph to determine the update data of the relationship edge may further include: and in response to the comparison result indicating that the relationship edge in the knowledge-graph is deleted, taking the information of the relationship edge in the first sub-graph as the update data of the relationship edge. Therefore, original data of the previous query result of the user is reserved, and the original data is prevented from being lost after the data is updated.
For example, still take the marriage relation that a certain relation edge in the first sub-image is Zhang III and Li IV as an example, and the marriage relation that Zhang III and Li IV in the first sub-image is "Zhang III and Li IV are a couple relation with each other". When further analysis is needed based on the first sub-graph, the information of the corresponding relation 'Zhang III and Li IV are a couple relation with each other' in the knowledge graph is searched based on the unique identifier of the marital relation, and if the relation side does not exist in the knowledge graph any more, the information about the relation side in the first sub-graph is still reserved.
According to some embodiments, the method may further comprise: after a first sub-graph associated with one or more preset nodes is obtained from the knowledge graph, data of the first sub-graph is coded, and coded data of the first sub-graph is obtained and stored in a database. For example, the graph data can be converted into binary data, converted into a byte stream, transmitted on the network conveniently, and stored in a database for operation conveniently.
According to some embodiments, the database may be a distributed database, such as but not limited to hbase (hadoop database) and tedb (titanium database) databases. Through distributed data storage, multiple backup operations of data are realized, and the data are not easy to lose. The database may also be a single-point database, such as but not limited to a MySQL (My structured-Query-Language) database.
According to some embodiments, in case the encoded data of the first sub-graph is stored in a database, the method may further comprise: reading the encoded data of the first sub-graph from the database in response to receiving the update request; and decoding the coded data of the first subgraph to obtain the first subgraph. And reading the backup from the third-party storage to realize the retrospective property of the data, so that the user can conveniently conduct further analysis on the basis of the subgraph.
According to the technical scheme of the disclosure, based on the unique identifiers of the nodes and the relationship edges in the first sub-graph, the first sub-graph can be put into the knowledge graph again for further analysis, and the second sub-graph is obtained.
According to some embodiments, the method may further comprise: and after the second subgraph is obtained, coding the data of the second subgraph to obtain coded data of the second subgraph to be stored in a database. So as to realize data backtracking and facilitate further analysis of the user based on the second subgraph.
While the operations in the above description are depicted in the drawings in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, nor that all illustrated operations be performed, to achieve desirable results.
FIG. 3A shows a schematic block diagram of a knowledge-graph in accordance with an illustrative embodiment; and fig. 3B and 3C are schematic diagrams illustrating a knowledge-graph according to an exemplary embodiment.
According to another aspect of the present disclosure, a knowledge graph generating device is also provided. The knowledge-graph may include: a plurality of nodes (node 1, node 2, node 3, and node 4 as shown in fig. 3B); and at least one relationship edge (e.g., relationship edge 1, relationship edge 2, relationship edge 3, relationship edge 4, and relationship edge 5 as shown in FIG. 3B), which can represent a relationship between the associated two nodes. As shown in fig. 3A, the generating apparatus 300 may include an identifier configuring unit 301 configured to configure a unique identifier (e.g., ID1, ID2, ID3, and ID4 shown in fig. 3B) for each node and a unique identifier (e.g., ID1 ', ID2 ', ID3 ', ID4 ', ID5 ' shown in fig. 3B) for each relationship edge according to a preset rule; and an editing unit 302 configured to modify or delete any one node or any one relationship edge based on the corresponding unique identifier. Therefore, any node or any relation edge of the knowledge graph can be modified or deleted based on the corresponding unique identifier to generate a new knowledge graph, so that the flexibility of using the knowledge graph can be enhanced, and a user can conveniently modify or delete the knowledge graph locally.
Here, the operations of the units of the knowledge-graph generating apparatus 300 shown in fig. 3A are similar to the operations of the steps in the method 100 described above, respectively, and are not described again here.
According to some embodiments, the unique identification of each node and the unique identification of each relationship edge in the knowledge-graph may be, but is not limited to being, generated by a snowflake algorithm.
In the example illustrated in fig. 3C, the knowledge-graph may include four nodes, respectively zhangsan, lien four, wang five, and wang xiao five, and respective different IDs (ID1, ID2, ID3, and ID 4). The knowledge-graph may also include five relational edges, respectively (transfer 1 ten thousand dollars, Miss, husband, transfer 1 ten thousand dollars, son), and respective different IDs (ID1 ', ID2 ', ID3 ', ID4 ', ID5 '). Because the two objects of transferring 1 ten thousand yuan are different, the two objects are not the same relationship edge and have different IDs. Therefore, only by searching the knowledge graph according to the specific ID, the graph information related to the knowledge graph can be found.
Fig. 4 is a schematic block diagram illustrating a knowledge-graph query apparatus 400 according to an exemplary embodiment. As shown in fig. 4, the knowledge-graph query apparatus 400 may include: an obtaining unit 401 configured to obtain a first sub-graph associated with one or more preset nodes from the knowledge-graph; a determining unit 402 configured to, in response to receiving the update request, compare information of each of the plurality of nodes in the first sub-graph with information of a corresponding node in the knowledge-graph based on the respective unique identifier to determine update data of the node, and compare information of each of at least one relationship edge in the first sub-graph with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge; and an updating unit 403 configured to update the first subgraph based on the update data of the plurality of nodes in the first subgraph and the update data of at least one relationship edge in the first subgraph to obtain a second subgraph.
Here, the operations of the above units 401 and 403 of the knowledge-graph query device 400 are similar to the operations of steps S201 to S203 described above, and are not described again here.
Still taking the example illustrated in fig. 3C as an example, the first sub-graph obtained by the previous analysis may include two nodes, one three (uniquely identified as ID1) and one lie four (uniquely identified as ID2), and a first relationship edge (uniquely identified as ID1 ') and a second relationship edge (uniquely identified as ID 2') between the three and the four. When further analysis is needed based on the first sub-graph, taking node Zhang III as an example, comparing the node Zhang III with the corresponding node Zhang III in the knowledge graph based on the corresponding unique identification, and if the corresponding node Zhang III in the knowledge graph is deleted, keeping the node Zhang III in the first sub-graph; and if the information of the corresponding node three in the knowledge graph is modified, modifying the information of the node three in the first sub-graph into the information of the node three in the knowledge graph. Based on the analysis requirement, a node wang five (uniquely identified as ID3) and a node wang xian five (uniquely identified as ID4) associated with the node lie four, a third relation edge (uniquely identified as ID3 ') and a fourth relation edge (uniquely identified as ID4 ') between the node wang five and the node lie four, and a fifth relation edge (uniquely identified as ID5 ') between the node wang five and the node wang xian five can be obtained from the knowledge graph, and the newly added nodes and the newly added relation edges are added to the first sub-graph. Through the above-mentioned updating operation on the first sub-graph, the second sub-graph in fig. 3C is obtained, and the update history of the knowledge graph can be determined based on the original first sub-graph and the updated second sub-graph. For example, the two relational edges "transfer 1 ten thousand" in FIG. 3C, it is possible to track "1 ten thousand" in the first relational edge ID 1' by comparing the original first sub-graph with the updated second sub-graph.
Although specific functions are discussed above with reference to specific units, it should be noted that the functions of the individual units discussed herein may be divided into multiple units and/or at least some of the functions of multiple units may be combined into a single unit. Performing an action by a particular element discussed herein includes the particular element itself performing the action, or alternatively the particular element invoking or otherwise accessing another component or element that performs the action (or performs the action in conjunction with the particular element). Thus, a particular element that performs an action can include the particular element that performs the action itself and/or another element that performs the action that the particular element invokes or otherwise accesses.
It should also be understood that various techniques may be described herein in the general context of software hardware elements or program units. The various elements described above with respect to fig. 4 may be implemented in hardware or in hardware in combination with software and/or firmware. For example, the units may be implemented as computer program code/instructions configured to be executed in one or more processors and stored in a computer readable storage medium. Alternatively, these units may be implemented as hardware logic/circuits. For example, in some embodiments, one or more of the obtaining unit 401, the determining unit 402, and the updating unit 403 may be implemented together in a System on Chip (SoC). The SoC may include an integrated circuit chip (which includes one or more components of a Processor (e.g., a Central Processing Unit (CPU), microcontroller, microprocessor, Digital Signal Processor (DSP), etc.), memory, one or more communication interfaces, and/or other circuitry), and may optionally execute received program code and/or include embedded firmware to perform functions.
According to an aspect of the disclosure, a computer device is provided that includes a memory, a processor, and a computer program stored on the memory. The processor is configured to execute the computer program to implement the steps of any of the method embodiments described above.
According to an aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the steps of any of the method embodiments described above.
According to an aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of any of the method embodiments described above.
Illustrative examples of such computer devices, non-transitory computer-readable storage media, and computer program products are described below in connection with FIG. 5.
Fig. 5 illustrates an example configuration of a computer device 500 that may be used to implement the methods described herein. The above-described apparatus may also be implemented in whole or at least in part by a computer device 500 or similar device or system.
Computer device 500 may be a variety of different types of devices, such as a server of a service provider, a device associated with a client (e.g., a client device), a system on a chip, and/or any other suitable computer device or computing system. Examples of computer device 500 include, but are not limited to: a desktop computer, a server computer, a notebook or netbook computer, a mobile device (e.g., a tablet, a cellular or other wireless telephone (e.g., a smartphone), a notepad computer, a mobile station), a wearable device (e.g., glasses, a watch), an entertainment device (e.g., an entertainment appliance, a set-top box communicatively coupled to a display device, a gaming console), a television or other display device, an automotive computer, and so forth. Thus, the computer device 500 may range from a full resource device with substantial memory and processor resources (e.g., personal computers, game consoles) to a low-resource device with limited memory and/or processing resources (e.g., traditional set-top boxes, hand-held game consoles).
The computer device 500 may include at least one processor 502, memory 504, communication interface(s) 506, display device 508, other input/output (I/O) devices 510, and one or more mass storage devices 512, which may be capable of communicating with each other, such as through a system bus 514 or other appropriate connection.
Processor 502 may be a single processing unit or multiple processing units, all of which may include single or multiple computing units or multiple cores. The processor 502 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuitry, and/or any devices that manipulate signals based on operational instructions. Among other capabilities, the processor 502 can be configured to retrieve and execute computer-readable instructions stored in the memory 504, mass storage device 512, or other computer-readable medium, such as program code for an operating system 516, program code for an application 518, program code for other programs 520, and so forth.
Memory 504 and mass storage device 512 are examples of computer-readable storage media for storing instructions that are executed by processor 502 to implement the various functions described above. By way of example, the memory 504 may generally include both volatile and nonvolatile memory (e.g., RAM, ROM, and the like). In addition, mass storage device 512 may generally include a hard disk drive, solid state drive, removable media, including external and removable drives, memory cards, flash memory, floppy disks, optical disks (e.g., CD, DVD), storage arrays, network attached storage, storage area networks, and the like. Memory 504 and mass storage device 512 may both be referred to herein collectively as memory or computer-readable storage media, and may be non-transitory media capable of storing computer-readable, processor-executable program instructions as computer program code that may be executed by processor 502 as a particular machine configured to implement the operations and functions described in the examples herein.
A number of program modules may be stored on the mass storage device 512. These programs include an operating system 516, one or more application programs 518, other programs 520, and program data 522, and they may be loaded into memory 504 for execution. Examples of such applications or program modules may include, for instance, computer program logic (e.g., computer program code or instructions) for implementing the following components/functions: an identity configuration unit 301, an editing unit 302, an obtaining unit 401, a determining unit 402, an updating unit 403, the method 100 and/or the method 200 (including any suitable steps of the methods 100, 200), and/or further embodiments described herein.
Although illustrated in fig. 5 as being stored in memory 504 of computer device 500, modules 516, 518, 520, and 522, or portions thereof, may be implemented using any form of computer-readable media that is accessible by computer device 500. As used herein, "computer-readable media" includes at least two types of computer-readable media, namely computer storage media and communication media.
Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information for access by a computer device.
In contrast, communication media may embody computer readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transport mechanism. Computer storage media, as defined herein, does not include communication media.
Computer device 500 may also include one or more communication interfaces 506 for exchanging data with other devices, such as over a network, a direct connection, and so forth, as previously discussed. Such communication interfaces may be one or more of the following: any type of network interface (e.g., a Network Interface Card (NIC)), wired or wireless (such as IEEE 802.11 Wireless LAN (WLAN)) wireless interface, worldwide interoperability for microwave Access (Wi-MAX) interface, Ethernet interface, Universal Serial Bus (USB) interface, cellular network interface, BluetoothTMAn interface, a Near Field Communication (NFC) interface, etc. The communication interface 506 may facilitate communication within a variety of networks and protocol types, including wired networks (e.g., LAN, cable, etc.) and wireless networks (e.g., WLAN, cellular, satellite, etc.), the Internet, and so forth. The communication interface 506 may also provide for communication with external storage devices (not shown), such as in storage arrays, network attached storage, storage area networks, and the like.
In some examples, a display device 508, such as a monitor, may be included for displaying information and images to a user. Other I/O devices 510 may be devices that receive various inputs from a user and provide various outputs to the user, and may include touch input devices, gesture input devices, cameras, keyboards, remote controls, mice, printers, audio input/output devices, and so forth.
While the disclosure has been illustrated and described in detail in the drawings and foregoing description, such illustration and description are to be considered illustrative and exemplary and not restrictive; the present disclosure is not limited to the disclosed embodiments. Variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed subject matter, from a study of the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps than those listed and the words "a" or "an" do not exclude a plurality. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.

Claims (19)

1. A method of generating a knowledge-graph, the knowledge-graph comprising a plurality of nodes and at least one relational edge capable of representing a relationship between two associated nodes, the method comprising:
configuring a unique identifier for each node and configuring a unique identifier for each relation edge according to a preset rule; and
and modifying or deleting any node or any relation edge based on the corresponding unique identification.
2. The method of claim 1, wherein configuring a unique identifier for each node and a unique identifier for each relationship edge according to a preset rule comprises:
before data of any node and data of any relation edge are imported into the knowledge graph, a unique identifier of the node is generated according to a preset rule and added into information of the node, and a unique identifier of the relation edge is generated according to a preset rule and added into information of the relation edge.
3. The method of claim 1 or 2, wherein the unique identification of each node and the unique identification of each relational edge are generated using a snowflake algorithm.
4. A query method of a knowledge graph, the knowledge graph comprising a plurality of nodes and at least one relational edge, the relational edge being capable of representing a relationship between two associated nodes, each node having a unique identification and each relational edge having a unique identification, the query method comprising:
obtaining a first sub-graph associated with one or more preset nodes from the knowledge graph;
in response to receiving an update request, comparing information of each of a plurality of nodes in the first sub-graph with information of a corresponding node in the knowledge-graph based on the corresponding unique identifier to determine update data of the node, and comparing information of each relationship edge in at least one relationship edge in the first sub-graph with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge; and
and updating the first subgraph based on the updating data of the nodes in the first subgraph and the updating data of at least one relation edge in the first subgraph to obtain a second subgraph.
5. The method of claim 4, further comprising:
based on the update request, acquiring at least one newly added node associated with at least one node in the first subgraph and at least one newly added relationship edge associated with the at least one newly added node from the knowledge graph;
and updating the first sub-graph based on the information of the at least one newly added node and the information of the at least one newly added relationship edge in the knowledge graph to obtain the second sub-graph.
6. The method of claim 4, wherein obtaining a first sub-graph associated with one or more preset nodes from the knowledge-graph comprises:
and acquiring data of the first subgraph, wherein the data of the first subgraph comprises node information, side information, statistical information and a preview graph.
7. The method of claim 4, wherein comparing information of each of a plurality of nodes in the first subgraph to information of a corresponding node in the knowledge-graph to determine update data for the node comprises:
and in response to the comparison result indicating that the information of the node in the knowledge-graph is different from the information of the node in the first sub-graph, taking the information of the node in the knowledge-graph as the update data of the node.
8. The method of claim 4, wherein comparing information of each of a plurality of nodes in the first subgraph to information of a corresponding node in the knowledge-graph to determine update data for the node comprises:
and in response to the comparison result indicating that the node in the knowledge-graph is deleted, using the information of the node in the first sub-graph as the update data of the node.
9. The method of claim 4, wherein comparing information of each relationship edge of the at least one relationship edge with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge comprises:
and in response to the comparison result indicating that the information of the relation edge in the knowledge graph is different from the information of the relation edge in the first sub-graph, taking the information of the relation edge in the knowledge graph as the update data of the relation edge.
10. The method of claim 4, wherein comparing information of each relationship edge of the at least one relationship edge with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge comprises:
and in response to the comparison result indicating that the relation edge in the knowledge-graph is deleted, taking the information of the relation edge in the first sub-graph as the update data of the relation edge.
11. The method according to any one of claims 4-10, further comprising:
after a first sub-graph associated with one or more preset nodes is obtained from the knowledge graph, data of the first sub-graph is coded, and coded data of the first sub-graph are obtained and stored in a database.
12. The method of claim 11, wherein the database is a distributed database.
13. The method of claim 11, further comprising:
reading the encoded data of the first sub-graph from the database in response to receiving an update request; and
and decoding the coded data of the first subgraph to obtain the first subgraph.
14. The method according to any one of claims 4-10, further comprising:
and after the second sub-graph is obtained, encoding the data of the second sub-graph to obtain encoded data of the second sub-graph so as to store the encoded data into a database.
15. A generation apparatus of a knowledge-graph having a plurality of nodes and at least one relational edge capable of representing a relationship between two associated nodes, the generation apparatus comprising:
the identification configuration unit is configured for configuring a unique identification for each node and configuring a unique identification for each relation edge according to a preset rule; and
and the editing unit is configured to modify or delete any node or any relation edge based on the corresponding unique identifier.
16. A query apparatus of a knowledge graph, the knowledge graph comprising a plurality of nodes and at least one relational edge, the relational edge being capable of representing a relationship between two associated nodes, each node having a unique identification and each relational edge having a unique identification, the query apparatus comprising:
an acquisition unit configured to acquire a first sub-graph associated with one or more preset nodes from the knowledge-graph;
a determining unit configured to, in response to receiving an update request, compare information of each of a plurality of nodes in the first sub-graph with information of a corresponding node in the knowledge-graph based on the respective unique identifier to determine update data of the node, and compare information of each of at least one relationship edge in the first sub-graph with information of a corresponding relationship edge in the knowledge-graph to determine update data of the relationship edge; and
the updating unit is configured to update the first subgraph based on the update data of the plurality of nodes in the first subgraph and the update data of at least one relationship edge in the first subgraph to obtain a second subgraph.
17. A computer device, comprising:
a memory, a processor, and a computer program stored on the memory,
wherein the processor is configured to execute the computer program to implement the steps of the method of any one of claims 1-14.
18. A non-transitory computer readable storage medium having a computer program stored thereon, wherein the computer program when executed by a processor implements the steps of the method of any of claims 1-14.
19. A computer program product comprising a computer program, wherein the computer program realizes the steps of the method of any one of claims 1-14 when executed by a processor.
CN202110292913.5A 2021-03-18 2021-03-18 Knowledge graph generation method, device, equipment and medium Pending CN112948593A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110292913.5A CN112948593A (en) 2021-03-18 2021-03-18 Knowledge graph generation method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110292913.5A CN112948593A (en) 2021-03-18 2021-03-18 Knowledge graph generation method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN112948593A true CN112948593A (en) 2021-06-11

Family

ID=76228263

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110292913.5A Pending CN112948593A (en) 2021-03-18 2021-03-18 Knowledge graph generation method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN112948593A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328977A (en) * 2022-03-09 2022-04-12 北京有生博大软件股份有限公司 Personnel migration map spectrum construction method based on map database

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10496678B1 (en) * 2016-05-12 2019-12-03 Federal Home Loan Mortgage Corporation (Freddie Mac) Systems and methods for generating and implementing knowledge graphs for knowledge representation and analysis
CN110750654A (en) * 2019-10-28 2020-02-04 中国建设银行股份有限公司 Knowledge graph acquisition method, device, equipment and medium
US20200167426A1 (en) * 2018-11-27 2020-05-28 International Business Machines Corporation Partitioning knowledge graph
CN111435367A (en) * 2019-01-15 2020-07-21 阿里巴巴集团控股有限公司 Knowledge graph construction method, system, equipment and storage medium
CN111831757A (en) * 2020-06-09 2020-10-27 时时同云科技(成都)有限责任公司 Method and device for generating and managing distributed global unique identification information
US20200372373A1 (en) * 2019-05-21 2020-11-26 Sisense Ltd. System and method for generating organizational memory using semantic knowledge graphs

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10496678B1 (en) * 2016-05-12 2019-12-03 Federal Home Loan Mortgage Corporation (Freddie Mac) Systems and methods for generating and implementing knowledge graphs for knowledge representation and analysis
US20200167426A1 (en) * 2018-11-27 2020-05-28 International Business Machines Corporation Partitioning knowledge graph
CN111435367A (en) * 2019-01-15 2020-07-21 阿里巴巴集团控股有限公司 Knowledge graph construction method, system, equipment and storage medium
US20200372373A1 (en) * 2019-05-21 2020-11-26 Sisense Ltd. System and method for generating organizational memory using semantic knowledge graphs
CN110750654A (en) * 2019-10-28 2020-02-04 中国建设银行股份有限公司 Knowledge graph acquisition method, device, equipment and medium
CN111831757A (en) * 2020-06-09 2020-10-27 时时同云科技(成都)有限责任公司 Method and device for generating and managing distributed global unique identification information

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
杜亚军等: "微博知识图谱构建方法研究", 西华大学学报(自然科学版), vol. 34, no. 1, pages 215 - 35 *
田萍芳: "《面向云出版的语义关键技术》", 30 April 2015, 武汉大学出版社, pages: 15 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328977A (en) * 2022-03-09 2022-04-12 北京有生博大软件股份有限公司 Personnel migration map spectrum construction method based on map database

Similar Documents

Publication Publication Date Title
CN109254733B (en) Method, device and system for storing data
CN110543586B (en) Multi-user identity fusion method, device, equipment and storage medium
CN107103011B (en) Method and device for realizing terminal data search
US11366821B2 (en) Epsilon-closure for frequent pattern analysis
CN110807028B (en) Method, apparatus and computer program product for managing a storage system
CN112912870A (en) Tenant identifier conversion
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN111078723A (en) Data processing method and device for block chain browser
CN115918110A (en) Spatial search using key-value store
CN115311399A (en) Image rendering method and device, electronic equipment and storage medium
US11704327B2 (en) Querying distributed databases
CN114493799A (en) Method and system for managing special vehicle order data in warehouse and table dividing manner
CN112948593A (en) Knowledge graph generation method, device, equipment and medium
US11200205B2 (en) Displaying an alert and options when deleting a file that is associated with a sequence of files
CN112182115A (en) Relationship display method and device, storage medium and electronic device
CN112889039A (en) Identification of records for post-clone tenant identifier conversion
US11113339B2 (en) System and method for federated content management using a federated library and federated metadata propagation
US11636111B1 (en) Extraction of relationship graphs from relational databases
CN115878860A (en) Menu generation method, device, server equipment and medium
US11727022B2 (en) Generating a global delta in distributed databases
US10114864B1 (en) List element query support and processing
CN113486025A (en) Data storage method, data query method and device
CN110083680B (en) Method and device for managing context data in distributed system
CN103970860B (en) Method, device and system for processing data
WO2014176954A1 (en) Processing method, device and system for data of distributed storage system

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