A dynamic knowledge base enhanced iterative domain knowledge graph construction method

By employing a method of dual-source context fusion generation, rule verification and knowledge base constraint error correction, and weighted entity filtering and iterative optimization, the adaptability and accuracy issues of domain knowledge graph construction in existing technologies are solved, achieving efficient and automatic knowledge graph construction and improving triple coverage and construction efficiency.

CN122489734APending Publication Date: 2026-07-31BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIHANG UNIV
Filing Date
2026-03-30
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing domain knowledge graph construction technologies suffer from problems such as poor domain adaptability, contextual noise interference, knowledge illusion, and insufficient triple coverage in scenarios with few samples, making it difficult to achieve high-precision, fully automated professional domain knowledge graph construction.

Method used

A dual-source context fusion generation step is adopted, and error correction is achieved through a dual mechanism of rule verification and knowledge base constraints. Combined with weighted entity screening and iterative optimization, triples are generated and corrected using a large language model. A multi-objective iterative optimization function is set to balance accuracy, domain specificity and redundancy.

Benefits of technology

It achieves fully automated and high-precision construction of professional domain knowledge graphs, solves the problems of contextual noise, knowledge illusion and iterative redundancy, and improves triple coverage and construction efficiency in scenarios with few samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122489734A_ABST
    Figure CN122489734A_ABST
Patent Text Reader

Abstract

This invention relates to the field of natural language processing and knowledge graph construction technology, and discloses an iterative domain knowledge graph construction method that integrates dynamic knowledge base enhancement. This method introduces dual context from both the domain corpus and the knowledge base through a dual-source context fusion generation step, solving the contextual noise and few-sample adaptation problems of LLMs; it suppresses knowledge illusion and error propagation through a dual-constraint verification and error correction step combining rule verification and knowledge base consistency checks; it reduces redundancy by optimizing entity selection and iteration direction through a weighted entity selection iterative optimization step; and finally, it achieves fully automated and high-precision construction of a professional domain knowledge graph by balancing accuracy, domain specificity, and redundancy through a multi-objective iterative optimization function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing and knowledge graph construction technology, specifically to an iterative domain knowledge graph construction method that integrates dynamic knowledge base enhancement. Background Technology

[0002] Knowledge graphs, as the core carrier of structured knowledge, use a triplet structure ("head entity-relationship-tail entity") to standardize and organize domain knowledge. Leveraging this triplet structure, knowledge graphs play an irreplaceable role in a range of knowledge-intensive tasks such as question answering, intelligent decision-making, and precise recommendation, providing crucial knowledge support for the intelligent upgrading of various industries. However, despite the widespread recognition of the application value of knowledge graphs, existing domain knowledge graph construction technologies still suffer from several core shortcomings that urgently need to be addressed. These shortcomings severely restrict the transition of knowledge graphs from technological research and development to large-scale industrial application, becoming a major bottleneck in the current development of the industry.

[0003] The three main technical approaches to constructing domain knowledge graphs all have significant limitations: rule-driven methods rely on manually designed rules, resulting in poor domain adaptability, high redundancy in extraction, and weak scalability for new domains; large language model-driven methods, while reducing human intervention, are susceptible to contextual noise and suffer from prominent knowledge illusion problems, and have insufficient triple coverage in scenarios with few samples; knowledge base-assisted methods, while providing contextual assistance, lack iterative pruning mechanisms and rely solely on knowledge base consistency verification, resulting in a single verification method that cannot effectively filter out format errors, logical conflicts, and other issues, making it difficult to support the construction of high-quality knowledge graphs.

[0004] Therefore, the current construction of domain knowledge graphs urgently needs an integrated solution that can simultaneously solve contextual noise, knowledge illusion, few-sample adaptation, and iterative redundancy, without requiring a large amount of manual annotation or rule design, and achieve fully automatic, high-precision, and highly domain-specific knowledge graph construction. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides an iterative domain knowledge graph construction method that integrates dynamic knowledge base enhancement, which has the advantages of fully automatic and high-precision knowledge graph construction, and solves the aforementioned technical problems.

[0006] To achieve the above objectives, the present invention provides the following technical solution: an iterative domain knowledge graph construction method integrating dynamic knowledge base enhancement, comprising the following steps: S1: From the domain corpus and auxiliary knowledge base Retrieve relevant context from the middle to provide enhanced input for the large language model and generate the first... Layer triple set ; S2: Detects and corrects the first step through a dual mechanism of rule validation and knowledge base constraints. Layer triple set Output the incorrect triplet in the input, and output the first one. Set of effective triplets ; S3: Determine the first Set of effective triplets Does the mid-tail entity need to be the next-level core entity? Output the filtered entity set and the final graph layer ; S4: Set the objective function for iterative optimization and perform iterative output. Stop iterating when the improvement rate of the objective function value is less than 1% or the number of iterations reaches the preset maximum value. The iterative optimization specifically involves maximizing the accuracy, domain specificity, and minimizing redundancy of the knowledge graph.

