Pipe network emergency knowledge graph cross-node reasoning method and system based on longest path decomposition
By adopting the longest path decomposition technology in pipeline emergency management, complex correlation graphs are converted into one-way tree structures, and multi-dimensional tables are established to improve cross-node indicator calculation and rapid response capabilities, the problem of insufficient accuracy and logic in the existing technology is solved, and efficient emergency management decision support is achieved.
Patent Information
- Application Number
- CN202411886811.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-05-02
AI Technical Summary
The prior art cannot meet the high requirements for accuracy and logic in pipeline emergency management, and it is difficult to quickly and accurately realize knowledge push between multiple links.
The cross-node inference method of pipeline network emergency knowledge graph based on longest path decomposition is adopted, and the longest path set is obtained by building emergency knowledge graphs, using the shortest path algorithm, and the cross-node index calculation and fast response capabilities are improved through the operation of multi-dimensional tables.
It significantly improves the efficiency of cross-node indicator calculation, and can complete parameter transfer calculations from the last-level concept node to the first-level concept node within 3 seconds, improving the response speed of emergency management.
Smart Images

Figure CN119918659A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pipeline network emergency knowledge graph reasoning technology, and specifically to a method and system for associating knowledge of pipeline documents, accident cases, pipeline detection, and emergency response processes to quickly and accurately realize knowledge push between multiple links in the emergency response process. Background Art
[0002] National pipeline network emergency management is crucial to ensuring national energy security and public safety. Through a sound risk prevention and control mechanism, potential risks can be quickly identified and assessed, scientific emergency plans can be formulated and implemented, emergencies can be effectively responded to, losses can be reduced, and social stability can be maintained. However, emergency management is a complex system engineering that requires fast cross-node reasoning and calculation to support decision-making. For emergencies, it is necessary to coordinate the operation of risk assessment, preventive measures, emergency plans, training and drills, information communication, resource management and other aspects of human, financial and material resources. Emergency management is a complex system engineering. Establishing a pipeline network emergency knowledge graph and performing fast cross-node reasoning and calculation based on the emergency knowledge graph is an effective way to achieve scientific emergency management.
[0003] Authorized patent CN202111263977.9 discloses a "knowledge question answering method, device, electronic device and storage medium". A knowledge question answering method, device, electronic device and storage medium are disclosed. Related entities are queried from a pre-built knowledge graph to establish related texts, and then the question and related text are used to determine the answer to the question through LLM. This is a comprehensive answer based on text LLM, which does not pursue accuracy and cannot meet the requirements for accuracy and logic in emergency management. Therefore, the present invention aims to provide a cross-node reasoning method for a pipe network emergency knowledge graph based on the longest path decomposition to solve the problems existing in the prior art. Summary of the invention
[0004] To solve the above-mentioned defects, the present invention provides a cross-node reasoning method and system for a pipeline network emergency knowledge graph based on longest path decomposition. The present invention targets the information flow in the pipeline emergency management process, establishes a pipeline network emergency knowledge graph, and converts the complex associated graph into a unidirectional tree structure through the longest path decomposition technology, and then establishes a multidimensional table. The cross-node indicator calculation and rapid response capability of emergency management are improved through the operation of the multidimensional table.
[0005] In a first aspect, the present invention provides a cross-node reasoning method for a pipe network emergency knowledge graph based on longest path decomposition, which comprises the following steps:
[0006] S0. Construct emergency knowledge graph: Construct emergency knowledge graph by transforming concept nodes and entity nodes in the emergency knowledge system into vector form;
[0007] S1. Decomposition of the longest path in the graph: Use the shortest path algorithm to obtain the longest path set in the graph; the longest path corresponds to the management process of the emergency knowledge graph, and all the longest path sets are obtained through iterative decomposition;
[0008] S2. Cross-node calculation: For the missing indicators of high-level nodes, the indicators of the lower-level nodes are used for transfer calculation, and the calculation is merged according to the rules based on the multi-dimensional table, so that the high-level nodes can obtain the updated indicator values and realize the cross-node reasoning function.
[0009] In one embodiment of the present invention, step S0 includes the following process:
[0010] S01: Read the emergency knowledge system and build an instance knowledge graph;
[0011] S02: Construct node mining prompt task;
[0012] S03: Build a knowledge graph.
[0013] In one embodiment of the present invention, in step S01, the emergency knowledge system includes concept nodes, entities, attributes and associated attributes; wherein concepts and entities are multi-level indexed, and entities are objects with unique identifiers; in addition, public knowledge in the emergency field is also included.
[0014] In one embodiment of the present invention, in step S02, an open source LLM big model is used to perform node data mining, which is organized and implemented according to entity recognition, entity-attribute extraction, and entity-relationship extraction tasks; and the number of entities and attributes of each mining task does not exceed 7.
[0015] In one implementation of the present invention, in step S03, the structured and unstructured data are merged to obtain a final entity table.
[0016] In one embodiment of the present invention, step S1 includes the following process:
[0017] S11: Initialization: establish a set of vertices and a set of edges;
[0018] S12: Shortest path algorithm: solve the shortest path set;
[0019] S13: Calculate the longest path set: exclude the shortest path set and calculate the longest path set.
[0020] In one embodiment of the present invention, in step S11, the set of vertices includes the in-degree and out-degree indicators of the nodes, and the sorting results in descending order of out-degree and ascending order of in-degree provide a basis for selecting the starting point and end point of the longest path; the weight of the set of edges is set to -1.
[0021] In one embodiment of the present invention, step S2 includes the following process:
[0022] S21: Construct a multidimensional table of the instance: Establish a multi-level index based on the longest path set.
[0023] S22: Merge calculation: realize the transfer of lower-level node indicators to higher-level nodes.
[0024] S23: Result output.
[0025] In a second aspect, the present invention provides a pipe network emergency knowledge graph cross-node reasoning system based on longest path decomposition, which includes:
[0026] The emergency knowledge graph construction module is used to vectorize the concept nodes and entity nodes in the emergency knowledge system to construct the emergency knowledge graph;
[0027] The graph longest path decomposition module is used to use the shortest path algorithm to obtain the longest path set in the graph;
[0028] The cross-node calculation module is responsible for transferring and calculating the missing indicators of high-level nodes based on the indicators of lower-level nodes, and merging them according to the rules of multi-dimensional tables to achieve cross-node reasoning.
[0029] In summary, the present invention provides a method and system for cross-node reasoning of a pipe network emergency knowledge graph based on the longest path decomposition. The beneficial effects of the present invention are:
[0030] The present invention decomposes the emergency knowledge graph containing a large number of concept nodes and entity nodes into a structured data table, which significantly improves the efficiency of cross-node index calculation. The present invention can complete the parameter transfer calculation from the last-level concept node to the first-level concept node within 3 seconds, which improves the response speed compared with the traditional knowledge graph method. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A principle flow chart of the cross-node reasoning method of the pipeline network emergency knowledge graph based on the longest path decomposition provided in the embodiment.
[0032] Figure 2 The prompt text recognized for the pipeline property.
[0033] Figure 3 is the instance knowledge graph; Figure 3 (a) All node data represented by nodes; Figure 3 (b) Table of examples of emergency supplies.
[0034] Figure 4 It is the knowledge graph of emergency concepts; Figure 4 (a) Concept map; Figure 4 (b) Example graph.
[0035] Figure 5 Schematic diagram of the longest path set.
[0036] Explanation of main element symbols: S0~S23, steps. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0038] like Figure 1 As shown, a cross-node reasoning method of a pipe network emergency knowledge graph based on the longest path decomposition includes the following steps:
[0039] S0. Constructing knowledge graph: Constructing instance knowledge graph through text mining of node data. Mathematically, each node on the emergency knowledge graph is a 1-dimensional vector, and the relationship between two points is equivalent to constructing a 2-dimensional relationship of Z=X×Y; treating it as a relationship table of all concept pairs and then visualizing it, we get the emergency knowledge graph; the emergency knowledge graph is a complex directed network with 10 nodes.
[0040] S1. Longest path decomposition. The longest path represents the longest information flow from the initiation and final convergence of information in the emergency knowledge graph. After decomposition, the longest path set corresponds to the management process of the emergency knowledge graph. In the shortest path algorithm, by taking a negative value for the path weight, all the longest path sets in the first round are obtained. By removing all the line segment sets in the first round from the line segment set, and repeating the longest path decomposition on the remaining line segment sets, all the longest path sets corresponding to the knowledge graph will be obtained. The emergency knowledge graph has a total of 5 longest paths, which means that all functions of the emergency knowledge graph can be transferred to the operation of 5 tables.
[0041] S3, cross-node reasoning: Through the multi-dimensional table composed of the longest path, matrix merging operations are performed to realize cross-node reasoning of the knowledge graph. For indicators that are not available at high-level nodes and need to be transferred through the indicators of their lower-level nodes, the multi-dimensional table is merged and calculated according to the rules, so that the high-level nodes can obtain new indicator values, thereby realizing cross-node reasoning.
[0042] The specific process is described as follows:
[0043] S01: Read the emergency knowledge system.
[0044] The emergency knowledge system is a table structure as shown in Table 1. Table 1 is the knowledge system table of the pipeline, including concept nodes, entities, attributes, associated attributes, etc., where concepts and entities constitute a multi-level index, and entities are objects with unique identifiers.
[0045] The emergency knowledge system is an expression of public knowledge in the emergency field. It collects data such as literature, accident cases, pipeline detection, and emergency response procedures related to pipeline failure, and summarizes a total of 10 first-level concepts, as shown in Table 2, which corresponds to at least 10 concept tables with the same structure as Table 1. These tables are templates for NLP mining.
[0046] Table 1 Pipeline knowledge system
[0047]
[0048] Table 2 11 Level 1 concepts
[0049]
[0050] S02: Construct node mining prompt task.
[0051] The open source LLM big model is used for node data mining, which is organized and implemented according to several tasks: entity recognition, entity-attribute extraction, and entity-relationship extraction. The number of entities and attributes in each mining task does not exceed 7. The prompt of a "pipeline-attribute" mining is as follows: Figure 2 shown.
[0052] The example graph node table finally formed by LLM mining is as follows Figure 3 As shown, Figure 3 (a) describes the situation of all concept nodes in the graph. Figure 3 (b) describes an entity table of "emergency supplies", which includes the unique identification number ID of "emergency supplies", its representation attribute "title", the intrinsic attribute "supply list and location" and the associated attribute "operating area".
[0053] Figure 3The sheet page describes the entities of each concept node, and they are displayed as a graph, which is the knowledge graph.
[0054] S03: Build a knowledge graph.
[0055] In addition to mining data from text, the data of the concept table also comes from the structured data table. This part of the content is directly copied to the corresponding concept table to complete the fusion of structured and unstructured data and obtain a final entity table.
[0056] Emergency management knowledge graph Figure 4 As shown, Figure 4 (a) is the concept map, Figure 4 (b) is a schematic diagram of an example spectrum. Figure 4 The concept map in (a) only shows the relationship between the first-level concepts. It can be seen from the figure that "emergency management process" and "operation area" are the center of the entire map. In the project, the former is the dispatch center of the entire emergency event, and the latter is the place where the emergency treatment occurs. Therefore, the map describes the focus and key points of emergency treatment work as a whole; Figure 4 (b) The center of the instance map is the two emergency response processes of "transmission interruption event" and "traffic accident" as well as the "YQ operation area", which confirms the judgment of the concept map on the central node of the map.
[0057] The longest path decomposition S1 is specifically described as follows:
[0058] S11: Initialization.
[0059] Establish a set of vertices, including the in-degree and out-degree indicators of the nodes, as shown in Table 3; Figure 4 It is the sorting result in descending order of out-degree and ascending order of in-degree (when out-degree is 0, it is at the front, and when in-degree is 0, it is at the back), which prepares the conditions for selecting the starting point and end point of the longest path; establish a set of edges, as shown in Table 5, note that the weight of the edge has been changed to -1, so that the path obtained by the shortest path algorithm is the longest path on the actual graph.
[0060] Since the knowledge graph is established according to the information flow, there are starting points and end points in the knowledge graph, that is, points with in-degree 0 and out-degree 0, as shown in Table 4.
[0061]
[0062] The initial value of constructing the longest path set is the combination of in-degree and out-degree, that is, D0 = {emergency supplies, emergency personnel, management segment} -> {organization, risk and time type} =
[0063] {
[0064] [Emergency Supplies->Organization],
[0065] [Emergency Supplies->Risk and Time Type],
[0066] [Emergency Personnel->Organization],
[0067] [Emergency Personnel->Risk and Time Type],
[0068] [Management Section->Organization],
[0069] [Management Section->Risk and Time Type]
[0070] }, a total of 6 distances between the starting and ending points.
[0071] S12: Shortest Path Algorithm
[0072] For each pair of nodes in D0, the shortest path is solved by the Dijkstra algorithm. In fact, what is obtained is the longest path between two points in the knowledge graph. The results are shown in Table 6.
[0073]
[0074] S13: Calculate the longest path set.
[0075] From Table 6, all line segments in S12 are deleted, and the remaining edge sets are obtained as shown in Table 7, which is already the longest path.
[0076]
[0077] The longest path set finally obtained is shown in Table 8.
[0078]
[0079] The longest path set is Figure 5 As shown, each path represents a hierarchical structure, which is a multi-level index of the table.
[0080] The function of cross-node reasoning S2 is to convert the cross-node reasoning calculation problem into a merge calculation problem of a multi-level index form, thereby converting graph operations into table operations to obtain accuracy and explainability for engineering reasoning.
[0081] S21: Build a multidimensional table of the instance.
[0082] Figure 5 The longest path set of concepts shows that the emergency knowledge graph can be described by 6 tables. The nodes of the longest path are the concept levels of each table, and this level will form a progressive inclusion relationship in the direction of the tree.
[0083] Figure 5The entity structure of the longest path in is a 7-layer table, as shown in Table 9 below, where an entity is a record in the concept table. For example, the actual content of the pipeline "a certain east line gas pipeline" is a complete record as shown in Table 10.
[0084]
[0085]
[0086] S22: Merge calculation.
[0087] Since the instance corresponding to the hierarchical structure of concepts is a tree structure, the objects at the top level have the indicators of the objects at the bottom level. When calculating or reasoning about attributes that are not defined at the top level, it is necessary to transfer the attributes of the lower level objects. This rule of reasoning or transferring from bottom to top is a feature of the tree structure and is also in line with common sense. For example, the CEO is at the top level of the tree, and the managers of each department are responsible for achieving performance as child nodes. The performance of the CEO is the sum of the performance of the managers of each department. This bottom-up information transmission ensures that the decision-making level can obtain the necessary information to make effective decisions.
[0088] In Pandas (data analysis tool), aggregation usually refers to the operation of grouping data and then performing summary statistics, which is achieved through the groupby method. Groupby is a very powerful function in Pandas, similar to the GROUP BY statement in SQL, which allows us to group data according to certain conditions and perform summary calculations on the data of each group; use the agg method to perform aggregate calculations on the grouped data, such as sum, mean, etc.; use the transform method to perform flexible transformations based on grouping and keep the result in the same structure as the original data.
[0089] For example, the process of calculating the "average operating pressure" of the pipe in the "management section" is as follows:
[0090] import pandas as pd,
[0091] #Create data,
[0092] #First, determine the node where the "average operating pressure" is located as 'Pipeline',
[0093] df_associated_node = pd.DataFrame(table9['management_segment', 'pipeline']),
[0094] #Replace "pipeline" with the node value 'average operating pressure',
[0095] Df_AssociatedNode['Pipeline'] = pd.DataFrame(Table 10['Average Operating Pressure'])[Table 9['Management Section'] == Table 10['Pipeline Abbreviation']]
[0096] #Grouping,
[0097] grouped = Df_AssociationNode.groupby('Management Segment'),
[0098] #Calculate the sum and mean of each group,
[0099] result=grouped['C'].agg(['mean']),
[0100] # Output result print(result),
[0101] #Convert,
[0102] #df['C_transformed']=grouped['C'].transform(lambda x:xx.mean())print(df),
[0103] The calculation results are shown in Table 11 below.
[0104]
[0105] The results show that although the "management section" does not have an "average operating pressure" indicator, the "average operating pressure" transferred through the lower-level "pipeline" is 6MPa, thus realizing the attribute transfer calculation from the lower-level to the upper-level node.
[0106] Because in Figure 5 There is no connection of "management section->pipeline" in the other five tables shown. Therefore, Table 11 is the only result of "management section-average operating pressure" given by the entire emergency knowledge graph.
[0107] S23: Result output.
[0108] Confirm and interpret the results in Table 11, process any abnormal results, and then output them.
[0109] Since the results in Table 11 are consistent with common sense and have been explained, no further post-processing is required.
[0110] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A cross-node reasoning method for the pipe network emergency knowledge graph based on the longest path decomposition, characterized in that: It includes the following steps: S0. Construct emergency knowledge graph: Construct emergency knowledge graph by transforming concept nodes and entity nodes in the emergency knowledge system into vector form; S1. Decomposition of the longest path in the graph: Use the shortest path algorithm to obtain the longest path set in the graph; the longest path corresponds to the management process of the emergency knowledge graph, and all the longest path sets are obtained through iterative decomposition; S2. Cross-node calculation: For the missing indicators of high-level nodes, the indicators of the lower-level nodes are used for transfer calculation, and the calculation is merged according to the rules based on the multi-dimensional table, so that the high-level nodes can obtain the updated indicator values and realize the cross-node reasoning function.
2. The cross-node reasoning method of the pipe network emergency knowledge graph based on the longest path decomposition according to claim 1 is characterized in that: Step S0 includes the following process: S01: Read the emergency knowledge system and build an instance knowledge graph; S02: Construct node mining prompt task; S03: Build a knowledge graph.
3. The cross-node reasoning method of the pipe network emergency knowledge graph based on the longest path decomposition according to claim 2 is characterized in that: In step S01, the emergency knowledge system includes concept nodes, entities, attributes and associated attributes; wherein concepts and entities are multi-level indexed, and entities are objects with unique identifiers; in addition, it also includes public knowledge in the emergency field.
4. The cross-node reasoning method of the pipe network emergency knowledge graph based on the longest path decomposition according to claim 2 is characterized in that: In step S02, an open source LLM large model is used to perform node data mining, which is organized and implemented according to entity recognition, entity-attribute extraction, and entity-relationship extraction tasks, and the number of entities and attributes in each mining task does not exceed 7.
5. The cross-node reasoning method of the pipe network emergency knowledge graph based on the longest path decomposition according to claim 2 is characterized in that: In step S03, the structured and unstructured data are merged to obtain a final entity table.
6. The cross-node reasoning method of the pipe network emergency knowledge graph based on the longest path decomposition according to claim 1 is characterized in that: Step S1 includes the following process: S11: Initialization: establish a set of vertices and a set of edges; S12: Shortest path algorithm: solve the shortest path set; S13: Calculate the longest path set: exclude the shortest path set and calculate the longest path set.
7. The cross-node reasoning method of the pipe network emergency knowledge graph based on the longest path decomposition according to claim 6 is characterized in that: In step S11, the vertex set includes the in-degree and out-degree indicators of the nodes, and the sorting results are sorted in descending order of out-degree and ascending order of in-degree to provide a basis for selecting the starting point and end point of the longest path; the weight of the edge set is set to -1.
8. The cross-node reasoning method of the pipe network emergency knowledge graph based on the longest path decomposition according to claim 1 is characterized in that: Step S2 The process includes: S21: Construct a multidimensional table of the instance: Create a multi-level index based on the longest path set. S22: Merge calculation: realize the transfer of lower-level node indicators to higher-level nodes. S23: Result output.
9. A cross-node reasoning system for emergency knowledge graph of pipe network based on longest path decomposition, characterized by: It includes: The emergency knowledge graph construction module is used to vectorize the concept nodes and entity nodes in the emergency knowledge system to construct the emergency knowledge graph; The graph longest path decomposition module is used to use the shortest path algorithm to obtain the longest path set in the graph; The cross-node calculation module is responsible for transferring and calculating the missing indicators of high-level nodes based on the indicators of lower-level nodes, and merging them according to the rules of multi-dimensional tables to achieve cross-node reasoning.
Citation Information
Patent Citations
Knowledge base question and answer method and device, electronic equipment and storage medium
CN113704445A