Water conservancy field knowledge graph construction method and system

By building a knowledge map in the water conservancy field and realizing the application of Q&A, the problems of information silos and data barriers in the water conservancy field have been solved, information management and utilization efficiency have been improved, and smart water conservancy construction has been promoted.

CN119476453APending Publication Date: 2025-02-18SHANDONG ZHIYANG SHANGSHUI INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411106304.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

Due to the inconsistent information construction standards in the water conservancy field, data barriers, dispersed management, low information utilization rate, and there is a problem of ‘information islands’.

Method used

A method and system for building knowledge graphs in the water conservancy field is proposed. By obtaining text data and Internet data in the water conservancy field, a knowledge graph is constructed, and combined with graph neural networks and large language models, the knowledge graph questions and answers are realized.

Benefits of technology

A communication bridge between data and knowledge in the water conservancy field has been established, information management and utilization efficiency has been improved, and smart water conservancy construction and digital reform have been promoted.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119476453A_ABST
    Figure CN119476453A_ABST
Patent Text Reader

Abstract

The invention provides a water conservancy field knowledge graph construction method and system. The method comprises the following steps: constructing an ontology of a knowledge graph by using obtained water conservancy field text data; extracting entity information and attribute information from the water conservancy field text data by using the ontology of the knowledge graph; according to the extracted entity information and attribute information, obtaining internet data in the water conservancy field; performing relation triple extraction on the obtained water conservancy field internet data to obtain relation triple information; fusing the relation triple information with the entity information and the attribute information to obtain a water conservancy field relation triple; and importing the water conservancy field relation triple into the graph database in batches to obtain the water conservancy field knowledge graph, and realizing question and answer application of the water conservancy field knowledge graph. Based on the method, the invention further provides a water conservancy field knowledge graph construction system. According to the method, technical support is provided for drought disaster prevention and water resource management work by constructing the water conservancy knowledge graph and realizing knowledge graph question and answer application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of knowledge graph construction, and in particular relates to a method and system for constructing a knowledge graph in the water conservancy field. Background Art

[0002] In recent years, with the continuous improvement of economic and information technology levels, various cities and related fields have gradually promoted informatization construction, among which water conservancy informatization is an important part of national informatization construction. In the current water conservancy informatization construction, the water conservancy field has achieved remarkable results, and the real-time monitoring capability and forecasting and early warning capability have also been greatly improved.

[0003] However, in the long development history of the current water conservancy industry, although a large amount of water conservancy information resources have been accumulated, due to the lack of unified information construction standards among regions and departments and the existence of data barriers, the management of water conservancy information resources is relatively scattered, the information utilization rate is low, and the "information island" problem is becoming increasingly serious. Summary of the invention

[0004] In order to solve the above technical problems, the present invention proposes a method and system for constructing a knowledge graph in the field of water conservancy. By constructing a water conservancy knowledge graph and realizing a knowledge graph question and answer application, it provides technical support for drought disaster prevention and water resources management, and promotes the further development of smart water conservancy construction and digital reform.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] A method for constructing a knowledge graph in the field of water conservancy, comprising the following steps:

[0007] Obtain text data in the water conservancy field, and use the text data in the water conservancy field to build the ontology of the water conservancy field knowledge graph;

[0008] By using the ontology of the knowledge graph in the water conservancy field, entity information and attribute information are extracted from the text data in the water conservancy field;

[0009] Based on the extracted entity information and attribute information, a web crawler is used to obtain Internet data in the water conservancy field;

[0010] Extract relational triples from the acquired Internet data in the field of water conservancy to obtain relational triple information;

[0011] The relationship triples are integrated with entity information and attribute information to obtain the relationship triples in the field of water conservancy. The relationship triples in the field of water conservancy are imported into the graph database in batches to obtain the knowledge graph in the field of water conservancy.

[0012] Furthermore, the method also includes realizing the question-and-answer application of the knowledge graph in the field of water conservancy by combining the graph neural network and the large language model, specifically:

[0013] Use question-answering data to train the graph neural network and obtain the target graph neural network;

[0014] The target graph neural network is used to perform reasoning on the knowledge graph. The target graph neural network generates a probability score for all nodes in the knowledge graph, indicating their credibility as candidate answers, and extracts the nodes with the highest probability score as candidate answers;

[0015] Extract the shortest path connecting the question entity and the candidate answer as the reasoning path in the knowledge graph;

[0016] Convert the reasoning path into a triple format text, and fill it into a prompt template for format conversion, so as to convert the reasoning path into a text form to obtain a first reasoning path;