[0007] As a preferred embodiment of the present invention, step S1 includes the following steps: S1.1: Corpus of Computational Domain The relevance scores of core entities and sentences in the corpus are calculated, ranked, and retrieved. Top-m Related sentences constitute the domain context ; S1.2: From the auxiliary knowledge base Retrieve entity-related knowledge base triples Sentence-Triple Example Pair ; S1.3: Domain Context Knowledge base triples Sentence-Triple Example Concatenate the data into an LLM input using a fixed format. , generate the first Layer triple set The specific expression is: in, Indicates the first Layer triple set, Represents the LLM model. τ For the temperature parameters of LLM, Indicates the first Core entity of the layer.

[0008] As a preferred technical solution of the present invention, the computational domain corpus in step S1.1 The specific expressions for the relevance scores of core entities and sentences in the corpus are as follows: in, Representation domain corpus The relevance score between core entities and sentences in the corpus. As the core entity, Indicates the first Core entity set of layers For the corpus sentences, This represents the term frequency-inverse document frequency score. Indicates the BM25 search score; In S1.2, from the auxiliary knowledge base Retrieve entity-related knowledge base triples Sentence-Triple Example Pair Specifically, it includes: S1.2.1: Cosine Similarity Retrieval and Core Entities Based on MiniLM Embedding Related Top-n Triples as knowledge base triples The specific expression is as follows: in, As the core entity, Indicates the head entity. Indicates a relationship. Indicates the tail entity. This indicates string concatenation. Represents cosine similarity. Represents the embedding function of the MiniLM model. Represents a knowledge base triple T Similarity between the core entity e and the knowledge base triples; S1.2.2: In the auxiliary knowledge base Searching for semantic similarity with domain context Top-l A sentence-triple pair, as an example sentence-triple pair The specific expression is as follows: in, Represents the domain context. For knowledge base sentences, For sentences The corresponding set of triples, To express summation, This represents the number of sentences in the corpus contained in the k-th layer domain context. This represents the similarity between the domain context and the knowledge base sentence-trine pair in the sentence-trine.

[0009] As a preferred technical solution of the present invention, step S2 specifically includes the following steps: S2.1: For the first Layer triple set The error detection score for each triplet is given by the following expression: in, Indicates the first Layer triple set The triplet in the middle, , For the head entity, For the relationship, For tail entities, This indicates the rule validation score. To score the knowledge base constraints, , Indicates the error detection score weight. Indicates the first Layer triple set Error detection score for each triple; S2.2: For The triplet generates a redial message based on the error type, which is then corrected via LLM, specifically as follows: in, This indicates the correct result after correction. This indicates string concatenation. τ The temperature parameter of the LLM mainly controls the output stability. Error type, In response to the correction prompt, Indicates the error threshold. Indicates the first Layer triple set The triplet in; S2.3: Filter to obtain the first Set of effective triplets The specific expression is as follows: in, Represents the union, Indicates that, This indicates the correct result after correction. Indicates the error threshold. The error detection score represents the corrected result.

[0010] As a preferred technical solution of the present invention, the rule verification score The specific expression is as follows: The knowledge base constraint score The specific expression is as follows: in, express Middle head entity The corresponding set of all relations, For the relationship, express The relationship between them.

[0011] As a preferred embodiment of the present invention, step S3 includes the following steps: S3.1: Calculate the first... Set of effective triplets Each tail entity The pruning decision score is expressed as follows: in, Represents tail entity The pruning decision score, , To prune the decision score weights, This represents the output of the T5 classifier, used to indicate the suitability of the current entity as a head entity. Represents tail entity Context relevance score; S3.2: When ≥Pruning threshold At that time, the tail entity Add the next layer of core entities Otherwise, the entity is determined to be a tail entity and subsequent generated content is deleted; The knowledge graph is updated using the following expression: in, Indicates the first Layered knowledge graph, Represents the union, Indicates the first The set of effective triples at each level Indicates the first Core entity set of the layer.

[0012] As a preferred technical solution of the present invention, the tail entity The context relevance score is specifically for tail entities. domain corpus and auxiliary knowledge base The correlation is expressed as follows: in, express, Represents tail entity Similarity to triples in the k-th layer knowledge base Represents the domain context of the k-th layer. This represents a triplet in the knowledge base.

[0013] As a preferred embodiment of the present invention, the specific expression of the objective function is as follows: in, , This indicates the number of top results retrieved from the domain corpus. This indicates the number of top results retrieved from the knowledge base triplet retrieval. This indicates the number of top retrieved sentences-triple pairs. As the weight for error detection scoring, To prune the decision score weights, Indicates the error threshold. Indicates the pruning threshold. , , The target weight coefficient, Indicates precision. Indicates domain specificity. Indicates redundancy.

