A method for constructing a traditional Chinese medicine culture resource investigation database based on a knowledge graph
By constructing a database of TCM cultural resources based on knowledge graphs, the problem of expressing semantic relationships between resources in existing technologies has been solved. This has enabled the transformation from isolated records to systematic knowledge associations, dynamically presenting the multidimensional evolution path of resources in the TCM cultural system, and supporting in-depth tracing and systematic research.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANXI UNIV OF CHINESE MEDICINE
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-26
Smart Images

Figure CN122285918A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database construction technology, specifically to a method for constructing a database for the survey of traditional Chinese medicine cultural resources based on knowledge graphs. Background Technology
[0002] Traditional Chinese medicine (TCM) culture is a treasure of the Chinese nation, encompassing a vast collection of ancient texts, diverse folk medical techniques, and long-standing academic schools. With the rapid development of modern information technology, the rescue and protection of TCM cultural resources using digital means has become an industry consensus. Existing TCM cultural resource survey database construction technologies typically focus on converting unstructured materials such as paper books, field survey audio and video recordings, and lineage genealogies into digital formats. By establishing relational or document databases, various resources are classified, stored, cataloged, and indexed, thereby achieving the digital preservation and basic information management of TCM cultural resources, providing data support for subsequent academic research and cultural dissemination.
[0003] However, the current problem is that there is an extremely complex internal logic among traditional Chinese medicine (TCM) cultural resources, including the inheritance of academic schools, regional cultural differences, and the correspondence between changes in the origin of medicinal materials and treatment customs. Existing database construction methods mostly focus on recording and retrieving surface-level information of resources, lacking a deep association mining mechanism based on graph structures. This flat storage method makes it difficult to capture and express the implicit semantic relationships and network structures between resource entities, resulting in the system's inability to perform effective knowledge reasoning and induction. When a user queries a specific cultural resource, the system can only return isolated records through keyword matching, failing to demonstrate the resource's position within the entire TCM cultural system and its deep connections with other resources, thus failing to meet the needs of in-depth tracing and systematic research on TCM culture. Summary of the Invention
[0004] The purpose of this invention is to provide a method for constructing a database for the survey of traditional Chinese medicine cultural resources based on knowledge graphs, thereby solving the problems in the background technology:
[0005] The objective of this invention can be achieved through the following technical solutions:
[0006] A method for constructing a database for surveying traditional Chinese medicine cultural resources based on knowledge graphs includes the following steps:
[0007] S1. Collect classical texts and field survey texts, extract core entity words through sequence labeling technology, and simultaneously bind the time span and geographic coordinate attributes of the text;
[0008] S2. Establish an ontology model that includes the dimensions of lineage and origin of medicinal materials, define the evolutionary logic and constraint rules between entities, and form a knowledge architecture in the field of traditional Chinese medicine.
[0009] S3. Use neural networks to extract entities and events from the text, align entities to ontology nodes according to the domain knowledge architecture, and generate a basic TCM resource map.
[0010] S4. Calculate the feature vectors of the graph nodes, use inference algorithms to mine the implicit relationship between changes in place of origin and medical customs, and complete the missing semantic edges in the graph.
[0011] S5. Perform multiple path searches for resource nodes, aggregate their associated nodes in the dimensions of lineage and region, and generate a subgraph containing the spatiotemporal evolution trajectory.
[0012] S6. Convert the generated subgraphs into topological data and store them in the database as a deep association index for resources, thus completing the construction of the network survey database.
[0013] As a further aspect of the present invention: In step S1, the process of collecting classical texts and field survey texts, extracting core entity words using sequence labeling technology, and simultaneously binding the time span and geographic coordinate attributes of the text is as follows:
[0014] Optical character recognition technology is used to convert classical texts into electronic documents, and speech-to-text technology is used to generate text data from field survey recordings. Noise reduction and word segmentation preprocessing are performed on the electronic documents and text data, and the standardized text is stored in the corpus to be processed.
[0015] The corpus to be processed is input into a bidirectional long short-term memory network to capture contextual features. The conditional random field layer is connected to calculate the label transition probability. The entity boundary is determined based on the global optimal path. The output is a sequence of entity core words labeled with the names of Chinese medicine schools and medicinal materials.
[0016] Identify historical dates and place names in the entity core word sequence, match the corresponding Gregorian calendar time period and latitude and longitude coordinates through the historical geographic database, and assign the matched time span and geographic coordinates to the corresponding entity core words to complete the synchronous binding of spatiotemporal attributes.
[0017] As a further aspect of the present invention: In step S2, the process of establishing an ontology model that includes the dimensions of lineage and origin of medicinal materials, defining the evolutionary logic and constraint rules between entities, and forming a knowledge architecture in the field of traditional Chinese medicine is as follows:
[0018] The core concepts of traditional Chinese medicine culture are identified, and categories are divided into parent and child categories based on academic schools, inheritors, medicinal materials, and geographical regions. A category tree structure with hierarchical inclusion relationships is constructed to establish the basic framework of the ontology model.
[0019] Define the semantic relationships connecting the category tree nodes, set the predicates representing the lineage of master and apprentice and the origin mapping predicates representing the origin of medicinal materials, configure the data attributes storing historical dates and geographical coordinates, and complete the multi-dimensional attribute definition.
[0020] Write logical rules to describe the evolution of entities, set the time sequence axiom that the apprenticeship relationship follows the chronological order, formulate the dynamic mapping axiom that the place of origin of medicinal materials changes with administrative divisions, and establish the verification standard for the logical relationship between entities.
[0021] The inference engine performs consistency checks on the category tree, semantic relationships, and logical rules, eliminates contradictory definitions, and serializes the verified model elements into a web ontology language format to form the final knowledge architecture for the field of traditional Chinese medicine.
[0022] As a further aspect of the present invention: In step S3, the process of extracting entities and events from the text using a neural network, aligning entities to ontology nodes according to the domain knowledge architecture, and generating a basic TCM resource map is as follows:
[0023] By inputting classical texts and field investigation texts into a convolutional neural network, attention mechanisms are used to capture textual dependencies, locate and output entity referents and medical event trigger words in the text;
[0024] The pre-trained language model is called to transform entity references into high-dimensional semantic vectors, and the feature vectors of ontology nodes in the knowledge architecture of traditional Chinese medicine are calculated simultaneously to build a vector index library to be matched.
[0025] Calculate the cosine similarity between entity references and ontology node vectors, select the node corresponding to the extreme value of similarity as the mapping target, and perform unique alignment of entity references to ontology nodes;
[0026] Based on the alignment results and event relationships, resource triples are generated, nodes are connected according to the edge attributes defined in the domain knowledge architecture, and instantiated into a basic TCM resource graph in the graph database.
[0027] As a further aspect of the present invention: In step S4, the process of calculating the feature vectors of the graph nodes and using inference algorithms to mine the implicit correlation between place of origin changes and medical customs, and to complete the missing semantic edges in the graph, is as follows:
[0028] The basic TCM resource map is input into a graph attention network, which aggregates the attributes of neighbor nodes, performs multi-level linear transformation, and outputs a low-dimensional dense feature vector that integrates semantic and structural information.
[0029] An energy scoring function is constructed by introducing a translation distance model, which maps low-dimensional dense feature vectors to a relational hyperplane to calculate the vector space distance between the medicinal material origin node and the treatment custom node.
[0030] Filter node pairs whose vector space distance meets the judgment threshold, perform spatiotemporal consistency verification using the node's time span and geographic coordinate attributes, and eliminate logically conflicting candidate associations.
[0031] The verified candidate associations are instantiated as directional semantic edges and written into the basic TCM resource graph to connect the corresponding origin and custom nodes, thus filling in the missing semantic relationships in the graph.
[0032] As a further aspect of the present invention: the specific method for constructing an energy scoring function by introducing a translation distance model, mapping low-dimensional dense feature vectors to a relational hyperplane, and calculating the vector space distance between the medicinal material origin node and the treatment custom node is as follows:
[0033] Define a normal vector that represents the potential relationship between the origin of medicinal materials and medical practices. Use this normal vector to project the low-dimensional dense feature vectors of the origin of medicinal materials node and the low-dimensional dense feature vectors of the medical practice node onto a specific hyperplane of relationship, and generate origin projection vectors and practice projection vectors orthogonal to the normal vector respectively.
[0034] Extract the relationship translation vector located on the relationship hyperplane, perform vector addition on the origin projection vector and the relationship translation vector, simulate the transformation process from the origin entity to the custom entity through a specific relationship, and generate a prediction vector representing the theoretical relationship target;
[0035] Calculate the Euclidean distance or Manhattan distance between the predicted vector and the custom projection vector, establish the calculated distance value as the output of the energy scoring function, and directly assign this output value as the vector space distance between the medicinal material origin node and the treatment custom node.
[0036] As a further aspect of the present invention: In step S5, the process of performing multiple path searches on resource nodes, aggregating their associated nodes in the dimensions of lineage and region, and generating a subgraph containing spatiotemporal evolution trajectories is as follows:
[0037] Receive a query command for the target resource node, call the graph traversal engine to perform a breadth-first search along the predefined lineage and geographical edges, traverse and record all access nodes and associated paths within the set depth limit, and output the original path set containing multi-level association information.
[0038] The node attributes in the original path set are analyzed, and the associated nodes with master-apprentice relationship characteristics or geographical affiliation characteristics are selected. Noisy data that does not conform to semantic constraints are removed, and the retained nodes and their connecting edges are aggregated to form a core associated node cluster around the target resource node.
[0039] Extract the time span attribute bound in the core associated node cluster, execute the sorting algorithm based on time ascending order to reorganize the nodes in time sequence, and simultaneously combine the geographic coordinate attribute corresponding to the node to establish spatial mapping, and construct a directed spatiotemporal evolution chain that represents the resource flow process;
[0040] The directed spatiotemporal evolution chain and the core associated node cluster are encapsulated as an independent graph data object. The boundary range and topological attributes of the object are defined, a subgraph containing the complete spatiotemporal evolution trajectory is generated, and the subgraph is output for subsequent conversion into topological structure data.
[0041] As a further aspect of the present invention: In step S6, the process of converting the generated subgraph into topological structure data and storing it in the database as a deep association index of resources to complete the construction of the network survey database is as follows:
[0042] Traverse the subgraph containing the spatiotemporal evolution trajectory, extract the globally unique identifiers of nodes and edge attributes, use a serialization algorithm to convert the subgraph into a machine-readable adjacency matrix format, and output standardized topological structure data.
[0043] Extract the core resource node identifiers from the topology data, establish an inverted mapping relationship between the identifiers and the corresponding adjacency matrix data, and generate a resource deep association index that supports structured queries;
[0044] The resource deep association index and topology data are written into the graph database storage engine, and data persistence and consistency verification are performed to complete the construction of a knowledge graph-based network survey database of traditional Chinese medicine cultural resources.
[0045] The beneficial effects of this invention are:
[0046] This invention constructs an ontology model and resource graph in the field of Traditional Chinese Medicine (TCM), transforming flat resource records into a semantically related network knowledge structure. This effectively overcomes the shortcomings of traditional databases, which can only support surface-level keyword matching and cannot reveal deep logical connections between resources. By extracting and aligning entities and events from text using sequence labeling and neural network technology, and combining multi-dimensional attributes such as lineage, region, and medicinal material origin for graph-based modeling, complex relationships such as the inheritance of academic schools, clinical customs, and the dynamic correspondence between medicinal material origins can be formally expressed and stored. Based on graph node feature vectors and inference algorithms, it can automatically mine and complete implicit semantic edges, thereby achieving a fundamental shift from isolated record retrieval to systematic knowledge association querying, significantly improving the depth and completeness of TCM cultural resource mining.
[0047] This invention proposes a subgraph generation mechanism based on multi-hop path search and spatiotemporal trajectory aggregation. This mechanism dynamically presents the evolutionary path and relational network of a resource within multi-dimensional contexts such as lineage and region, solving the problem that traditional methods cannot display the location and evolutionary trajectory of resources within the overall cultural system. By aggregating resource nodes and their associated nodes according to time and geographical coordinates into a subgraph with a topological structure and storing it in a database as a deep relational index, complex evolutionary processes can be intuitively presented. This allows users to obtain three-dimensional relational information and spatiotemporal evolutionary context of a single cultural resource within the entire TCM knowledge network when querying it, supporting deeper knowledge reasoning, induction, and cultural research. It represents a leap from static information storage to dynamic knowledge association and visualization. Attached Figure Description
[0048] The invention will now be further described with reference to the accompanying drawings.
[0049] Figure 1 This is a flowchart illustrating the method for constructing a database for the survey of traditional Chinese medicine cultural resources based on knowledge graphs, according to the present invention. Detailed Implementation
[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0051] Please see Figure 1 As shown, this invention is a method for constructing a database for surveying traditional Chinese medicine cultural resources based on knowledge graphs, comprising the following steps:
[0052] S1. Collect classical texts and field survey texts, extract core entity words through sequence labeling technology, and simultaneously bind the time span and geographic coordinate attributes of the text;
[0053] S2. Establish an ontology model that includes the dimensions of lineage and origin of medicinal materials, define the evolutionary logic and constraint rules between entities, and form a knowledge architecture in the field of traditional Chinese medicine.
[0054] S3. Use neural networks to extract entities and events from the text, align entities to ontology nodes according to the domain knowledge architecture, and generate a basic TCM resource map.
[0055] S4. Calculate the feature vectors of the graph nodes, use inference algorithms to mine the implicit relationship between changes in place of origin and medical customs, and complete the missing semantic edges in the graph.
[0056] S5. Perform multiple path searches for resource nodes, aggregate their associated nodes in the dimensions of lineage and region, and generate a subgraph containing the spatiotemporal evolution trajectory.
[0057] S6. Convert the generated subgraphs into topological data and store them in the database as a deep association index for resources, thus completing the construction of the network survey database.
[0058] In one embodiment of the present invention, step S1, which involves collecting classical texts and field survey texts, extracting core entity words using sequence labeling technology, and simultaneously binding the time span and geographic coordinate attributes of the text, is as follows:
[0059] First, the classical texts of various schools of thought are digitized. An industrial-grade high-resolution scanner is used to convert the paper books into image files. Optical character recognition (OCR) technology is used to extract the features of Chinese characters from the images. By detecting changes in brightness and edge contours, character strokes are identified, and the image information is mapped into computer-encodeable character codes, thus forming editable electronic documents. Simultaneously, the recordings from field investigations are processed. Speech-to-text technology is used to convert audio signals from interviews with traditional Chinese medicine practitioners or herbalists into text data. This process analyzes the spectral characteristics of speech using an acoustic model, segmenting continuous sound waveforms into phoneme sequences. A language model is then used to convert these phoneme sequences into the most probable combinations of Chinese characters. After the basic data conversion, denoising and word segmentation preprocessing is performed on the electronic documents and text data. Regular expressions are used to remove garbled characters, non-Chinese characters, and meaningless interjections from the text, eliminating noise interference. A statistically based Chinese word segmentation algorithm is used to segment the continuous text stream into independent lexical units based on the tightness of character combinations. The cleaned and normalized text is then aggregated and stored in a corpus to be processed, preparing data for knowledge extraction.
[0060] The text data in the corpus to be processed is converted into a vector matrix and input into a bidirectional long short-term memory network. This network contains two independent time-series processing channels, forward and backward, which scan from the beginning to the end of the text and from the end to the beginning, respectively. A gating mechanism is used to control the forgetting and retention of information, thereby capturing the long-distance dependency features of each character in the context and solving the problem of semantic feature loss in long texts. The feature vectors output by the network are transmitted to a conditional random field layer, which is mainly responsible for constraining the legality of the label sequence. By calculating the transition probability between adjacent labels, it avoids labeling results that do not conform to grammatical logic, such as verb labels being directly adjacent to the end of place name labels. Based on the calculated state feature function and transition feature function, the conditional random field uses the Viterbi algorithm to search for the path with the highest global score among all possible label paths, thereby accurately determining the start and end positions of entities. Finally, based on this optimal path, specific character fragments in the text are labeled as names of traditional Chinese medicine schools or names of Chinese medicinal materials, and the core word sequence containing entity category labels is output to ensure the accuracy of entity recognition and semantic coherence.
[0061] After obtaining the core word sequence of entities, the named entity recognition algorithm is further used to identify the implicit time adverbs and geographical terms in the sequence, focusing on extracting key information such as dynastic years, imperial reign titles, and ancient place names. A pre-constructed historical geography database is used as a reference benchmark. This database contains tables of the evolution of administrative divisions and chronological comparison tables throughout Chinese history. Through keyword retrieval and matching technology, the identified non-standard time descriptions are mapped to specific Gregorian calendar start and end years. For example, specific reign titles are converted into specific Gregorian calendar time periods, eliminating ambiguous time concepts. Simultaneously, ancient place names are mapped to latitude and longitude coordinates on modern maps. By comparing ancient and modern place name comparison tables, geographical location deviations caused by administrative region mergers or renamings are corrected, obtaining accurate spatial positioning data. The matched Gregorian calendar time span and latitude and longitude coordinates are used as metadata attributes and directly assigned to the corresponding core words of traditional Chinese medicine schools or medicinal materials. This ensures that each entity not only possesses semantic information but also carries specific time and spatial dimension information, thereby completing the synchronous binding of spatiotemporal attributes and achieving precise anchoring of traditional Chinese medicine cultural resources in time and space.
[0062] In one embodiment of the present invention, step S2, which involves establishing an ontology model including the dimensions of lineage and origin of medicinal materials, defining the evolutionary logic and constraint rules between entities, and forming a knowledge architecture in the field of traditional Chinese medicine, is as follows:
[0063] First, a comprehensive review and definition of core concepts within the field of Traditional Chinese Medicine (TCM) culture was conducted. This involved consulting numerous TCM classics, records of lineage transmission, and modern TCM standard documents to select a representative and universally applicable set of terms. These terms were then categorized according to their inherent logical attributes, establishing four top-level parent categories: academic schools, lineage holders, TCM herbs, and geographical regions. Further refinement of subcategories followed this foundation. For example, academic schools were subdivided into typhoid fever schools and febrile disease schools, while TCM herbs were categorized based on medicinal parts, such as rhizomes and fruits. A multi-level tree structure was constructed using taxonomic principles, clearly defining the position of each concept within the hierarchy and its inclusion relationships with other concepts. This hierarchical inclusion relationship establishment process followed the principle of moving from abstract to concrete, ensuring that each child node automatically inherits the universal attributes of its parent node. This created a robust and logically rigorous classification framework for the entire knowledge graph, enabling computers to understand the complex conceptual hierarchies within TCM and providing a standard classification template for subsequent entity mapping.
[0064] After establishing the category tree structure, the next step is to define the semantic relationships connecting these category nodes. This process mainly involves the detailed configuration of object attributes and data attributes. For the unique social relationships and material attributes in the field of traditional Chinese medicine, specific predicates are defined to describe the dynamic connections between entities. For example, a predicate representing the master-apprentice relationship is defined to connect two different entities under the category of "inheritor," clearly indicating who is the instructor and who is the successor. Simultaneously, a predicate representing the origin of medicinal materials is defined to associate medicinal material entities with geographical region entities. By restricting the domain and value range of the predicates, the legality of the relationship connection is ensured. Furthermore, data attributes storing specific numerical values need to be configured. Time attributes such as birth year and death year are set for human entities, and spatial coordinate attributes such as longitude and latitude are set for geographical region entities. By defining these attributes as integer, floating-point, or date data types, the ontology model can not only express qualitative relationships between entities but also store quantitative spatiotemporal data, thus completing a comprehensive characterization of the multi-dimensional features of entities.
[0065] Next, logical rules describing the evolution of entities are written. This step aims to equip computers with basic logical reasoning abilities. Strict constraints are set based on the historical facts of the development of traditional Chinese medicine. For example, a time sequence axiom is set for apprenticeship relationships, stipulating that the master's birth year must be earlier than the apprentice's birth year, or the master's active period of medical practice must cover the apprentice's learning period. This temporal order is enforced by writing logical expressions to prevent erroneous relationships that violate historical common sense. A dynamic mapping axiom is set for the origin of medicinal materials, taking into account the changes in place names throughout history. It is stipulated that when the administrative name of a certain geographical area changes, the attributes of medicinal materials associated with that origin should be automatically mapped to the new geographical name or the corresponding modern coordinate range through reasoning rules. Establishing these verification standards for the logical relationships between entities is to ensure that every relationship chain stored in the knowledge graph is logically self-consistent and can truly reflect the objective evolution of history and geography.
[0066] Finally, the inference engine is activated to perform a comprehensive consistency check on the constructed category tree, semantic relationships, and logical rules. This process loads a predefined ontology model file and uses descriptive logic algorithms to check the satisfiability of each definition in the model. It automatically scans and identifies potential logical conflicts in the model, such as checking for definitions that violate the mutual exclusion principle by having the same entity belong to both the Person and Drug categories, or checking for circular definitions of apprenticeship relationships. Once a contradictory definition is found, it is immediately corrected or removed based on the error report to ensure the purity and accuracy of the model. After all consistency verifications are completed, these rigorously tested model elements are converted into a web ontology language format using serialization technology. This is a standard syntax format that is computer-readable and transmissible, transforming the abstract mental model into a concrete code file. This forms the final knowledge architecture for the field of traditional Chinese medicine that can be used to guide data storage and retrieval, laying a solid logical foundation for subsequent data filling.
[0067] In one embodiment of the present invention, step S3, which involves using a neural network to extract entities and events from the text, aligning entities to ontology nodes based on a domain knowledge architecture, and generating a basic traditional Chinese medicine resource map, is as follows:
[0068] Preprocessed text data from classical Chinese medicine texts and field surveys are transformed into vector matrices and input into a convolutional neural network model. This network uses multiple convolutional kernels of different sizes to perform a sliding window operation on the text sequence, extracting local semantic features and phrase patterns. Simultaneously, an attention mechanism module is introduced. This module dynamically allocates attention by calculating the association weights between each word and all other words in the text sequence, thereby capturing long-distance semantic dependencies in the text without relying on distance. This solves the problem that traditional convolutional networks struggle to handle semantic relationships across clauses in long sentences. Through this deep feature extraction and contextual analysis, the model can accurately locate the lexical boundaries representing specific things and the positions of trigger words representing actions within sentences. Ultimately, it outputs entity references such as names of figures from Chinese medicine schools and medicinal materials, as well as trigger words for medical events such as diagnosis, teaching, and herb gathering, providing foundational material for structured extraction.
[0069] After obtaining the entity references in the text, a pre-trained language model trained on a large-scale medical corpus is invoked to map each textual entity reference into a semantic vector in a high-dimensional space. The numerical distribution of this vector represents the deep semantic information of the word in a specific context. Simultaneously, predefined ontology nodes in the knowledge architecture of the traditional Chinese medicine field are read, including various standardized Chinese medicine names, school names, and terminology definitions. The same vectorization method is used to calculate the feature vectors of these ontology nodes, thereby ensuring that the text entities and standard ontology are in the same semantic vector space. These calculated ontology node feature vectors are organized to construct a vector index library to be matched. This index library supports the rapid retrieval and location of the nearest vector points in large-scale data by partitioning and optimizing the vector space, thus preparing the data for the mapping from non-standard text descriptions to standard concepts.
[0070] The core entity alignment operation is performed by comparing the similarity between entity referential vectors and ontology node vectors in the index one by one using mathematical calculations. Specifically, the cosine similarity algorithm is used to calculate the cosine of the angle between the two vectors in multidimensional space. The closer this value is to 1, the more consistent the directions of the two vectors are, meaning that the referentials in the text and the concepts in the ontology are semantically closer. The candidate nodes in the index are traversed, and the similarity values of all candidate options are calculated and sorted. The ontology node corresponding to the extreme similarity value is selected as the unique mapping target. This process uses the distance in the semantic space to quantify the identity of word meanings, thereby accurately pointing entity referentials that may have aliases or abbreviations in the text to the unique standard node in the knowledge architecture. This eliminates the ambiguity caused by polysemy or homonymy, and completes the unique alignment of entity referentials to ontology nodes, realizing the standardization of data.
[0071] Based on the entity identities determined in the alignment steps above and the event trigger words extracted in the first step, semantic triples describing resource relationships are constructed, forming a structured data form with subject nodes, predicate relations, and object nodes. According to the predefined edge attribute rules in the domain knowledge architecture, it is determined whether there is a valid logical connection between two nodes. For example, a doctor node and a disease node are connected through a diagnosis-treatment relationship, while a school of thought node and a doctor node are connected through an affiliation relationship. After confirming that the relationship type conforms to the architecture definition, these triples are instantiated and written into the graph database. Corresponding node objects and edge objects are created within the database, thereby transforming the originally discrete, unstructured text information into a network data structure with interconnected nodes and clearly defined relationships. This generates a basic TCM resource graph with preliminary semantic query and analysis capabilities, completing the transformation from text flow to graph structure.
[0072] In one embodiment of the present invention, step S3, which involves calculating the feature vectors of the graph nodes, using inference algorithms to mine the implicit correlation between changes in place of origin and medical practices, and completing the missing semantic edges in the graph, is as follows:
[0073] First, the constructed basic TCM resource map is input as a structured data stream into the graph attention network model. The core mechanism of this network is its ability to adaptively focus on the differences in importance of different neighboring nodes to the central node. By establishing attention weight coefficients between nodes and their neighbors, it simulates the cognitive process of humans focusing on key information when reading literature. The model traverses each node in the graph, calculates the feature correlation between the node and its directly connected neighboring nodes, and assigns different numerical weights according to the strength of the correlation. For example, when inferring the attributes of a certain medicinal material node, the medicinal property node connected to it may be assigned a higher weight, while the age node connected to it may have a relatively lower weight. These dynamically calculated weights are used to perform a weighted aggregation operation on the feature information of neighboring nodes, integrating the scattered knowledge in the surrounding area into the representation of the central node. Then, a multi-level linear transformation operation is performed to compress and map the original high-dimensional sparse graph data into a low-dimensional continuous vector space through matrix mapping. The output is a low-dimensional dense feature vector containing rich semantic content and topological structure information, so that each entity in the graph is encoded into a numerical sequence that can be mathematically operated on by a computer.
[0074] An energy scoring function is constructed by introducing a translational distance model, mapping low-dimensional dense feature vectors to a relational hyperplane, and calculating the vector space distance between the medicinal material origin node and the treatment custom node; specific content includes:
[0075] First, a specific normal vector is initialized in the algorithm model to uniquely represent the potential association between the origin of medicinal materials and medical practices. This normal vector is geometrically perpendicular to a specific hyperplane, which is designed to carry the semantic interaction under this specific relationship. This normal vector is then used to perform a projection operation on the original low-dimensional dense feature vectors of the origin of medicinal materials and the medical practices nodes. The mathematical principle is to subtract the component in the direction of the normal vector from the original vector, thus retaining the component perpendicular to the normal vector. This process is equivalent to compressing and projecting entity points in three-dimensional or high-dimensional space onto a two-dimensional or low-dimensional hyperplane of the relationship. Through this projection transformation, general feature noise unrelated to the origin-custom relationship being discussed can be effectively filtered out, such as the chemical composition attributes of medicinal materials or the non-regional features of medical practices. This generates origin projection vectors and practice projection vectors orthogonal to the normal vector for the origin of medicinal materials and medical practices, respectively, ensuring that subsequent operations are fully focused on the specific relational context. This solves the problem of semantic ambiguity in traditional models when dealing with complex many-to-many relationships.
[0076] Next, the relationship translation vector located on the hyperplane of this association is extracted. This vector is a parameter learned by the model during training, representing a certain inherent rule or trend of semantic crossing from the geographical origin dimension to the medical custom dimension. Starting from the origin projection vector, the relationship translation vector is used as the increment to perform vector addition. This physical process simulates the migration of entity meaning in the vector space, that is, the theoretical position that should be reached if moving along a specific cultural evolution relationship path starting from a specific origin. Through this simulated transformation process, a prediction vector representing the theoretical association target is generated. This prediction vector is a virtual landing point in geometric position, which represents the ideal position that the custom should exist in the vector space if the medicinal material origin does indeed give rise to a certain medical custom. The core of this step is to use the translation properties of vectors to explicitly model the semantic transformation logic between entities, concretizing the abstract cultural influence relationship into a mathematical displacement operation, and providing accurate theoretical benchmark coordinates for subsequent matching verification.
[0077] Finally, the spatial distance between the generated predicted vector and the actual custom projection vector is calculated. Based on the data distribution characteristics and computational resource limitations, the Euclidean distance formula can be used to calculate the straight-line length between two points, or the Manhattan distance formula can be used to calculate the sum of the absolute axial distances between two points on the coordinate axes. The calculated distance value is established as the output of the energy scoring function. The physical meaning of this scoring function is to measure the degree of deviation between the assumed relationship and objective facts. The smaller the distance value, the closer the predicted vector is to the actual vector, indicating a greater likelihood of a correlation between the medicinal herb origin and the medical custom, and vice versa. Finally, this output result is directly assigned as the vector spatial distance between the medicinal herb origin node and the medical custom node. This distance is no longer a simple physical length but a comprehensive metric that integrates semantic reasoning strength, serving as a quantitative basis for measuring the potential correlation between two nodes in the graph, providing standardized numerical input for the next step of threshold determination.
[0078] Based on the calculated energy score, a reasonable threshold is first set to filter out potential related node pairs, retaining those candidates whose distance is less than the threshold. However, this only represents statistical correlation at the mathematical level and is insufficient as factual evidence. Therefore, it is necessary to further utilize the time span and geographical coordinate attributes bound to the nodes in the previous steps to perform strict spatiotemporal consistency verification. The algorithm extracts the active period of candidate medicinal material production area nodes and the popular time period of treatment custom nodes, comparing whether there is overlap or reasonable sequential relationship between the two on the timeline. If the prosperity period of the production area is later than the decline period of the custom, it is judged as a temporal logical conflict. At the same time, the spatial distance of geographical coordinates is compared to determine whether the production area of medicinal materials is within the radiation radius of treatment custom. For those related candidates whose vector distance is very close but have obvious contradictions in historical time or physical space, they are regarded as noise generated by the algorithm and resolutely eliminated to ensure that every relationship mined conforms to the objective spatiotemporal laws of the development of traditional Chinese medicine.
[0079] Finally, the candidate items that have passed all verification steps are transformed into storable entity objects in the graph database. This process is called instantiation, which involves creating a directional semantic edge with a clear direction between the medicinal herb origin node and the treatment custom node. The direction of this edge is from the origin to the custom or from the custom to the origin, depending on the predefined ontology relation logic. Specific attribute labels are assigned to this newly generated edge to indicate that it is an implicit association mined by a reasoning algorithm rather than an explicit relationship directly recorded in the original text. At the same time, the credibility score of the reasoning is written as the weight attribute of the edge. These newly instantiated edge data are updated and written into the storage structure of the basic TCM resource graph, making it an organic part of the graph. This connects the origin and custom nodes that originally existed in isolation in the graph, effectively filling the semantic gaps caused by the lack or dispersion of records in classical texts, and greatly enriching the relation density and knowledge completeness of the graph.
[0080] In one embodiment of the present invention, step S5, which involves performing multiple path searches on resource nodes, aggregating their associated nodes in terms of lineage and region, and generating a subgraph containing spatiotemporal evolution trajectories, is as follows:
[0081] First, the system receives a query command from the user client targeting a specific node in the TCM cultural resources database. This command contains a unique identifier for the target entity, such as querying detailed information about a particular historical physician or a specific school of thought. The graph traversal engine responds to this command and uses the target resource node as the starting anchor point, executing a breadth-first search strategy along predefined edge types in the knowledge graph. These edge types are strictly limited to lineage edges representing master-apprentice relationships and geographical location edges representing geographical affiliations. During the search process, a specific traversal depth threshold is set, typically three to five levels, to prevent the search scope from expanding indefinitely and leading to irrelevant results. With the introduction of information, the engine will visit neighboring nodes directly and indirectly connected to the starting node layer by layer, recording in detail the access path of each hop and all node information along the way, including node name, node type, and edge attributes. The reason for using breadth-first search is that this strategy can prioritize the discovery of the closest neighbor group with the closest relationship to the target node, thereby quickly delineating the most valuable association network for studying the resource. Finally, it outputs a set of original paths containing multi-level association information. This set encompasses all potential relationship links radiating outward from the central node, providing a full set of basic data materials for the next step of screening.
[0082] Next, the program performs in-depth attribute analysis on the output original path set. It iterates through each node object in the set, reading the semantic tags and attribute fields contained in its metadata, focusing on whether nodes possess mentorship or geographical affiliation characteristics. Based on preset semantic constraint rules, it filters out nodes that, although on the path, are semantically irrelevant to the inheritance of traditional Chinese medicine culture, classifying them as noise data and removing them. For example, it removes administrative nodes that only represent general administrative levels without specific medical activities, or document nodes that simply represent citation relationships without substantial mentorship. For nodes that pass the screening, their complete information structure is preserved, and these nodes and the effective edges connecting them are aggregated using set theory's union operation to remove duplicate nodes and edges, thus eliminating redundant data caused by overlapping paths. This process aims to extract truly effective information circles closely distributed around the target resource nodes, forming a highly cohesive core cluster of related nodes. This cluster logically eliminates impurities, retaining only the core elements that can explain the origin and spatial distribution of the traditional Chinese medicine resource, ensuring the purity and research value of the data.
[0083] After acquiring the core cluster of related nodes, the algorithm automatically extracts the time span attribute bound to each node in the cluster. This attribute is usually expressed in the form of a Gregorian calendar year range or dynastic year. A sorting algorithm based on ascending time order is executed to rearrange all nodes according to the order of their active start time. For nodes with overlapping time, a secondary sort is performed according to their end time or the order of occurrence of related events, thereby clarifying the chronological logic of generational succession or the development of schools of thought. At the same time, the geographic coordinate attribute corresponding to the nodes is read synchronously, and each sorted node is mapped to a virtual geographic spatial coordinate system to establish a correspondence between time and space. By connecting the spatial coordinates of adjacent time-series nodes, a directed spatiotemporal evolution chain representing the process of resource flow is constructed. This chain, in the form of directed line segments, intuitively depicts the migration path of traditional Chinese medicine cultural resources between different geographical regions over time. For example, it shows how a school of thought gradually spread from its place of origin to other provinces through master-disciple transmission, thereby transforming static node data into a dynamic historical evolution narrative.
[0084] Finally, the constructed directed spatiotemporal evolution chain and core associated node clusters are encapsulated to create an independent graph data object to carry this information. This object is not merely a simple accumulation of data, but a structured entity with clearly defined boundaries and topological attributes. During the encapsulation process, the set of nodes and edges contained in the subgraph are clearly defined, and the topological features of the subgraph, such as the degree distribution of nodes, clustering coefficients, and critical path lengths, are calculated and recorded. These attributes describe the structural compactness and information transmission efficiency within the subgraph. The generated subgraph, as a complete and independent semantic unit, fully preserves the evolutionary trajectory of the target resource in the spatiotemporal dimension, including both micro-level inheritance details and macro-level geographical changes. This subgraph is formatted and output as a high-value data product that has undergone deep processing, directly connecting to the next stage of storage and indexing. This provides sufficient structured preparation for transforming the complex cultural evolution process into topological data that can be efficiently retrieved and analyzed by computers.
[0085] In one embodiment of the present invention, step S6, which involves converting the generated subgraph into topological structure data and storing it in a database as a deep association index for resources to complete the construction of the network survey database, is as follows:
[0086] First, a full depth-first or breadth-first traversal is performed on the subgraph generated in memory, containing the spatiotemporal evolution trajectory. This involves accessing every node and edge object in the subgraph structure, reading and extracting the globally unique identifier assigned to each node. This identifier is typically generated by a universally unique identifier generation algorithm to ensure uniqueness across the entire database. Simultaneously, the weight attributes and semantic type labels stored in the edge objects are extracted. Using the matrix representation principle in graph theory, the complex graph topology is mapped to a two-dimensional adjacency matrix. The row and column indices of this matrix correspond to the node identifiers in the subgraph, while the element values represent the existence of connecting edges between nodes and the weight of the edges. For example, the closeness of a mentor-mentee relationship is quantified into matrix element values. A serialization algorithm is then used to convert this abstract adjacency matrix data structure into a continuous byte stream or text string format. This process, through encoding rules, transforms the object state in memory into a storable and transmittable linear data format, thus outputting standardized topological structure data. This allows the graph structure, which originally relied on memory address links, to exist independently of the program's runtime environment, providing a universal data carrier for persistent storage.
[0087] Next, the standardized output topology data is deeply analyzed to locate and extract the core resource node identifier located at the center of the subgraph. This node is usually the target object of the initial query, such as a specific famous doctor or school of thought. Using this core identifier as the index key and the serialized adjacency matrix data block as the index value, an efficient inverted index mapping relationship is constructed. This mapping mechanism is similar to the retrieval directory of a dictionary, allowing for quick location of complex structured data blocks using a simple keyword. A hash table or B+ tree data structure is built in memory to carry this mapping relationship. The storage address of the data is determined by calculating the hash value of the core identifier, generating a deep resource association index that supports structured queries. The principle behind this is that when the evolution trajectory of the resource needs to be accessed again, there is no need to perform time-consuming path search and calculation again in the huge graph network. Instead, the pre-calculated and stored topology data can be directly retrieved through the index, greatly reducing the time complexity of complex queries and achieving an instant response from single-point query to full-view display.
[0088] Finally, the constructed resource deep association index and the serialized topology data are written together into the graph database storage engine. This process initiates an atomic write transaction, ensuring that the index data and content data are either written successfully simultaneously or rolled back simultaneously in case of an error, preventing the "dirty write" phenomenon of data inconsistency. The storage engine flushes the data buffer content in memory to the physical disk sectors, performs data persistence operations, and uses write-ahead logging technology to record every data change, ensuring that data can be recovered through logs even in the event of unexpected failures such as power outages, thus guaranteeing data security. At the same time, strict consistency checks are performed during the write process to check whether the newly written topology meets the constraints of the graph database, such as verifying whether the start and end nodes of all edges actually exist and checking whether the attribute data types match. After confirming that there are no errors, the commit is completed. Thus, the scattered fragments of traditional Chinese medicine cultural resources are integrated into a logically rigorous and efficiently indexed network survey database, realizing the complete construction of traditional Chinese medicine cultural resources from scattered texts to a deep association graph.
[0089] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.
Claims
1. A method for constructing a database for surveying traditional Chinese medicine cultural resources based on knowledge graphs, characterized in that, Includes the following steps: S1. Collect classical texts and field survey texts, extract core entity words through sequence labeling technology, and simultaneously bind the time span and geographic coordinate attributes of the text; S2. Establish an ontology model that includes the dimensions of lineage and origin of medicinal materials, define the evolutionary logic and constraint rules between entities, and form a knowledge architecture in the field of traditional Chinese medicine. S3. Use neural networks to extract entities and events from the text, align entities to ontology nodes according to the domain knowledge architecture, and generate a basic TCM resource map. S4. Calculate the feature vectors of the graph nodes, use inference algorithms to mine the implicit relationship between changes in place of origin and medical customs, and complete the missing semantic edges in the graph. S5. Perform multiple path searches for resource nodes, aggregate their associated nodes in the dimensions of lineage and region, and generate a subgraph containing the spatiotemporal evolution trajectory. S6. Convert the generated subgraphs into topological data and store them in the database as a deep association index for resources, thus completing the construction of the network survey database.
2. The method for constructing a database for the survey of traditional Chinese medicine cultural resources based on knowledge graphs according to claim 1, characterized in that, In step S1, the process of collecting classical texts and field survey texts, extracting core entity words using sequence labeling technology, and simultaneously binding the text's time span and geographic coordinate attributes is as follows: Optical character recognition technology is used to convert classical texts into electronic documents, and speech-to-text technology is used to generate text data from field survey recordings. Noise reduction and word segmentation preprocessing are performed on the electronic documents and text data, and the standardized text is stored in the corpus to be processed. The corpus to be processed is input into a bidirectional long short-term memory network to capture contextual features. The conditional random field layer is connected to calculate the label transition probability. The entity boundary is determined based on the global optimal path. The output is a sequence of entity core words labeled with the names of Chinese medicine schools and medicinal materials. Identify historical dates and place names in the entity core word sequence, match the corresponding Gregorian calendar time period and latitude and longitude coordinates through the historical geographic database, and assign the matched time span and geographic coordinates to the corresponding entity core words to complete the synchronous binding of spatiotemporal attributes.
3. The method for constructing a database for surveying traditional Chinese medicine cultural resources based on knowledge graphs according to claim 1, characterized in that, In step S2, the process of establishing an ontology model that includes the dimensions of lineage and origin of medicinal materials, defining the evolutionary logic and constraint rules between entities, and forming a knowledge architecture in the field of traditional Chinese medicine is as follows: The core concepts of traditional Chinese medicine culture are identified, and categories are divided into parent and child categories based on academic schools, inheritors, medicinal materials, and geographical regions. A category tree structure with hierarchical inclusion relationships is constructed to establish the basic framework of the ontology model. Define the semantic relationships connecting the category tree nodes, set the predicates representing the lineage of master and apprentice and the origin mapping predicates representing the origin of medicinal materials, configure the data attributes storing historical dates and geographical coordinates, and complete the multi-dimensional attribute definition. Write logical rules to describe the evolution of entities, set the time sequence axiom that the apprenticeship relationship follows the chronological order, formulate the dynamic mapping axiom that the place of origin of medicinal materials changes with administrative divisions, and establish the verification standard for the logical relationship between entities. The inference engine performs consistency checks on the category tree, semantic relationships, and logical rules, eliminates contradictory definitions, and serializes the verified model elements into a web ontology language format to form the final knowledge architecture for the field of traditional Chinese medicine.
4. The method for constructing a database for the survey of traditional Chinese medicine cultural resources based on knowledge graphs according to claim 1, characterized in that, In step S3, the process of extracting entities and events from the text using a neural network, aligning entities to ontology nodes according to the domain knowledge architecture, and generating a basic TCM resource map is as follows: By inputting classical texts and field investigation texts into a convolutional neural network, attention mechanisms are used to capture textual dependencies, locate and output entity referents and medical event trigger words in the text; The pre-trained language model is called to transform entity references into high-dimensional semantic vectors, and the feature vectors of ontology nodes in the knowledge architecture of traditional Chinese medicine are calculated simultaneously to build a vector index library to be matched. Calculate the cosine similarity between entity references and ontology node vectors, select the node corresponding to the extreme value of similarity as the mapping target, and perform unique alignment of entity references to ontology nodes; Based on the alignment results and event relationships, resource triples are generated, nodes are connected according to the edge attributes defined in the domain knowledge architecture, and instantiated into a basic TCM resource graph in the graph database.
5. The method for constructing a database for the survey of traditional Chinese medicine cultural resources based on knowledge graphs according to claim 1, characterized in that, In step S4, the process of calculating the feature vectors of the graph nodes and using inference algorithms to mine the implicit correlation between changes in place of origin and medical customs, and to complete the missing semantic edges in the graph, is as follows: The basic TCM resource map is input into a graph attention network, which aggregates the attributes of neighbor nodes, performs multi-level linear transformation, and outputs a low-dimensional dense feature vector that integrates semantic and structural information. An energy scoring function is constructed by introducing a translation distance model, which maps low-dimensional dense feature vectors to a relational hyperplane to calculate the vector space distance between the medicinal material origin node and the treatment custom node. Filter node pairs whose vector space distance meets the judgment threshold, perform spatiotemporal consistency verification using the node's time span and geographic coordinate attributes, and eliminate logically conflicting candidate associations. The verified candidate associations are instantiated as directional semantic edges and written into the basic TCM resource graph to connect the corresponding origin and custom nodes, thus filling in the missing semantic relationships in the graph.
6. The method for constructing a database for surveying traditional Chinese medicine cultural resources based on knowledge graphs according to claim 5, characterized in that, The method for constructing an energy scoring function by introducing a translation distance model, mapping low-dimensional dense feature vectors to a relational hyperplane, and calculating the vector space distance between the medicinal material origin node and the treatment custom node is as follows: Define a normal vector that represents the potential relationship between the origin of medicinal materials and medical practices. Use this normal vector to project the low-dimensional dense feature vectors of the origin of medicinal materials node and the low-dimensional dense feature vectors of the medical practice node onto a specific hyperplane of relationship, and generate origin projection vectors and practice projection vectors orthogonal to the normal vector respectively. Extract the relationship translation vector located on the relationship hyperplane, perform vector addition on the origin projection vector and the relationship translation vector, simulate the transformation process from the origin entity to the custom entity through a specific relationship, and generate a prediction vector representing the theoretical relationship target; Calculate the Euclidean distance or Manhattan distance between the predicted vector and the custom projection vector, establish the calculated distance value as the output of the energy scoring function, and directly assign this output value as the vector space distance between the medicinal material origin node and the treatment custom node.
7. The method for constructing a database for the survey of traditional Chinese medicine cultural resources based on knowledge graphs according to claim 1, characterized in that, In step S5, the process of performing multiple path searches on resource nodes, aggregating their associated nodes in the dimensions of lineage and region, and generating a subgraph containing spatiotemporal evolution trajectories is as follows: Receive a query command for the target resource node, call the graph traversal engine to perform a breadth-first search along the predefined lineage and geographical edges, traverse and record all access nodes and associated paths within the set depth limit, and output the original path set containing multi-level association information. The node attributes in the original path set are analyzed, and the associated nodes with master-apprentice relationship characteristics or geographical affiliation characteristics are selected. Noisy data that does not conform to semantic constraints are removed, and the retained nodes and their connecting edges are aggregated to form a core associated node cluster around the target resource node. Extract the time span attribute bound in the core associated node cluster, execute the sorting algorithm based on time ascending order to reorganize the nodes in time sequence, and simultaneously combine the geographic coordinate attribute corresponding to the node to establish spatial mapping, and construct a directed spatiotemporal evolution chain that represents the resource flow process; The directed spatiotemporal evolution chain and the core associated node cluster are encapsulated as an independent graph data object. The boundary range and topological attributes of the object are defined, a subgraph containing the complete spatiotemporal evolution trajectory is generated, and the subgraph is output for subsequent conversion into topological structure data.
8. The method for constructing a database for surveying traditional Chinese medicine cultural resources based on knowledge graphs according to claim 1, characterized in that, In step S6, the process of converting the generated subgraph into topological structure data and storing it in the database as a deep association index for resources to complete the construction of the network survey database is as follows: Traverse the subgraph containing the spatiotemporal evolution trajectory, extract the globally unique identifiers of nodes and edge attributes, use a serialization algorithm to convert the subgraph into a machine-readable adjacency matrix format, and output standardized topological structure data. Extract the core resource node identifiers from the topology data, establish an inverted mapping relationship between the identifiers and the corresponding adjacency matrix data, and generate a resource deep association index that supports structured queries; The resource deep association index and topology data are written into the graph database storage engine, and data persistence and consistency verification are performed to complete the construction of a knowledge graph-based network survey database of traditional Chinese medicine cultural resources.