Dynamic map construction method, dynamic map construction device, and readable storage medium
By acquiring identifiers and time-series information from graph data, a dynamic knowledge graph is constructed, which solves the problem that static graphs cannot compare across multiple time periods and fuse across graphs. It enables real-time multi-time period comparison and cross-graph fusion, supports multi-scenario analysis, and improves the timeliness and efficiency of business strategies.
Patent Information
- Application Number
- CN202211730575.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-12-30
AI Technical Summary
Static knowledge graphs do not support comparing changes across multiple time periods, cannot be fused across graphs, and have limitations in application scenarios.
By acquiring the identifiers and time-series information of the graph data, the data type is determined, and the graph data and time-series information are associated and saved to the target data table based on the construction rules, thus constructing a dynamic knowledge graph that supports real-time multi-time period comparison analysis and cross-graph fusion.
It enables real-time, multi-time-period comparative analysis and cross-graph fusion of knowledge graphs, supports data analysis in multiple scenarios, and improves the timeliness and efficiency of business strategies.
Smart Images

Figure CN115952300B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data management, in particular to a dynamic graph construction method, a dynamic graph construction device and a computer readable storage medium. BACKGROUND
[0002] A knowledge graph is an application and implementation based on a data network technology framework, which realizes the mapping of knowledge of the objective world from string description to structured semantic description. The knowledge graph generally constructs and manages the knowledge structure in a certain field based on entities and the associations between entities, thereby realizing knowledge query.
[0003] In related technologies, nodes are used to represent entities existing in the real world, and edges are used to represent the relationships between entities, and then a network, i.e., a knowledge graph, is formed by nodes and edges. The generated knowledge graph is generally a static graph. After generating the knowledge graph according to the obtained data, the knowledge graph can be analyzed and monitored according to the corresponding scene. The generated knowledge graph is generally a static graph.
[0004] However, the static graph does not support comparison of changes in the knowledge graph in multiple time periods, cannot be fused across graphs, and the application scenarios are limited. SUMMARY
[0005] The embodiments of the present application provide a dynamic graph construction method, a dynamic graph construction device and a computer readable storage medium, which solve the technical problem that the static graph in related technologies does not support comparison of changes in the knowledge graph in multiple time periods, cannot be fused across graphs, and the application scenarios are limited, and realize real-time, multi-period comparative analysis of the knowledge graph and cross-graph or multi-graph fusion.
[0006] The embodiments of the present application provide a dynamic graph construction method, which comprises:
[0007] Obtaining graph data used for constructing a knowledge graph, determining identifiers and time sequence information of the graph data;
[0008] Based on the identifiers, determining a scene type and a data type of the graph data, wherein the data type comprises entity data, relationship data and attribute data;
[0009] Based on the construction rules corresponding to the data type, associating and saving the graph data and the time sequence information to a target data table;
[0010] According to the type corresponding to the target data table, taking a target entity data table and a target attribute data table as nodes, and a target relationship data table as an edge to construct a corresponding knowledge graph, and associating the knowledge graph and the scene type.
[0011] Optionally, the step of saving the graph data and the time sequence information to the target data table according to the construction rule corresponding to the data type comprises:
[0012] When the data type is entity data, determining an entity type of the graph data, and determining whether an entity type block corresponding to the entity type exists;
[0013] If the entity type block exists, determining whether an entity value corresponding to the graph data is stored in the entity type block;
[0014] If the entity value exists, updating the entity value based on the time sequence information, and determining whether a main scene corresponding to the scene type exists;
[0015] If the entity value does not exist, storing the entity value and the time sequence information in the entity type block, and determining whether a main scene corresponding to the scene type exists.
[0016] Optionally, after the step of determining the entity type of the graph data and determining whether the entity type block corresponding to the entity type exists when the data type is entity data, the method further comprises:
[0017] If the entity type block does not exist, creating the entity type block, and associating the entity type with the entity type block;
[0018] Determining an entity value of the graph data, and writing the entity value and the time sequence information to the entity type block;
[0019] Determining whether a main scene corresponding to the scene type exists.
[0020] Optionally, after the step of determining whether the main scene corresponding to the scene type exists, the method further comprises:
[0021] If the main scene exists, determining a sub-scene corresponding to the graph data, and determining whether the main scene is associated with the sub-scene;
[0022] If the main scene is not associated with the sub-scene, creating the sub-scene, and associating and storing the sub-scene and the graph data;
[0023] If the main scene is associated with the sub-scene, and the sub-scene is not associated with the graph data, associating and storing the sub-scene and the graph data.
[0024] Optionally, the step of saving the graph data and the time sequence information to the target data table according to the construction rule corresponding to the data type further comprises:
[0025] When the data type is attribute data, a type of attribute of the graph data is determined, and it is determined whether a main scene corresponding to the scene type is associated with an attribute type block corresponding to the type of attribute;
[0026] If the attribute type block is associated, a value of attribute corresponding to the graph data is determined, and it is determined whether the value of attribute is stored in the attribute type block;
[0027] If the value of attribute is stored in the attribute type block, the attribute type block is updated based on the value of attribute and the time sequence information;
[0028] If the value of attribute is not stored in the attribute type block, the value of attribute and the time sequence information are stored in the attribute type block in association.
[0029] Optionally, the step of saving the graph data and the time sequence information to the target data table based on the construction rule corresponding to the data type further includes:
[0030] When the data type is relationship data, a type of relationship of the graph data is determined, and it is determined whether a main scene corresponding to the scene type is associated with a relationship type block corresponding to the type of relationship;
[0031] If the relationship type block is associated, a first entity value, a second entity value and a relationship value corresponding to the graph data are determined, and it is determined whether the relationship value is stored in the relationship type block;
[0032] If the relationship value is stored in the relationship type block, the relationship type block is updated based on the first entity value, the second entity value, the relationship value and the time sequence information;
[0033] If the relationship value is not stored in the relationship type block, the first entity value, the second entity value, the relationship value and the time sequence information are stored in the relationship type block in association.
[0034] Optionally, the step of constructing a corresponding knowledge graph with the target entity data table and the target attribute data table as nodes and the target relationship data table as edges according to the type corresponding to the target data table, and associating the knowledge graph and the scene type includes:
[0035] A target relationship data table stored under the scene type is acquired, and the target entity data table and / or the target attribute data table pointed to by the target relationship data table is determined;
[0036] The target entity data table and / or the target attribute data table are taken as the nodes, a connection line between the nodes is generated according to an association relationship corresponding to the target relationship data table, so as to form the knowledge graph.
[0037] Optionally, after the step of saving the graph data and the time sequence information to the target data table according to the construction rule corresponding to the data type, the method further comprises:
[0038] determining the definition of the type block corresponding to the graph data in the mapping table of the sub-table according to the hash value of the graph data.
[0039] In addition, the present application also proposes a dynamic graph construction device, which comprises a memory, a processor, and a dynamic graph construction program stored in the memory and executable on the processor. When the processor executes the dynamic graph construction program, the steps of the dynamic graph construction method described above are implemented.
[0040] In addition, the present application also proposes a computer readable storage medium, which stores a dynamic graph construction program. When the processor executes the dynamic graph construction program, the steps of the dynamic graph construction method described above are implemented.
[0041] The one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0042] 1. Since the graph data used for constructing the knowledge graph is acquired, the identifier and the time sequence information of the graph data are determined, the scene type and the data type of the graph data are determined based on the identifier, the data type includes entity data, relationship data, and attribute data, the graph data and the time sequence information are saved to the target data table based on the construction rule corresponding to the data type, and the corresponding knowledge graph is constructed with the target entity data table and the target attribute data table as nodes and the target relationship data table as edges, and the knowledge graph and the scene type are associated. Therefore, the technical problem that the static graph in the related art does not support comparison of the change of the knowledge graph in multiple time periods, cannot be fused across graphs, and the application scene is limited is effectively solved, and real-time, multi-period comparison and analysis of the knowledge graph are implemented, and cross-graph or multi-graph fusion is also implemented.
[0043] 2. By adding the time dimension in the knowledge graph data, the knowledge graph constructed can use the time sequence analysis technology and the graph similarity technology to analyze the change and trend of the graph structure over time, so that the key information is mastered. The preset scene is set, the effect of supporting multiple scenes is achieved, the data is analyzed from different dimensions and different levels through supporting multiple scenes and multiple levels, which is helpful to the improvement of business strategy. It is beneficial to timely and efficient viewing of the change and trend of the graph in each time period and evaluation of the change. BRIEF DESCRIPTION OF DRAWINGS
[0044] Figure 1 A flowchart for the process of the dynamic graph construction method embodiment one of the present application is shown in FIG. 1.
[0045] Figure 2 A flowchart for the detailed process of step S130 in the dynamic graph construction method embodiment two of the present application is shown in FIG. 2.
[0046] Figure 3 A flowchart for part of the dynamic graph construction method embodiment two of the present application is shown in FIG. 3.
[0047] Figure 4 A hardware structure diagram related to the dynamic graph construction device embodiment of the present application is shown in FIG. 4. DETAILED DESCRIPTION
[0048] In the related art, mainstream graph databases include Neo4j graph, JanusGraph graph, HugeGraph graph, etc. The Neo4j graph is a high-performance, NOSQL static graph database, but does not support dynamic graphs. The JanusGraph graph supports real-time analysis and traversal of large graphs, but does not support time series. The HugeGraph graph is an easy-to-use, efficient, and general-purpose open-source graph database that supports the fast import of more than 10 billion vertices and edges, but does not support multi-scene layering. The main technical solution adopted by the present application is: obtaining an identifier and time series information of graph data, determining a data type of the graph data according to the identifier, determining a corresponding construction rule according to the data type, associating and saving the graph data and the time series information to a target data table according to the construction rule, and constructing a knowledge graph according to the target data table. Thus, real-time, multi-period comparative analysis of the knowledge graph is realized, and cross-graph or multi-graph fusion is also realized.
[0049] In order to better understand the above technical solutions, exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0050] Embodiment one
[0051] Embodiment one of the present application discloses a dynamic graph construction method, referring to Figure 1 , the dynamic graph construction method comprises:
[0052] Step S110, obtaining graph data for constructing a knowledge graph, determining an identifier and time series information of the graph data;
[0053] Step S120, determining a scene type and a data type of the graph data based on the identifier, wherein the data type comprises entity data, relationship data and attribute data;
[0054] In the embodiment, the graph data is processed basic data, and the graph data is associated with an identifier and time sequence information.
[0055] As an optional implementation, the scene type of the graph data is determined according to the identifier, and the scene type comprises a main scene name and a sub-scene name to which the graph data belongs; the data type of the graph data is determined according to the identifier, and the graph data is divided into entity data, relationship data and attribute data according to the data type; and the time sequence information associated with the graph data is determined.
[0056] Step S130, associating and saving the graph data and the time sequence information to a target data table based on a construction rule corresponding to the data type.
[0057] In the embodiment, different types of data correspond to different construction rules, the graph data is saved to the target data table according to the corresponding construction rule, and the time sequence information is updated according to a current time node, and the updated time sequence information is associated and saved to the target data table with the graph data.
[0058] Optionally, after step S130, the method further comprises:
[0059] Step S131, determining a definition of a type block corresponding to the graph data in a mapping table of the sub-table according to a hash value of the graph data.
[0060] As an optional implementation, a hash value in a unique MD5 (Message-Digest Algoorithm 5, fifth generation information-abstract algorithm) encryption mode is generated according to a graph path, a main scene name and a sub-scene name created by a user, and the definition of each type block of the target data in the mapping table of the sub-table is determined according to the hash value of the target data, so as to ensure the uniqueness of the value.
[0061] Step S140, constructing a corresponding knowledge graph according to a type corresponding to the target data table, taking a target entity data table and a target attribute data table as nodes and a target relationship data table as an edge, and associating the knowledge graph and the scene type.
[0062] In the embodiment, the type corresponding to the target data table is the data type of the graph data, the target data table composed of the entity data is the target entity data table, the target data table composed of the relationship data is the target relationship data table, and the target data table composed of the attribute data is the target attribute data table.
[0063] Optionally, step S140 comprises:
[0064] Step S141, obtaining the target relationship data table stored under the scene type, determining the target entity data table and / or the target attribute data table pointed by the target relationship data table;
[0065] Step S142, taking the target entity data table and / or the target attribute data table as the node, generating the connection between the nodes according to the corresponding association relationship of the target relationship data table, to form the knowledge graph.
[0066] As an optional implementation, the scene type of the knowledge graph to be constructed is determined, the target relationship data table associated with the main scene in the scene type is determined, and the target entity data table and / or the target attribute data table associated with the target relationship data table are determined; the target entity data table and / or the target attribute data table are taken as nodes, and the target relationship data table is taken as the edge between the nodes, to form a knowledge graph.
[0067] The technical solutions in the embodiments of the present application have at least the following technical effects or advantages:
[0068] Since the graph data used for constructing the knowledge graph is obtained, the identifier and the time sequence information of the graph data are determined; based on the identifier, the scene type and the data type of the graph data are determined, wherein the data type includes entity data, relationship data and attribute data; based on the construction rule corresponding to the data type, the graph data and the time sequence information are associated and saved to a target data table; according to the type corresponding to the target data table, the target entity data table and the target attribute data table are taken as nodes, and the target relationship data table is taken as an edge to construct a corresponding knowledge graph, and the knowledge graph and the scene type are associated. Therefore, the technical problem that the static graph in the related art does not support comparison of the change of the knowledge graph in multiple time periods, cannot be fused across graphs, and the application scene is limited is effectively solved, and real-time, multi-period comparison and analysis of the knowledge graph are realized, and cross-graph or multi-graph fusion is also realized.
[0069] Embodiment Two
[0070] Based on embodiment one, embodiment two of the present application proposes a dynamic graph construction method, which refers to Figure 2 , step S130 includes:
[0071] Step S210, when the data type is entity data, determining the entity type of the graph data, and determining whether the entity type block corresponding to the entity type exists;
[0072] Step S220, if the entity type block exists, determining whether the entity value corresponding to the graph data is stored in the entity type block;
[0073] Step S230, if the entity value exists, updating the entity value based on the timing information, and determining whether the main scene corresponding to the scene type exists;
[0074] Step S240, if the entity value does not exist, storing the entity value and the timing information in the entity type block, and determining whether the main scene corresponding to the scene type exists.
[0075] In the embodiment, the same entity data can be contained in different scenes and at different timings. Comprehensive consideration is given to various aspects, such as generality, reusability, bandwidth, and server resource consumption. A 64-bit benchmark encoding rule is used for string encryption to store the entity data in the entity type block. The scene and the timing only need to be associated with the universally unique identifier in the entity type block, which greatly increases the reusability and reduces the bandwidth and server resource consumption caused by data transmission.
[0076] As an optional implementation, when the data type is entity data, the entity type of the graph data is determined, it is determined whether the entity type block corresponding to the entity type exists, and it is determined whether the entity value corresponding to the graph data is stored in the entity type block when the entity type block exists. If the entity value exists, the entity value is updated based on the obtained timing information, and it is determined whether the main scene corresponding to the identifier exists. If the entity value does not exist, the entity value and the timing information are stored in the entity type block, and it is determined whether the main scene corresponding to the identifier exists.
[0077] Optionally, after step S210, the method further includes:
[0078] Step S211, if the entity type block does not exist, creating the entity type block, and associating the entity type with the entity type block;
[0079] Step S212, determining the entity value of the graph data, and writing the entity value and the timing information to the entity type block;
[0080] Step S213, determining whether the main scene corresponding to the scene type exists.
[0081] As an optional implementation, if the entity type block does not exist, the entity type block corresponding to the entity type is created, the entity value of the graph data and the timing information are associated and saved to the entity type block, and it is determined whether the main scene corresponding to the scene type exists.
[0082] Optionally, referring to Figure 3 after the step of determining whether the main scene corresponding to the scene type exists, the method further includes:
[0083] Step S241, if the main scene exists, determine the sub-scene corresponding to the graph data, and determine whether the main scene is associated with the sub-scene.
[0084] Step S242, if the main scene does not have the associated sub-scene, create the sub-scene, and store the sub-scene and the graph data in association.
[0085] Step S243, if the main scene has the associated sub-scene, and the sub-scene is not associated with the graph data, store the sub-scene and the graph data in association.
[0086] As an optional embodiment, if the main scene exists, determine whether the sub-scene corresponding to the graph data exists; if the main scene is associated with the sub-scene, but the sub-scene is not associated with the graph data, store the sub-scene and the graph data in association; if the main scene is not associated with the sub-scene, create the corresponding sub-scene under the main scene, and associate the main scene, the sub-scene, and the graph data.
[0087] If the main scene does not exist, create the corresponding main scene and sub-scene according to the scene type, and associate the main scene, the sub-scene, and the graph data.
[0088] For example, when the entity type block does not exist, create the entity type block through a preset rule. For example, a method for creating a table for storing the entity type as a domain name is as follows: prefix + entity type + type hash value = table name, that is, LA_Exu_Entity_49, LA_Exu_ is a prefix, Entity represents an entity type, and the identification prefix of the domain name in the entity type is defined as 49.
[0089] Optionally, step S130 further includes:
[0090] Step S251, when the data type is attribute data, determine the attribute type of the graph data, determine whether the main scene corresponding to the scene type is associated with the attribute type block corresponding to the attribute type;
[0091] Step S252, if the attribute type block is associated, determine the attribute value corresponding to the graph data, and determine whether the attribute value is stored in the attribute type block;
[0092] Step S253, if the attribute type block stores the attribute value, update the attribute type block based on the attribute value and the time sequence information;
[0093] Step S254, if the attribute type block does not store the attribute value, store the attribute value and the time sequence information in the attribute type block in association.
[0094] As an optional implementation, if the main scene corresponding to the scene type is not associated with the relationship type block corresponding to the relationship type, the relationship type block is created under the main scene; and the time sequence information is associated with the relationship value and saved to the relationship type block.
[0095] For example, it is determined whether the attribute type block corresponding to the scene type exists, if the attribute type block does not exist, the attribute type block corresponding to the scene type is created; if the attribute type block exists, it is determined whether the attribute value corresponding to the attribute data exists in the attribute type block, if the attribute value corresponding to the attribute data does not exist in the attribute type block, the attribute value is added in the attribute type block, if the attribute value corresponding to the attribute data exists in the attribute type block, the time information corresponding to the existing attribute value is compared with the time sequence information, if the time information is consistent with the time sequence information, the existing attribute value is not changed; if the time information is inconsistent with the time sequence information, the attribute type block is updated based on the attribute data and the time sequence information.
[0096] Optionally, step S130 further includes:
[0097] Step S261, when the data type is relationship data, the relationship type of the graph data is determined, it is determined whether the main scene corresponding to the scene type is associated with the relationship type block corresponding to the relationship type;
[0098] Step S262, if the relationship type block is associated, the first entity value, the second entity value and the relationship value corresponding to the graph data are determined, it is determined whether the relationship type block stores the relationship value;
[0099] Step S263, if the relationship type block stores the relationship value, the relationship type block is updated based on the first entity value, the second entity value, the relationship value and the time sequence information;
[0100] Step S264, if the relationship type block does not store the relationship value, the first entity value, the second entity value, the relationship value and the time sequence information are associated and stored to the relationship type block.
[0101] As an optional implementation, if the main scene corresponding to the scene type is not associated with the relationship type block corresponding to the relationship type, the relationship type block is created under the main scene; and the time sequence information is associated with the relationship value and saved to the relationship type block.
[0102] Exemplarily, since the relationship is not fixed in different scenarios, each scenario sets the relationship between the entities corresponding to the relationship data, for example, the relationship between entity A and entity B in scenario A is R1, and the relationship between entity A and entity B in scenario B is R2.
[0103] Exemplarily, when the data type is relationship data, the relationship type of the graph data is determined, it is judged whether the main scene is associated with a corresponding relationship type block, if the relationship type block does not exist, the relationship type block is created; if the relationship type block exists, it is first judged whether the relationship between the first entity and the second entity corresponding to the relationship data exists in the relationship type block, if the relationship between the entities corresponding to the relationship data does not exist in the relationship type block, the relationship of the two entities is added in the relationship type block, if the relationship between the entities corresponding to the relationship data exists in the relationship type block, the time information corresponding to the existing relationship is compared with the time sequence information, if the time information and the time sequence information are consistent, the existing relationship is not changed; if the time is inconsistent, the relationship type block is updated based on the relationship data and the time sequence information.
[0104] The technical solutions in the embodiments of the present application have at least the following technical effects or advantages:
[0105] Since the corresponding construction method is selected according to the data type of the graph data, the corresponding data table is associated and created in the corresponding main scene and sub-scene, and the time dimension is added in the knowledge graph data, so that the constructed knowledge graph can use the time sequence analysis technology and the graph similarity technology to analyze the change and trend of the graph structure with time, so as to master the key information. The preset scene is set, which can realize the effect of supporting multiple scenes. By supporting multiple scenes, multiple levels, the data can be analyzed from different dimensions and different levels, which is helpful to improve the business strategy. It is beneficial to timely and efficiently view the change and trend of the graph in each time period and evaluate the change.
[0106] The present application also proposes a dynamic graph construction device, referring to Figure 4 , Figure 4 The dynamic graph construction device structure schematic diagram of the hardware running environment involved in the embodiment scheme of the present application.
[0107] As Figure 4As shown, the dynamic map construction device can include a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize the connection and communication between the components. The user interface 1003 can include a display, an input unit such as a keyboard, and can also include a standard wired interface, a wireless interface. The network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 can be a high-speed random access memory (RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 can also be a storage device independent of the aforementioned processor 1001.
[0108] Those skilled in the art can understand that Figure 4 The structure shown in the figure does not constitute a limitation on the dynamic map construction device, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.
[0109] Optionally, the memory 1005 is electrically connected with the processor 1001, and the processor 1001 can be used to control the operation of the memory 1005, and can also read the data in the memory 1005 to realize dynamic map construction.
[0110] Optionally, as Figure 4 The memory 1005 as a storage medium can include an operating system, a data storage module, a network communication module, a user interface module, and a dynamic map construction program.
[0111] Optionally, in Figure 4 In the dynamic map construction device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the dynamic map construction device of the present application can be arranged in the dynamic map construction device.
[0112] As Figure 4 The dynamic map construction device calls the dynamic map construction program stored in the memory 1005 through the processor 1001, and performs the related step operations of the dynamic map construction method provided by the embodiments of the present application:
[0113] acquire graph data for constructing a knowledge graph, determine an identifier and time sequence information of the graph data;
[0114] determine a scene type and a data type of the graph data based on the identifier, wherein the data type comprises entity data, relationship data and attribute data;
[0115] save the graph data and the time sequence information to a target data table based on a construction rule corresponding to the data type;
[0116] construct a corresponding knowledge graph according to a type corresponding to the target data table, taking a target entity data table and a target attribute data table as nodes and a target relationship data table as edges, and associate the knowledge graph and the scene type.
[0117] Optionally, the processor 1001 can invoke a dynamic graph construction program stored in the memory 1005, and further perform the following operations:
[0118] when the data type is entity data, determine an entity type of the graph data, and determine whether an entity type block corresponding to the entity type exists;
[0119] if the entity type block exists, determine whether an entity value corresponding to the graph data is stored in the entity type block;
[0120] if the entity value exists, update the entity value based on the time sequence information, and determine whether a main scene corresponding to the scene type exists;
[0121] if the entity value does not exist, store the entity value and the time sequence information in the entity type block, and determine whether a main scene corresponding to the scene type exists.
[0122] Optionally, the processor 1001 can invoke a dynamic graph construction program stored in the memory 1005, and further perform the following operations:
[0123] if the entity type block does not exist, create the entity type block, and associate the entity type with the entity type block;
[0124] determine an entity value of the graph data, and write the entity value and the time sequence information to the entity type block;
[0125] determine whether a main scene corresponding to the scene type exists.
[0126] Optionally, the processor 1001 can invoke a dynamic graph construction program stored in the memory 1005, and further perform the following operations:
[0127] If the main scene exists, a sub-scene corresponding to the graph data is determined, and it is judged whether the main scene is associated with the sub-scene;
[0128] If the main scene does not have the associated sub-scene, the sub-scene is created, and the sub-scene is stored in association with the graph data;
[0129] If the main scene has the associated sub-scene, and the sub-scene is not associated with the graph data, the sub-scene is stored in association with the graph data.
[0130] Optionally, the processor 1001 can call the dynamic graph construction program stored in the memory 1005, and further perform the following operations:
[0131] When the data type is attribute data, the attribute type of the graph data is determined, and it is judged whether the main scene corresponding to the scene type is associated with the attribute type block corresponding to the attribute type;
[0132] If the attribute type block is associated, the attribute value corresponding to the graph data is determined, and it is determined whether the attribute value is stored in the attribute type block;
[0133] If the attribute value is stored in the attribute type block, the attribute type block is updated based on the attribute value and the time sequence information;
[0134] If the attribute value is not stored in the attribute type block, the attribute value and the time sequence information are stored in association in the attribute type block.
[0135] Optionally, the processor 1001 can call the dynamic graph construction program stored in the memory 1005, and further perform the following operations:
[0136] When the data type is relationship data, the relationship type of the graph data is determined, and it is judged whether the main scene corresponding to the scene type is associated with the relationship type block corresponding to the relationship type;
[0137] If the relationship type block is associated, the first entity value, the second entity value, and the relationship value corresponding to the graph data are determined, and it is judged whether the relationship value is stored in the relationship type block;
[0138] If the relationship value is stored in the relationship type block, the relationship type block is updated based on the first entity value, the second entity value, the relationship value, and the time sequence information;
[0139] If the relationship value is not stored in the relationship type block, the first entity value, the second entity value, the relationship value, and the time sequence information are stored in association in the relationship type block.
[0140] Optionally, the processor 1001 can invoke the dynamic graph construction program stored in the memory 1005, and further perform the following operations:
[0141] Obtain the target relationship data table stored under the scene type, and determine the target entity data table and / or the target attribute data table pointed to by the target relationship data table;
[0142] Take the target entity data table and / or the target attribute data table as the nodes, generate the connection lines between the nodes according to the corresponding association relationship of the target relationship data table, so as to form the knowledge graph.
[0143] Optionally, the processor 1001 can invoke the dynamic graph construction program stored in the memory 1005, and further perform the following operations:
[0144] Determine the definition of the type block corresponding to the graph data in the mapping table of the sub-table according to the hash value of the graph data.
[0145] In addition, the embodiment of the present application further proposes a computer readable storage medium, and the computer readable storage medium stores the dynamic graph construction program. When the processor executes the dynamic graph construction program, the related steps of any embodiment of the dynamic graph construction method described above are realized.
[0146] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0147] The present application is described with reference to flowcharts and / or block diagrams according to the method, device (system), and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one flow or multiple flows and / or blocks Figure 1 The device that implements the functions specified in one block or multiple blocks.
[0148] These computer program instructions can 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 instructions which implement the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0149] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flow or flows and / or blocks Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0150] It is noted that any references made herein to an element or apparatus should be understood in the context of the present application as references to at least one element or apparatus. It is further noted that in the claims the word comprising does not exclude any component not mentioned in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of both hardware and software, and any combination thereof. In the claims, any reference signs placed between two elements having the same reference sign imply a constancy that the two elements are operationally related. The use of the word "about" in relation to a numerical value specifies the precision of the value, and allows a certain tolerance around that value. The use of the word "comprise", "comprises" or "comprising" does not exclude the presence of elements or steps other than those listed in a claim. The word "first", "second", "third" and the like in the description do not necessarily have an chronological meaning but can be used to distinguish between two elements having the same name.
[0151] Although preferred embodiments of the application have been described, those skilled in the art will be able to make additional modifications and variations to the described embodiments without departing from the spirit and scope of the application. Accordingly, it is intended that the appended claims be construed to include all such modifications and variations as fall within the scope of the application.
[0152] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.
Claims
1. A dynamic graph construction method, characterized in that, The dynamic graph construction method comprises: acquiring graph data for constructing a knowledge graph, determining identifiers and time sequence information of the graph data; determining a scene type and a data type of the graph data based on the identifiers, wherein the data type comprises entity data, relationship data and attribute data; associating and saving the graph data and the time sequence information to a target data table based on a construction rule corresponding to the data type; constructing a corresponding knowledge graph with a target entity data table and a target attribute data table as nodes and a target relationship data table as an edge according to a type corresponding to the target data table, and associating the knowledge graph and the scene type; the step of associating and saving the graph data and the time sequence information to the target data table based on the construction rule corresponding to the data type comprises: when the data type is entity data, determining an entity type of the graph data, and determining whether an entity type block corresponding to the entity type exists; if the entity type block exists, determining whether an entity value corresponding to the graph data is stored in the entity type block; if the entity value exists, updating the entity value based on the time sequence information, and determining whether a main scene corresponding to the scene type exists; if the entity value does not exist, storing the entity value and the time sequence information in the entity type block, and determining whether a main scene corresponding to the scene type exists; if the entity type block does not exist, creating the entity type block and associating the entity type with the entity type block; determining an entity value of the graph data, and writing the entity value and the time sequence information to the entity type block; determining whether a main scene corresponding to the scene type exists; when the data type is attribute data, determining an attribute type of the graph data, and determining whether a main scene corresponding to the scene type is associated with an attribute type block corresponding to the attribute type; if the attribute type block is associated, determining an attribute value corresponding to the graph data, and determining whether the attribute value is stored in the attribute type block; if the attribute value is stored in the attribute type block, updating the attribute type block based on the attribute value and the time sequence information; if the attribute value is not stored in the attribute type block, associating and storing the attribute value and the time sequence information to the attribute type block; when the data type is relationship data, determining a relationship type of the graph data, and determining whether a main scene corresponding to the scene type is associated with a relationship type block corresponding to the relationship type; if the relationship type block is associated, determining a first entity value, a second entity value and a relationship value corresponding to the graph data, and determining whether the relationship value is stored in the relationship type block; if the relationship value is stored in the relationship type block, updating the relationship type block based on the first entity value, the second entity value, the relationship value and the time sequence information; if the relationship value is not stored in the relationship type block, associating and storing the first entity value, the second entity value, the relationship value and the time sequence information to the relationship type block.
2. The dynamic map construction method of claim 1, wherein, The step of judging whether the main scene corresponding to the scene type exists further comprises: If the main scene exists, determining a sub-scene corresponding to the graph data, and judging whether the main scene is associated with the sub-scene; If the main scene does not have the associated sub-scene, creating the sub-scene and storing the sub-scene and the graph data in association; If the main scene has the associated sub-scene and the sub-scene is not associated with the graph data, storing the sub-scene and the graph data in association.
3. The dynamic map construction method of claim 1, wherein, The step of constructing a corresponding knowledge graph according to the type of the target data table, taking a target entity data table and a target attribute data table as nodes and a target relationship data table as an edge, and associating the knowledge graph and the scene type comprises: Obtaining a target relationship data table stored under the scene type, and determining the target entity data table and / or the target attribute data table pointed to by the target relationship data table; Taking the target entity data table and / or the target attribute data table as the nodes, generating a connection between the nodes according to the association relationship of the target relationship data table, so as to form the knowledge graph.
4. The dynamic map construction method of claim 1, wherein, The step of associating and saving the graph data and the time sequence information to a target data table based on the construction rule corresponding to the data type further comprises: Determining the definition of the type block corresponding to the graph data in the mapping table of the sub-table according to the hash value of the graph data.
5. A dynamic map construction device characterized by comprising: The computer readable storage medium stores a dynamic graph construction program, and the dynamic graph construction program is executed by the processor to realize the steps of the dynamic graph construction method according to any one of claims 1 to 4.
6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a dynamic graph construction program, and the dynamic graph construction program is executed by the processor to realize the steps of the dynamic graph construction method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Scene knowledge graph generation method, man-machine conversation method and related equipment
CN110955764A
Knowledge graph construction method, device and equipment and storage medium
CN111522967A