[0014] As a preferred technical solution of the present invention, the accuracy The specific expression is as follows: in, Indicates the first The number of triples contained in the set of valid triples at each level. Indicates the first The number of triples contained in the set of layer triples; Domain specificity The specific expression is as follows: in, This indicates an auxiliary knowledge base; The redundancy The specific expression is as follows: in, and Denotes the set of valid triples at level k. Any two triples in the set, Represents the embedding function of the MiniLM model. This indicates string concatenation. Represents cosine similarity. , and They represent triples respectively. Head entities, relationships, and tail entities , and They represent triples respectively Head entities, relationships, and tail entities.

[0015] Compared with existing technologies, this invention provides an iterative domain knowledge graph construction method that integrates dynamic knowledge base enhancement, which has the following beneficial effects: This invention addresses the contextual noise and few-sample adaptation issues of LLMs by introducing dual contextual corpora and knowledge bases through a dual-source contextual fusion generation step. It suppresses knowledge illusions and error propagation through a dual-constraint verification and error correction step that combines rule verification and knowledge base consistency checks. Furthermore, it reduces redundancy by optimizing entity selection and iteration directions through a weighted entity selection iterative optimization step. Finally, it achieves fully automated, high-precision construction of professional domain knowledge graphs by balancing accuracy, domain specificity, and redundancy through a multi-objective iterative optimization function. Attached Figure Description

