A multi-source heterogeneous knowledge graph construction method and system
By calculating the similarity of multi-source data and generating an entity alignment mapping table, a relationship classification model is trained, and a three-layer heterogeneous graph structure is constructed. This solves the problems of inconsistent entity granularity and lack of relationship strength in the knowledge graph of integrated traditional Chinese and Western medicine, and realizes stable knowledge graph library management and query interface calls.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN BOJI LIFE TECHNOLOGY CO LTD
- Filing Date
- 2026-02-06
- Publication Date
- 2026-06-09
AI Technical Summary
Existing medical knowledge graphs lack cross-system association modeling in the context of integrated traditional Chinese and Western medicine. The entity granularity is inconsistent, relation extraction relies on costly manual annotation and is updated unstably. They are difficult to handle implicit knowledge and ambiguous expressions in traditional Chinese medicine literature, and lack the quantification of relation strength and confidence, resulting in unclear graph structure support levels.
By acquiring data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases, name similarity, attribute similarity, and semantic vector similarity are calculated to generate an entity alignment mapping table. Based on this, a remote supervised annotation set is generated to train a relation classification model. Literature support, clinical support, and semantic relevance are calculated to generate a relation strength set. Finally, a three-layer heterogeneous graph structure is constructed and written into a graph database.
It achieves stability and reliability in entity alignment and relation extraction under multi-source heterogeneous data, supports refined graph reasoning, and is suitable for query scenarios such as entity retrieval, shortest path and similarity retrieval.
Smart Images

