Water resource scheduling knowledge question-answering system construction and evaluation method based on Graph RAG
By constructing a knowledge question-and-answer system for water resource scheduling using the Graph RAG method, the problems of terminological ambiguity and logical deficiencies in large models in the field of water conservancy were solved, thereby improving professionalism and accuracy, reducing labor costs, and providing efficient knowledge services.
Patent Information
- Application Number
- CN202511629037.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-02-17
AI Technical Summary
Large models suffer from terminological ambiguity, logical gaps, and illusions in their application in the water conservancy field, resulting in insufficient accuracy of knowledge indexing and question answering, and high manual costs for knowledge graph construction.
The Graph RAG method is used to extract structured and unstructured data from water conservancy data to generate domain-adapted Prompt text templates. A triple knowledge graph is constructed by combining knowledge graphs and DeepSeek-R1 and bge-m3 models to establish an intelligent question answering system. A multi-dimensional evaluation method is used to optimize the question answering system.
It improves the professionalism and accuracy of the water resource scheduling knowledge question-and-answer system, reduces the manual cost of knowledge graph construction, provides efficient knowledge service support, and enhances the interpretability and credibility of the answers.
Smart Images

Figure CN121542437A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of water conservancy informatization and artificial intelligence, and in particular to a water resource scheduling knowledge question and answer system construction and evaluation method based on GraphRAG. BACKGROUND
[0002] In related policy documents, it is clearly proposed to deepen the research and application of frontier technologies such as big data and artificial intelligence, launch the "artificial intelligence +" action plan, and promote the deep integration of technological innovation and practical application. The water conservancy industry supervisory department actively responds and emphasizes in the relevant work conference to build a digital twin water conservancy system, build a water conservancy knowledge platform around flood control, water resources and other businesses, and support the intelligent development of "four predictions". With the landing application of large models in various industries, they play a key role in the construction of vertical field knowledge base. For example, some research explores the use of AI large models to drive the intelligent generation of water conservancy engineering planning and design reports and the construction of intelligent checking systems. Some industry subjects develop special large models in the water conservancy field, which realize complex queries and accurate responses of professional knowledge in the water conservancy field, and are applied to knowledge question and answer work in production operation, operation and maintenance, project management and safety regulations.
[0003] However, large models have problems such as illusion, black box and weak reasoning ability, and may generate outputs that are irrelevant to the input, do not conform to the facts or are logically unreasonable when generating content, making it difficult to apply them stably in fields such as flood control scheduling and water supply scheduling that require high precision and stability of indexed knowledge. To solve this problem, knowledge graph technology, as a structured knowledge representation and organization method, is introduced and integrated with large models to improve the precision of knowledge indexing and question answering. For example, some research based on large models assists in designing flood control rule scheduling tags, and builds a knowledge graph in the field of flood control scheduling. In 2023, a related technical team proposed a graph retrieval-augmented generation (Graph RAG) method, which reduces the randomness and error rate of generated content by constraining reliable prior knowledge. However, the complex systems such as large models and knowledge graphs involved in the integration technology of Graph RAG still face key technical challenges when applied in vertical fields such as water conservancy, such as the semantic gap between general semantic understanding of large models and water conservancy professional terminology system, which may lead to biased graph retrieval results and professional logical errors in generated content. SUMMARY
[0004] The main purpose of the present application is to provide a kind of water resources scheduling knowledge question and answer system construction and evaluation method based on Graph RAG, solve the term ambiguity, logic missing, big model illusion problem existing in the application of water conservancy field, reduce the artificial cost of knowledge graph construction at the same time, improve the professionalism and accuracy of water resources scheduling knowledge question and answer system, provide efficient knowledge service support for water conservancy decision-making.
[0005] To solve the above technical problems, the technical solution adopted by the present application is: a kind of water resources scheduling knowledge question and answer system construction and evaluation method based on Graph RAG, the method comprises: S1, structured and unstructured data are extracted from water conservancy field literature, industry standard, scheduling manual multi-source heterogeneous data, data cleaning and table conversion text normalization processing are carried out; S2, in combination with the entity and relationship of knowledge graph, generate Prompt text template adapted to the field of water resources allocation, enhance the domain semantic understanding ability of large language model; S3, adopt DeepSeek-R1 and bge-m3 model, form knowledge graph by entity extraction and construct triple, and store in graph database, combine semantic alignment and index, establish intelligent question and answer system, realize accurate subgraph positioning and credible answer generation, support traceability; S4, the output results of intelligent question and answer system are evaluated by combining accuracy, comprehensiveness, timeliness and artificial evaluation, and the performance improvement effect of question and answer system is verified.
[0006] In the preferred scheme, in S1, structured and unstructured data are fused, and the fusion process includes table to text conversion, table header type classification and fusion with text; The table header type classification method is: the title only contains a single index and dimension, which is "simple table", and the title has nested aggregation or multi-level semantics, which is "complex table"; Normalization processing also includes unit unification of flow and water level field, and removal of abnormal data and irrelevant data.
[0007] In the preferred scheme, S2 specifically includes the following steps: A1, a method combining task decomposition and field specialization guidance is adopted, a complex task is decomposed into an executable subtask sequence by "step-by-step reasoning" strategy, structured prompt words are used to guide large model to establish systematic thinking path, and fine-grained expert role mapping is constructed, so that the response content is limited within the scope of water conservancy profession; A2, a method of entity extraction and declaration extraction is adopted, and a knowledge unit with business closed loop characteristics is formed; The entity extraction takes the functional role in the business chain as the core division standard, the candidate triple adopts the complete business closed loop mode of "infrastructure, action, constraint condition" or "subject, behavior, object", and the triple corresponds to the water resources scheduling and flood control and disaster reduction scene; in the extraction process, the recognition ability of water conservancy professional terms is optimized by a few sample learning paradigm, and the few sample learning paradigm is specifically: 50-100 groups of water conservancy field labeled "entity-relation-entity" triple sample are selected as a training set, and a large model is input to fine-tune the parameters; The declaration extraction adopts a "state-declaration" dual-channel filtering mechanism to process the water conservancy scheduling corpus, and the "state-declaration" dual-channel filtering mechanism is specifically: The first channel performs "state verification" on the corpus to determine whether the corpus contains explicit or implicit time identifiers; the second channel performs "declaration classification" on the corpus, which is classified into one of the three categories of "condition declaration", "operation declaration" and "effect declaration", and checks whether the corpus contains numerical or quantifiable parameters; The corpus verified by the two channels is written into the graph database in the form of edge attributes, and the number of samples in the prompt template should not be too large, which is less than 5 groups; A3, according to the field dimension, it is divided into water resources basic information, hydropower station operation data and water quantity scheduling scheme, and then according to the research granularity, it is subdivided into paragraph types, including cross-domain comprehensive description, single-domain multi-problem discussion and special problem depth analysis; The large model identifies the problem category through a pre-trained domain classifier, and the pre-trained domain classifier is constructed in the following way: 500-1000 pieces of text data labeled with problem categories in the water conservancy field are used as a training set, and a BERT model is used for training; The large model adopts a hierarchical response mechanism to output content, generates structured output through hierarchical summarization, suppresses information illusion through "only answer known information" and "uncertainty annotation" dual prompts, and contains positive examples and negative examples in the prompt design to form a balanced prompt strategy, and the balanced prompt strategy is specifically: the number ratio of positive examples to negative examples is 1:1, and the business types in the water resources scheduling and flood control and disaster reduction scenes are covered.
[0008] In the preferred scheme, S3 specifically includes the following steps: B1, select bge-m3 model as the core Embedding generation tool, in the knowledge graph construction stage, use bge-m3 to generate embedding vectors for the extracted entity and relationship description text, which is used for subsequent semantic index construction; B2, based on the text preprocessing results of S1 and the prompt word optimization design method of S2, generate corresponding text blocks and call a large model to establish the topology structure of the knowledge graph, and store the triple into the Neo4j graph database; B3. During the question-and-answer phase, bge-m3 is used to vectorize user queries and align them with node / edge vectors in the knowledge graph; the question and its sub-vectors are then used to... Figure One Input DeepSeek-R1, and the model will answer based on the subgraph content under the prompt constraints designed in S2. The answer will also include the subgraph path for front-end visualization and tracing.
[0009] In the preferred scheme, the comprehensive evaluation and feedback control in S4 specifically includes the following steps: C1. Collect n responses from k models to m questions; C2. The collected answers are evaluated by experts, and winners are identified by comparing them in pairs for the same question. C3. The evaluation results are scored, with the winner receiving 5 points and the rest receiving points decreasing step by step according to the comparison results. The scores are used to determine whether the answers cover all important aspects related to the question. In the preferred scheme, the heuristic evaluation and feedback control in S4 specifically include the following steps: D1. Definition ,in This indicates that the k-th model hits the heuristic regular expression in its j-th response to question i. This indicates a miss, where j represents the n repeated responses of the same model to the same problem; D2, Calculation The calculation formula is: ; D3、 Multiply by 100 to get ,calculate The calculation formula is: ; D4. Score according to the hit rate: 5 points for a hit and 3 points for a miss; In the preferred scheme, the data-driven evaluation and feedback control in S4 specifically include the following steps: E1. Counting based on "number + source" ,Will Capped at 3n; E2, Calculate density The calculation formula is: ; E3. Calculate the average value at the problem level. The calculation formula is: , where m is the number of questions; In the preferred scheme, the stability evaluation and feedback control in S4 specifically include the following steps: F1. For the same question and the same model, obtain n≥3 repeated answers, define... a character set of the jth answer of the kth model to question i; F2, calculating the pairwise consistency degree , the calculation formula is ; , wherein is the combination number; F3, calculating the stability score , the calculation formula is ; F4, calculating the average score at the question level , the calculation formula is ; In the preferred solution, the accuracy evaluation and feedback control in S4 specifically include the following steps: G1, splitting the jth answer of the kth model to question i into a plurality of verifiable propositions, defining as the number of propositions that hit the correct answer in the jth answer of model k to question i, as the total number of verifiable propositions split in the answer; G2, calculating the accuracy ratio , the calculation formula is ; G3, calculating the average ratio at the question level , the calculation formula is ; G4, mapping to 1-5 grades to obtain the final accuracy score: In the preferred solution, the timeliness evaluation and feedback control in S4 specifically include the following steps: H1, recording the generation delay of the jth answer of the kth model to question i; H2, sorting the n times of delay in the same question i in the order from short to long; H3, assigning scores according to the sorting result, assigning 5 points to the shortest delay, 4 points to the middle, and 3 points to the longest, to obtain the timeliness score; The preferred solution includes a data preprocessing module, a Prompt optimization module, a knowledge graph and question answering system construction module, and an evaluation and feedback optimization module. The data preprocessing module is used to perform step S1 to extract data from multiple source heterogeneous data in the water conservancy field and perform normalization processing; The Prompt optimization module is used to perform step S2 to generate a Prompt text template adapted to the water resources allocation field; The knowledge graph and question answering system construction module is used to perform step S3 to construct a knowledge graph and establish an intelligent question answering system; The evaluation and feedback optimization module is used to perform step S4, evaluate the question-and-answer results, and verify the performance improvement of the question-and-answer system.
[0010] This invention provides a method for constructing and evaluating a knowledge-based question-and-answer system for water resource scheduling based on Graph RAG. It achieves intelligent organization and precise retrieval of water conservancy professional knowledge. The knowledge graph constructed based on the water conservancy domain ontology can automatically extract and associate "entity-relationship-declaration" triples. Combined with the domain's Prompt template, it significantly improves the question-and-answer system's ability to understand professional terminology and complex business logic, solving the semantic understanding bias problem existing in traditional methods for water conservancy professional question-and-answer. Employing a "vector-graph hybrid retrieval" architecture, it is not limited to a single large model or retrieval strategy. It can flexibly replace the embedding model, graph database, or multi-objective optimization algorithm according to actual computing power and accuracy requirements, making it widely applicable and highly scalable. It can be deployed locally or in the cloud. The system particularly strengthens the answer tracing function, allowing all answers to be associated with the original data nodes in the knowledge graph, greatly improving the interpretability and credibility of decision-making basis, while reducing the manual cost of knowledge graph construction. This provides efficient knowledge service support for water conservancy decision-making, helping the water conservancy industry move towards intelligence and precision. Attached Figure Description
[0011] The present invention will be further described below with reference to the accompanying drawings and embodiments: Figure 1 This is a flowchart of the knowledge question-answering system construction and evaluation method of the present invention; Figure 2 This is a schematic diagram illustrating the construction of some basic knowledge units in this invention, using triples as an example; Figure 3 This is a schematic diagram illustrating the traceability of the problem system in this invention; Figure 4 The problem described in this invention is the operation interface diagram. Detailed Implementation
[0012] Example 1 like Figures 1-4 As shown, a method for constructing and evaluating a knowledge-based question-answering system for water resource scheduling based on Graph RAG is presented. This method includes: S1. Extract structured and unstructured data from multi-source heterogeneous data such as literature, industry standards, and dispatch manuals in the water conservancy field, and perform data cleaning and normalization processing to convert tables into text. S2. By combining entities and relationships from the knowledge graph, a Prompt text template adapted to the water resource allocation domain is generated to enhance the domain semantic understanding capability of the large language model. S3, adopt DeepSeek-R1 and bge-m3 models, build triples through entity extraction to form a knowledge graph and store it in a graph database, combine semantic alignment and indexing to establish an intelligent question answering system, realize accurate subgraph positioning and credible answer generation, and support traceability; S4, adopt a combination of accuracy, comprehensiveness, timeliness, and manual evaluation to evaluate the output of the intelligent question answering system, and verify the performance improvement effect of the question answering system.
[0013] In the preferred scheme, in S1, structured and unstructured data are fused, and the fusion process includes table-to-text conversion, table header type classification, and fusion with text; The table header type classification method is: the title contains only a single index and dimension, which is a "simple table"; the title has nested aggregation or multi-level semantics, which is a "complex table"; The normalization process also includes unit unification of flow and water level fields, and removal of abnormal data and irrelevant data.
[0014] In the preferred scheme, S2 specifically includes the following steps: A1, adopt a method combining task decomposition and domain specialization guidance, decompose complex tasks into executable subtask sequences through a "step-by-step reasoning" strategy, use structured prompt words to guide the big model to establish a systematic thinking path, and build a fine-grained expert role mapping to limit the response content within the water conservancy professional range; A2, adopt a method of synergistic fusion of entity extraction and declaration extraction to form a knowledge unit with business closed-loop characteristics; Entity extraction takes the functional role in the business chain as the core division standard, candidate triples use the complete business closed-loop mode of "infrastructure, action, constraint condition" or "subject, behavior, object", and triples correspond to water resources dispatching and flood control scenarios; During the extraction process, the model's recognition ability for water conservancy terminology is optimized through a few-shot learning paradigm, which specifically selects 50-100 groups of water conservancy field labeled "entity-relation-entity" triple samples as the training set, and inputs the big model for parameter fine-tuning; The "state-declaration" dual-channel filtering mechanism is used to process water conservancy dispatching corpus, and the "state-declaration" dual-channel filtering mechanism specifically includes: The first channel performs "state verification" on the corpus to determine whether it contains explicit or implicit time identifiers; The second channel performs "declaration classification" on the corpus, which is classified into one of the three categories: "condition declaration", "operation declaration", and "effect declaration", while verifying whether the corpus contains numerical or quantifiable parameters; Only the corpus verified by the two channels is written into the graph database in the form of edge attributes, and the number of samples in the input prompt template should not be too large, preferably less than 5. A3, divided into water resources basic information, hydropower station operation data, water quantity scheduling scheme according to the research granularity, paragraph type includes cross-domain comprehensive description, single-domain multi-problem discussion and special problem depth analysis three categories; The large model identifies the problem category through the pre-trained domain classifier. The pre-trained domain classifier is constructed in the following manner: 500-1000 pieces of text data labeled with problem categories in the water conservancy field are used as the training set, and a BERT model is used for training; The large model adopts a hierarchical response mechanism to output content, generates structured output through hierarchical summary, suppresses information hallucination through "only answer known information" and "uncertainty annotation" double prompts, and contains positive examples and negative examples in the prompt design to form a balanced prompt strategy. The balanced prompt strategy is as follows: the number ratio of positive examples to negative examples is 1:1, and the business types in the water resources scheduling and flood control and disaster reduction scenarios are covered.
[0015] In the preferred scheme, S3 specifically includes the following steps: B1, select bge-m3 model as the core Embedding generation tool, in the knowledge graph construction stage, use bge-m3 to generate embedding vectors for the extracted entity and relationship description text, which is used for subsequent semantic index construction; B2, based on the text preprocessing results of S1 and the prompt word optimization design method of S2, generate corresponding text blocks and call the large model, establish the topological structure of the knowledge graph, and store the triples to the Neo4j graph database; B3, in the question and answer stage, use bge-m3 to vectorize the user query and align it with the node / edge vectors in the knowledge graph; the question and the sub Figure One and input DeepSeek-R1, the model answers according to the subgraph content under the prompt constraint of S2, and the subgraph path is attached to the answer for front-end visualization and tracing.
[0016] In the preferred scheme, the comprehensive evaluation and feedback control in S4 specifically include the following steps: C1, collect n times of answers from k models to m questions; C2, the collected answers are evaluated by experts, and for the same question, the winners are marked by pairwise comparison; C3, score the evaluation results, the winner gets 5 points, and the rest decreases the score level by level according to the comparison result, and whether the answer covers all important aspects related to the question is judged by the score; In the preferred scheme, the heuristic evaluation and feedback control in S4 specifically include the following steps: D1, define , wherein This indicates that the k-th model hits the heuristic regular expression in its j-th response to question i. This indicates a miss, where j represents the n repeated responses of the same model to the same problem; D2, Calculation The calculation formula is: ; D3、 Multiply by 100 to get ,calculate The calculation formula is: ; D4. Score according to the hit rate: 5 points for a hit and 3 points for a miss; In the preferred scheme, the data-driven evaluation and feedback control in S4 specifically include the following steps: E1. Counting based on "number + source" ,Will Capped at 3n; E2, Calculate density The calculation formula is: ; E3. Calculate the average value at the problem level. The calculation formula is: , where m is the number of questions; In the preferred scheme, the stability evaluation and feedback control in S4 specifically include the following steps: F1. For the same question and the same model, obtain n≥3 repeated answers, define... Let be the set of characters for the j-th response of the k-th model to question i; F2. Calculate pairwise consistency. The calculation formula is: ,in It is the number of combinations; F3, Calculate the stability score The calculation formula is: ; F4. Calculate the average score at the question level. The calculation formula is: ; In the preferred scheme, the accuracy evaluation and feedback control in S4 specifically include the following steps: G1, decompose the j-th response of the k-th model to question i into several verifiable propositions, and define... Let be the number of propositions in which model k correctly answers question i in its j-th response. This represents the total number of verifiable propositions extracted from this response. G2, Calculation accuracy ratio The calculation formula is: ; G3, calculate the average ratio at the problem level , the calculation formula is ; G4, map to 1-5 grades to obtain the final score of accuracy: ; In the preferred embodiment, the timeliness evaluation and feedback control in S4 specifically include the following steps: H1, record the generation delay of the kth model for the jth answer to question i; H2, sort the n times of delay in the same question i in order from short to long; H3, score according to the sorting result, the shortest delay is assigned 5 points, the middle is assigned 4 points, and the longest is assigned 3 points, to obtain the timeliness score; In the preferred embodiment, it includes a data preprocessing module, a Prompt optimization module, a knowledge graph and question answering system construction module, and an evaluation and feedback optimization module. The data preprocessing module is used to perform step S1 to extract data from multiple source heterogeneous data in the water conservancy field and perform normalization processing; The Prompt optimization module is used to perform step S2 to generate a Prompt text template adapted to the water resources allocation field; The knowledge graph and question answering system construction module is used to perform step S3 to construct a knowledge graph and establish an intelligent question answering system; The evaluation and feedback optimization module is used to perform step S4 to evaluate the question answering result and verify the performance improvement effect of the question answering system.
[0017] Scheme arrangement and explanation This scheme focuses on the construction and evaluation method of the water resources scheduling knowledge question answering system based on Graph RAG, and details the 6 evaluation and feedback control processes of comprehensiveness, inspiration, data, stability, accuracy, and timeliness in the system evaluation stage (S4), as well as the system module composition. The specific content and formula explanation is as follows: Comprehensiveness evaluation and feedback control in S4 This evaluation ensures that the question answering result covers the key aspects of the question through expert comparison evaluation and threshold feedback. The steps are: first, collect n times of answers to m questions by k models, then compare the answers to the same question by experts and mark the winner, the winner gets 5 points, the rest decreases the score according to the comparison result, and the score is used to judge whether the answer covers all important aspects.
[0018] Inspiration evaluation and feedback control in S4 The evaluation assesses the heuristic value of the answers and optimizes the search range through regular hit statistics and quantitative calculation. The steps and formula explanations are as follows: define parameters , wherein represents the kth model's jth answer hit heuristic regular expression for the ith question, represents a miss, and j is the number of repeated responses of the same model to the same question; calculate , the formula , wherein represents the total number of times the heuristic regular expression is hit in the kth model's n answers to the ith question, obtained by summing n answers; calculate , the formula , wherein represents the heuristic hit frequency (in percentage form) of the kth model for m questions, first taking the average of m questions , and then multiplying by 100 to convert to percentage; score according to hits and misses, with 5 points for hits and 3 points for misses.
[0019] Data evaluation and feedback control in S4 The evaluation assesses the data integrity of the answers and supplements the knowledge graph data through "number + source" statistics and density calculation. The steps and formula explanations are as follows: count the "number + source" , and cap it at 3n (3n is used to ensure that the upper limit expands and contracts with n); calculate the density , the formula , wherein represents the "number + source" density of the kth model's jth answer to the ith question, obtained by taking the minimum value of and 3n to ensure that the density does not exceed 1; calculate the average value at the question level , the formula , wherein represents the average data score of the kth model for m questions, first taking the average of m questions, n answers for each question , and then mapping to the 5-point scale range after calculation.
[0020] Stability evaluation and feedback control in S4 The evaluation assesses the stability of the answers and adjusts the model parameters through the consistency calculation of the character set of the answers. The steps and formula explanations are as follows: obtain the repeated answers of the same model for the same question n≥3 times, and define as the character set of the kth model's jth answer to the ith question; calculate the pairwise consistency , the formula , wherein is the number of combinations of 2 from n answers, and For the k-th model, the i-th problem is represented by the i-th model. sequence The character set of the next answer. The number of elements in the intersection of the two sets. The number of elements in the union of the two sets. The stability score is obtained by averaging the ratios of the intersection and union of all pairwise combinations, reflecting the consistency of n responses; ,formula middle, To determine the stability score of the k-th model for the i-th problem, we will... Multiply by 5 and take the minimum value not exceeding 5, then map to a 5-point scale; calculate the average score at the problem level. ,formula middle, Let be the average stability score of the k-th model for m problems.
[0021] Accuracy evaluation and feedback control in S4 This evaluation assesses the accuracy of responses and switches models based on the hit ratio of verifiable propositions. The steps and formulas are explained below: The k-th model's j-th response to the i-th question is broken down into verifiable propositions, defined as follows: This represents the number of propositions that hit the correct answer in this response. The total number of verifiable propositions extracted from this answer; calculate the accuracy ratio. ,formula middle, The ratio of the accuracy of the k-th model for the j-th answer to the i-th question reflects the percentage of correct propositions; the average ratio at the question level is calculated. ,formula middle, The average accuracy ratio of the k-th model across m questions; calculate the final accuracy score. ,formula middle, To obtain the final accuracy score for the k-th model, Multiply by 5 and round up to the nearest integer, mapping to levels 1-5.
[0022] Timeliness evaluation and feedback control in S4 This evaluation assesses response speed and optimizes the index by sorting responses based on generation latency. The steps are as follows: record the generation latency of the k-th model for the j-th response to the i-th question; within the same question, sort the n latency responses from shortest to longest, assigning 5 points to the shortest latency, 4 points to the middle latency, and 3 points to the longest latency.
[0023] The water resource allocation knowledge question-answering system based on Graph RAG consists of four core modules: a data preprocessing module (currently in step S1), which extracts and normalizes data from multi-source heterogeneous data in the water resources field; a Prompt optimization module (currently in step S2), which generates a Prompt text template adapted to the water resource allocation field; a knowledge graph and question-answering system construction module (currently in step S3), which constructs a knowledge graph and establishes an intelligent question-answering system; and an evaluation and feedback optimization module (currently in step S4), which evaluates the question-answering results and verifies the performance improvement effect of the question-answering system.
[0024] Example 2 Further explanation in conjunction with Example 1, such as Figures 1-4 As shown, the purpose of this invention is to provide a method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG. It proposes a Graph RAG-based prompt word optimization method and improves the model's performance in processing complex water conservancy knowledge by introducing the structured retrieval capabilities of knowledge graphs. Finally, using water conservancy knowledge question-answering as an experimental scenario, the performance advantages of Graph RAG are verified, providing an efficient and feasible construction solution for the development of smart water conservancy and helping the water conservancy industry move towards intelligence and precision.
[0025] To achieve the above objectives, this invention provides a method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG, comprising the following steps: Step 1: Text preprocessing based on a large model: Extract structured and unstructured data from multi-source heterogeneous data such as water conservancy literature, industry standards, and scheduling manuals, and perform data cleaning and normalization processing to convert tables into text. Step 2: Optimization design of prompt words in the field of water resource allocation: Combine the entities and relationships of the knowledge graph to generate a prompt text template adapted to the field of water resource allocation, thereby enhancing the domain semantic understanding ability of the Large Language Model (LLM). Step 3: Construction of a knowledge graph and question-answering system for water resource scheduling based on Graph RAG: Using DeepSeek-R1 and bge-m3 models, a knowledge graph is formed by extracting entities and storing it in a graph database. Combined with semantic alignment and indexing, an intelligent question-answering system is established to achieve accurate subgraph positioning and reliable answer generation, supporting source tracing. Step 4: Analysis and Evaluation of Intelligent Question Answering Results: The performance improvement effect of the question answering system is verified by combining methods such as accuracy, comprehensiveness, timeliness, and human evaluation.
[0026] Furthermore, it integrates structured and unstructured data, including table-to-text conversion, table header type classification, and integration with text.
[0027] Further, the step two specifically includes: Step 2.1, global role positioning prompt design: Adopting the method of task decomposition combined with domain specialization guidance, the complex task is decomposed into executable subtask sequence through "step-by-step reasoning" strategy, and the structured prompt is used to guide the large model to establish systematic thinking path. Construct fine-grained expert role mapping to ensure that the response content is strictly limited within the professional range.
[0028] Step 2.2, basic knowledge unit construction: Adopting the method of entity extraction and declaration extraction fusion, form knowledge unit with business closed loop characteristics. Entity extraction takes the functional role in the business chain as the core division standard, requires that the candidate triple must meet the complete business closed loop mode of "infrastructure-action-constraint condition" or "subject-behavior-object", and is strictly limited to core scenes such as water resources dispatching and flood control. During the extraction process, the model's ability to recognize water conservancy terminology is optimized through the few-shot learning paradigm to ensure the accurate generation of "entity-relation-entity" triples. The synchronous declaration extraction adopts the "state-declaration" dual-channel filtering mechanism to strictly screen the water conservancy dispatch corpus: the sentence must contain numerical or quantifiable parameters, be classified into one of the three categories of "condition declaration", "operation declaration" and "effect declaration", and have explicit or implicit time identification. Write in graph database in the form of edge attribute. To ensure extraction accuracy, typical declaration samples are embedded in Prompt templates to realize dynamic adaptation of business rules through the context learning ability of large language models.
[0029] Step 2.3, classification and integration prompt design: According to the field dimension, it is divided into water resources basic information, hydropower station operation data, water quantity dispatching scheme, etc. Then according to the research granularity, it is subdivided into three categories including cross-domain comprehensive description, single-domain multi-problem discussion and special problem depth analysis. The large model accurately identifies the problem category through the pre-trained domain classifier, and adopts hierarchical response mechanism: for comprehensive problems, generate multi-dimensional structured answers, and for special problems, focus on in-depth analysis to ensure that the output content not only conforms to the format specification of "problem type-answer paradigm", but also maintains professional and logical rigor, building a knowledge community with "entity-relation-declaration" as the smallest semantic unit. These community nodes form dynamically callable knowledge units in the graph database, supporting intelligent retrieval based on business priority and dynamic display of knowledge links through visualization engine. Through hierarchical abstract generation structured output, through "only answer known information" and "uncertainty annotation" double prompt, effectively suppress information illusion. At the same time, build balanced prompt strategy, synchronously contain positive (correct response example) and negative (typical error case) examples in Prompt design to ensure balanced sample distribution covering all business scenarios.
[0030] Furthermore, step three specifically includes: Step 3.1, Embedding Model Selection: To achieve efficient semantic representation and alignment of text in the field of water resource scheduling, the bge-m3 model was selected as the core embedding generation tool. During the knowledge graph construction phase, bge-m3 was used to generate embedding vectors from the extracted entity and relation description texts for subsequent semantic index construction. Step 3.2, Knowledge Graph Construction: Based on the methods in Steps 1 and 2, generate corresponding text blocks and call the large model to establish the topological structure of the knowledge graph, and store the triples in the Neo4j graph database; Step 3.3, Intelligent Question Answering System Construction: In the question answering stage, bge-m3 is used to vectorize the user query and align it with the node / edge vectors in the knowledge graph; then the question and its sub-vectors are... Figure One Input DeepSeek-R1, and the model will answer based solely on the subgraph content under the prompt constraint designed in step two, avoiding illusions. At the same time, the subgraph path will be included in the answer for front-end visualization and tracing.
[0031] Furthermore, step four specifically includes: Step 4.1, Comprehensive Evaluation: Check whether the results cover all important aspects related to the question and do not omit key information. Submit n answers to m questions from k models to experts for evaluation. For the same question, compare each answer pairwise and mark the winner, with the winner receiving 5 points, decreasing progressively. Step 4.2, Heuristic Evaluation: Take the frequency of the 0 / 1 labels matched by the regular expression along question i. Multiply by 100 to get , j represents the n repeated responses of the same model to the same problem. This indicates that the k-th model hit the heuristic regular expression in its j-th response to question i; otherwise... A successful shot is worth 5 points, and a missed shot is worth 3 points. Step 4.3, Data-driven evaluation: "Number + Source" count First cap the ceiling to 3n, then calculate the density. Then, at the problem level, average 3n ensures that the upper limit scales synchronously with n; Step 4.4, Stability Evaluation: Directly utilize repetitions of n≥3: For the same problem and the same model, take all pairwise consistency degrees and average them according to the number of combinations C(n,2). , then average , , The pairwise consistency of model k in n responses to question i is determined by n. Let be the set of characters for the j-th response of the k-th model to question i; Step 4.5, Accuracy Evaluation: Break down each answer into several verifiable propositions and count the number of hits. ,ratio , then average Mapped to levels 1–5 , Let be the number of propositions in which model k hits the correct answer in the j-th response to question i. This represents the total number of verifiable propositions that are split out from the k-th model in the j-th response to the i-th question; Step 4.6, Timeliness Evaluation: First, record the generation delay of each answer. Within the same question, sort the n delays and assign them a grading value of 5 / 4 / 3.
[0032] Example 3 Further explanation in conjunction with Example 1, such as Figures 1-4 As shown, Figure 1 As shown, the specific process of this invention includes: 1) Text preprocessing: Extract structured and unstructured data from multi-source heterogeneous data such as water conservancy literature, industry standards, and scheduling manuals, and perform data cleaning and normalization processing to convert tables into text. 2) Domain-specific prompt word optimization design: Through global role-based prompt word design, basic knowledge unit construction, classification and integration prompt word design, etc., domain-adaptive Prompt templates are generated to enhance the domain semantic understanding capability of the Large Language Model (LLM); 3) Knowledge graph construction based on Graph RAG: Using DeepSeek-R1 and bge-m3 models, a knowledge graph is formed by extracting entities and storing it in a graph database. Combined with semantic alignment and indexing, an intelligent question answering system is established to achieve accurate subgraph positioning and reliable answer generation, and support source tracing. 4) Question and answer result analysis and evaluation: The performance improvement effect of the question and answer system is verified by combining accuracy, comprehensiveness, timeliness and other methods with manual evaluation.
[0033] Taking the water allocation plan for the Han River basin as an example, the specific implementation steps are as follows: Step 1: Text Preprocessing Based on a Large Model: Tables are input into LLMs as high-resolution image formats (PNG / JPG), and target areas are visually labeled (red rectangles) to eliminate interfering information. First, a binary classification is performed based on the table title structure: tables with titles containing only a single indicator and unit are classified as "simple tables," while those with nested aggregations or multi-level semantics are classified as "complex tables." Then, all fields such as flow rate and water level are normalized to units such as m³ / s, m, and m³, removing outliers and irrelevant text (such as copyright notices). Taking the Hanjiang River Basin Dispatch Manual as an example, the raw data is cleaned to form a standardized TXT text set.
[0034] Step Two: Optimization Design of Prompt Keywords in the Field of Water Resource Allocation: First, based on the disciplinary classification system of the target field of water resources, which includes hydrology, water resources management, water conservancy engineering, etc., the roles are mapped to specific branches. For example, "water conservancy expert" can be further subdivided into "hydrologist and water resources scientist" or "water conservancy engineering expert," etc., to ensure that their knowledge scope is focused on a specific subfield (such as water resources allocation). Second, the core competencies of the roles are defined through basic domain concepts (such as "river flow" and "natural drop") and task types (such as data analysis). For example, this study explicitly limits the role to "answering water resources questions based on data," avoiding knowledge generalization.
[0035] The classification criterion is based on the entity's role in the business chain, rather than general semantics. Candidate triples must simultaneously contain a complete closed loop such as "infrastructure-action-constraint" or "subject-behavior-object," and highly represent core business scenarios such as water resource allocation and flood control. They are then output in the format of "entity-relationship-entity," as shown below. Figure 2 As shown, the type and confidence level are labeled on the relation side.
[0036] Nodes are written with entity attributes and source metadata, and the structured results are ultimately imported into a graph database, achieving accurate conversion from unstructured text to a knowledge graph. A few-sample paradigm is applied to ensure accurate conversion from unstructured text to a knowledge graph. For example, input: Shiquan Hydropower Station was completed in July 1975 and is a seasonal regulating reservoir power station. Output: Shiquan Hydropower Station - Reservoir Type - Seasonal Regulating Reservoir Power Station.
[0037] In the water conservancy scheduling corpus, sentences are filtered according to a dual-channel rule of "state-declaration". Sentences must simultaneously meet the following criteria: containing numerical values or quantifiable descriptions, belonging to one of the three declaration categories, and having a specific or default time period. Sentences without numerical values or water conservancy business verbs are directly filtered. The filtered sentences are uniformly parsed, with the subject added, elements extracted, and types and states labeled. The results are written to the edge attributes of the graph database, and examples are input into the Prompt to ensure accuracy.
[0038] For example, if the input is: the average surface water resources from 1956 to 2010 is 550.89, and the cv value is 0.322, the output will be: [Subject: Target watershed | Object: Average precipitation | Type: Climate statistics | Status: TRUE | Value: 550.89 | Time period: 1956–2010].
[0039] From the extracted knowledge units such as reservoirs, a knowledge community is formed with the "entity-relationship-declaration" triple as the smallest granularity, which can independently support the water resource scheduling business chain.
[0040] For each qualified community, the large-scale driver outputs a fixed template: a one-sentence summary of the community's theme, outputting a JSON array where each line contains the entity name, entity type, entity-relationship-entity sequence, and score. After parsing, the array is directly written to the community node in the graph database for subsequent priority sorting and visualization. For example: Theme: Joint Scheduling of the Minjiang and Tuojiang River Cascade Reservoir Group. Community output: Entity: Minjiang and Tuojiang River, Type: River Section, Description: Includes 35 reservoirs and 4 water diversion projects, Relationship: Minjiang and Tuojiang River. reservoir Water supply capacity, score: 9.2.
[0041] The final integration step embeds text from scheduling reports, scheduling plans, and other sources into a single vector space. First, core conclusions are generated, then key data and examples are retained. The final output is a structured summary, emphasizing key points to consider in each step. The model is explicitly required to "answer only with known information" or "label uncertainty" to reduce illusion problems. For example, the objective can be set to: "If you don't know the answer, just say so; don't make anything up." Step 3: Construction of a Knowledge Graph and Question-Answering System for Water Resource Scheduling Based on Graph RAG: The triples extracted in Step 2, such as "Shiquan Reservoir - Minimum Discharge Flow - 40 m³ / s", are stored in Neo4j to form the corresponding knowledge graph. When querying "Ankang Reservoir Scheduling Rules": 1) Locate the Ankang Reservoir node using model vector retrieval; 2) Obtain the "Ankang Hydropower Station Dispatch Regulations" by following the "Dispatch Basis" relationship chain; 3) The intelligent question-answering system combines Prompt templates to generate structured answers containing procedure clause numbers and annotates data sources, such as... Figure 3 As shown.
[0042] Step 4: Analysis and Evaluation of Intelligent Question Answering Results: Taking the water consumption of the Hanjiang River Basin in Henan Province from November 2013 to October 2014 as an example, the six indicators of the three models are evaluated respectively, and verified through secondary evaluation using a large model: ①Comprehensiveness: The three models' three answers to the same question were submitted to experts for evaluation. Through pairwise comparisons, the winner was marked with 5 points, decreasing progressively. The expert scores were consistent with the scores of the larger model. Model 3's answer was more comprehensive, not only including data from various cities, but also analyzing seasonal characteristics and regional differences. ② Heuristic: Model 1's answer hits the regular expression and contains a heuristic question; assuming it hits, it gets 5 points. Model 2 and Model 3's answers do not hit the regular expression and each gets 3 points. ③ Data accuracy: Model 1 provides data but does not specify the source, N ijk Lower, d ijk =0.6, score 3 points. Model 2 provides data with partial source annotations. N ijk Higher, d ijk =0.8, score 4 points. Model 3 provides data and has more complete source labeling. N ijk Higher, d ijk =1, get 5 points; ④ Stability: Model 1 provided three different answers to the same question, including significant fluctuations in the data range. ik =0.4, score 2 points. Model 2's answer structure is consistent, and the data is stable. A ik =0.8, score 4 points, Model 3 answers are highly consistent, A ik =1, get 5 points; ⑤ Accuracy: The data provided by Model 1 contains illusions, i.e., fabricated data. T k =0.6, score 3 points, Model 2 data is more accurate, T k =0.8, score 4 points. Model 3 data is accurate and sourced clearly. T k =1, get 5 points; ⑥ Timeliness: Model 2 had the longest response time of 20 seconds, Model 3 had the shortest of 7 seconds, and Model 1 was in between at around 10 seconds, assigned scores of 5 / 4 / 3 respectively. The scores for all indicators are shown in Table 1. Table 1 Evaluation metrics and scores for different models
[0043] Example 4 When deploying a Graph RAG-based water resource scheduling knowledge question-and-answer system, the following steps should be followed, and all software and modules used should be selected based on the core requirements of system construction and evaluation: First, we deploy the data preprocessing stage, using the Python programming language and Pandas and NumPy libraries to process multi-source heterogeneous data such as water conservancy literature, industry standards, and scheduling manuals. We use a combination of manual and large-scale modeling to read and transform tabular data (converting tables into text), and use NumPy for data cleaning and normalization (unifying the units of fields such as flow rate and water level, and removing abnormal and irrelevant data). At the same time, we can use Python's re library to perform preliminary screening of text content to ensure data standardization. Next, the Prompt optimization design phase is deployed. Based on the Python environment, a Prompt template generation module is built, defining a dedicated Prompt template containing water conservancy professional terms and reasoning logic. At the same time, a few-shot learning function is integrated. By inputting labeled "entity-relationship-entity" triple samples in the water conservancy field, the ability of the large language model to recognize water conservancy professional terms is optimized. During this process, a pre-trained text classification model (such as the BERT model) can be loaded with the Hugging Face Transformers library to build a pre-trained domain classifier to achieve accurate identification of the question category. Then, the knowledge graph and question-answering system are deployed. Neo4j is selected as the graph database to store the "entity-relationship-declaration" triples constructed through entity extraction. The py2neo library in Python is used to implement interaction with Neo4j (such as writing triples and establishing the knowledge graph topology). The embedding model bge-m3 is selected and loaded through the HuggingFace Transformers library to generate embedding vectors for semantic index construction. The core model of the intelligent question-answering system adopts DeepSeek-R1 to realize the alignment of user query vectorization with knowledge graph node / edge vectors, thereby completing accurate subgraph positioning.
[0044] Finally, the web service interface of the question-answering system is built using Flask or FastAPI frameworks to realize user query reception, answer generation, and subgraph path return, supporting front-end visual traceability. The final deployment stage involves intelligent question-answering result analysis and evaluation. The existing intelligent question-answering system is compared with three models: one with a general prompt and one with an optimized prompt. This verifies the performance improvement of the question-answering system. The front-end visualization part can be built using Vue.js or React frameworks to visualize question-answering results, knowledge graph subgraph paths, and provide an intuitive presentation of evaluation results.
[0045] The above embodiments are merely preferred technical solutions of the present invention and should not be considered as limitations on the present invention. The scope of protection of the present invention should be limited to the technical solutions described in the claims, including equivalent substitutions of the technical features described in the claims. That is, equivalent substitutions and improvements within this scope are also within the scope of protection of the present invention.
Claims
1. A method for constructing and evaluating a knowledge-based question-answering system for water resource scheduling based on Graph RAG, characterized by: The method includes: S1. Extract structured and unstructured data from multi-source heterogeneous data such as literature, industry standards, and dispatch manuals in the water conservancy field, and perform data cleaning and normalization processing to convert tables into text. S2. By combining entities and relationships from the knowledge graph, a Prompt text template adapted to the water resource allocation domain is generated to enhance the domain semantic understanding capability of the large language model. S3. Using DeepSeek-R1 and bge-m3 models, a knowledge graph is formed by extracting entities and storing it in a graph database. Combined with semantic alignment and indexing, an intelligent question answering system is established to achieve accurate subgraph positioning and reliable answer generation, and support source tracing. S4. The output results of the intelligent question-answering system are evaluated using a combination of accuracy, comprehensiveness, timeliness, and human evaluation. The performance improvement effect of the question-answering system is verified based on the evaluation results.
2. The method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG as described in claim 1, characterized in that: In S1, structured and unstructured data are merged. The fusion process includes table-to-text conversion, table header type classification, and fusion with text. The table header type is classified as follows: "simple table" is one where the header contains only a single indicator and dimension, and "complex table" is one where the header has nested aggregations or multi-level semantics. Normalization also includes standardizing the units of flow rate and water level fields, as well as removing abnormal and irrelevant data.
3. The method for constructing and evaluating a knowledge-based question-and-answer system for water resource scheduling according to claim 1, characterized in that: S2 specifically includes the following steps: A1. By combining task decomposition with domain-specific guidance, a "step-by-step reasoning" strategy is used to break down complex tasks into a sequence of executable sub-tasks. Structured prompts are used to guide the large model to establish a systematic thinking path and to construct fine-grained expert role mappings, so that the response content is limited to the scope of water conservancy. A2. Employ a method that integrates entity extraction and declaration extraction to form knowledge units with business closed-loop characteristics; Entity extraction is based on the functional roles in the business chain as the core criterion. Candidate triples adopt a complete business closed-loop model of "infrastructure, action, constraint" or "subject, behavior, object", and the triples correspond to water resource scheduling and flood control and disaster reduction scenarios. During the extraction process, the model's ability to recognize water conservancy professional terms is optimized through a few-shot learning paradigm. The few-shot learning paradigm is as follows: 50-100 sets of labeled "entity-relationship-entity" triple samples in the water conservancy field are selected as training set and input into the large model for parameter fine-tuning. The declaration extraction process employs a "state-declaration" dual-channel filtering mechanism to process the water conservancy scheduling corpus. Specifically, the "state-declaration" dual-channel filtering mechanism is as follows: The first channel performs "state verification" on the corpus to determine whether the corpus contains explicit or implicit time markers; the second channel performs "declaration classification" on the corpus, classifying the corpus into one of the three categories of "condition declaration", "operation declaration" and "effect declaration", while verifying whether the corpus contains numerical values or quantifiable parameters. The corpus validated only through two channels is written into the graph database in the form of edge attributes; the number of samples in the input prompt template should not be too large, no more than 5 groups. A3. It is divided into three major categories according to the domain dimension: basic water resources information, hydropower station operation data, and water dispatching scheme. Then, it is further subdivided into paragraph types according to the research granularity. The paragraph types include three categories: cross-domain comprehensive description, single-domain multi-issue discussion, and in-depth analysis of specific issues. The large model identifies problem categories through a pre-trained domain classifier. The pre-trained domain classifier is constructed by using 500-1000 text data items labeled with problem categories in the water conservancy field as the training set and training them with the BERT model. The large model adopts a hierarchical response mechanism to output content, generates structured output through hierarchical summarization, and suppresses information illusion through dual prompts of "only answering known information" and "uncertainty labeling". At the same time, the Prompt design includes positive and negative examples to form a balanced prompt strategy. The balanced prompt strategy is as follows: the ratio of positive to negative examples is 1:1, and it covers business types in water resource scheduling and flood control and disaster reduction scenarios.
4. The method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG as described in claim 1, characterized in that: S3 specifically includes the following steps: B1. The bge-m3 model is selected as the core embedding generation tool. In the knowledge graph construction stage, bge-m3 is used to generate embedding vectors for the extracted entity and relation description text, which are then used for subsequent semantic index construction. B2. Based on the text preprocessing results of S1 and the prompt word optimization design method of S2, generate corresponding text blocks and call the large model to establish the topological structure of the knowledge graph and store the triples in the Neo4j graph database. B3. During the question-and-answer phase, bge-m3 is used to vectorize user queries and align them with the node / edge vectors in the knowledge graph. Input the question and the subgraph into DeepSeek-R1. The model will answer based on the subgraph content under the prompt constraints designed in S2, and will also include the subgraph path in the answer for front-end visualization and tracing.
5. The method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG as described in claim 1, characterized in that: The comprehensive evaluation and feedback control in S4 specifically includes the following steps: This evaluation criterion assesses the model before and after the modification prompt compared to the existing model, without designing a threshold. C1. Collect n responses from k models to m questions; C2. The collected answers are evaluated by experts, and winners are identified by comparing them in pairs for the same question. C3. The evaluation results are scored, with the winner receiving 5 points and the rest receiving points decreasing step by step according to the comparison results. The scores are used to determine whether the answers cover all important aspects related to the question.
6. The method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG as described in claim 5, characterized in that: S4 The heuristic evaluation and feedback control in this context specifically includes the following steps: D1. Definition ,in This indicates that the k-th model hits the heuristic regular expression in its j-th response to question i. This indicates a miss, where j represents the n repeated responses of the same model to the same problem; D2, Calculation The calculation formula is: ; D3、 Multiply by 100 to get ,calculate The calculation formula is: ; D4. Score based on whether the hit is successful: 5 points for a successful hit and 3 points for a missed hit.
7. The method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG as described in claim 5, characterized in that: S4 The data-driven evaluation and feedback control in this process specifically includes the following steps: E1. Counting based on "number + source" ,Will Capped at 3n; E2, Calculate density The calculation formula is: ; E3. Calculate the average value at the problem level. The calculation formula is: , where m is the number of questions.
8. The method for constructing and evaluating a knowledge-based question-and-answer system for water resource scheduling according to claim 5, characterized in that: The stability evaluation and feedback control in S4 specifically include the following steps: F1. For the same question and the same model, obtain n≥3 repeated answers, define... Let be the set of characters for the j-th response of the k-th model to question i; F2. Calculate pairwise consistency. The calculation formula is: ,in It is the number of combinations; F3, Calculate the stability score The calculation formula is: ; F4. Calculate the average score at the question level. The calculation formula is: .
9. The method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG as described in claim 5, characterized in that: S4 The accuracy evaluation and feedback control in the process specifically includes the following steps: G1, decompose the j-th response of the k-th model to question i into several verifiable propositions, and define... Let be the number of propositions in which model k correctly answers question i in its j-th response. This represents the total number of verifiable propositions extracted from this response. G2, Calculation accuracy ratio The calculation formula is: ; G3. Calculate the average ratio at the problem level. The calculation formula is: ; G4, will Mapped to levels 1–5, the final accuracy score is obtained: .
10. The method for constructing and evaluating a water resource scheduling knowledge question-answering system based on Graph RAG according to claim 1, characterized in that: S4 The timeliness evaluation and feedback control in the process specifically includes the following steps: H1, record the generation delay of the j-th answer of the k-th model to question i; H2. Within the same problem i, sort the n delays in ascending order; H3. Assign scores based on the sorting results: the shortest delay is assigned 5 points, the middle delay is assigned 4 points, and the longest delay is assigned 3 points, thus obtaining the timeliness score.
11. A knowledge-based question-and-answer system for water resource scheduling based on Graph RAG, characterized by: It includes a data preprocessing module, a Prompt optimization module, a knowledge graph and question answering system construction module, and an evaluation and feedback optimization module; The data preprocessing module is used to perform step S1 in claim 1, extracting data from multi-source heterogeneous data in the water conservancy field and performing normalization processing; The Prompt optimization module is used to execute step S2 in claim 1 to generate a Prompt text template adapted for the field of water resource allocation. The knowledge graph and question answering system construction module is used to perform step S3 in claim 1, to construct a knowledge graph and establish an intelligent question answering system; The evaluation and feedback optimization module is used to perform step S4 in claim 1 to evaluate and verify the performance improvement effect of the question-answering system on the question-answering results.