[0016] Figure 1 It is a flowchart of the iterative domain knowledge graph construction process that integrates dynamic knowledge base enhancement; Figure 2 This is an example diagram of the domain corpus D; Figure 3 This is an example diagram of the auxiliary knowledge base (KB). Figure 4 This is an example diagram of triple generation at level 0; Figure 5 This is an example diagram of effective triplets at level 0; Figure 6 This is an example diagram of valid triples at level 0 and core entities at level 1; Figure 7 This is a list of knowledge graph triple results. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Please see Figures 1-7The knowledge graph construction framework comprises three core steps: Dual-Source Context Fusion Generation (DSFD), Dual-Constraint Verification and Error Correction (DCVC), and Weighted Entity Filtering Iterative Optimization (WEFI). The DSFD step introduces dual contexts from the domain corpus and knowledge base, addressing the contextual noise and few-sample adaptation issues inherent in LLMs. The DCVC step combines rule verification and knowledge base consistency checks to suppress knowledge illusions and error propagation. The WEFI step optimizes entity filtering and iteration direction, reducing redundancy. Finally, a multi-objective iterative optimization function balances accuracy, domain specificity, and redundancy, achieving fully automated, high-precision construction of a professional domain knowledge graph. Its framework formula is as follows: in, G (k) For the first k Layered knowledge graph, E (k) For the first k Core entity set of layers D For domain corpus, KB To support the knowledge base (which consists of a domain corpus) D It is constructed from a portion of the data in the middle. KB The knowledge base stores triple data and the original statements that generated the triples. An iterative domain knowledge graph construction method integrating dynamic knowledge base enhancement includes the following steps: S1: From the domain corpus and auxiliary knowledge base Retrieve relevant context from the middle to provide enhanced input for the large language model and generate the first... Layer triple set ; S1 includes the following steps: S1.1: Corpus of Computational Domain The relevance scores of core entities and sentences in the corpus are calculated, ranked, and retrieved. Top-m Related sentences constitute the domain context ; S1.1 Computational Domain Corpus The specific expressions for the relevance scores of core entities and sentences in the corpus are as follows: in, Representation domain corpus The relevance score between core entities and sentences in the corpus. As the core entity, Indicates the first Core entity set of layers For the corpus sentences, This represents the term frequency-inverse document frequency score. Indicates the BM25 search score; S1.2: From the auxiliary knowledge base Retrieve entity-related knowledge base triples Sentence-Triple Example Pair ; From the auxiliary knowledge base in S1.2 Retrieve entity-related knowledge base triples Sentence-Triple Example Pair Specifically, it includes: S1.2.1: Cosine Similarity Retrieval and Core Entities Based on MiniLM Embedding Related Top-n Triples as knowledge base triples The specific expression is as follows: in, As the core entity, Indicates the head entity. Indicates a relationship. tail Indicates the tail entity. This indicates string concatenation. Represents cosine similarity. Represents the embedding function of the MiniLM model. Represents a knowledge base triple T Similarity between the core entity e and the knowledge base triples; S1.2.2: In the auxiliary knowledge base Searching for semantic similarity with domain context Top-l A sentence-triple pair, as an example sentence-triple pair The specific expression is as follows: in, Represents the domain context of the k-th layer. For knowledge base sentences, For sentences The corresponding set of triples, To express summation, This represents the number of sentences in the corpus contained in the k-th layer domain context. This represents the similarity between the domain context and the knowledge base sentence-truncation pairs in the sentence-truncation pair. S1.3: Domain Context Knowledge base triples Sentence-Triple Example Concatenate the data into an LLM input using a fixed format. , generate the first Layer triple set The specific expression is: in, Indicates the first Layer triple set, Represents the LLM model. τ For the temperature parameters of LLM, Indicates the first Core entity of the layer; S2: Detects and corrects the first step through a dual mechanism of rule validation and knowledge base constraints. Layer triple set Output the incorrect triplet in the input, and output the first one. Set of effective triplets 、; S2 specifically includes the following steps: S2.1: For the first Layer triple set The error detection score for each triplet is given by the following expression: in, Indicates the first Layer triple set The triplet in the middle, , For the head entity, For the relationship, For tail entities, This indicates the rule validation score. To score the knowledge base constraints, , Indicates the error detection score weight; Rule verification score The specific expression is as follows: Knowledge base constraint score The specific expression is as follows: in, express Middle head entity The corresponding set of all relations, For the relationship, express The relationship between them; S2.2: For The triplet generates a redial message based on the error type, which is then corrected via LLM, specifically as follows: in, This indicates the correct result after correction. This indicates string concatenation. τ The temperature parameter of the LLM mainly controls the output stability. Error type, In response to the correction prompt, Indicates the error threshold; S2.3: Filter to obtain the first Set of effective triplets The specific expression is as follows: in, Represents the union, Indicates that, This indicates the correct result after correction. Indicates the error threshold. An error detection score representing the corrected result; S3: Determine the first Set of effective triplets Does the mid-tail entity need to be the next-level core entity? Output the filtered entity set and the final graph layer ; S3 includes the following steps: S3.1: Calculate the first... Set of effective triplets Each tail entity The pruning decision score is expressed as follows: in, Represents tail entity The pruning decision score, , To prune the decision score weights, This represents the output of the T5 classifier, used to indicate the suitability of the current entity as a head entity. Represents tail entity Context relevance score; Tail entity The context relevance score is specifically for tail entities. domain corpus and auxiliary knowledge base The correlation is expressed as follows: in, Represents tail entity and the Sentence similarity in the layered knowledge base corpus Represents tail entity Similarity to triples in the k-th layer knowledge base Represents the domain context. Represents a knowledge base triple; S3.2: When ≥Pruning threshold At that time, the tail entity Add the next layer of core entities Otherwise, the entity is determined to be a tail entity and subsequent generated content is deleted; The knowledge graph is updated using the following expression: in, Indicates the first Layered knowledge graph, Represents the union, Indicates the first The set of effective triplets at each level; S4: Set the objective function for iterative optimization and perform iterative output. Stop iterating when the improvement rate of the objective function value is less than 1% or the number of iterations reaches the preset maximum value. The specific expression of the objective function is as follows: in, , This indicates the number of top results retrieved from the domain corpus. This indicates the number of top results retrieved from the knowledge base triplet retrieval. This indicates the number of top retrieved sentences-triple pairs. As the weight for error detection scoring, To prune the decision score weights, Indicates the error threshold. Indicates the pruning threshold. , , The target weight coefficient, Indicates precision. Indicates domain specificity. Indicates redundancy; accuracy The specific expression is as follows: in, Indicates the first The set of effective triples at each level Indicates the first Layer triple set, Indicates the first The number of triples contained in the set of valid triples at each level. Indicates the first The number of triples contained in the set of layer triples; Domain specificity The specific expression is as follows: in, This indicates an auxiliary knowledge base. Indicates the first The number of triples contained in the set of valid triples at each level. Indicates the first The number of triples contained in the set of layer triples; Redundancy The specific expression is as follows: in, and Denotes the set of valid triples at level k. Any two triples in the set, Represents the embedding function of the MiniLM model. This indicates string concatenation. Represents cosine similarity. , and They represent triples respectively Head entities, relationships, and tail entities , and They represent triples respectively Head entities, relationships, and tail entities; The iterative optimization specifically involves maximizing the accuracy, domain specificity, and minimizing redundancy of the knowledge graph; Example: This implementation uses pharmaceutical data as an application scenario to construct a knowledge graph in the field of medical technology, and specifically implements an iterative domain knowledge graph construction method that integrates dynamic knowledge base enhancement. The core parameters of the model are set as follows: Top number of domain corpus retrieval m=5, Top number of knowledge base triple retrieval n=3, Top number of sentence-tripet example pair retrieval l=2, Error detection scoring weights α=0.6 and β=0.4, Pruning decision scoring weights γ=0.5 and δ=0.5, Error threshold θ=0.7, and Pruning threshold... =0.6, LLM temperature parameter τ=0.1, iterative optimization objective weights w 1 = 0.4 w 2 = 0.3, w 3 = 0.3.