[0017] Fill the question into a prompt template for retrieving the reasoning path, so as to use the large language model to retrieve the second reasoning path related to the question;

[0018] The first reasoning path, the second reasoning path and the question are combined to form context information for knowledge graph question and answer, which is filled into a prompt template for knowledge graph question and answer, and the prompt is input into a large language model to finally realize the knowledge graph question and answer application.

[0019] Furthermore, the process of obtaining text data in the water conservancy field and constructing the ontology of the water conservancy field knowledge graph using the text data in the water conservancy field includes:

[0020] Determine the professional knowledge system of knowledge graph in the field of water conservancy; carry out conceptual layer design under the patent knowledge system;

[0021] Extracting entity nodes from the water conservancy field text data, and the entity nodes adopt a node structure of the concept layer;

[0022] The ontology of the knowledge graph in the field of water conservancy is obtained by combing the entity nodes designed with the concept layer node structure through a combination of top-down and bottom-up approaches.

[0023] Furthermore, the method for designing the concept layer is: determining the hierarchical relationship between the concepts of each water conservancy object, and each concept name represents a concept node; the concept layer includes top-level concepts, first-level concepts, second-level concepts and third-level concepts; the top-level concepts include water conservancy objects; the first-level concepts include engineering and non-engineering categories; the second-level concepts include detection points, water conservancy projects, natural geography and management objects; the third-level concepts include water conservancy object categories.

[0024] Furthermore, the process of extracting entity information and attribute information from text data in the water conservancy field by using the ontology of the water conservancy field knowledge graph includes:

[0025] The structured data and unstructured data are saved separately in .pdf file type; entity information and attribute information are extracted from the ontology of the water conservancy field knowledge graph using a text recognition tool, and are stored in .csv format files according to the water conservancy object category; the .csv format files are used to save structured data.

[0026] Furthermore, the method also includes translating the water conservancy field text data that needs to be translated and storing it in a .csv format file.

[0027] Furthermore, the process of obtaining Internet data in the water conservancy field by using a web crawler based on the extracted entity information and attribute information includes:

[0028] According to the extracted entity information and attribute information, the name of each category of water conservancy object is extracted to obtain a water conservancy object name set;

[0029] Using a web crawler, the names of the water conservancy objects in each water conservancy object set are used as search keywords to collect water conservancy field information on the corresponding websites;

[0030] The information in the water conservancy field is collected, and the data is processed and summarized to generate Internet data in the water conservancy field.

[0031] Furthermore, the process of extracting relational triples from the acquired Internet data in the field of water conservancy to obtain relational triple information includes:

[0032] Use the ontology of the water conservancy knowledge graph to customize schemas for different categories of water conservancy objects;

[0033] For different types of water conservancy objects, the prompt for model input is constructed based on the schema of the category and the Internet data in the water conservancy field;

[0034] Set the OneKE model parameters, input prompt, and extract relation triples;

[0035] The output results of the OneKE model are cleaned and the relation triple information is extracted, and stored in .csv format files according to the water conservancy object category.

[0036] Furthermore, the relationship triples are integrated with the entity information and the attribute information to obtain the relationship triples in the water conservancy field. The process of batch importing the relationship triples in the water conservancy field into the graph database to obtain the knowledge graph in the water conservancy field includes:

[0037] The relationship triple information, entity information and attribute information are stored in a dictionary using the water conservancy object name as the key and the attribute as the value; the rules for data fusion are defined to update the dictionary value;

[0038] Extract the relationship triple information from the dictionary, obtain the relationship triple in the water conservancy field, and store it in .csv format;

[0039] Using the graph database Neo4j, use the Cypher Load CSV statement to batch import entity relationships and attribute information into the graph database.

[0040] The present invention also proposes a water conservancy field knowledge graph construction system, including a data acquisition module, a first extraction module, a second extraction module, a third extraction module and a fusion module;

[0041] The data acquisition module is used to acquire text data in the water conservancy field, and use the text data in the water conservancy field to construct the ontology of the water conservancy field knowledge graph;

[0042] The first extraction module is used to extract entity information and attribute information from text data in the water conservancy field by using the ontology of the water conservancy field knowledge graph;

[0043] The second extraction module is used to obtain Internet data in the field of water conservancy using a web crawler based on the extracted entity information and attribute information;

[0044] The third extraction module is used to extract relation triples from the acquired Internet data in the field of water conservancy to obtain relation triple information;