Figure CN121660057B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer information processing, and in particular to a method and system for constructing a multi-source heterogeneous knowledge graph. Background Technology
[0002] The integration of traditional Chinese medicine (TCM) and Western medicine is an important direction for the development of medicine in my country. One of its core challenges lies in establishing a mapping relationship between TCM theoretical concepts and the modern medical knowledge system. TCM diagnosis and treatment are based on "syndrome differentiation and treatment," emphasizing the selection of appropriate treatments and medications according to the patient's syndrome pattern; while Western medicine is based on standardized treatment according to disease diagnosis. How to achieve knowledge interoperability while maintaining the characteristics of each medical system is a key issue in the research of integrating TCM and Western medicine.
[0003] Knowledge graphs, as a structured knowledge representation method, have been widely used in the healthcare field in recent years. However, existing medical knowledge graphs have significant shortcomings when dealing with scenarios integrating traditional Chinese medicine (TCM) and Western medicine. First, existing knowledge graphs typically focus on a single medical system, either a purely TCM syndrome-prescription graph or a purely Western medicine disease-drug graph, lacking cross-system relational modeling. Second, even those attempts at integration often employ simple entity linking, mapping TCM syndromes to Western diseases one-to-one. This approach is too crude and ignores the complexity of syndrome-disease relationships—the same syndrome may correspond to multiple diseases, and the same disease may manifest as different syndromes. Third, existing graphs lack a unified standard for entity granularity; some use drugs as the smallest unit, while others delve into the chemical composition level, posing challenges to graph integration and reasoning.
[0004] From a technical implementation perspective, existing knowledge graph construction methods also have several limitations. Rule-based methods rely on manually defined pattern matching rules, making it difficult to handle the large amount of implicit knowledge and ambiguous expressions in traditional Chinese medicine (TCM) literature. Statistical methods discover entity relationships through indicators such as co-occurrence frequency or mutual information, but they cannot distinguish between causal and correlational relationships and are prone to introducing noise. While deep learning-based relationship extraction methods perform well in general domains, they suffer from a lack of training data in TCM professional texts, limiting the model's generalization ability. Furthermore, existing methods generally lack the quantification of relationship strength and confidence, treating all edges as equivalent, which makes it difficult to support refined graph reasoning.
[0005] Furthermore, in the field of computer information processing, existing solutions for data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases typically involve data access, field extraction, and entity recognition to form entity sets. These entities are then linked or merged, and relationships between entities are extracted from text or structured records before being written into graph data storage. However, this approach suffers from limitations such as inconsistent naming conventions across sources leading to difficulties in entity alignment, reliance on costly manual annotation for relationship extraction with unstable update chains, and a lack of comparable strength and reliable support for relationship edges. Existing methods often rely on single similarity clues or static rules to merge entities, making it difficult to simultaneously address ambiguities introduced by differences in name, attributes, and semantics. In scenarios involving parallel access to multi-source heterogeneous data and overlapping entity types, mapping conflicts easily arise, with both homonymous and heteronymous entities coexisting. This introduces cascading noise into subsequent relationship extraction, making it difficult to stably form reusable entity alignment mapping tables and traceable sets of relationship triples. Meanwhile, existing relation extraction processes often lack a mechanism for continuous verification and incremental updates of relation confidence sets, making it difficult to maintain a consistent standard for relation type determination when there are differences in the wording of documents and the structure of case records. Furthermore, during the relation writing stage, relation edges from different sources and with different semantic distances are often treated equally, lacking a unified quantification and fusion standard for document support, clinical support, and semantic relevance. This results in unclear interpretability and strength levels of edges in the graph structure, making it difficult to support the subsequent construction and maintenance of a three-layer heterogeneous graph structure. In addition, existing graph construction schemes often use a single graph structure or a storage method with weak type constraints when the entity type span is large. They lack unified constraints for typified modeling and cross-type propagation around syndrome entities, disease entities, prescription entities, single herb entities, chemical component entities, and target entities. This makes it difficult to form stable inter-layer connections and a sustainable knowledge graph library management link within the graph database. Consequently, it is difficult to maintain consistent data dependencies and traceable data sources for query interface parameters in scenarios such as entity retrieval, shortest path, neighborhood traversal, similarity retrieval, and link prediction. Summary of the Invention
[0006] To address the aforementioned technical problems, this invention provides a method for constructing a multi-source heterogeneous knowledge graph, comprising:
[0007] S100: Obtain data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases; extract entities of syndrome types, diseases, prescriptions, single herbs, chemical components, and targets by field mapping; and generate a candidate set of entities.
[0008] S200: Calculate name similarity, attribute similarity, and semantic vector similarity for the entity candidate set, input the three types of similarity into the fusion network, and output the entity alignment mapping table;
[0009] S300: Generate a remote supervised annotation set based on the entity alignment mapping table to train the relation classification model, extract samples according to the model uncertainty to generate an expert annotation increment set and update the relation classification model, and output the relation triplet set and relation confidence set;
[0010] S400: Calculate document support, clinical support, and semantic relevance based on relation triplet sets and relation confidence sets, generate relation strength sets by weighted geometric average, and output heterogeneous edge sets;
[0011] S500: Construct a three-layer heterogeneous graph structure based on heterogeneous edge sets, including a disease-symptom layer, a disease-prescription layer, and a drug-ingredient layer, with disease entities and single-herb entities connected. Learn entity embedding sets by transforming matrices according to entity types, using relational attention and gating cross-type propagation. Write the three-layer heterogeneous graph structure, entity embedding sets, and relational strength sets into a graph database to generate a knowledge graph library.
[0012] Furthermore, after extracting disease entities, S100 performs disease name normalization and ICD-11 encoding mapping, and registers the encoding field of the disease entities in the entity candidate set.
[0013] Furthermore, the name similarity is composed of an exact match score, a character set Jaccard similarity score, and an edit distance similarity score.
[0014] Furthermore, the attribute similarity is obtained by weighted summation of the similarity scores of the molecular formula field, the CAS number field, and the meridian tropism field; the semantic vector similarity is obtained by taking the cosine similarity score of the semantic vector output by the biomedical pre-trained language model.
[0015] Furthermore, the fusion network consists of an input layer, two fully connected hidden layers, and an output layer. The output layer outputs an alignment score. A threshold T is set, and the entity alignment mapping table is formed by registering entity pairs whose alignment scores are greater than the threshold T.
[0016] Furthermore, the remote supervision annotation set is generated from the syndrome-disease comparison table, the prescription indication table, the medicinal material component table, and the component target table, and the relationship type labels of clinical literature segments are annotated according to the entity alignment mapping table.
[0017] Furthermore, the model uncertainty is calculated from the entropy value of the probability distribution output by the relation classification model; a threshold U is set, and the expert annotation increment set consists of a set of samples with uncertainty greater than the threshold U.
[0018] Furthermore, the literature support is obtained by normalizing the number of times the relation triple appears in the literature database; the clinical support is obtained by normalizing the co-occurrence frequency of the relation triple in the structured case records; the semantic relevance is obtained by the cosine similarity of the entity embedding vectors at both ends of the relation triple; and the relation strength set is obtained by multiplying the literature support, clinical support, and semantic relevance by their weights and then exponentiating the result.
[0019] Furthermore, the graph database is a graph database that supports attribute graph models, preferably the Neo4j graph database, and the query interface parameters include entity retrieval parameters, shortest path parameters, neighborhood traversal parameters, similarity retrieval parameters, and link prediction parameters.
[0020] Furthermore, a multi-source heterogeneous knowledge graph construction system, applied to any of the methods described above, includes:
[0021] The data access and entity candidate generation module is used to access data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases, and to load field mapping rules.
[0022] The similarity calculation and entity alignment module is used to receive a candidate set of entities, calculate name similarity, attribute similarity and semantic vector similarity, and input the three types of similarity into the fusion network to generate alignment scores;
[0023] The relation extraction and closed-loop update module is used to receive the entity alignment mapping table and call the syndrome comparison table, prescription indication table, medicinal material component table and component target table to generate a remote supervision annotation set.
[0024] The relation strength quantification and heterogeneous edge generation module is used to receive the relation triple set and the relation confidence set, generate literature support based on the occurrence count of relation triples in the literature database, generate clinical support based on the co-occurrence count of relation triples in structured case records, generate semantic relevance based on the semantic vector similarity of the entities at both ends of the relation triple, and generate the relation strength set by weighted geometric mean fusion.
[0025] The three-layer heterogeneous graph construction and entity embedding learning module is used to receive heterogeneous edge sets and construct a three-layer heterogeneous graph structure that includes a syndrome-disease layer, a disease-prescription layer, and a drug-component layer, and is connected by disease entities and single-herb entities.
[0026] The graph database writing and knowledge graph library management module is used to receive three-layer heterogeneous graph structures, entity embedding sets and relation strength sets, generate graph database writing batches and perform node writing, edge writing and attribute field writing processing.
[0027] The key innovations of this invention include:
[0028] (1) Simultaneously calculate name similarity, attribute similarity, and semantic vector similarity for the entity candidate set, and input the three types of similarity into the fusion network to output the entity alignment mapping table, so that the entity alignment mapping table simultaneously covers the alignment basis of the three dimensions of name, attribute field and semantic vector within the same alignment link.
[0029] (2) Based on the entity alignment mapping table, a remote supervision annotation set is generated to train the relation classification model. Samples are extracted according to the model uncertainty to generate an expert annotation increment set and update the relation classification model. The relation extraction link forms a closed-loop update under the joint drive of the remote supervision annotation set and the expert annotation increment set, and outputs the relation confidence set corresponding to each relation triplet set.
[0030] (3) Calculate the document support, clinical support and semantic relevance based on the relation triple set and the relation confidence set, and generate a relation strength set by weighted geometric average to output a heterogeneous edge set. Based on the heterogeneous edge set, construct a three-layer heterogeneous graph structure containing a syndrome-disease layer, a disease-prescription layer and a drug-ingredient layer, and connected by disease entities and single-herb entities. Combine entity type transformation matrix, relation attention and gating cross-type propagation to learn entity embedding sets and write them into the graph database together with the relation strength set to form a knowledge graph library.
[0031] The following are its main beneficial effects:
[0032] (1) In view of the difficulties in entity alignment caused by inconsistent cross-source naming standards in the background technology and the fact that a single similarity clue can easily lead to the coexistence of homonymous and heteronymous entities, the present invention calculates the entity alignment mapping table by jointly calculating name similarity, attribute similarity and semantic vector similarity and inputting it into a fusion network to output the entity alignment mapping table. This makes the entity alignment mapping table a unified carrier for the entity alignment basis of entities with different source identifiers, different attribute fields and different semantic vector representations in the entity candidate set. Thus, the entity candidate set completes the verifiable alignment registration and mapping landing point before entering the relation extraction link. It is applicable to scenarios where ancient books, clinical literature and traditional Chinese medicine, drug and disease databases are accessed in parallel and entity types overlap.
[0033] (2) In view of the situation in the background technology where relation extraction relies on high-cost manual annotation and the update link is unstable, and the judgment of relation type drifts with the change of data distribution, the present invention generates the remote supervision annotation set based on the entity alignment mapping table to train the relation classification model, and uses model uncertainty to drive sampling to generate the expert annotation increment set and trigger the model update operation, so that the relation classification model maintains the incremental closed-loop update of the remote supervision annotation set and the expert annotation increment set during the operation, and outputs the correspondence between the relation triple set and the relation confidence set, which facilitates the consistent verification and continuous maintenance of relation extraction results under the constraints of differences in literature statement expression and differences in case record structure.
[0034] (3) In view of the lack of comparable strength characterization and reliable support for relation edges in the background technology, and the unclear support hierarchy of graph structure caused by the equal writing of relation edges from different sources, the present invention calculates the literature support, clinical support and semantic relevance based on the relation triple set and the relation confidence set, and generates the relation strength set by weighted geometric average, outputs the heterogeneous edge set carrying relation strength, and constructs a three-layer heterogeneous graph structure connected by disease entities and single-herb entities. Combined with entity type transformation matrix, relation attention and gated cross-type propagation to learn the entity embedding set, the three-layer heterogeneous graph structure, the entity embedding set and the relation strength set are written into the graph database to form a knowledge graph library, so that the nodes, edges and attribute fields in the graph database are written to support links consistent with the relation strength set. It is suitable for query interface parameter call scenarios for entity retrieval parameters, shortest path parameters, neighborhood traversal parameters, similarity retrieval parameters and link prediction parameters. Attached Figure Description
[0035] Figure 1 A flowchart illustrating a method for constructing a multi-source heterogeneous knowledge graph, provided in an embodiment of this application;
[0036] Figure 2 A structural block diagram of a multi-source heterogeneous knowledge graph construction system provided in this application embodiment;
[0037] Figure 3 This is a schematic diagram of a three-layer heterogeneous knowledge graph structure provided in an embodiment of this application;
[0038] Figure 4 A visual diagram illustrating a proof-based reasoning path is provided in an embodiment of this application;
[0039] Figure 5 This is a schematic diagram of a knowledge graph system interface provided in an embodiment of this application. Detailed Implementation
[0040] Example 1: Refer to Figure 1This is a flowchart illustrating a method for constructing a multi-source heterogeneous knowledge graph according to an embodiment of the present invention. The process may include at least steps S100-S500:
[0041] S100: Obtain data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases; extract entities of syndrome types, diseases, prescriptions, single herbs, chemical components, and targets by field mapping; and generate a candidate set of entities.
[0042] S200: Calculate name similarity, attribute similarity, and semantic vector similarity for the entity candidate set, input the three types of similarity into the fusion network, and output the entity alignment mapping table;
[0043] S300: Generate a remote supervised annotation set based on the entity alignment mapping table to train the relation classification model, extract samples according to the model uncertainty to generate an expert annotation increment set and update the relation classification model, and output the relation triplet set and relation confidence set;
[0044] S400: Calculate document support, clinical support, and semantic relevance based on relation triplet sets and relation confidence sets, generate relation strength sets by weighted geometric average, and output heterogeneous edge sets;
[0045] S500: Construct a three-layer heterogeneous graph structure based on heterogeneous edge sets, including a disease-symptom layer, a disease-prescription layer, and a drug-ingredient layer, with disease entities and single-herb entities connected. Learn entity embedding sets by transforming matrices according to entity types, using relational attention and gating cross-type propagation. Write the three-layer heterogeneous graph structure, entity embedding sets, and relational strength sets into a graph database to generate a knowledge graph library.
[0046] S100: Obtain data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases; extract entities of syndrome types, diseases, prescriptions, single herbs, chemical components, and targets by field mapping; and generate a candidate set of entities.
[0047] In this step, the ancient books refer to a collection of TCM classics that have been digitized and organized into a searchable text database; the clinical literature refers to a collection of medical papers and case records that include diagnostic conclusions, syndrome descriptions, prescription records, medication records, and follow-up records; and the TCM, drug, and disease database data refers to a collection of structured records that have been authorized for access. The structured records include record identifiers, name fields, alias fields, attribute fields, source fields, and evidence location fields. This step involves the data access module receiving a list of data sources and access credentials as input. The data source list includes data source identifiers, data source types, update trigger rules, data retrieval range constraints, and verification rules. The update trigger rules include two types: timed pull triggers and incremental push triggers. Timed pull triggers are generated by the task scheduling unit according to a preset cycle, while incremental push triggers are generated by the access gateway receiving data arrival events and generating data retrieval tasks. A data source version record is established for the same data source identifier. The data source version record includes the collection batch number, collection time, number of original records, number of successfully parsed records, number of failed parsing records, and failure reason code. The failure reason code consists of four values: character set abnormality, field missing, record duplicate, and verification failure, for subsequent auditing and batch rollback.
[0048] Specifically, after the data retrieval task is triggered, the data access module loads the raw data into the parsing unit. The parsing unit performs hierarchical parsing according to the data source type. For ancient books and clinical literature, it performs paragraph segmentation, sentence segmentation and punctuation normalization, and retains the text evidence location field, which includes the document identifier, chapter number, paragraph number and sentence offset. For structured record sets, it performs field extraction and field standardization. Field standardization includes name field noise removal, whitespace character normalization, simplified and traditional Chinese character normalization, full-width and half-width character normalization and synonym expansion. The field mapping unit receives intermediate records output by the parsing unit and calls the field mapping rule table to unify field definitions. The field mapping rule table consists of field name mapping pairs, field value normalization rules, enumeration value mapping rules, and unit normalization rules. The field mapping unit uniformly writes name fields from different sources into the standardized name field, uniformly writes alias fields into the alias set field, uniformly writes source fields into the source library identifier field and the source record location field, uniformly writes structured attributes into the attribute key value field, and writes the original text fragments or original structured fragments into the evidence fragment field, thereby forming a unified input record stream for the subsequent entity extraction unit.
[0049] Based on a unified input record stream, the entity extraction unit performs entity discovery, entity boundary determination, and entity type determination for syndrome entities, disease entities, prescription entities, single herb entities, chemical component entities, and target entities. The syndrome entity refers to a TCM diagnostic unit composed of a syndrome name, syndrome elements, and associated markers; the syndrome name includes a standard name field and an alternative name set field. The disease entity refers to a Western medicine diagnostic unit composed of a disease name and disease code field. The prescription entity refers to a prescription unit composed of a prescription name and a set of component items field; the set of component items field consists of a single herb name and a dosage description fragment. The single herb entity refers to a herb unit composed of a medicinal material name, part description, and processing description. The chemical component entity refers to a compound unit composed of a component name, molecular formula attribute, and registration number attribute. The target entity refers to an object unit composed of a target name, gene symbol attribute, and protein identifier attribute. The entity discovery process employs a parallel execution of a "Term Bank matching channel" and a "Statistical Sequence Labeling channel." The Term Bank matching channel performs maximum matching on the standardized name field and the evidence fragment field using the term bank and outputs candidate hits. The Statistical Sequence Labeling channel performs word segmentation, part-of-speech tagging, and entity fragment labeling on the evidence fragment field and outputs candidate hits. Candidate hits from both channels enter the conflict resolution subunit. The conflict resolution subunit merges these hits according to entity type priority, hit span length, and evidence consistency markers to form an entity mention set. The entity mention set includes mention text field, mention start and end position field, mention source field, and mention type field. The mention source field is written back as the evidence location field for subsequent cross-database tracing.
[0050] After extracting the disease entity, the disease standardization unit performs disease name standardization and ICD-11 coding mapping processing on the disease entity. Disease name standardization performs synonym merging, abbreviation expansion, and word order normalization on the alias set field, and writes the merged disease name into the standard name field. Coding mapping processing performs candidate code retrieval based on the ICD-11 terminology list. The candidate code retrieval outputs a candidate code set, which includes a code value field, a standard name field, and a matching basis field. The matching basis field consists of three types of values: alias match, standard name match, and contextual constraint. When there are multiple records in the candidate code set, the ambiguity resolution subunit calls the diagnostic context terms in the evidence fragment field and performs consistency judgment, writing the judgment result into the disease code field. Simultaneously, a coding mapping record field is generated, containing a snapshot of the candidate code set and a snapshot of the resolution basis, for subsequent data backtracking and batch review.
[0051] After the entity mention set is formed, the entity aggregation unit aggregates mentions according to the entity type field. The aggregation key is composed of the specification name field and the source library identifier field. Records with the same key are deduplicated and merged. The merging process performs a union of the alias set field and forms a multi-source attribute fragment set by the attribute key value field according to the source record location field. Attribute conflicts are written to the conflict flag field, which has three values: missing, conflicting, and consistent. For missing and conflicting records, the quality verification unit generates quality event records and writes them to the quality event log. The quality event log includes the data source identifier, collection batch number, entity type field, specification name field, conflict flag field, and handling status field. The handling status field has two values: pending review and reviewed. The entity candidate set output in this step consists of an entity record set. The core fields of the entity record set include the entity type field, specification name field, alias set field, source library identifier field, source record location field, and evidence location field. The preferred fields include the attribute key value field, evidence fragment field, conflict flag field, quality event identifier field, and disease code field. The entity candidate set serves as the input to S200, allowing S200 to calculate name similarity, attribute similarity, and semantic vector similarity, and generate an entity alignment mapping table. Simultaneously, the collection batch number and data source version record corresponding to the entity candidate set are written into the version archive table, which is used for subsequent cross-step traceability and consistency verification.
[0052] Summary of the technical effects of this step: This step completes the access of multi-source data, standardization of field definitions, entity extraction and disease coding mapping, forming an entity candidate set that includes evidence location and version records, and providing a unified input to the subsequent S200.
[0053] S200: Calculate name similarity, attribute similarity, and semantic vector similarity for the entity candidate set, input the three types of similarity into the fusion network, and output the entity alignment mapping table;
[0054] In this step, the input source is the entity candidate set output by S100. The entity candidate set includes an entity type field, a canonical name field, an alias set field, a source library identifier field, a source record location field, and an evidence location field, and includes a disease code field in the disease entity records. This step involves the entity alignment module receiving the entity candidate set and alignment job configuration as input. The alignment job configuration includes candidate pairing range constraints, similarity calculation switches, attribute key whitelists, semantic vector generation parameters, fusion network model version identifiers, alignment score thresholds, conflict resolution rules, and audit record switches. The entity alignment module triggers a full alignment job upon receiving a new collection batch number and an incremental alignment job upon receiving an incremental update batch number of the entity candidate set. The full alignment job pairs entities with cross-source library identifiers under the same entity type field, while the incremental alignment job only pairs newly added or updated source record location fields. During the alignment process, the entity alignment module generates a pairing identifier field for each candidate pairing and writes it to the alignment operation log when the audit record switch is turned on. The alignment operation log includes the collection batch number, the fusion network model version identifier, the number of candidate pairs, the number of passes the threshold, the number of conflicts, and the exception reason code. The exception reason code includes four types of values: field missing, character exception, vector generation failure, and attribute parsing failure.
[0055] Specifically, the entity alignment module first performs name standardization processing on the entity candidate set. This standardization process performs whitespace character normalization, full-width / half-width character normalization, simplified / traditional character normalization, punctuation normalization, and homonym / variable character merging on the standardized name field and the alias set field. The processed text is then written into the standardized name field and the standardized alias set field. Next, the name similarity calculation unit calculates the exact match score, character set Jaccard similarity score, and edit distance similarity score for candidate pairs within the same entity type field. The exact match score is obtained from the identity determination of the standardized name field. The character set Jaccard similarity score is obtained by calculating the intersection and union ratio of the character sets of the two standardized name fields. The edit distance similarity score is obtained by normalizing the minimum number of edit operations for the two standardized name fields. When the standardized alias set field exists, the name similarity calculation unit combines the standardized name field and the standardized alias set field into a name candidate group. The maximum similarity score at both ends of the name candidate group is written into the name similarity field, and simultaneously written into the name evidence field. The name evidence field records the name pair text that triggers the maximum similarity score. The system then proceeds to the attribute similarity calculation unit. This unit calls different attribute parsers based on the entity type field. For chemical component entities, it parses the molecular formula and registry number attributes; for single herb entities, it parses the meridian tropism field, part description, and processing description; for disease entities, it parses the disease code field and diagnostic synonym field; for prescription entities, it parses the single herb name in the composition item set field; and for target entities, it parses the gene symbol and protein identifier attributes. The attribute similarity calculation unit performs key alignment and value normalization on the parsed attribute key-value fields. The normalized values are written into the standardized attribute key-value fields, and under the constraint of the attribute key whitelist, it calculates the similarity scores for sub-items such as the molecular formula field, registry number field, and meridian tropism field. These scores are aggregated according to preset weights and written into the attribute similarity field. Simultaneously, an attribute missing marker field is written, with values including no missing, unilateral missing, and bilateral missing.The process then proceeds to the semantic vector similarity calculation unit. This unit calls the Biomedical Pretrained Language Model to generate semantic vectors. The semantic vector input sequence is formed by concatenating the standardized name field, the standardized alias set field, and the evidence fragment field. Truncation, denoising, and segmentation encoding are performed according to the semantic vector generation parameters. When the evidence fragment field is missing or too short, the semantic vector input sequence is formed by the standardized name field and the standardized alias set field. The semantic vector similarity calculation unit writes this situation into the vector degradation marker field. After the semantic vectors are generated, the semantic vector similarity calculation unit calculates the cosine similarity of the two semantic vectors and writes it into the semantic vector similarity field and the vector generation version field. The vector generation version field records the version identifier of the Biomedical Pretrained Language Model and the version identifier of the text preprocessing.
[0056] After obtaining the name similarity field, attribute similarity field, and semantic vector similarity field, the entity alignment module enters the fusion network inference unit. The fusion network consists of an input layer, two fully connected hidden layers, and an output layer. The input layer receives the name similarity field, attribute similarity field, semantic vector similarity field, attribute missing marker field, and vector degradation marker field to form a fusion input vector. The output layer outputs the alignment subfield. The fusion network inference unit performs forward inference on the fusion input vector and outputs the alignment subfield, while simultaneously writing the component contribution field. The component contribution field records the snapshot values of the name similarity field, attribute similarity field, and semantic vector similarity field in the fusion input vector. After the alignment subfield is generated, the alignment decision unit compares the alignment subfield with the alignment threshold to obtain the alignment judgment field. The alignment judgment field has two values: pass and fail. For pass records, the alignment decision unit generates entity alignment mapping table records and writes them into the left entity identifier field, right entity identifier field, alignment subfield, name similarity field, attribute similarity field, semantic vector similarity field, left source library identifier field, right source library identifier field, collection batch number, fusion network model version identifier, and alignment time field. If multiple pass records appear in the same left entity identifier field, the conflict resolution unit sorts them in descending order by the alignment subfield and performs a one-to-one mapping binding in combination with the entity type field constraint. The binding result is written into the binding status field, which has three values: bound, candidate retained, and manually reviewed. The manually reviewed records are written into the review queue, which includes a snapshot of the candidate pair set and a snapshot of the evidence location field. The entity alignment mapping table serves as the input to the S300, enabling the S300 to generate a remote supervision annotation set, train a relation classification model, and output a set of relation triples and a set of relation confidence scores. Simultaneously, the entity alignment module writes the alignment operation log and the version record of the entity alignment mapping table into a version archive table. This version archive table includes fields for the collection batch number, the fusion network model version identifier, the alignment score threshold, the conflict resolution rule version identifier, and the number of mapping table records, for subsequent batch reproduction and audit traceability.This step provides an engineering embodiment. The entity alignment module performs candidate pairing on chemical component entities from different source libraries under the same collection batch number. Entities with the standardized name field "quercetin" and entities with the standardized alias set field containing "Quercetin" are included in the same candidate pairing. The name similarity calculation unit outputs the name evidence field in the alias channel. The attribute similarity calculation unit parses and aligns the molecular formula attribute and registration number attribute and writes them into the standardized attribute key value field. The semantic vector similarity calculation unit generates a semantic vector and writes it into the vector generation version field when the evidence fragment field contains the relevant context of "Astragalus". The fusion network inference unit outputs the alignment sub-field and enters the alignment decision unit to complete the writing of the alignment judgment field. Finally, an entity alignment mapping table record containing the left entity identifier field, the right entity identifier field, and the alignment sub-field is formed and enters S300.
[0057] Summary of the technical effects of this step: Based on the entity candidate set, this step generates name similarity field, attribute similarity field, and semantic vector similarity field, and outputs alignment subfield through the fusion network, generates entity alignment mapping table and writes it into the version archive table. The entity alignment mapping table can be directly called by S300.
[0058] S300: Generate a remote supervised annotation set based on the entity alignment mapping table to train the relation classification model, extract samples according to the model uncertainty to generate an expert annotation increment set and update the relation classification model, and output the relation triplet set and relation confidence set;
[0059] In this step, the input source is the entity alignment mapping table output by S200, and the evidence fragment field and evidence location field of the clinical literature and the ancient book corresponding to the batch number are called in the same batch. The entity alignment mapping table includes a left entity identifier field, a right entity identifier field, an alignment subfield, a name similarity field, an attribute similarity field, a semantic vector similarity field, a left source library identifier field, a right source library identifier field, a collection batch number, and a fusion network model version identifier. The relation extraction module receives relation extraction job configuration as input. The relation extraction job configuration includes a relation type set, a labeled sample construction window, candidate sentence segment filtering rules, a remote supervision labeled set version identifier, a relation classification model version identifier, an uncertainty threshold, an expert labeled channel identifier, and an incremental update strategy. Among them, the relation type set corresponds to the syndrome-disease correspondence relationship type, disease-treatment relationship type, prescription composition relationship type, medicinal material content relationship type, component-targeting relationship type, and target-pathway relationship type in the three-layer heterogeneous graph structure of this invention. The labeled sample construction window determines the sentence segment range by the text evidence positioning field and generates a sentence segment identifier field. The candidate sentence segment filtering rules are composed of entity co-occurrence constraints, word distance constraints, and negative word constraints and are written into the filtering rule version identifier. When the relation extraction module receives a new collection batch number and completes the entity alignment mapping table entry event, it triggers a remote supervision annotation set generation job. When it receives an expert annotation incremental set entry event, it triggers a relation classification model incremental update job. Each job is written to the relation extraction job log, which includes the collection batch number, remote supervision annotation set version identifier, relation classification model version identifier, number of candidate sentence segments, number of labeled samples, number of incremental samples, and exception reason code.
[0060] Specifically, the relation extraction module first performs entity unified identifier parsing processing on the entity alignment mapping table. This parsing process merges the left and right entity identifier fields into a unified entity identifier field and writes it back to the mapping snapshot field of the entity alignment mapping table. The mapping snapshot field records the set of multi-source library identifier entities corresponding to the same unified entity identifier field, for subsequent segment matching and relation evidence location. Then, the relation extraction module calls the seed knowledge table to generate a set of seed relation pairs. The seed knowledge table consists of a syndrome-disease comparison table, a prescription indication table, a medicinal material component table, and a component target table. The set of seed relation pairs includes a head entity standardized name field, a tail entity standardized name field, a relation type field, and a seed source field. The relation extraction module maps the head entity standardized name field and the tail entity standardized name field in the seed relation pair set to the unified entity identifier field through the entity alignment mapping table and generates a set of seed relation anchor points. This set includes a head unified entity identifier field, a tail unified entity identifier field, a relation type field, and a seed source field. The relation extraction module performs sentence segment retrieval within the evidence fragment fields of the clinical literature and the ancient books. Sentence segment retrieval traverses the evidence fragment fields according to the sentence segment identifier field and performs entity mention localization, writing the matched entity mentions into a sentence segment hit table. This table includes a sentence segment identifier field, a unified entity identifier field, an entity type field, a mention start and end position field, and an evidence localization field. When the same sentence segment identifier field simultaneously hits both the head and tail unified entity identifier fields and meets the candidate sentence segment selection rules, the relation extraction module generates a remote supervision annotation sample record and writes it into a remote supervision annotation set. This remote supervision annotation sample record includes a sample identifier field, a sentence segment identifier field, a sentence segment text field, a head unified entity identifier field, a tail unified entity identifier field, a head entity type field, a tail entity type field, a relation type field, an annotation source field, and an evidence localization field. The annotation source field includes two values: seed source and weak negation. Weak negation is triggered by negation word constraints and written into a negation trigger field, which records the triggered negation word fragment and its position in the sentence segment text field. To reduce conflicts between multiple relation types for the same pair of entities within the same sentence segment, the relation extraction module performs conflict resolution processing on the remote supervision annotation set. The conflict resolution processing generates a resolution result field based on the hierarchical constraints of the relation type set, the matching constraints of the head and tail entity type fields, and the priority constraints of the annotation source field, and writes the resolution result field into the remote supervision annotation set. When the resolution result field is pending review, the relation extraction module writes the corresponding sample into the manual review queue and records the review reason field. The review reason field includes three categories: type mismatch, relation conflict, and missing evidence.
[0061] After the remote supervision annotation set is generated, the relation extraction module enters the relation classification model training process. The relation classification model consists of a text encoding submodule and a classification output submodule. The text encoding submodule adopts a Bidirectional Encoder Representations from Transformers (BERT) model structure, and the classification output submodule includes a fully connected layer and a normalized output layer. During the training phase, the relation extraction module divides the remote supervision annotation set into a training subset and a validation subset according to the collection batch number and the remote supervision annotation set version identifier. It then assembles the sentence text field, the header unified entity identifier field, the tail unified entity identifier field, and the relation type field into training input records. Among them, the training input records have an entity position marker field written into the sentence text field. The entity position marker field is generated by the header and tail start and end position fields and written into the position marker version field with each batch. The relation extraction module loads model parameter snapshots according to the relation classification model version identifier and executes training iterations. The training iterations calculate the output probability distribution field batch by batch and perform error backpropagation updates with the relation type field. The training process is written to the training process record field, which includes the batch number, sample identifier field, loss value record, learning rate record, and model parameter snapshot identifier. When the convergence judgment field of the validation subset meets the termination condition, the relation extraction module generates a new version of the relation classification model and writes it to the model version record table. The model version record table includes the relation classification model version identifier, training data version identifier, location marker version field, collection batch number range field, and parameter snapshot identifier field.
[0062] After the relation classification model completes one training iteration, the relation extraction module performs inference processing on the unlabeled segment pool. This pool consists of segment identifier fields from the clinical literature and ancient texts that satisfy entity co-occurrence constraints and are not included in the remote supervision annotation set. The inference processing inputs the segment text field and entity location marker field into the relation classification model, outputting a relation type candidate field and an output probability distribution field, and writing the output probability distribution field into the inference record table. Subsequently, the relation extraction module performs model uncertainty calculation processing. The model uncertainty is calculated from the entropy value of the output probability distribution field, and the uncertainty calculation result is written into the uncertainty field. The relation extraction module compares the uncertainty field with an uncertainty threshold. When sampling trigger conditions are met, an incremental set of expert annotations is generated. These sampling trigger conditions include three categories: uncertainty field exceeding the uncertainty threshold, confidence distribution drift marker field triggering in two consecutive collection batches for the same relation type candidate field, and manual review queue backlog exceeding the queue threshold. The confidence distribution drift marker field is written from the probability quantile changes in the inference record table. The incremental set of expert annotations is generated by the expert annotation module. The expert annotation module receives the sample identifier field, sentence / segment text field, header unified entity identifier field, tail unified entity identifier field, relation type candidate field, output probability distribution field, and evidence location field, and outputs the expert annotation relation type field and annotation consistency field. The annotation consistency field is written by a dual-person review strategy. The relation extraction module merges the incremental set of expert annotations and the remote supervision annotation set according to the training data version identifier and triggers the incremental update operation of the relation classification model. The incremental update operation writes the parent version identifier field and the incremental sample quantity field into the model version record table, and writes the rollback flag field and rollback reason field for the case of incremental update failure. The rollback reason field includes three categories: abnormal sample format, parameter non-convergence, and version conflict.
[0063] After completing the relation classification model inference and incremental update, the relation extraction module outputs a set of relation triples and a set of relation confidence scores. The relation triple set consists of a set of triple records, including a header unified entity identifier field, a relation type field, a tail unified entity identifier field, a sentence segment identifier field, an evidence location field, a collection batch number, and a relation classification model version identifier. The relation confidence score set consists of a set of confidence records, including a triple identifier field, an output probability distribution field, a relation confidence score field, and an uncertainty field. The relation confidence score field is written from the probability value in the output probability distribution field corresponding to the relation type field. The relation extraction module writes the relation triple set and the relation confidence score set into the relation result database and uses them as input to the S400 relation triple set and relation confidence score set, allowing the S400 to calculate literature support, clinical support, and semantic relevance, and generate relation strength sets and heterogeneous edge sets. This step provides an engineering embodiment. In a hospital knowledge service scenario, the relation extraction module accesses electronic medical record segments with the same collection batch number as evidence fragment fields of the clinical literature, accesses classical Chinese medicine texts as evidence fragment fields of the ancient books, and calls the syndrome-disease comparison table and prescription indication table to generate a set of seed relation anchor points. In the sentence segment retrieval stage, the relation extraction module completes the entity mention location of the head unified entity identifier field and the tail unified entity identifier field in the relevant sentence segment identifier field of "chest tightness and phlegm", and generates remote supervision annotation sample records. In the inference stage, the probability distribution field is output and the uncertainty field is calculated. Samples exceeding the uncertainty threshold are sent to the expert annotation module to form an expert annotation increment set, and then written into the model version record table to complete the incremental update of the relation classification model. Finally, relation triplet records containing evidence location fields and relation classification model version identifiers are generated and written into the relation result database.
[0064] Summary of the technical effects of this step: This step generates a remote supervision annotation set based on the entity alignment mapping table and trains the relation classification model. It forms an incremental set of expert annotations according to the model uncertainty and drives the version update of the relation classification model. It outputs a set of relation triples and a set of relation confidence for S400 to call.
[0065] S400: Calculate document support, clinical support, and semantic relevance based on relation triplet sets and relation confidence sets, generate relation strength sets by weighted geometric average, and output heterogeneous edge sets;
[0066] This step takes as input the relation triplet set and relation confidence set output by S300. The relation triplet set includes a header unified entity identifier field, a relation type field, and a tail unified entity identifier field. The relation confidence set includes relation confidence fields corresponding to each relation triplet in the set. This step also reads the collection batch number, evidence location field, and evidence fragment field archived by S100 in the same batch, and reads the entity semantic vector field archived by S200. The entity semantic vector field is bound and stored with the unified entity identifier field. The relation strength calculation module receives the relation strength job configuration as input. The relation strength job configuration includes a literature database range field, a structured case record range field, a sentence / segment statistics window field, a weight configuration version identifier, a normalization strategy version identifier, and an anomaly handling rule field. The relation strength calculation module triggers the job when it detects a relation triplet set entry event or a collection batch number update event, and writes the collection batch number, relation classification model version identifier, weight configuration version identifier, and normalization strategy version identifier into the relation strength job log. The relation strength job log synchronously records the input, output, and anomaly segments for batch traceability.
[0067] Specifically, the relation strength calculation module first performs triple standardization on the relation triple set. The standardization process solidifies the arrangement of the header and tail unified entity identifier fields according to the directional attribute bound to the relation type field, and writes the solidified result into the standardized triple field. Records missing header or tail unified entity identifier fields are written into the missing marker field and placed in an isolation queue. The literature support calculation unit establishes an inverted index on the clinical literature database and ancient book database, which are defined by the literature database scope field. The inverted index key is the unified entity identifier field, and the inverted index value is the evidence location field set. The literature support calculation unit retrieves the co-occurrence counts of the entities at both ends of each standardized triple field within the same evidence location field, aggregates and writes this count into the literature count field, then performs truncation and normalization processing according to the normalization strategy version identifier, writes the result into the literature support field, and compresses and writes the evidence location field set that triggers co-occurrence into the literature evidence snapshot field.
[0068] The clinical support calculation unit performs co-occurrence statistical processing on the structured case record set defined by the structured case record scope fields. The structured case records are parsed from Electronic Medical Records (EMRs) and include case identifier fields, time fields, diagnosis fields, syndrome type fields, prescription fields, and medication fields. A unified entity identifier field is stored in the diagnosis and syndrome type fields. The clinical support calculation unit aggregates the diagnosis, syndrome type, prescription, and medication fields according to the case identifier field to generate a case entity set field. Under the constraints of the sentence segment statistics window field, it calculates the co-occurrence frequency of the standardized triplet field in the case entity set field, writes it to the clinical count field, and then writes it to the clinical support field according to the normalization strategy version identifier, while also writing it to the clinical evidence snapshot field. In the engineering embodiment, the deployment end is located at the offline analysis node of the hospital information system. This step is triggered by the daily update of the collection batch number. When the abnormal handling rule field meets the review conditions in the abnormal data segment, a review task field is generated and bound to the collection batch number for archiving.
[0069] After generating the literature support and clinical support fields, the semantic relevance calculation unit reads the entity semantic vector fields corresponding to the entities at both ends of each standardized triple field, and defines the entity semantic vector fields as entity embedding vectors to participate in similarity calculation. The semantic relevance calculation unit performs vector normalization on the entity embedding vectors at both ends and calculates the cosine similarity score, writing the similarity score into the semantic relevance field. Records with missing entity semantic vector fields are written into the vector missing marker field and enter the supplementation queue. The supplementation queue calls the biomedical pre-trained language model version identifier bound to S200 to generate missing vectors and writes them back into the entity semantic vector field, while writing the supplementation action into the vector supplementation log. For records with consecutive failures in the supplementation queue, the anomaly handling rule field is written into the degradation marker field and the semantic relevance field is written with a default value.
[0070] After all three types of indicators are available, the relation strength fusion unit reads the literature support field, clinical support field, and semantic relevance field, and performs weighted product aggregation according to the version identifier configured by weight. During the aggregation process, zero-value smoothing is performed on each indicator and written into the smoothing mark field. Then, the version identifier of the product result is written into the relation strength field according to the normalization strategy. The relation strength field is aggregated into the relation strength set according to the standardized triple field. The relation strength fusion unit simultaneously writes the relation confidence field into the confidence field and aggregates the literature evidence snapshot field and clinical evidence snapshot field into the evidence field, generating a heterogeneous edge set. The heterogeneous edge set record includes the edge identifier field, the header unified entity identifier field, the relation type field, the tail unified entity identifier field, the relation strength field, the confidence field, the evidence field, the collection batch number, and the version identifier field. The edge consistency verification unit checks the type combination according to the entity type field constraint and writes the type mismatch mark field to the isolation queue for mismatched records. When multiple edge records with the same standardized triple field appear in the same collection batch number, the edge deduplication unit sorts and folds them according to the relation strength field and the confidence field and writes them into the folding result field. The final output is a set of relation strengths and a set of heterogeneous edges. The set of heterogeneous edges is used as the input of the heterogeneous edge set of S500, and the set of relation strengths is used as the input of the relation strength set of S500.
[0071] Summary of the technical effects of this step: This step completes the multi-source support calculation and fusion of the relation triple set and relation confidence set, outputs the relation strength set and heterogeneous edge set and connects them to the S500 graph construction link.
[0072] S500: Construct a three-layer heterogeneous graph structure based on heterogeneous edge sets, including a disease-symptom layer, a disease-prescription layer, and a drug-ingredient layer, with disease entities and single-herb entities connected. Learn entity embedding sets by transforming matrices according to entity types, using relational attention and gating cross-type propagation. Write the three-layer heterogeneous graph structure, entity embedding sets, and relational strength sets into a graph database to generate a knowledge graph library.
[0073] The inputs for this step are the heterogeneous edge set and relation strength set output by S400. The heterogeneous edge set includes an edge identifier field, a header unified entity identifier field, a relation type field, a tail unified entity identifier field, a relation strength field, a confidence field, an evidence field, and a collection batch number field. The relation strength set corresponds to each edge in the heterogeneous edge set according to the edge identifier field. This step simultaneously reads the entity candidate set archived by S100 and the entity alignment mapping table archived by S200. The entity candidate set includes a unified entity identifier field, an entity name field, an entity type field, and a source field. The entity alignment mapping table includes the entity identifier field before alignment, the unified entity identifier field after alignment, and the alignment subfield. This step triggers a graph construction operation upon receiving the heterogeneous edge set entry event or the collection batch number field update event. The collection batch number field, graph mode version identifier, graph embedding model version identifier, training configuration version identifier, and write batch number field are written to the graph construction operation log. The graph construction operation log records input data segments, output data segments, exception data segments, and a rollback flag field for batch traceability and audit review.
[0074] Specifically, the three-layer heterogeneous graph construction module performs entity merging and type solidification processing on the entity candidate set. Entity merging is driven by the entity alignment mapping table, mapping the entity identifier field before alignment to the unified entity identifier field after alignment, merging the entity name fields under the same unified entity identifier field after alignment to generate a standard name field, and aggregating the source fields to generate a source set field. The type solidification processing performs enumeration verification on the entity type fields and writes them into the type validity flag field. The three-layer heterogeneous graph construction module then performs intra-layer attribution determination processing on the heterogeneous edge set. The intra-layer attribution determination processing determines the layer field where the edge is located based on the combination of the head unified entity identifier field and the tail unified entity identifier field in the entity candidate set, and writes it into the edge layer field. Among them, the edge record composed of syndrome entity and disease entity is written into the syndrome-disease layer field, the edge record composed of disease entity and prescription entity or disease entity and single herb entity is written into the disease-prescription layer field, and the edge record composed of single herb entity and chemical component entity or chemical component entity and target entity is written into the drug-component layer field. The edge record that does not meet the above constraints is written into the type conflict flag field and enters the isolation queue. The process of constructing interconnected nodes is executed within the three-layer heterogeneous graph construction module. This process marks disease entities and single-herb entities as interconnected entity marker fields and establishes cross-layer index fields for these interconnected entity marker fields in the three-layer heterogeneous graph structure. These cross-layer index fields aggregate and associate adjacent records in different edge layer fields according to the aligned unified entity identifier field, thus obtaining the three-layer heterogeneous graph structure. The three-layer heterogeneous graph structure is organized in memory using an adjacency list structure. The adjacency list structure includes a node identifier field, a node type field, an inbound edge set field, an outbound edge set field, and an adjacent node set field, and shares the edge identifier field as a connection key with the heterogeneous edge set.
[0075] Figure 3 This is a schematic diagram of a three-layer heterogeneous knowledge graph structure provided in an embodiment of this application, such as... Figure 3 As shown, the structure is divided into three layers from top to bottom: the top layer is the "Syndrome-Disease Layer," which includes TCM syndrome nodes such as "Liver Qi Stagnation" and "Qi and Yin Deficiency," and is connected to modern medical disease nodes such as "Depression" and "Chronic Gastritis" through edges; the middle layer is the "Disease-Formula Layer," which shows the therapeutic relationship between "Depression" and formulas such as "Xiaoyao San" and "Chaihu Shugan San"; the bottom layer is the "Drug-Ingredient Layer," which presents the compositional relationship between Chinese herbs such as "Bupleurum" and chemical components such as "Bupleurum Saponin A." The three layers are vertically connected through two core bridge entities: "Disease" and "Single Herb," forming a complete knowledge network from macroscopic syndrome differentiation to microscopic material basis.
[0076] As mentioned earlier, through steps S100 to S400, we obtained the entity alignment mapping table, the set of relation triples, and the quantized relation strengths. Based on this, in step S500, the system automatically constructs the following structure according to the entity type and predefined hierarchical rules: Figure 3 The three-layer heterogeneous graph structure shown is not a simple planar network, but a deeply organized semantic framework.
[0077] Syndrome-Disease Layer: This layer realizes the mapping and connection between TCM syndrome differentiation and Western medicine disease differentiation, and is the "syndrome differentiation-disease differentiation" combination layer of the knowledge graph. For example, the high-strength association edge between the "liver qi stagnation" syndrome and diseases such as "depression" and "functional dyspepsia" reflects the connection between different descriptive systems of TCM and Western medicine for the same pathological state.
[0078] Disease-Prescription Layer: This layer carries the core treatment knowledge of "finding prescriptions based on diseases" and "diagnosing diseases based on prescriptions." The weight of the edges between disease nodes (such as "depression") and prescription nodes (such as "Xiaoyao San") is determined by the strength of the relationship calculated by S400, which intuitively reflects the degree of therapeutic support of the prescription for the disease.
[0079] Drug-Component Layer: This layer reveals the modern material basis of traditional Chinese medicine treatment. It links the physical Chinese medicinal material (such as "Bupleurum") with its chemical components (such as "Saikosaponin A"), providing a data bridge for explaining the efficacy of prescriptions from a molecular mechanism perspective.
[0080] The key innovation lies in the fact that the entities of "disease" and "single herb" serve as hubs connecting these three layers of structure. For example, a node of "depression" connects to "liver qi stagnation" at the syndrome-disease layer and to "Xiaoyao San" at the disease-prescription layer. "Xiaoyao San" is composed of herbs such as "Bupleurum," thus tracing back to "Bupleurum saponin a" at the prescription-component layer. This design enables the knowledge graph to support cross-level, interpretable query and reasoning paths from "syndrome" to "effective ingredient," perfectly realizing the deep integration and structured representation of multi-source heterogeneous knowledge.
[0081] After the three-layer heterogeneous graph structure is generated, the graph embedding training module receives the training configuration record as input. The training configuration record includes an entity type set field, a relation type set field, an embedding dimension field, a sampling strategy field, a batch size field, a stopping condition field, and a random seed field. Among them, the entity type set field, relation type set field, and embedding dimension field constitute the minimum set of core parameters in this step, while the sampling strategy field, batch size field, and stopping condition field constitute the set of constraint parameters related to training stability. The graph embedding training module uses a graph neural network (GNN) architecture to perform type-aware message passing training. The type-aware message passing training first initializes the entity type transformation matrix set based on the entity type set field. The entity type transformation matrix set establishes a one-to-one correspondence parameter block according to the entity type field, and binds the parameter block identifier field with the graph embedding model version identifier for archiving. Subsequently, the graph embedding training module reads the relation type field and relation strength field for each edge record. The relation strength field participates in the attention normalization process as an edge weight field to generate a relation attention weight field. The relation attention weight field is normalized within the incoming edge set field of the same node and written to the attention snapshot field. Gated cross-type propagation is performed after the relation attention weight field is generated. For each node, the gated cross-type propagation reads the node type distribution from the node type field and the neighboring node set field, calculates the gate coefficient field in conjunction with the attention snapshot field, and limits the value of the gate coefficient field to zero to one, writing it into the gated snapshot field. Message aggregation processing performs weighted aggregation on the message vectors of the neighboring node set field under the constraints of the gated snapshot field. The aggregation result is transformed by the corresponding entity type transformation matrix set parameter block and written into the node representation field. The graph embedding training module iteratively updates the entity type transformation matrix set and relation attention-related parameters according to the stopping condition field recorded in the training configuration, and writes the training round field, loss record field, and gradient anomaly label field at the end of each iteration. When the gradient anomaly label field meets the anomaly handling rules, the graph embedding training module writes the rollback round field and restores to the most recent stable checkpoint. The stable checkpoint is located by the parameter block identifier field, the training round field, and the random seed field. After training, the graph embedding training module exports an entity embedding set, which includes a unified entity identifier field, an embedding vector field, a node type field, a collection batch number field, and a graph embedding model version identifier. The embedding vector field is aligned with the entity candidate set, and the unified entity identifier field is then aligned and verified. Records that fail the verification are written into the embedding missing marker field and entered into the supplementary calculation queue.
[0082] The write and publish module receives the three-layer heterogeneous graph structure, entity embedding set, and relation strength set as input, and writes them into the graph database to generate a knowledge graph library. The graph database is the Neo4j graph database. The write and publish module submits nodes and edges through a batch transaction write channel. In the node writing process, the write and publish module creates a node record for each unified entity identifier field. The node record includes a standard name field, a node type field, a source set field, a connecting entity tag field, and an embedding vector field. In the edge writing process, the write and publish module creates a relation record for each edge identifier field. The relation record includes a relation type field, a relation strength field, a confidence field, an evidence field, an edge layer field, and a collection batch number field. The relation strength field is also synchronously registered as an edge weight attribute field in the graph database. The release index construction is performed after the database write is completed. The release index construction creates cross-level index fields for node records where the entity marker field is true, creates relationship type index fields for relationship type fields, and creates version index fields for the collection batch number field and the graph embedding model version identifier. The database write batch number field is written to the release record table. The release record table contains release status fields and rollback pointer fields. When the release status field is failure, the database write and release modules cancel the transaction set corresponding to the database write batch number field according to the rollback pointer field and write it to the rollback completion marker field.
[0083] Figure 4 A visualization diagram of a syndrome reasoning path provided in this application embodiment is shown in the figure. Taking "liver qi stagnation" as an example, it intuitively demonstrates the process of intelligent reasoning and path discovery based on the constructed knowledge graph. The figure centers on the "liver qi stagnation" syndrome node, radiating outwards multiple related edges, clearly marking the related targets and quantified relationship strength values. For example, the associated disease nodes include "depression (0.82)" and "functional dyspepsia (0.76)"; the associated recommended prescription nodes include "Chaihu Shugan San (0.87)" and "Xiaoyao San (0.81)". This figure vividly illustrates the dynamic process of exploring multi-hop associations along the knowledge graph network and obtaining quantified results, starting from the core concept.
[0084] The completed knowledge graph repository is not a static data warehouse, but an interactive platform that supports complex reasoning and intelligent discovery. For example... Figure 4As shown, when a user uses a specific entity (such as the syndrome "Liver Qi Stagnation") as the starting point for their query, the system can utilize the traversal and aggregation functions of the graph database to perform multi-hop queries and sort and visualize the results based on the relationship strength quantified by S400. The specific process is as follows: the system first locates the "Liver Qi Stagnation" node, then discovers the disease with the highest correlation along the "Syndrome-Disease" edge (such as depression, strength 0.82), and simultaneously discovers classic treatment formulas (such as Chaihu Shugan San, strength 0.87) along the "Syndrome-Formula" edge or through the indirect path of the "Disease-Formula" layer. This visualization not only presents the associated entities but also reveals the reliability of the association through the relationship strength values (derived from the fusion of multi-source evidence from literature, clinical practice, and semantics). This greatly assists in TCM clinical decision-making (recommending highly relevant formulas for specific syndromes), scientific research discovery (exploring the hidden patterns between syndromes, diseases, and formulas), and TCM teaching (intuitively understanding the networked relationships of classic theories), fully demonstrating the practicality and intelligence level of the knowledge graph constructed in this invention.
[0085] Example 2: Figure 2 A structural block diagram of a multi-source heterogeneous knowledge graph construction system according to an embodiment of the present invention is shown. Figure 2 As shown, the structure may include:
[0086] The data access and entity candidate generation module 01 is used to access data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases. It loads field mapping rules, performs cleaning, segmentation, field extraction, entity recognition, and entity type labeling on the accessed data, and generates an entity candidate set containing entity identifiers, entity names, entity types, source identifiers, and attribute fields. This entity candidate set is then sent to the similarity calculation and entity alignment module. Specifically, after receiving the data from the ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases, the data access and entity candidate generation module loads the field mapping rules and registers the mapping effectiveness record. The field mapping rules include field correspondence, data type constraints, value caliber constraints, and missing test marker caliber. The module performs duplicate merging, unresolvable symbol removal, punctuation regularization, and segmentation generation on the accessed data. It extracts name and attribute fields according to the field mapping rules, completes entity recognition, alias merging, and entity type labeling, generates entity identifiers, and writes them into the entity candidate set. When a field is missing or there is a type conflict, the missing test marker caliber is written into the attribute field, and the conflict marker field is registered. The entity candidate set includes entity identifier, entity name, entity type, source identifier, and attribute fields, and is sent to the similarity calculation and entity alignment module.
[0087] The similarity calculation and entity alignment module 02 receives the entity candidate set, calculates name similarity, attribute similarity, and semantic vector similarity, inputs the three types of similarity into a fusion network to generate alignment scores, performs threshold determination, conflict arbitration, and mapping registration processing, outputs an entity alignment mapping table containing entity alignment pairs, alignment scores, and arbitration tag fields, and sends the entity alignment mapping table to the relation extraction and closed-loop update module. Specifically, the similarity calculation and entity alignment module generates a set of entity pairs to be compared according to entity type and calculates name similarity, attribute similarity, and semantic vector similarity. The semantic vector similarity is generated by the semantic vector output from the biomedical pre-trained language model. The fusion network includes an input layer, two fully connected hidden layers, and an output layer. The output layer outputs the alignment scores. The threshold determination reads threshold parameters and performs threshold comparison on the alignment scores to generate entity alignment pairs. The conflict arbitration, in the scenario where multiple entity alignment pairs correspond to the same entity identifier, is sorted by alignment score and the arbitration mark field is registered in combination with the source identifier priority rule. The mapping registration writes the entity alignment pair, alignment score and arbitration mark field into the entity alignment mapping table and sends it to the relationship extraction and closed-loop update module.
[0088] The relation extraction and closed-loop update module 03 is used to receive the entity alignment mapping table, call the syndrome-disease comparison table, the prescription indication table, the medicinal material ingredient table, and the ingredient target table to generate a remote supervision annotation set, train a relation classification model based on the remote supervision annotation set, calculate the entropy value of the probability distribution output by the relation classification model to form the model uncertainty, extract samples according to the model uncertainty threshold to generate an expert annotation increment set and trigger the model update operation, output a set of relation triples containing head entity identifier, relation type, and tail entity identifier fields and a set of relation confidence scores corresponding to each relation triple, and send the set of relation triples and the set of relation confidence scores to the relation strength quantification and heterogeneous edge generation module; specifically, the relation extraction and closed-loop update module performs entity name alignment mapping on the syndrome-disease comparison table, the prescription indication table, the medicinal material ingredient table, and the ingredient target table, generates an in-table relation index, and generates the remote supervision annotation set by matching the co-occurrence results with clinical literature sentence segments. The relation classification model receives sentence segments, head entity identifiers, and tail entity identifiers for training and outputs a relation type probability distribution. The model uncertainty is calculated by registering the entropy value from the relation type probability distribution. The sample extraction generates an incremental set of expert annotations based on the model uncertainty threshold and triggers the model update operation. The relation extraction and closed-loop update module outputs a set of relation triples and maps them to the relation type probability distribution to generate a relation confidence set. The relation triples are matched one by one with the relation confidence set and then sent to the relation strength quantification and heterogeneous edge generation module.
[0089] The relation strength quantification and heterogeneous edge generation module 04 is used to receive the relation triple set and the relation confidence set, generate literature support based on the occurrence count of relation triples in the literature database, generate clinical support based on the co-occurrence count of relation triples in structured case records, generate semantic relevance based on the semantic vector similarity of the entities at both ends of the relation triple, generate a relation strength set by weighted geometric mean fusion, and register a heterogeneous edge set based on the relation type field and the relation strength set. The heterogeneous edge set is then sent to the three-layer heterogeneous graph construction and entity embedding learning module. Specifically, the relation strength quantification and heterogeneous edge generation module retrieves and normalizes the occurrence count of relation triples in the literature database and registers the literature support, retrieves and normalizes the co-occurrence count in structured case records and registers the clinical support, and reads the semantic vector similarity of the head entity identifier and the tail entity identifier to register the semantic relevance. The weighted geometric mean fusion reads the weight parameters and integrates literature support, clinical support and semantic relevance to generate a relation strength set. The heterogeneous edge set registers the edge type according to the relation type field and writes the relation strength set into the edge attribute field before sending it to the three-layer heterogeneous graph construction and entity embedding learning module.
[0090] The three-layer heterogeneous graph construction and entity embedding learning module 05 is used to receive the heterogeneous edge set, construct a three-layer heterogeneous graph structure including a syndrome-disease layer, a disease-prescription layer, and a drug-ingredient layer, and to load an entity type transformation matrix and perform relational attention calculation and gated cross-type propagation processing. It learns an entity embedding set corresponding to each node of the three-layer heterogeneous graph structure and sends the three-layer heterogeneous graph structure and the entity embedding set to the graph database writing and knowledge graph library management module. Specifically, after receiving the heterogeneous edge set, the three-layer heterogeneous graph construction and entity embedding learning module generates the three-layer heterogeneous graph structure and registers the interconnected association between disease entities and single-herb entities. The relational attention calculation reads the relation type field and relation strength set to generate attention weights. The gated cross-type propagation performs cross-type message propagation under the attention weight constraint and writes it into the entity embedding set. The entity embedding set corresponds to each node of the three-layer heterogeneous graph structure and is registered according to the entity identifier index. The three-layer heterogeneous graph structure and the entity embedding set are sent to the graph database writing and knowledge graph library management module.
[0091] The graph database writing and knowledge graph library management module 06 receives the three-layer heterogeneous graph structure, the entity embedding set, and the relation strength set. It generates graph database writing batches and performs node writing, edge writing, and attribute field writing processes to complete the knowledge graph library registration. It also outputs query interface parameters including entity retrieval parameters, shortest path parameters, neighborhood traversal parameters, similarity retrieval parameters, and link prediction parameters. Specifically, the module assembles graph database writing batches and writes nodes and edges. The node writing payload includes entity identifier, entity name, entity type, source identifier, attribute fields, and entity embedding set fields. The edge writing payload includes head entity identifier, relation type, tail entity identifier, and relation strength set fields. During the writing process, it registers the library entry status field and the exception rollback flag field and completes the knowledge graph library registration. The query interface parameters are output after the library registration is completed and include entity retrieval parameters, shortest path parameters, neighborhood traversal parameters, similarity retrieval parameters, and link prediction parameters for external query calls and are associated with the library entry status field.
[0092] Figure 5 This is a schematic diagram of a knowledge graph system interface provided in an embodiment of this application, such as... Figure 5 The diagram shows a user interface (UI) of the "Traditional Chinese Medicine Knowledge Graph System" implemented using this method. The interface is clearly designed, divided into three main functional areas: the left-hand "Entity Search" bar allows users to enter query terms (such as "liver qi stagnation"); the large central "Knowledge Graph Visualization" area dynamically displays the network graph formed by the query results; and the right-hand "Entity Details" panel displays structured information about the selected entity, such as "Syndrome Type: Liver Qi Stagnation," along with statistics on "Related Diseases: 3" and "Recommended Prescriptions: 5." This interface integrates search, visualization, and detail browsing, forming a complete knowledge service front-end.
[0093] The method described in this invention is ultimately provided to the end user through an integrated software system. This system typically employs a front-end / back-end separation architecture: the back-end is responsible for executing all processes from S100 to S500 and managing the graph database; the front-end provides, for example... Figure 5 The interactive interface shown is mainly composed of three functional modules:
[0094] Entity search module: Users can enter any entity name (such as syndrome type, disease, prescription, drug, etc.) in the input box. The system uses the entity alignment mapping table to perform accurate matching and fuzzy recommendation to quickly locate nodes in the graph.
[0095] Knowledge Graph Visualization Module: This is the core display area of the system. When a user performs a search or clicks on a node, this module calls the graph database interface to retrieve subgraph data centered on that node within a preset number of hops, and automatically lays out and renders it using algorithms such as force-directed graphs. Users can explore complex knowledge networks through dragging, zooming, and clicking.
[0096] Entity Details Display Module: When a user selects a node in the visualization graph or clicks on an item in the search results, this module will extract all attributes of the entity (such as the composition of the prescription, the properties and meridians of the drug) and summary information of all its associated edges (such as the number of associations and the strongest associated objects) from the graph database and display them in a structured panel format.
[0097] The complex underlying processes of multi-source heterogeneous data processing, graph construction, and relationship quantification are encapsulated into an intuitive, easy-to-use, and powerful knowledge exploration tool. This allows users with non-technical backgrounds, such as TCM practitioners and researchers, to fully utilize the knowledge graph constructed by this invention for in-depth analysis and decision support, thus completing a value loop from data and methods to practical applications.
Claims
1. A method for constructing a multi-source heterogeneous knowledge graph, characterized in that, include: S100: Obtain data from ancient books, clinical literature, and databases of traditional Chinese medicine, drugs, and diseases; extract entities of syndrome types, diseases, prescriptions, single herbs, chemical components, and targets by field mapping; and generate a candidate set of entities. S200. Based on the entity candidate set, calculate name similarity, attribute similarity, and semantic vector similarity. Input the name similarity, attribute similarity, semantic vector similarity, attribute missing marker field, and vector degradation marker field into the fusion network and output the alignment score field. The alignment score field is compared with the alignment score threshold to generate an entity alignment mapping table; wherein, the fusion network consists of an input layer, two fully connected hidden layers and an output layer; S300. Based on the entity alignment mapping table, a remote supervision annotation set is generated by calling the syndrome comparison table, prescription indication table, medicinal material component table, and component target table. After mapping the head entity standardized name field and tail entity standardized name field in the seed relationship pair to the unified entity identifier field through the entity alignment mapping table, a sentence segment retrieval is performed on the evidence fragment field of clinical literature and ancient books. When the head unified entity identifier field and the tail unified entity identifier field are hit simultaneously in the same sentence segment identifier field, and the candidate sentence segment screening rules composed of entity co-occurrence constraint, word distance constraint, and negative word constraint are satisfied, a remote supervision annotation sample containing the annotation source field is generated. The remote supervision annotation set is then used. A relation classification model is trained, and the entropy value of the probability distribution output by the relation classification model is calculated as the model uncertainty. Sampling trigger conditions are set, including: the model uncertainty is greater than the uncertainty threshold, the confidence distribution drift marker field of the candidate field of the same relation type in two consecutive collection batch numbers is triggered, and the backlog of the manual review queue exceeds the queue threshold. For samples that meet the sampling trigger conditions, an expert annotation increment set is generated. The expert annotation module outputs the expert-annotated relation type field and the annotation consistency field written by the dual-person review strategy, and updates the relation classification model based on the expert annotation increment set, outputting a relation triplet set and a relation confidence set. The value of the annotation source field includes seed source and weak negation triggered by the negation word constraint; conflict adjudication processing is performed on the remote supervision annotation set, and the conflict adjudication processing generates an adjudication result field according to the hierarchical constraints of the relation type set, the head and tail entity type matching constraints and the priority constraints of the annotation source field; S400. Based on the set of relation triples and the set of relation confidence, calculate the literature support obtained by normalizing the frequency of occurrence of relation triples in the literature database, the clinical support obtained by normalizing the co-occurrence frequency of relation triples in structured case records, and the semantic relevance obtained by the cosine similarity of the entity embedding vectors at both ends of the relation triples. For records with missing entity semantic vector fields, write a missing vector flag field and enter the completion queue. The completion queue calls the biomedical pre-trained language model version identifier to generate missing vectors and writes them back. For records that fail consecutively in the completion queue, write a downgrade flag field and a default value in the semantic relevance field. Generate a relation strength set by weighted geometric mean. The relation strength set is obtained by multiplying the literature support, clinical support, and semantic relevance by weights and then exponentiating the result. Register the edge type according to the relation type field and write the relation strength set into the edge attribute field, outputting a heterogeneous edge set. S500. Based on the heterogeneous edge set, construct a three-layer heterogeneous graph structure comprising a syndrome-disease layer, a disease-prescription layer, and a drug-ingredient layer, interconnected by disease entities and single-herb entities. Organize the three-layer heterogeneous graph structure in memory as an adjacency list structure, which includes a node identifier field, a node type field, an incoming edge set field, an outgoing edge set field, and an adjacent node set field. Establish a one-to-one correspondence set of entity type transformation matrices according to entity type. Read the relation type field and the relation strength set to generate a relation attention weight field, and perform normalization on the relation attention weight field within the incoming edge set field of the same node. Under the constraint of the normalized attention weight, for each Each node reads the node type distribution from the node type field and the adjacent node set field, and calculates the gating coefficient field by combining it with the normalized attention weight field. The gating coefficient field is limited to a value range of zero to one. Gated cross-type message propagation is then performed to learn the entity embedding set corresponding to each node in the three-layer heterogeneous graph structure. The three-layer heterogeneous graph structure, the entity embedding set, and the relationship strength set are written into the graph database to generate a knowledge graph library. The writing and publishing module includes a publishing record table, which contains a publishing status field and a rollback pointer field. When the publishing status field indicates failure, the transaction set corresponding to the writing batch number field is revoked according to the rollback pointer field.
2. The method according to claim 1, characterized in that, After extracting disease entities, S100 performs disease name normalization and ICD-11 encoding mapping, and registers the encoding field of the disease entities in the entity candidate set.
3. The method according to claim 1, characterized in that, The name similarity is composed of exact match score, character set Jaccard similarity score, and edit distance similarity score.
4. The method according to claim 1, characterized in that, In S200, the attribute similarity is obtained by calling the attribute parser according to the entity type field, performing key alignment and value normalization on the parsed attribute key value field, calculating the similarity score of the molecular formula field, the similarity score of the registration number field, and the similarity score of the meridian field under the constraint of the attribute key whitelist, and aggregating them according to the preset weight. The semantic vector similarity is obtained by calling a biomedical pre-trained language model to generate semantic vectors for the standardized name field, the standardized alias set field, and the evidence fragment field, and then calculating the cosine similarity score of the semantic vectors at both ends.
5. The method according to claim 1, characterized in that, In S200, the entity alignment mapping table records the following fields: left entity identifier field, right entity identifier field, alignment subfield, name similarity field, attribute similarity field, semantic vector similarity field, left source library identifier field, right source library identifier field, collection batch number, fusion network model version identifier, and alignment time field. If multiple records pass the same left entity identifier field, they are sorted in descending order by the alignment subfield and a one-to-one mapping binding is performed in combination with the entity type field constraint.
6. The method according to claim 1, characterized in that, In S300, the set of relationship types includes syndrome-disease correspondence relationship types, disease-treatment relationship types, prescription composition relationship types, medicinal material content relationship types, component-targeting relationship types, and target pathway relationship types.
7. The method according to claim 1, characterized in that, In S400, literature support is obtained by normalizing the frequency of occurrence of relation triples in the literature database; clinical support is obtained by normalizing the co-occurrence frequency of relation triples in structured case records. Semantic relevance is obtained by the cosine similarity of the entity embedding vectors at both ends of the relation triple.
8. The method according to claim 1, characterized in that, In S500, the heterogeneous edge set includes an edge identifier field, a header unified entity identifier field, a relation type field, a tail unified entity identifier field, a relation strength field, a confidence field, an evidence field, a collection batch number field, and a version identifier field.
9. The method according to claim 1, characterized in that, The graph database is a graph database that supports attribute graph models. After completing the registration of the knowledge graph database, it outputs query interface parameters such as entity retrieval parameters, shortest path parameters, neighborhood traversal parameters, similarity retrieval parameters, and link prediction parameters.