[0019] In this embodiment, the large language model used is ChatGLM3-6B, the embedding model is MiniLM-L6-v2, the classifier is T5-small, and the rule base includes four categories of verification rules: naming conventions, attribute type consistency, head and tail entity conflict, and relationship rationality. 1. Data preparation: (1) Domain Corpus D: Taking the medical technology field as an example, journal articles in the medical technology field are selected as the domain corpus. After cleaning and deduplication, a structured corpus sentence set is obtained. The example data is related to the medical technology field and contains more than 1,000 valid corpus sentences. Some data examples are shown below. Figure 2 ; (2) Auxiliary Knowledge Base KB: 30% of the corpus is extracted from the domain corpus D to construct the auxiliary knowledge base KB. KB stores triple data and the original sentences that generate triples, and also includes sentence-triple example pairs to provide reference examples for the model. Some KB example data are as follows: Figure 3 ; (3) Initial core entity set E(0): Select core entities in the field of medical technology as the initial core entity set of the 0th layer, with a total of n core entities, specifically: E(0) = [Application of ginseng acidic polysaccharide in the treatment of premature ovarian failure, patient care assistance system based on artificial intelligence, application of dehydrolecithin in the preparation of wound healing drugs, bioactivity of Chinese herbal plant polysaccharides, an analysis method for the therapeutic effect of acupuncture and massage...].

[0020] (4) Rule Base: Construct a rule base specifically for the medical technology field, containing 4 types of core validation rules, which serve as the basis for dual constraint validation. Examples of the rules are shown below: Naming conventions: Entity names must conform to the naming principles of generic medical technology names. Non-standardized terms are prohibited. For example, "ginseng polysaccharide" should be corrected to "ginseng acidic polysaccharide / ginseng neutral non-amyloid polysaccharide".

[0021] Consistent attribute types: The types of the head and tail entities corresponding to the relationship are fixed. For example, the head entity of "Applied To" must be "Technology / Results", and the tail entity must be "Application Field".

[0022] Head-to-tail entity conflict: Triplets with logical conflicts are prohibited. For example, "Acupuncture and massage analysis method, applied to anti-tumor drug research and development" has no basis in traditional Chinese medicine and is judged as conflict.

[0023] Reasonableness of relationships: Relationships in the field of medical technology must conform to common sense, such as the head entity of "undertaking" being "technology / method" and the tail entity being "personnel"; 2. Dual-source context fusion generation Using the initial core entity set at layer 0 as input, dual-source contexts are retrieved from the domain corpus and knowledge base to construct LLM-enhanced input and generate a set of triples at layer 0. This is achieved in three sub-steps.

[0024] Domain Corpus Retrieval: Based on core entities, the relevance between entities and sentences in the corpus is calculated using a combination of TF-IDF and BM25 relevance scoring methods. The five most relevant sentences are retrieved to form the domain context. Taking the core entity "a method for analyzing the therapeutic effect of acupuncture and massage" as an example, the relevance score calculation results are shown in Table 1 below: Table 1 (1) Dynamic retrieval of knowledge base: Entity-related triples and sentence-triple example pairs are retrieved from the auxiliary knowledge base, and the similarity is calculated based on cosine similarity of MiniLM embedding.

[0025] 1) Entity-related triplet retrieval: Retrieves the top-3 triplets related to the initial core entity set, yielding: ["An analytical method for the therapeutic effect of acupuncture and massage", "related to", "viscoelastic mechanical parameters of tissues"], ["Application of ginseng acidic polysaccharide in the treatment of premature ovarian failure", "related to", "treatment of premature ovarian failure"], ["Artificial intelligence-based patient care assistance system", "related to", "optimization of nursing strategies"] 2) Sentence-trine example pair retrieval: By calculating semantic similarity, the two most similar example pairs are retrieved. The similarity with the example pairs in the knowledge base is 0.925 and 0.890, respectively. That is, all two sentence-trine example pairs in the knowledge base are selected as the retrieval results.

[0026] (3) LLM Input Construction and Triple Generation: The domain context, knowledge base triples, and sentence-triple examples are concatenated into LLM input in a fixed format of “domain context + knowledge base triples + example pairs + generation instructions”. The generation instructions are: “Based on the above medical technology information, with the head entity being the application of ginseng acidic polysaccharide in the treatment of premature ovarian failure, the patient care assistance system based on artificial intelligence, the application of dehydrolecithin in the preparation of wound healing drugs, the bioactivity domain of Chinese herbal plant polysaccharides, and an analysis method for the therapeutic effect of acupuncture and massage, generate triples that conform to [head entity-relationship-tail entity], generate only triples, and prohibit redundant content.”