[0045] The fusion module is used to fuse the relationship triplet information with the entity information and the attribute information to obtain the relationship triplet in the water conservancy field; the relationship triplet in the water conservancy field is batch imported into the graph database to obtain the knowledge graph in the water conservancy field.

[0046] The effects provided in the content of the invention are only the effects of the embodiments, not all the effects of the invention. One of the above technical solutions has the following advantages or beneficial effects:

[0047] The present invention proposes a method and system for constructing a knowledge graph in the field of water conservancy. The method includes the following steps: obtaining text data in the field of water conservancy, and using the text data in the field of water conservancy to construct the ontology of the knowledge graph in the field of water conservancy; using the ontology of the knowledge graph in the field of water conservancy to extract entity information and attribute information from the text data in the field of water conservancy; using a web crawler to obtain Internet data in the field of water conservancy based on the extracted entity information and attribute information; extracting relation triples from the acquired Internet data in the field of water conservancy to obtain relation triple information; fusing the relation triple information with the entity information and attribute information to obtain relation triples in the field of water conservancy; and batch importing the relation triples in the field of water conservancy into a graph database to obtain a knowledge graph in the field of water conservancy. And by combining a graph neural network and a large language model, a question-and-answer application of the knowledge graph in the field of water conservancy is realized. Based on a method for constructing a knowledge graph in the field of water conservancy, a system for constructing a knowledge graph in the field of water conservancy is also proposed. This invention aims to build a communication bridge between data and knowledge in the field of water conservancy. By constructing a water conservancy knowledge graph and realizing a knowledge graph question and answer application, it provides technical support for drought disaster prevention and water resources management, and promotes the further development of smart water conservancy construction and digital reform.

[0048] The present invention combs and determines the ontology of the knowledge graph in the field of water conservancy through a combination of top-down and bottom-up models; collects data in the field of water conservancy from multiple angles, including open source data, government documents, and Internet data, and constructs a more complete knowledge graph in the field of water conservancy by integrating multi-source data.

[0049] The present invention compares the effects of large information extraction models on the task of extracting relation triples in the water conservancy field, and uses the best model OneKE to extract relation triples, and can obtain relation triples with higher accuracy without the need to label the data set training model; the present invention combines the reasoning ability of graph neural networks and the language comprehension ability of large language models, and adopts a retrieval enhancement generation method to realize the knowledge graph question and answer application. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A flow chart of a method for constructing a knowledge graph in the water conservancy field proposed in Example 1 of the present invention;

[0051] Figure 2 This is a schematic diagram of a water conservancy field knowledge graph construction system proposed in Example 2 of the present invention. DETAILED DESCRIPTION

[0052] In order to clearly illustrate the technical features of the present solution, the present invention is described in detail below through specific implementation methods and in conjunction with the accompanying drawings. The disclosure below provides many different embodiments or examples for realizing different structures of the present invention. In order to simplify the disclosure of the present invention, the components and settings of specific examples are described below. In addition, the present invention may repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed. It should be noted that the components illustrated in the accompanying drawings are not necessarily drawn to scale. The present invention omits the description of known components and processing techniques and processes to avoid unnecessary limitations on the present invention.

[0053] Example 1

[0054] Embodiment 1 of the present invention proposes a method for constructing a knowledge graph in the field of water conservancy, which is used to solve the technical problems existing in the construction of knowledge graphs in the field of water conservancy in the prior art. Figure 1 This is a flow chart of a method for constructing a knowledge graph in the water conservancy field proposed in Example 1 of the present invention.

[0055] In step S1, text data in the field of water conservancy is obtained. The data comes from the name code of a reservoir in a certain area, the name code of a sluice in a certain area, the code of a river in a certain area, the water conservancy statistical yearbook of a certain place in a certain year, or the water potential statistical data released by the government. For example: national reservoir data set, responsible person documents for national and provincial, municipal and county water conservancy objects issued by the government, "China Water Conservancy Statistical Yearbook 2022", "China Sluice Name Code", "China River Code", etc. The scope of protection of the present invention is not limited to the data listed in Example 1.

[0056] In step S2, the text data in the water conservancy field is used to construct the ontology of the knowledge graph in the water conservancy field.

[0057] By sorting out the professional knowledge in four areas, namely "Basic Database Table Structure and Identifiers of Water Conservancy Objects", "Basic Data Specifications of Rivers and Lakes", "Basic Data Specifications of Reservoirs", and "Classification Specifications of Water Conservancy Objects", and combining it with the acquired water conservancy data, the professional knowledge system of the water conservancy knowledge graph is determined, the hierarchical relationship is clarified, and the professional fields and scope are determined.