[0027] Input the content into ChatGLM3-6B to generate the set of triples at level 0. The final result of this step is as follows: Figure 4 ; 3. Double constraint verification and error correction Based on a dual mechanism of rule validation and knowledge base constraints, error detection, correction, and filtering are performed on the triples in the set of triples at level 0, outputting a set of valid triples. This is implemented in three sub-steps, setting... α =0.6, β =0.4, error threshold θ =0.7; Based on a dual mechanism of rule validation and knowledge base constraints, error detection, correction, and filtering are performed on the triples in the set of triples at level 0, outputting a set of valid triples. This is implemented in three sub-steps, setting... α =0.6, β =0.4, error threshold θ =0.7.

[0028] (1) Error detection score: The error detection score for each triple is calculated by weighting the rule validation score and the knowledge base constraint score, where: Rule validation score (0 or 1) is determined based on the rule base. Knowledge base constraint score (0-1) is calculated based on the consistency of relation constraints in the knowledge base KB.

[0029] Taking the triplet set at level 0 as an example, the error detection score calculation results are shown in Table 2 below: Table 2 (2) Error correction: For erroneous triples with an error detection score below the threshold, a re-prompt is generated based on the error type, and correction is performed using LLM. The correction prompt is: "An error was detected in the triple [an analysis method for the therapeutic effect of acupuncture and massage, involving anti-tumor drug development], the error types are: 1. Head-tail entity conflict, the acupuncture and massage analysis method has no traditional Chinese medicine basis for anti-tumor drug development; 2. Relationship rationality violation, the relationship involved does not match the entity logic. Please correct the triple based on the domain corpus and only generate the correct triples." After concatenating the correction prompt with the original LLM input, input it into ChatGLM3-6B to obtain the corrected ternary set: an analysis method for the therapeutic effect of acupuncture and massage, involving the viscoelastic mechanical parameters of tissues.

[0030] The error detection score was recalculated for the corrected triples. The rule validation score was 1, the knowledge base constraint score was 0.920, and the error detection score was 0.968, which is higher than 0.7. Therefore, the corrected triples are valid.

[0031] (3) Valid Triple Screening: According to the screening rules, triples with error detection scores not lower than the threshold, and triples with corrected error detection scores not lower than the threshold, are included in the valid triple set. The final result of this step is... Figure 5As shown; 4. Iterative optimization of weighted entity filtering For all tail entities in the effective triplet set, calculate pruning decision scores to determine whether to add them to the next layer of core entity set. Simultaneously, generate the 0th layer knowledge graph and set... γ =0.5, δ =0.5, pruning threshold =0.6.

[0032] (1) Extracting the tail entity set: Extract all tail entities from the effective triple set and obtain the tail entity set after deduplication: Treatment of premature ovarian failure, treatment field of premature ovarian failure, nursing strategy optimization, sleep stage identification, anti-tumor drug research and development, wound healing, bioactivity, new Chinese medicine, and viscoelastic mechanical parameters of tissues.

[0033] (2) Calculation of pruning decision score: The pruning decision score of each tail entity is calculated by weighting the head entity fit score and the context relevance score output by the T5 classifier, where: 1) Head entity fit score (0-1), which indicates the degree of fit of the tail entity as the next level head entity; 2) Context relevance score (0-1), calculated by combining the average similarity between the entity and the domain context and the knowledge base triples.

[0034] The results of the tail entity trimming decision score calculation are shown in Table 3 below: Table 3 (3) Entity screening and graph update: Tail entities with pruning decision scores not lower than the threshold are added to the core entity set of the next layer, and tail entities with pruning decision scores lower than the threshold are removed and do not participate in the generation of the next layer; the knowledge graph of the 0th layer is generated based on the core entity set and the set of effective triples.

[0035] This step yields the next layer of core entity sets: treatment of premature ovarian failure, premature ovarian failure treatment field, nursing strategy optimization, sleep stage identification, anti-tumor drug development, wound healing, new traditional Chinese medicine drugs, and tissue viscoelastic mechanical parameters.

[0036] The JSON format of the level 0 valid triple set and the level 1 core entity set is as follows: Figure 6 As shown; 5. Solving the objective function through iterative optimization Based on the results generated at layer 0, the objective function value for iterative optimization is calculated using a weighted method that integrates accuracy, domain specificity, and redundancy. J To assess the accuracy of the map P Domain specificity DS Redundancy R ,set up w1 = 0.4 w 2 = 0.3, w 3 = 0.3.

[0037] (1) Calculation accuracy: Accuracy represents the proportion of valid triples to generated triples. In this embodiment, the number of valid triples is 9 and the number of generated triples is 9, so the accuracy is 1.0.

[0038] (2) Calculate domain specificity: Domain specificity represents the proportion of newly added valid triples to the generated triples, excluding triples that already exist in the knowledge base. By comparison, there are 6 newly added triples in the set of valid triples that do not exist in the knowledge base, so the domain specificity is approximately 0.667.