[0058] When designing the concept layer, first clarify the hierarchical relationship between the concepts of various water conservancy objects. Each concept name represents a concept node.

[0059] The top-level concepts include “water conservancy objects”, the first-level concepts include “engineering and non-engineering”, the second-level concepts include “testing stations (points), water conservancy projects, natural geography, and management objects”, and the third-level concepts include “reservoirs, rivers, lakes…” The third-level concepts are the categories of water conservancy objects;

[0060] Except for the top level, the relationship between any layer and its upper layer is a subordinate relationship, and there is also a certain relationship between concept nodes at the same level. The relationship between concept nodes at the same level is constructed according to the file mentioned in step S1, and the constructed relationship can continue to be applied to the relationship between subsequent entity nodes.

[0061] After the conceptual layer design is initially completed, the entity layer is constructed. The construction of entity nodes and attribute nodes can be achieved by extracting them from the professional knowledge files sorted out above. The relationship between entity nodes can inherit the relationship between concept nodes.

[0062] The ontology of the knowledge graph in the field of water conservancy is sorted out and determined by combining top-down and bottom-up approaches, and the entity layer is fine-tuned based on the acquired data in the field of water conservancy.

[0063] The Neo4j platform is used to build the concept layer structure in the knowledge graph ontology in the water conservancy field. Each concept name represents a concept node, which is represented by a circle in the graph. Nodes at different levels are distinguished by different colors. The relationship between nodes is represented by directed line segments, and the specific relationship is marked on the directed line segments in the form of label text.

[0064] In step S3, the ontology of the water conservancy field knowledge graph is used to extract entity information and attribute information from the water conservancy field text data;

[0065] The structured data and unstructured data are saved in .pdf file types respectively; entity information and attribute information are extracted from the ontology of the water conservancy field knowledge graph using a text recognition tool, and stored in .csv format files according to the water conservancy object categories, such as reservoir.csv, river.csv. The .csv format file is used to save structured data.

[0066] In this step, the text data in the water conservancy field that needs to be translated is translated and stored in a .csv format file.

[0067] For example, the English version of the national reservoir dataset can be translated into the Chinese version of the national reservoir dataset.

[0068] First, use the translation tool to obtain preliminary translation results

[0069] Secondly, based on the reservoir .csv file obtained in the above steps, the reservoir names and geographical location information were used as reference information to correct the preliminary translation results. The reservoir names with translation errors or failures were manually processed to obtain the Chinese version of the national reservoir dataset in .csv format.

[0070] In step S4, based on the extracted entity information and attribute information, a web crawler is used to obtain Internet data in the water conservancy field;

[0071] According to the extracted entity information and attribute information, the name of each category of water conservancy object is extracted to obtain a water conservancy object name set; for example, a reservoir name set and a river name set;

[0072] By using a web crawler, the names of the water conservancy objects in each water conservancy object set are used as search keywords to collect water conservancy information on corresponding websites; the corresponding websites include: government websites, water conservancy professional websites, major portals, and professional institution websites.

[0073] The information in the water conservancy field is collected, cleaned, converted, analyzed, and summarized to generate Internet data in the water conservancy field. The categories of Internet data in the water conservancy field include news information, policies, regulations, journals, patents, reports, achievements, and encyclopedias.

[0074] In step S5, relation triples are extracted from the acquired Internet data in the water conservancy field to obtain relation triple information.

[0075] By comparing the effects of existing models based on large models for information extraction in the field of water conservancy on extracting relation triples, a model for extracting relation triples is determined, and the model used in the present invention is OneKE.

[0076] Use the ontology of the water conservancy knowledge graph to customize schemas for different categories of water conservancy objects;

[0077] For different types of water conservancy objects, the prompt for model input is constructed based on the schema of the category and the Internet data in the water conservancy field;

[0078] Set the OneKE model parameters, input prompt, and extract relation triples;

[0079] The output results of the OneKE model are cleaned and the relation triple information is extracted, and stored in .csv format files according to the water conservancy object category.

[0080] In step S6, the relationship triples information is integrated with the entity information and the attribute information to obtain the relationship triples in the water conservancy field; the relationship triples in the water conservancy field are batch imported into the graph database to obtain the knowledge graph in the water conservancy field.

[0081] Store the .csv file of relationship triple information and the .csv file of entity information and attribute information into a dictionary using the water conservancy object name as the key and the attribute as the value;

[0082] Define the data fusion rules to update the dictionary values ​​and handle the situation where there are multiple attribute values. For example, for the geographic location attribute, keep the one with the longest character length.

[0083] Extract relation triple information from the dictionary, obtain relation triples in the water conservancy field, and store them in .csv format; including reservoir relation triples.csv, river relation triples.csv, etc.

[0084] In step S7, the graph database Neo4j is used to batch import entity relationships and attribute information into the graph database using the Cypher Load CSV statement.

[0085] In step S8, by combining graph neural network and large language model, the question-and-answer application of knowledge graph in the field of water conservancy is realized, specifically:

[0086] Use question-answer data to train the graph neural network and obtain the target graph neural network; that is, use the "question-answer pair" data to optimize the graph neural network parameters, and define it as a node classification task (answer and non-answer) for training;

[0087] The target graph neural network is used to perform reasoning on the knowledge graph. The target graph neural network generates a probability score for all nodes in the knowledge graph, indicating their credibility as candidate answers, and extracts the nodes with the highest probability score as candidate answers;

[0088] Extract the shortest path connecting the question entity and the candidate answer as the reasoning path in the knowledge graph;

[0089] Convert the reasoning path into triple format text and fill it into the prompt template for format conversion to convert the reasoning path into text form to obtain the first reasoning path; the prompt template for format conversion is: "Your task is to convert a knowledge graph into one or more sentences. The knowledge graph is: {triple format text}.

[0090] Fill the question into the prompt template for retrieving the reasoning path to achieve the retrieval of the second reasoning path related to the question using the large language model; the prompt template for retrieving the reasoning path is: "Your task is to retrieve useful reasoning paths for the question. The question is: {question}.".

[0091] The first reasoning path, the second reasoning path and the question are combined to form the context information for the knowledge graph question answering, which is filled into the prompt template for the knowledge graph question answering, and the prompt is input into the large language model to finally realize the knowledge graph question answering application. The prompt template for the knowledge graph question answering is: "You are an expert in the field of water conservancy. In order to answer the question concisely and correctly in the end, you need to first read the context information provided. Then, by referring to the information in the context, briefly give your final answer. The context information is: {context information}.".

[0092] Embodiment 1 of the present invention proposes a method for constructing a knowledge graph in the field of water conservancy, aiming to establish a communication bridge between data and knowledge in the field of water conservancy, provide technical support for drought disaster prevention and water resources management by constructing a water conservancy knowledge graph and realizing a knowledge graph question and answer application, and promote the further development of smart water conservancy construction and digital reform.

[0093] Embodiment 1 of the present invention proposes a method for constructing a knowledge graph in the field of water conservancy, which combs and determines the ontology of the knowledge graph in the field of water conservancy through a combination of top-down and bottom-up models; collects data in the field of water conservancy from multiple angles, including open source data, government documents, and Internet data, and constructs a more complete knowledge graph in the field of water conservancy by integrating multi-source data.

[0094] Embodiment 1 of the present invention proposes a method for constructing a knowledge graph in the field of water conservancy, compares the effects of large information extraction models on the task of extracting relationship triples in the field of water conservancy, and uses the best model OneKE to extract relationship triples, so that relationship triples with higher accuracy can be obtained without the need to train the model with an annotated data set; the present invention combines the reasoning ability of graph neural networks and the language understanding ability of large language models, and adopts a retrieval enhancement generation method to realize the question and answer application of knowledge graphs.

[0095] Example 2

[0096] Based on the method for constructing a knowledge graph in the water conservancy field proposed in Example 1 of the present invention, Example 2 of the present invention further proposes a system for constructing a knowledge graph in the water conservancy field. Figure 2 A schematic diagram of a water conservancy field knowledge graph construction system proposed in Example 2 of the present invention, the system includes a data acquisition module, a first extraction module, a second extraction module, a third extraction module and a fusion module;

[0097] The data acquisition module is used to acquire text data in the water conservancy field and use the text data in the water conservancy field to construct the ontology of the water conservancy field knowledge graph;

[0098] The first extraction module is used to extract entity information and attribute information from text data in the water conservancy field by using the ontology of the water conservancy field knowledge graph;

[0099] The second extraction module is used to obtain Internet data in the water conservancy field using a web crawler based on the extracted entity information and attribute information;

[0100] The third extraction module is used to extract relation triples from the acquired Internet data in the water conservancy field to obtain relation triple information;