[0039] (3) Calculate redundancy: Redundancy represents the mean semantic similarity between effective triples. The semantic similarity between all triples in the effective triple set is calculated by MiniLM. The total similarity is 1.125 after summing. Therefore, the redundancy is about 0.014.

[0040] (4) Calculate the objective function value: Substitute the accuracy, domain specificity and redundancy into the objective function to obtain the objective function value of the 0th layer, which is approximately 0.596.

[0041] The accuracy of the 0th layer map is 1.0, the domain specificity is about 0.667, the redundancy is about 0.014, and the objective function value is about 0.596. The map accuracy is 100%, the domain specificity is good, and the redundancy is low. The value is approximately 0.596, the map accuracy is 100%, the domain specificity is good, and the redundancy is low.

[0042] 6. Iterative Termination of Knowledge Graph Generation The next layer of core entity set becomes the new core entity set. The process of generating the core entity set through dual-source context fusion, verifying and correcting errors through dual constraints, iteratively optimizing the weighted entity selection, and solving the objective function through iterative optimization is repeated. This process generates a new set of triples, a set of valid triples, the next layer of core entity set, the knowledge graph, and the objective function value, until the iteration termination condition is met. 1) The improvement rate of the objective function value is less than 1%; 2) The number of iterations reaches the preset maximum value. In this embodiment, the preset maximum number of iterations is 5.

[0043] In this embodiment, when iterating to the third layer, the objective function value is approximately 0.622, which is about 0.005 higher than the objective function value of approximately 0.617 in the second layer. This is less than 1%, and the iteration termination condition is met, so the iteration stops.

[0044] Integrating the core entity sets and effective triple sets from all iterative layers, the final knowledge graph triples are generated, such as... Figure 7As shown; The performance indicators of the map include: accuracy P≈0.990, domain specificity DS≈0.785, redundancy R≈0.016, and objective function value J≈0.622.

[0045] The final generated knowledge graph is free from knowledge illusions and contextual noise interference. In scenarios with few samples, the triplet coverage rate reaches over 90%, achieving fully automated, high-precision, and highly domain-specific construction of knowledge graphs in the field of pharmaceutical technology.

[0046] This method has shown significant effectiveness in the medical technology field. Compared with existing technologies, it solves four core problems: contextual noise interference, knowledge illusion, poor adaptability to few-sample scenarios, and high redundancy in iterative generation. 1) The dual-source contextual fusion generation mechanism effectively reduces the contextual noise of LLM, improving the triple coverage in few-sample scenarios. 2) The dual-constraint verification and error correction mechanism suppresses knowledge illusion, improving the accuracy of triples in the medical technology field. 3) The weighted entity screening iterative optimization mechanism effectively reduces iterative redundancy. 4) It achieves automated construction of knowledge graphs in the medical technology field without requiring extensive manual annotation or rule design, with a significant improvement in construction efficiency compared to traditional methods.

[0047] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for constructing an iterative domain knowledge graph that integrates dynamic knowledge base enhancement, characterized in that: Includes the following steps: S1: From the domain corpus and auxiliary knowledge base Retrieve relevant context from the middle to provide enhanced input for the large language model and generate the first... Layer triple set ; S2: Detects and corrects the first step through a dual mechanism of rule validation and knowledge base constraints. Layer triple set Output the incorrect triplet in the input, and output the first one. Set of effective triplets ; S3: Determine the first Set of effective triplets Does the mid-tail entity need to be the next-level core entity? Output the filtered entity set and the final graph layer ; S4: Set the objective function for iterative optimization and perform iterative output. Stop iterating when the improvement rate of the objective function value is less than 1% or the number of iterations reaches the preset maximum value. The iterative optimization specifically involves maximizing the accuracy, domain specificity, and minimizing redundancy of the knowledge graph.

2. The method for constructing an iterative domain knowledge graph with enhanced dynamic knowledge base according to claim 1, characterized in that: S1 includes the following steps: S1.1: Corpus of Computational Domain The relevance scores of core entities and sentences in the corpus are calculated, ranked, and retrieved. Top-m Related sentences constitute the domain context ; S1.2: From the auxiliary knowledge base Retrieve entity-related knowledge base triples Sentence-Triple Example Pair ; S1.3: Domain Context Knowledge base triples Sentence-Triple Example Concatenate the data into an LLM input using a fixed format. , generate the first Layer triple set The specific expression is: in, Indicates the first Layer triple set, Represents the LLM model. τ For the temperature parameters of LLM, Indicates the first Core entity of the layer.

3. The iterative domain knowledge graph construction method with dynamic knowledge base enhancement as described in claim 2, characterized in that: The computational domain corpus in S1.1 The specific expressions for the relevance scores of core entities and sentences in the corpus are as follows: in, Representation domain corpus The similarity between core entities and sentences in the corpus. As the core entity, Indicates the first Core entity set of layers For the corpus sentences, This represents the term frequency-inverse document frequency score. Indicates the BM25 search score; In S1.2, from the auxiliary knowledge base Retrieve entity-related knowledge base triples Sentence-Triple Example Pair Specifically, it includes: S1.2.1: Cosine Similarity Retrieval and Core Entities Based on MiniLM Embedding Related Top-n Triples as knowledge base triples The specific expression is as follows: in, As the core entity, Indicates the head entity. Indicates a relationship. tail Indicates the tail entity. This indicates string concatenation. Represents cosine similarity. Represents the embedding function of the MiniLM model. Represents a knowledge base triple T Similarity between the core entity e and the knowledge base triples; S1.2.2: In the auxiliary knowledge base Searching for semantic similarity with domain context Top-l A sentence-triple pair, as an example sentence-triple pair The specific expression is as follows: in, Represents the domain context of the k-th layer. For knowledge base sentences, For sentences The corresponding set of triples, To express summation, This represents the number of sentences in the corpus contained in the k-th layer domain context. This represents the similarity between the domain context and the knowledge base sentence-trine pair in the sentence-trine.

4. The method for constructing an iterative domain knowledge graph with enhanced dynamic knowledge base according to claim 2, characterized in that: S2 specifically includes the following steps: S2.1: For the first Layer triple set The error detection score for each triplet is given by the following expression: in, Indicates the first Layer triple set The triplet in the middle, , For the head entity, For the relationship, For tail entities, This indicates the rule validation score. To score the knowledge base constraints, , Indicates the error detection score weight. Indicates the first Layer triple set Error detection score for each triple; S2.2: For The triplet generates a redial message based on the error type, which is then corrected via LLM, specifically as follows: in, This indicates the correct result after correction. This indicates string concatenation. τ The temperature parameter of the LLM mainly controls the output stability. Error type In response to the correction prompt, Indicates the error threshold. Indicates the first Layer triple set The triplet in; S2.3: Filter to obtain the first Set of effective triplets The specific expression is as follows: in, Represents the union, Indicates that, This indicates the correct result after correction. Indicates the error threshold. The error detection score represents the corrected result.

5. The method for constructing an iterative domain knowledge graph with enhanced dynamic knowledge base according to claim 4, characterized in that: The rule verification score The specific expression is as follows: The knowledge base constraint score The specific expression is as follows: in, express Middle head entity The corresponding set of all relations, For the relationship, express The relationship between them.

6. The iterative domain knowledge graph construction method with dynamic knowledge base enhancement as described in claim 4, characterized in that: S3 includes the following steps: S3.1: Calculate the first... Set of effective triplets Each tail entity The pruning decision score is expressed as follows: in, Represents tail entity The pruning decision score, , To prune the decision score weights, This represents the output of the T5 classifier, used to indicate the suitability of the current entity as a head entity. Represents tail entity Context relevance score; S3.2: When ≥Pruning threshold At that time, the tail entity Add the next layer of core entities Otherwise, the entity is determined to be a tail entity and subsequent generated content is deleted; The knowledge graph is updated using the following expression: in, Indicates the first Layered knowledge graph, Represents the union, Indicates the first The set of effective triples at each level Indicates the first Core entity set of the layer.

7. The method for constructing an iterative domain knowledge graph with enhanced dynamic knowledge base according to claim 6, characterized in that: The tail entity The context relevance score is specifically for tail entities. domain corpus and auxiliary knowledge base The correlation is expressed as follows: in, Represents tail entity and the Sentence similarity in the layered knowledge base corpus Represents tail entity Similarity to triples in the k-th level knowledge base Represents the domain context of the k-th layer. This represents a triplet in the k-th level knowledge base.

8. The iterative domain knowledge graph construction method with dynamic knowledge base enhancement as described in claim 6, characterized in that: The specific expression of the objective function is as follows: in, , This indicates the number of top results retrieved from the domain corpus. This indicates the number of top results retrieved from the knowledge base triplet retrieval. This indicates the number of top retrieved sentences-triple pairs. As the weight for error detection scoring, To prune the decision score weights, Indicates the error threshold. Indicates the pruning threshold. , , The target weight coefficient, Indicates precision. Indicates domain specificity. Indicates redundancy.

9. The iterative domain knowledge graph construction method with dynamic knowledge base enhancement as described in claim 8, characterized in that: The accuracy The specific expression is as follows: in, Indicates the first The number of triples contained in the set of valid triples at each level. Indicates the first The number of triples contained in the set of layer triples; Domain specificity The specific expression is as follows: in, This indicates an auxiliary knowledge base; The redundancy The specific expression is as follows: in, and Denotes the set of valid triples at level k. Any two triples in the set, Represents the embedding function of the MiniLM model. This indicates string concatenation. Represents cosine similarity. , and They represent triples respectively Head entities, relationships, and tail entities , and They represent triples respectively Head entities, relationships, and tail entities.