[0101] The fusion module is used to fuse the relationship triple information with the entity information and attribute information to obtain the relationship triples in the water conservancy field; the relationship triples in the water conservancy field are batch imported into the graph database to obtain the knowledge graph in the water conservancy field.

[0102] The data acquisition module executes the following process: the data comes from the name code of a reservoir in a certain area, the name code of a sluice in a certain area, the code of a river in a certain area, the water conservancy statistical yearbook of a certain place in a certain year, or the water potential statistical data released by the government. For example: national reservoir data set, the responsible person documents of national and provincial, municipal and county water conservancy objects released by the government, "China Water Conservancy Statistical Yearbook 2022", "China Sluice Name Code", "China River Code", etc.

[0103] Determine the professional knowledge system of the knowledge graph in the water conservancy field; perform conceptual layer design under the patent knowledge system; extract entity nodes from the text data in the water conservancy field, and the entity nodes adopt the node structure of the conceptual layer; and obtain the ontology of the knowledge graph in the water conservancy field by combing the entity nodes designed with the conceptual layer node structure through a combination of top-down and bottom-up methods.

[0104] The method of conceptual layer design is: determine the hierarchical relationship between the concepts of various water conservancy objects, and each concept name represents a concept node; the concept layer includes top-level concepts, first-level concepts, second-level concepts and third-level concepts; the top-level concepts include water conservancy objects; the first-level concepts include engineering and non-engineering categories; the second-level concepts include detection points, water conservancy projects, natural geography and management objects; the third-level concepts include water conservancy object categories.

[0105] The process executed by the first extraction module is: saving structured data and unstructured data respectively in .pdf file type; using text recognition tools to extract entity information and attribute information from the ontology of the water conservancy field knowledge graph, and storing them in .csv format files according to the water conservancy object category; the .csv format file is used to save structured data.

[0106] The text data in the water conservancy field that needs to be translated is translated and stored in a .csv format file.

[0107] The process executed by the second extraction module is: extracting the name of each category of water conservancy objects based on the extracted entity information and attribute information to obtain a set of water conservancy object names; using a web crawler, using the water conservancy object names in each water conservancy object set as search keywords, and collecting water conservancy field information on corresponding websites; collecting the water conservancy field information, and processing and summarizing the data to generate Internet data in the water conservancy field.

[0108] The process executed by the third extraction module is: using the ontology of the knowledge graph in the water conservancy field to customize the schema for different categories of water conservancy objects; for different categories of water conservancy objects, building the model input prompt based on the schema of the category and the Internet data in the water conservancy field; setting the OneKE model parameters, inputting the prompt, and extracting the relationship triples; cleaning the output results of the OneKE model and extracting the relationship triple information, and storing it in a .csv format file according to the water conservancy object category.

[0109] The execution process of the fusion module is as follows: store the relationship triple information, entity information and attribute information in the dictionary using the water conservancy object name as the key and the attribute as the value; define the data fusion rules to update the dictionary value; extract the relationship triple information from the dictionary, obtain the relationship triple in the water conservancy field, and store it in .csv format; use the graph database Neo4j and the Cypher Load CSV statement to batch import the entity relationship and attribute information into the graph database.

[0110] The system also includes an application module; the process of implementing the application module includes: realizing the question-and-answer application of the knowledge graph in the water conservancy field by combining the graph neural network and the large language model, specifically:

[0111] Use question-answer data to train the graph neural network and obtain the target graph neural network; that is, use the "question-answer pair" data to optimize the graph neural network parameters, and define it as a node classification task (answer and non-answer) for training;

[0112] The target graph neural network is used to perform reasoning on the knowledge graph. The target graph neural network generates a probability score for all nodes in the knowledge graph, indicating their credibility as candidate answers, and extracts the nodes with the highest probability score as candidate answers;

[0113] Extract the shortest path connecting the question entity and the candidate answer as the reasoning path in the knowledge graph;

[0114] Convert the reasoning path into triple format text and fill it into the prompt template for format conversion to convert the reasoning path into text form to obtain the first reasoning path; the prompt template for format conversion is: "Your task is to convert a knowledge graph into one or more sentences. The knowledge graph is: {triple format text}.

[0115] Fill the question into the prompt template for retrieving the reasoning path to achieve the retrieval of the second reasoning path related to the question using the large language model; the prompt template for retrieving the reasoning path is: "Your task is to retrieve useful reasoning paths for the question. The question is: {question}.".

[0116] The first reasoning path, the second reasoning path and the question are combined to form the context information for knowledge graph question answering, which is then filled into the prompt template for knowledge graph question answering, and the prompt is input into the large language model to finally implement the knowledge graph question answering application. The prompt template for knowledge graph question answering is: "You are an expert in the field of water conservancy. In order to answer the question concisely and correctly in the end, you need to first read the context information provided. Then, by referring to the information in the context, briefly give your final answer. The context information is: {context information}."

[0117] Embodiment 2 of the present invention proposes a knowledge graph construction system in the field of water conservancy, which aims to establish a communication bridge between data and knowledge in the field of water conservancy. By constructing a water conservancy knowledge graph and realizing a knowledge graph question and answer application, it provides technical support for drought disaster prevention and water resources management, and promotes the further development of smart water conservancy construction and digital reform.

[0118] Embodiment 2 of the present invention proposes a knowledge graph construction system in the field of water conservancy, which combs and determines the ontology of the knowledge graph in the field of water conservancy through a combination of top-down and bottom-up models; collects data in the field of water conservancy from multiple angles, including open source data, government documents, and Internet data, and constructs a more complete knowledge graph in the field of water conservancy by integrating multi-source data.

[0119] Embodiment 2 of the present invention proposes a knowledge graph construction system in the field of water conservancy, compares the effects of large information extraction models on the task of extracting relationship triples in the field of water conservancy, and uses the best model OneKE to extract relationship triples, and can obtain relationship triples with higher accuracy without the need to label the data set training model; the present invention combines the reasoning ability of graph neural networks and the language understanding ability of large language models, and adopts a retrieval enhancement generation method to realize the knowledge graph question and answer application.

[0120] Example 2 of the present invention proposes a system for constructing a knowledge graph in the field of water conservancy. The description of the relevant parts can be found in the detailed description of the corresponding parts in the method for constructing a knowledge graph in the field of water conservancy provided in Example 1 of the present application, and will not be repeated here.

[0121] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment that includes a series of elements are inherent to the elements. In the absence of more restrictions, the elements limited by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or equipment that includes the elements. In addition, the above-mentioned technical solution provided in the embodiment of the present application is consistent with the corresponding technical solution in the prior art in principle, and the part is not described in detail, so as not to repeat too much.

[0122] Although the above describes the specific implementation of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. For those skilled in the art, other different forms of modifications or deformations can be made on the basis of the above description. It is not necessary and impossible to list all the implementation methods here. On the basis of the technical solution of the present invention, various modifications or deformations that can be made by those skilled in the art without creative work are still within the scope of protection of the present invention.

Claims

1. A method for constructing a knowledge graph in the field of water conservancy, characterized in that: The following steps are involved: Obtain text data in the water conservancy field, and use the text data in the water conservancy field to build the ontology of the water conservancy field knowledge graph; By using the ontology of the knowledge graph in the water conservancy field, entity information and attribute information are extracted from the text data in the water conservancy field; Based on the extracted entity information and attribute information, a web crawler is used to obtain Internet data in the water conservancy field; Extract relational triples from the acquired Internet data in the field of water conservancy to obtain relational triple information; The relationship triples are integrated with entity information and attribute information to obtain the relationship triples in the water conservancy field; The relationship triplets in the water conservancy field are imported into the graph database in batches to obtain the knowledge graph in the water conservancy field.

2. A method for constructing a knowledge graph in the field of water conservancy according to claim 1, characterized in that: The method also includes realizing a question-and-answer application of a knowledge graph in the field of water conservancy by combining a graph neural network and a large language model, specifically: Use question-answering data to train the graph neural network and obtain the target graph neural network; The target graph neural network is used to perform reasoning on the knowledge graph. The target graph neural network generates a probability score for all nodes in the knowledge graph, indicating their credibility as candidate answers, and extracts the nodes with the highest probability score as candidate answers; Extract the shortest path connecting the question entity and the candidate answer as the reasoning path in the knowledge graph; Convert the reasoning path into a triple format text, and fill it into a prompt template for format conversion, so as to convert the reasoning path into a text form to obtain a first reasoning path; Fill the question into a prompt template for retrieving the reasoning path, so as to use the large language model to retrieve the second reasoning path related to the question; The first reasoning path, the second reasoning path and the question are combined to form context information for knowledge graph question and answer, which is filled into a prompt template for knowledge graph question and answer, and the prompt is input into a large language model to finally realize the knowledge graph question and answer application.

3. A method for constructing a knowledge graph in the field of water conservancy according to claim 1, characterized in that: The process of obtaining text data in the water conservancy field and using the text data in the water conservancy field to construct the ontology of the water conservancy field knowledge graph includes: Determine the professional knowledge system of knowledge graph in the field of water conservancy; carry out conceptual layer design under the patent knowledge system; Extracting entity nodes from the water conservancy field text data, and the entity nodes adopt a node structure of the concept layer; The ontology of the knowledge graph in the field of water conservancy is obtained by combing the entity nodes designed with the concept layer node structure through a combination of top-down and bottom-up approaches.

4. A method for constructing a knowledge graph in the field of water conservancy according to claim 3, characterized in that: The method for designing the concept layer is: determining the hierarchical relationship between the concepts of various water conservancy objects, and each concept name represents a concept node; the concept layer includes top-level concepts, first-level concepts, second-level concepts and third-level concepts; the top-level concepts include water conservancy objects; the first-level concepts include engineering and non-engineering categories; the second-level concepts include detection points, water conservancy projects, natural geography and management objects; the third-level concepts include water conservancy object categories.

5. The method for constructing a knowledge graph in the field of water conservancy according to claim 1, characterized in that: The process of extracting entity information and attribute information from text data in the water conservancy field by using the ontology of the water conservancy field knowledge graph includes: The structured data and unstructured data are saved separately in .pdf file type; entity information and attribute information are extracted from the ontology of the water conservancy field knowledge graph using a text recognition tool, and are stored in .csv format files according to the water conservancy object category; the .csv format files are used to save structured data.

6. A method for constructing a knowledge graph in the field of water conservancy according to claim 5, characterized in that: The method further comprises translating the water conservancy field text data that needs to be translated and storing the translated data in a .csv format file.

7. A method for constructing a knowledge graph in the field of water conservancy according to claim 1, characterized in that: The process of obtaining Internet data in the water conservancy field by using a web crawler based on the extracted entity information and attribute information includes: According to the extracted entity information and attribute information, the name of each category of water conservancy object is extracted to obtain a water conservancy object name set; Using a web crawler, the names of the water conservancy objects in each water conservancy object set are used as search keywords to collect water conservancy field information on the corresponding websites; Collect the information in the water conservancy field, and process and summarize the data to generate Internet data in the water conservancy field.

8. A method for constructing a knowledge graph in the field of water conservancy according to claim 1, characterized in that: The process of extracting relational triples from the acquired Internet data in the field of water conservancy to obtain relational triple information includes: Use the ontology of the water conservancy knowledge graph to customize schemas for different categories of water conservancy objects; For different types of water conservancy objects, the prompt for model input is constructed based on the schema of the category and the Internet data in the water conservancy field; Set the OneKE model parameters, input prompt, and extract relation triples; The output results of the OneKE model are cleaned and the relation triple information is extracted, and stored in .csv format files according to the water conservancy object category.

9. A method for constructing a knowledge graph in the field of water conservancy according to claim 1, characterized in that: The process of integrating the relationship triples with the entity information and the attribute information to obtain the relationship triples in the water conservancy field and importing the relationship triples in the water conservancy field into the graph database in batches to obtain the knowledge graph in the water conservancy field includes: The relationship triple information, entity information and attribute information are stored in a dictionary using the water conservancy object name as the key and the attribute as the value; the rules for data fusion are defined to update the dictionary value; Extract relation triple information from the dictionary, obtain relation triples in the water conservancy field, and store them in .csv format; Use the graph database Neo4j and the Cypher Load CSV statement to batch import entity relationships and attribute information into the graph database.

10. A knowledge graph construction system in the field of water conservancy, characterized in that: It includes a data acquisition module, a first extraction module, a second extraction module, a third extraction module and a fusion module; The data acquisition module is used to acquire text data in the water conservancy field, and use the text data in the water conservancy field to construct the ontology of the water conservancy field knowledge graph; The first extraction module is used to extract entity information and attribute information from text data in the water conservancy field by using the ontology of the water conservancy field knowledge graph; The second extraction module is used to obtain Internet data in the field of water conservancy using a web crawler based on the extracted entity information and attribute information; The third extraction module is used to extract relation triples from the acquired Internet data in the field of water conservancy to obtain relation triple information; The fusion module is used to fuse the relationship triplet information with the entity information and the attribute information to obtain the relationship triplet in the water conservancy field; The relationship triplets in the water conservancy field are imported into the graph database in batches to obtain the knowledge graph in the water conservancy field.

Citation Information

Cited By

  • Knowledge graph construction method for emergency water supply event

    CN120387507A