Tibetan medicine knowledge graph retrieval method and device, computer equipment and medium
By constructing a Tibetan medicine knowledge graph and integrating topological, semantic, and temporal features, the problem of insufficient utilization of the graph structure in the existing RAG system is solved, achieving high quality and interpretability of Tibetan medicine knowledge retrieval results and generating hierarchical output of content.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
The existing RAG system has failed to effectively mine and utilize graph structure features in Tibetan medicine knowledge retrieval, resulting in insufficient quality and interpretability of search results, as well as a lack of priority differentiation of search results and insufficient targeting and hierarchy of generated content.
A Tibetan medicine knowledge graph is constructed. The topological and semantic features of nodes are extracted through local subnets, and feature fusion is performed by combining temporal features. The semantic similarity between the query vector and the knowledge graph nodes is calculated and weighted and sorted according to the node influence. A structured knowledge context is generated and input into a large language model to generate answers.
The quality and interpretability of Tibetan medicine knowledge retrieval results have been improved. By layering node influence and feature fusion, priority distinction of retrieval results and hierarchical output of generated content have been achieved, thereby improving the relevance and interpretability of retrieval results.
Smart Images

Figure CN121833969A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical retrieval, specifically relating to a Tibetan medicine knowledge graph retrieval method, device, computer equipment, and medium. Background Technology
[0002] Tibetan medicine is an important component of traditional medicine, boasting a long history and a unique theoretical system. Tibetan medicinal materials are numerous and complex in their properties, exhibiting intricate compatibility relationships and processing methods. With the development of artificial intelligence technology, utilizing knowledge graph technology for structured representation and intelligent retrieval of Tibetan medicine knowledge has become a research hotspot in this field.
[0003] In recent years, Retrieval-Augmented Generation (RAG) technology has been widely used in knowledge question answering systems. Traditional RAG systems typically involve three main steps: first, converting the user query into a vector representation; second, retrieving documents or knowledge fragments semantically similar to the query from the knowledge base; and finally, inputting the retrieved content as context into a large language model to generate the answer. This approach has achieved good results in general knowledge question answering scenarios.
[0004] However, existing RAG systems mainly rely on text semantic matching and fail to effectively mine and utilize these graph structure features, resulting in insufficient quality and interpretability of search results. Moreover, after retrieving multiple related nodes or knowledge fragments, traditional RAG systems usually adopt semantic similarity ranking or simple time ranking strategies, assigning approximately the same weight to all search results. This ultimately leads to a lack of priority differentiation of search results and insufficient targeting and hierarchy of generated content. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a Tibetan medicine knowledge graph retrieval method, apparatus, computer equipment, and medium.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A method for retrieving Tibetan medicine knowledge graphs, the method comprising: Tibetan medicine knowledge is collected from multi-source heterogeneous data. After entity recognition and relation extraction, a Tibetan medicine knowledge graph is constructed with entities as nodes and relations as edges. The topological and spatial features of nodes are extracted by constructing local subnets centered on nodes. The semantic features of nodes are extracted using a pre-trained semantic feature extraction model. Temporal features reflecting changes in node influence are extracted based on the sequence of local subnets. The topological features, semantic features, spatial features, and temporal features are fused in both spatial and temporal dimensions to obtain the influence representation of a node. Based on the query information input by the user, query encoding and entity recognition are performed to obtain a query vector; Calculate the semantic similarity between the query vector and the knowledge graph nodes, combine the influence representation of the nodes for weighted sorting, and select a preset number of nodes as the search results; The search results are stratified based on the influence of the nodes to generate a structured knowledge context; the structured knowledge context is combined with the user query to form prompt words, which are then input into a large language model to generate the answer.
[0007] Optionally, the step of collecting Tibetan medicine knowledge from multi-source heterogeneous data, and constructing a Tibetan medicine knowledge graph containing nodes and edges through entity recognition and relation extraction includes: Knowledge Acquisition and Preprocessing: Information on medicinal material names, efficacy and indications, properties and meridians, compatibility, processing methods, geographical distribution and clinical applications is collected from Tibetan medicine classics, clinical data and scientific research literature, and then the data is cleaned, deduplicated and standardized. Named entity recognition technology is used to identify medicinal material entities, disease entities, compatibility entities, and processing method entities. Relationship extraction technology is used to identify the treatment, compatibility, processing, origin, and meridian tropism relationships between entities. By using entities as nodes and relationships as edges, a Tibetan medicine knowledge graph G=(V, E) is constructed, where V is the set of nodes and E is the set of edges. Each node contains type, name, description and attribute value, and each edge contains relationship type, weight and confidence.
[0008] Optionally, the topological features, semantic features, spatial features, and temporal features are fused using spatial and temporal dimensions to obtain a node influence representation, including: By inputting the spatial and topological features of nodes into a graph convolutional network, a spatial representation of node influence is obtained. By concatenating the historical prior information of node influence with the spatial characteristics of the node at the current moment and inputting it into the Long Short-Term Memory network, a temporal representation of node influence is obtained. After batch normalizing the spatial representation and the temporal representation, they are added together to obtain the spatiotemporal representation of node influence.
[0009] Optionally, the step of calculating the semantic similarity between the query vector and the knowledge graph nodes, combining the node's influence representation for weighted sorting, selecting a preset number of nodes as the retrieval results, and constructing a contextual knowledge subgraph includes: Calculate the cosine similarity between the query vector and the semantic vector of the knowledge graph node, and select the top-K candidate nodes with the highest semantic similarity as the candidate set; Add the neighboring nodes of the candidate node to the candidate set to obtain an expanded candidate set; The nodes in the expanded candidate set are reordered based on the comprehensive score. The comprehensive score is calculated as follows: ; in, For balancing parameters, It is semantic similarity. This represents the node's influence, and normalize is the normalization function; Extract neighborhood subgraphs centered on a preset number of nodes to construct a context knowledge subgraph.
[0010] Optionally, the step of stratifying the search results based on the influence of nodes to generate a structured knowledge context includes: The search results are divided into a core layer, an important layer, and an auxiliary layer based on the node influence score. The core layer consists of the top 30% of nodes by influence score, the important layer consists of nodes from 30% to 70%, and the auxiliary layer consists of the bottom 30% of nodes. The knowledge nodes and their relationships at each level are converted into natural language descriptions and organized into a structured knowledge context in the order of core layer, important layer, and auxiliary layer.
[0011] Optionally, the spatial characteristics of the node are a cascade of multiple centrality indices of the node in the local subnet centered on it, and the centrality indices include degree centrality, proximity centrality, betweenness centrality, eigenvector centrality, HITS value and K-shell value; The sequence of local subnets consists of local subnets at different times. For each subnet in the sequence, its node spatial features are extracted and processed by a graph convolutional network. The processed sequence is used as historical prior information of node influence to form temporal features. Extracting topological features includes calculating the degree centrality, eigenvector centrality, HITS value, proximity centrality, betweenness centrality, and K-shell value of nodes; Extracting semantic features involves encoding the textual description of nodes using a pre-trained semantic feature extraction model to obtain the semantic vector representation of nodes, and performing one-hot encoding or embedding encoding on the type features and attribute features of nodes.
[0012] Optionally, the step of combining structured knowledge context with user queries into prompt words, and inputting them into a large language model to generate answers includes: Use structured knowledge context and user queries to build prompt word templates to instruct the large language model to explain core layer knowledge, appropriately explain important layer knowledge, and briefly mention auxiliary layer knowledge; Input the prompt words into a large language model to generate hierarchical answers.
[0013] A Tibetan medicine knowledge graph retrieval device, the device comprising: The module is used to collect Tibetan medicine knowledge from multi-source heterogeneous data, and after entity recognition and relation extraction, construct a Tibetan medicine knowledge graph with entities as nodes and relations as edges. The extraction module is used to extract the topological and spatial features of nodes by constructing local subnets centered on nodes, extract the semantic features of nodes using a pre-trained semantic feature extraction model, and extract temporal features reflecting changes in node influence based on the sequence of local subnets. The fusion module is used to fuse the topological features, semantic features, spatial features and temporal features in both spatial and temporal dimensions to obtain the influence representation of the node. The receiving module is used to encode and identify entities based on the query information input by the user to obtain a query vector; calculate the semantic similarity between the query vector and the knowledge graph nodes, combine the influence representation of the nodes for weighted sorting, and select a preset number of nodes as the retrieval results; The generation module is used to stratify the search results based on the influence of nodes and generate structured knowledge context; it combines the structured knowledge context with the user query to form prompt words, which are then input into a large language model to generate answers.
[0014] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described Tibetan medicine knowledge graph retrieval method.
[0015] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the aforementioned Tibetan medicine knowledge graph retrieval method.
[0016] The Tibetan medicine knowledge graph retrieval method provided by this invention has the following beneficial effects: This invention constructs a Tibetan medicine knowledge graph, comprehensively mining the graph structure features within Tibetan medicine knowledge. This effectively addresses the shortcomings of existing RAG systems in utilizing graph structures, improving the quality and interpretability of search results. In feature extraction, node features are characterized from multiple dimensions—topological, semantic, and spatiotemporal—and fused using a spatiotemporal graph model to obtain a precise influence representation, making node evaluation more comprehensive. During retrieval, a weighted ranking system combining semantic similarity and node influence breaks away from traditional simple ranking strategies, distinguishing the priority of search results and enhancing the relevance of generated content. Finally, based on the hierarchical search results according to node influence, a structured knowledge context is constructed and combined with the user query input to generate answers using a large language model. This allows the generated answers to prioritize user needs, improving the hierarchy of generated content and enhancing the quality and interpretability of search results. Attached Figure Description
[0017] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a Tibetan medicine knowledge graph retrieval method according to an exemplary embodiment of the present invention.
[0019] Figure 2 This is a schematic diagram illustrating the process of constructing a spatiotemporal graph feature according to an exemplary embodiment of the present invention.
[0020] Figure 3 This is a schematic diagram of a feature fusion process based on a spatiotemporal graph model provided by the present invention according to an exemplary embodiment.
[0021] Figure 4 This is a block diagram of a Tibetan medicine knowledge graph retrieval device provided by the present invention according to an exemplary embodiment. Detailed Implementation
[0022] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.
[0023] The technical solutions provided by the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0024] First, this invention provides a method for retrieving Tibetan medicine knowledge graphs, specifically as follows: Figure 1 As shown, it includes the following steps: S101. Collect Tibetan medicine knowledge from multi-source heterogeneous data, and construct a Tibetan medicine knowledge graph with entities as nodes and relationships as edges through entity recognition and relation extraction.
[0025] In this step, knowledge acquisition and preprocessing are performed first: information on medicinal material names, efficacy and indications, properties and meridian tropism, compatibility relationships, processing methods, geographical distribution, and clinical applications are collected from Tibetan medicine classics, clinical data, and scientific research literature, followed by data cleaning, deduplication, and standardization. Next, named entity recognition technology is used to identify medicinal material entities, disease entities, compatibility entities, and processing method entities. Relationship extraction technology is used to identify the therapeutic, compatibility, processing, origin, and meridian tropism relationships between entities. Finally, entities are used as nodes and relationships as edges to construct a Tibetan medicine knowledge graph G=(V, E), where V is the set of nodes and E is the set of edges. Each node contains type, name, description, and attribute value, and each edge contains relationship type, weight, and confidence.
[0026] In one embodiment, Tibetan medicine-related knowledge is collected from heterogeneous data sources such as Tibetan medicine classics, clinical data, and scientific research literature. This includes information such as the name of the medicinal material, its efficacy and indications, properties and meridian tropism, compatibility relationships, processing methods, geographical distribution, and clinical applications. The collected data is cleaned, deduplicated, and standardized to unify terminology and data format. Named Entity Recognition (NER) technology is used to identify entities in the text, including medicinal material entities, disease entities, compatibility entities, and processing method entities. Relationship extraction technology is used to identify relationships between entities, including relationship types such as "treatment," "compatibility," "processing," "origin," and "meridian tropism." The extracted entities are used as nodes, and the relationships are used as edges to construct a Tibetan medicine knowledge graph G=(V, E), where V is the set of nodes and E is the set of edges. Each node v∈V contains an attribute set {type, name, description, attribute value}, and each edge e∈E contains an attribute set {relationship type, weight, confidence}.
[0027] S102. Extract the topological and spatial features of nodes by constructing local subnets centered on nodes, extract the semantic features of nodes using a pre-trained semantic feature extraction model, and extract the temporal features reflecting the changes in node influence based on the sequence of local subnets.
[0028] The spatial features of a node are a concatenation of multiple centrality indices within its local subnet, including degree centrality, proximity centrality, betweenness centrality, eigenvector centrality, HITS value, and K-shell value. The sequence of local subnets consists of subnets at different times. For each subnet in the sequence, its node spatial features are extracted and processed via a graph convolutional network. The resulting sequence is used as historical prior information about node influence to constitute temporal features. Topological features are extracted by calculating the node's degree centrality, eigenvector centrality, HITS value, proximity centrality, betweenness centrality, and K-shell value. Semantic features are extracted by encoding the node's textual description using a pre-trained semantic feature extraction model to obtain the node's semantic vector representation, and by performing one-hot encoding or embedding encoding on the node's type and attribute features.
[0029] In this step, complex network analysis needs to be performed on the constructed knowledge graph to extract the structural features of each node, as shown in Table 1: Table 1. Description of Selected Feature Indicators for Node Influence Spatial Centrality Secondly, pre-trained semantic feature extraction (such as BERT, RoBERTa) is used to encode the text description of the node to obtain the semantic vector representation of the node. At the same time, discrete features such as the type features and attribute features of the node are extracted and one-hot encoding or embedding encoding is performed.
[0030] This study investigates node influence from both temporal and spatial dimensions, with spatiotemporal characteristics revolving around the subnet. Construction, spatial features The classic centrality index of nodes, time series characteristics This refers to historical prior information about the node's influence. For example... Figure 2 As shown.
[0031] Spatial Feature Construction: This model performs feature modeling on each local subnet, selecting three classic types of node local and global centrality indices as the cascaded representation of nodes in the subnet. Spatial centrality index This refers to the spatial centrality definition mentioned in this invention. For nodes... Local subnets centered on Node spatial feature matrix Subnet topology matrix To comprehensively reflect the spatial information of the influence of subnet nodes. For network research... The two-dimensional node feature information of each subnet is stitched together to form three-dimensional feature data. It is handled using a simplified model.
[0032] .
[0033] Temporal feature construction: based on subgraph sequences Timing information Pair graph Middle node The temporal features are constructed by mining the influence of nodes' historical prior information on node influence, further enhancing the model's ability to perceive the time dimension. The specific temporal feature construction is shown below:
[0034] ; ; The feature processing result sequence of the subgraph at different time points serves as historical prior information about node influence. ,and The results of the corresponding nodes in each subgraph The time-series information of the corresponding nodes in each subnet. Among them, , .
[0035] S103. Perform spatial and temporal feature fusion on the topological features, semantic features, spatial features and temporal features to obtain the influence representation of the node.
[0036] This involves using a spatiotemporal graph model to fuse spatial and temporal features of nodes. This model is a combination of Graph Neural Networks (GNNs) and Long Short-Term Memory (LSTMs) networks, used to process data in both spatial and temporal dimensions simultaneously. In this step, as... Figure 3 As shown, the spatial features and topological features of nodes are input into a graph convolutional network to obtain the spatial representation of node influence; the historical prior information of node influence is concatenated with the spatial features of the node at the current moment and input into a long short-term memory network to obtain the temporal representation of node influence; the spatial representation and the temporal representation are batch normalized and then added to obtain the spatiotemporal representation of node influence.
[0037] First, spatial feature processing is performed: traversing the network's three-dimensional feature data. Each time, the spatial features of a subnet node are extracted. And combined with subnet topology information As input to the model, the influence space representation of subnet nodes is obtained through GCN network aggregation. For detailed processing steps, please refer to the formula: ; in, It is the first The node representation matrix of the layer, yes The enhanced adjacency matrix, where It is the original adjacency matrix. It is an identity matrix, used to consider information about the nodes themselves. yes The angle matrix, where , It is the first The weight matrix of the layer, It is an activation function. It is the input feature matrix, i.e. Subnet node influence space representation It is the final node representation matrix.
[0038] Temporal feature processing: Initialization of a two-dimensional zero matrix Used to record historical prior information about node influence, at each moment, the spatial characteristics of subnet nodes are... The data were processed using GCN and LSTM respectively, and the results were then used. filling During the filling process, node data corresponds one-to-one, and one column of data is filled at each time step. Historical prior information is concatenated with the current subnet spatial features to form the LSTM input data. The processing procedure is as follows:
[0039] ; ; ; ; ; ; in, It is an activation function. It is the hyperbolic tangent activation function. This indicates that the elements are multiplied one by one. This is the input for the current time step. It is the hidden state of the previous time step. It is a comprehensive weight matrix. It is the bias vector. This is the input gate, used to selectively accept and store node influence information relevant to the current time step. This is a forgetting gate, used to selectively forget irrelevant historical information. This is the output gate, used to determine which information from the memory cell will be output to the hidden state. Candidate memory units, This is the hidden state update unit. The output of the LSTM is the hidden state. The sequence, after feature processing of each subnet, yields the corresponding temporal representation of node influence. .
[0040] Spatiotemporal feature processing: Subnet node feature matrices are used to obtain the node influence space representation. and timing representation Batch Normalization (BN) is then performed to accelerate model convergence and prevent overfitting. Finally, the processed spatial and temporal representations are summed to obtain the spatiotemporal representation of the influence of nodes in different subnets. The detailed processing procedure is as follows: ; ; in, , and , They are spatial representations respectively Mean and variance in terms of time. and correspond and , and These are learnable parameters.
[0041] A heuristic evaluation algorithm is employed to jointly optimize the influence strength of nodes at different stages, and the node influence is quantified through a nonlinear optimization function. The specific process is shown in the table below:
[0042] Table 2. Flowchart of Heuristic Joint Optimization Algorithm In the algorithm, input data , , Receive node influence score Step 2 initializes the global data, including the global loss. Historical information on node influence Step 3 involves data extraction, extracting the spatial features of nodes from one subnet at a time. Subnet adjacency matrix Subnet node influence tags Step 4 initializes the local data, including the optimal Kendall coefficients. and local loss Steps 3-11 and 12-14 represent local and global optimizations, respectively, forming a heuristic joint optimization. Step 3 involves optimizing the local structure to ensure that large-scale subnets can achieve the optimal representation of node influence locally, and to enhance the reliability of historical information on node influence. Step 8 records the node influence representation under the optimal result into the historical information. Step 12 uses MLP to reduce the high-dimensional feature data of node influence at different stages to a low dimension, which is then used as the global node influence. The specific processing is as follows:
[0043] ; in, It is the first The weight matrix of the layer, It is the first The layer's bias vector, It is an activation function. correspond .
[0044] Thus, this invention, through a spatiotemporal graph model, deeply integrates the topological features of the graph, the semantic embedding features of nodes, and the spatiotemporal evolution features of knowledge. It captures multi-dimensional representations of node influence within a unified representation space, thereby improving the accuracy and robustness of influence identification. Furthermore, this invention employs the message passing mechanism of a graph neural network (GNN), enabling nodes to aggregate information from multi-hop neighborhoods. Combined with a spatiotemporal attention mechanism, it assigns adaptive weights to different dimensions and spatiotemporal features, achieving deep interaction and organic integration of topological, semantic, relational, and spatiotemporal features, rather than simple feature splicing. For complex Tibetan medicine compatibility relationships, this invention can comprehensively consider multi-dimensional information such as the efficacy (semantics) and the position (topology) of medicinal materials in the compatibility network to accurately assess their influence, thus providing a more reliable reference for clinical applications.
[0045] S104. Based on the query information input by the user, perform query encoding and entity recognition to obtain the query vector.
[0046] In this step, after receiving the user's natural language query Q, a pre-trained semantic feature extraction model is used to encode the query, resulting in a query vector q. Then, key entities and intents in the query are identified to determine the query type (such as medicinal efficacy query, compatibility query, disease treatment query, etc.).
[0047] S105. Calculate the semantic similarity between the query vector and the knowledge graph nodes, combine the influence representation of the nodes for weighted sorting, and select a preset number of nodes as the search results.
[0048] In this step, the cosine similarity between the query vector and the semantic vector of the knowledge graph node is calculated, and the top-K candidate nodes with the highest semantic similarity are selected as the candidate set. The neighboring nodes of the candidate nodes are added to the candidate set to obtain an expanded candidate set. The nodes in the expanded candidate set are then re-ranked according to the comprehensive score, calculated using the following formula: ; in, For balancing parameters, It is semantic similarity. It represents the node influence, and normalize is the normalization function; extract the neighborhood subgraph centered on a preset number of nodes to construct the context knowledge subgraph.
[0049] In one embodiment, the similarity between the query vector q and the semantic vector h_v of all nodes in the knowledge graph is first calculated: ; Select the top-K candidate nodes with the highest semantic similarity. Expand the candidate node set by adding the 1-hop or 2-hop neighbors of each candidate node, resulting in an expanded candidate set. Calculate the overall score by combining the node's influence score and semantic similarity.
[0050] ; Where λ is the balancing parameter and normalize is the normalization function. Candidate nodes are re-ranked based on their comprehensive scores, and the Top-M nodes are selected as the final retrieval results R = {v_1, v_2, ..., v_M}. Using the retrieved Top-M nodes as centers, their neighborhood subgraphs are extracted, including related entities, relationships, and attribute information, to construct a contextual knowledge subgraph.
[0051] Thus, this invention uses the node influence identification results as a weighting factor to intelligently weight and reorder the knowledge nodes retrieved by RAG, giving higher priority to nodes with higher influence and greater importance in the knowledge network, thereby improving the quality and relevance of the search results. Furthermore, this invention combines semantic similarity (local matching) with node influence (global importance), achieving dual protection through a comprehensive score: Score(v) = λ·sim(q,v) + (1-λ)·I(v). This allows the system to not only find nodes semantically relevant to the query but also prioritize high-influence nodes that occupy a core position in the knowledge network, thus avoiding interference from semantically similar but actually unimportant nodes in traditional methods.
[0052] For example, when searching for "Tibetan medicine for treating rheumatism", traditional methods may retrieve a large number of general descriptive nodes that mention rheumatism, while the present invention can prioritize the identification of core Tibetan medicines that are commonly used in clinical practice, have rich compatibility relationships, and have significant curative effects (such as Twenty-Five Flavor Catechu Pills, Eighteen Flavor Codonopsis Pills, etc.), thus significantly improving the practical value of the search results.
[0053] S106. Based on the influence of nodes, the search results are stratified to generate a structured knowledge context; the structured knowledge context is combined with the user query to form prompt words, which are then input into a large language model to generate answers.
[0054] The search results are divided into three layers based on node influence scores: core layer, important layer, and auxiliary layer. The core layer consists of the top 30% of nodes by influence score, the important layer consists of nodes from 30% to 70%, and the auxiliary layer consists of the bottom 30%. The knowledge nodes and their relationships at each layer are converted into natural language descriptions and organized into a structured knowledge context in the order of core layer, important layer, and auxiliary layer. Finally, the structured knowledge context and user queries are used to construct prompt word templates, instructing the large language model to explain core layer knowledge in detail, appropriately describe important layer knowledge, and briefly mention auxiliary layer knowledge. The prompt words are then input into the large language model to generate hierarchical answers.
[0055] In one embodiment, the search results are divided into three levels based on the node influence score: Core layer: The nodes with influence scores in the top 30% represent the most important core knowledge; Important layer: The nodes with influence scores in the 30%-70% represent important supplementary knowledge; Auxiliary layer: The nodes with influence scores in the bottom 30% represent auxiliary reference knowledge.
[0056] The knowledge nodes and their relationships at each level are converted into natural language descriptions and organized in the order of "core layer → important layer → auxiliary layer" to form a structured knowledge context.
[0057] Construct prompt word templates that incorporate hierarchical knowledge: Prompt = Answer the questions based on the following knowledge of Tibetan medicine:
Core Knowledge
[0058]
Important Knowledge
[0059] [Reference Knowledge] {Knowledge Fragments for Auxiliary Layers}.
[0060] Question: {User query}.
[0061] Please focus on explaining the core knowledge, provide appropriate explanations of important knowledge, and briefly mention references.
[0062] Finally, the constructed prompts are input into a large language model (such as GPT, ChatGLM, etc.) to generate a structured answer. This utilizes the node influence ranking results to guide the large language model in giving differentiated attention and space allocation to knowledge content of different importance when generating answers. It focuses on explaining and elaborating on the relevant content of high-influence nodes, while providing a brief overview of the content of low-influence nodes, thus achieving hierarchical output and highlighting key points. Furthermore, by dividing the search results into core, important, and auxiliary layers according to influence and constructing hierarchical prompts, the answers generated by this invention have a clear hierarchical structure and focus. The hierarchical prompts explicitly tell the large language model which knowledge is core (requiring detailed explanation), which is important (appropriately explained), and which is auxiliary (briefly mentioned). Leveraging the instruction compliance capability of LLM, it automatically adjusts its generation strategy, allocating different attention and space to different levels of content, rather than simply presenting a flat narrative.
[0063] Furthermore, the present invention has been practically verified based on the above steps. Details are as follows.
[0064] For example, Experiment Case 1: Querying the efficacy of medicinal materials.
[0065] Enter the query: What are the effects of safflower? Traditional RAG method output: Answer: Safflower is a common Tibetan medicinal herb. It has the effect of promoting blood circulation and removing blood stasis, and can be used to regulate menstruation and relieve pain. Saffron is a similar herb with similar effects. Safflower is mainly produced in Tibet, and is generally harvested in summer. Processing methods for safflower include sun-drying and steaming. Modern pharmacological studies have shown that safflower contains a variety of active ingredients. Safflower is used in Tibetan medicine formulas such as the Seventy-Flavor Pearl Pill. Safflower has a wide range of modern applications.
[0066] Output of the method of this invention: Answer: [Core Efficacy] Safflower is an important medicinal material in Tibetan medicine, possessing significant blood-activating and stasis-removing effects, and has wide clinical applications. Safflower can promote blood circulation and dredge meridians, mainly used to treat blood stasis syndromes, such as dysmenorrhea, amenorrhea, traumatic injuries, and swelling and pain due to blood stasis. At the same time, safflower has the effect of regulating menstruation and relieving pain, and is a commonly used gynecological medicine, capable of alleviating menstrual pain and regulating irregular menstruation.
[0067] [Important Applications] In Tibetan medicine, safflower is often used in combination with other medicinal herbs. For example, in the famous Tibetan medicine formula "Seventy-Flavor Pearl Pill," safflower, as the main herb for promoting blood circulation and removing blood stasis, is combined with pearl, sandalwood, and other herbs to treat stroke, paralysis, and other ailments. It is important to note that although saffron and safflower have similar names, they are different medicinal materials; saffron is more potent but also more expensive.
[0068] [Additional Information] Safflower is mainly produced in high-altitude regions such as Tibet and Qinghai. Traditional processing methods include sun-drying and low-temperature drying. Modern pharmacological studies have found that safflower contains various active ingredients such as safflower yellow pigment, which have anticoagulant and anti-inflammatory effects.
[0069] As can be seen from the two types of answers above, the traditional answer treats all search results equally; lacks focus and is information-heaped; the core efficacy of "promoting blood circulation and removing blood stasis, regulating menstruation and relieving pain" is not fully explained; secondary information such as "harvesting time" takes up too much space; and it lacks hierarchical structure.
[0070] This invention addresses the core efficacy of "promoting blood circulation, removing blood stasis, regulating menstruation, and relieving pain" in three layers based on its impact (60%), with appropriate explanations of important combinations and applications (30%), and brief mentions of secondary information (10%). The structure is clear and the key points are highlighted.
[0071] For example, Experimental Case 2: Disease Treatment Inquiry.
[0072] Enter your query: What Tibetan medicine is used to treat rheumatoid arthritis? Traditional RAG method output: Answer: Rheumatoid arthritis is a common disease. Tibetan medicines used to treat rheumatoid arthritis include the Twenty-Five Flavor Catechu Pill, the Twenty Flavor Agarwood Pill, *Duyiwei* (a type of herb), Tibetan Artemisia capillaris, and Rhodiola rosea. These medicines have the effect of dispelling wind and dampness. Clinical studies have shown that Tibetan medicine has a certain therapeutic effect on rheumatoid arthritis. During treatment, patients need to pay attention to keeping warm and avoiding exposure to cold. Related treatment cases show good results.
[0073] Output of the method of this invention: Answer: [Preferred Treatment] For treating rheumatoid arthritis, Tibetan medicine clinically prioritizes the "Twenty-Five Flavor Catechu Pill." This is a classic Tibetan medicine formula for treating rheumatic bone diseases, composed of twenty-five medicinal herbs including catechu, Terminalia chebula, Terminalia chebula var. chinensis, and Phyllanthus emblica. Its main effects are dispelling wind and dampness, reducing swelling and relieving pain, and promoting blood circulation and removing blood stasis. It is significantly effective for rheumatoid arthritis, osteoarthritis, gout, and other conditions. Clinical application shows that continuous use for 4-8 weeks can significantly improve joint pain and swelling symptoms, and improve joint function.
[0074] [Important Alternative] In addition to the Twenty-Five Flavor Catechu Pill, the "Twenty Flavor Agarwood Pill" is also an important formula for treating rheumatic diseases, suitable for rheumatic pain, joint stiffness, and other symptoms. For patients with milder symptoms, single herbs with wind-dispelling and dampness-removing effects, such as *Artemisia capillaris* and *Artemisia capillaris*, can be used alone, or combined with Rhodiola rosea to strengthen the body and eliminate pathogenic factors.
[0075] [Medication Guidance] When using Tibetan medicine to treat rheumatoid arthritis, it is recommended to consult a Tibetan physician for diagnosis and treatment. During treatment, pay attention to keeping warm, engaging in appropriate exercise, and adjusting your diet. Modern clinical research has confirmed that Tibetan medicine for treating rheumatism has the characteristics of few side effects and long-lasting efficacy.
[0076] As can be seen from the two answers above, the traditional answer does not highlight the status of "Twenty-Five Flavor Catechu Pill" as the first choice formula, confuses the medicinal materials with the prepared formula, lacks priority, does not adequately explain the core treatment plan, and is interfered with by a large amount of secondary information.
[0077] This invention explicitly states that "Twenty-Five Flavor Catechu Pills" is the preferred choice (high influence = core recommendation), and details the composition, efficacy, and usage of the preferred option. Secondary options are provided as supplementary explanations, and medication guidance is briefly mentioned.
[0078] By employing the aforementioned method, a Tibetan medicine knowledge graph is constructed to comprehensively mine the graph structure features within Tibetan medicine knowledge, effectively addressing the shortcomings of existing RAG systems in utilizing graph structures and improving the quality and interpretability of retrieval results. In feature extraction, node features are characterized from multiple dimensions, including topology, semantics, and spatiotemporal dimensions. After fusion using a spatiotemporal graph model, a precise influence representation is obtained, making node evaluation more comprehensive. During retrieval, a weighted ranking system combining semantic similarity and node influence breaks away from traditional simple ranking strategies, distinguishing the priority of retrieval results and enhancing the relevance of generated content. Finally, based on the hierarchical retrieval results according to node influence, a structured knowledge context is constructed and combined with the user query input to generate answers using a large language model. This allows the generated answers to prioritize user needs, improving the hierarchy of generated content and enhancing the quality and interpretability of retrieval results.
[0079] Secondly, this invention also provides a Tibetan medicine knowledge graph retrieval device, such as... Figure 4 As shown, it includes: Module 201 is used to collect Tibetan medicine knowledge from multi-source heterogeneous data, and after entity recognition and relation extraction, construct a Tibetan medicine knowledge graph with entities as nodes and relations as edges.
[0080] Extraction module 202 is used to extract the topological and spatial features of nodes by constructing local subnets centered on nodes, extract the semantic features of nodes using a pre-trained semantic feature extraction model, and extract temporal features reflecting changes in node influence based on the sequence of local subnets.
[0081] The fusion module 203 is used to fuse the topological features, semantic features, spatial features and temporal features in spatial and temporal dimensions to obtain the influence representation of the node.
[0082] The receiving module 204 is used to perform query encoding and entity recognition based on the query information input by the user to obtain a query vector; calculate the semantic similarity between the query vector and the knowledge graph nodes, combine the influence representation of the nodes for weighted sorting, and select a preset number of nodes as the retrieval results.
[0083] The generation module 205 is used to stratify the search results according to the influence of the nodes and generate a structured knowledge context; the structured knowledge context is combined with the user query to form prompt words, which are then input into the large language model to generate the answer.
[0084] The present invention also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 The steps for providing a Tibetan medicine knowledge graph retrieval method.
[0085] This invention also provides a computer device. At the hardware level, the computer device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other hardware required for various operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then executes it to achieve the above-mentioned functions. Figure 1 The steps for providing a Tibetan medicine knowledge graph retrieval method.
[0086] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0087] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0088] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0089] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0090] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail in this specification, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered within the protection scope of the patent of the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A Tibetan medicine knowledge graph retrieval method, characterized in that, The method comprises: Collecting Tibetan medicine knowledge from multi-source heterogeneous data, constructing a Tibetan medicine knowledge graph taking entities as nodes and relationships as edges through entity recognition and relationship extraction; Extracting the topological structure features and spatial features of the nodes by constructing a local subnet centered on the nodes, extracting the semantic features of the nodes using a pre-trained semantic feature extraction model, and extracting the time sequence features reflecting the changes in the influence of the nodes based on the sequence of the local subnet; Fusing the topological structure features, semantic features, spatial features and time sequence features in the spatial and temporal dimensions to obtain the influence representation of the nodes; Based on the query information input by the user, performing query encoding and entity recognition to obtain a query vector; Calculating the semantic similarity between the query vector and the knowledge graph nodes, combining the influence representation of the nodes to perform weighted ranking, and selecting a preset number of nodes as the retrieval results; Layering the retrieval results according to the influence of the nodes to generate a structured knowledge context; combining the structured knowledge context with the user query to form a prompt word, and inputting the prompt word into a large language model to generate an answer.
2. The method of claim 1, wherein, The method of collecting Tibetan medicine knowledge from multi-source heterogeneous data, constructing a Tibetan medicine knowledge graph containing nodes and edges through entity recognition and relationship extraction comprises: Knowledge collection and preprocessing: collecting information such as medicinal material names, efficacy and indications, nature and taste, meridian tropism, compatibility relationship, processing method, production distribution and clinical application information from Tibetan medical classics, clinical data and scientific research literature, and performing data cleaning, deduplication and standardization processing; Using named entity recognition technology to identify medicinal material entities, disease entities, compatibility entities and processing method entities, and using relationship extraction technology to identify the treatment, compatibility, processing, production and meridian tropism relationships between entities; Taking entities as nodes and relationships as edges, a Tibetan medicine knowledge graph G=(V, E) is constructed, where V is a node set and E is an edge set, each node contains type, name, description and attribute value, and each edge contains relationship type, weight and confidence.
3. The method of claim 1, wherein, The method of fusing the topological structure features, semantic features, spatial features and time sequence features in the spatial and temporal dimensions to obtain the influence representation of the nodes comprises: Inputting the spatial features and topological structure features of the nodes into a graph convolution network to obtain the spatial representation of the node influence; Concatenating the historical prior information of the node influence with the spatial features of the node at the current time and inputting them into a long short-term memory network to obtain the time sequence representation of the node influence; Adding the spatial representation and the time sequence representation after batch normalization to obtain the spatio-temporal representation of the node influence.
4. The method of claim 1, wherein, The method of calculating the semantic similarity between the query vector and the knowledge graph nodes, combining the influence representation of the nodes to perform weighted ranking, selecting a preset number of nodes as the retrieval results, and constructing a context knowledge subgraph comprises: Calculating the cosine similarity between the query vector and the semantic vector of the knowledge graph nodes, and selecting the Top-K candidate nodes with the highest semantic similarity as a candidate set; Adding the neighbor nodes of the candidate nodes to the candidate set to obtain an expanded candidate set; Reordering the nodes in the expanded candidate set according to the comprehensive score, and the comprehensive score calculation formula is: ; wherein, is a balancing parameter, is a semantic similarity, is a node influence representation, normalize is a normalization function; Extracting a neighborhood subgraph centered on a preset number of nodes to construct a context knowledge subgraph.
5. The method of claim 1, wherein, The hierarchical retrieval result according to the influence of the node includes: The retrieval result is divided into a core layer, an important layer and an auxiliary layer according to the node influence score, wherein the core layer is the node with an influence score of the top 30%, the important layer is the node with an influence score of 30%-70%, and the auxiliary layer is the node with an influence score of the last 30%; The knowledge nodes and their relationships in each layer are converted into natural language descriptions, and are organized into a structured knowledge context in the order of the core layer, the important layer and the auxiliary layer.
6. The method of claim 1, wherein, The spatial feature of the node is a cascade of multiple centrality indicators of the node in a local subnetwork centered on the node, and the centrality indicators include degree centrality, closeness centrality, betweenness centrality, eigenvector centrality, HITS value and K-shell value; The sequence of the local subnetworks is composed of local subnetworks at different time points, and for each subnetwork in the sequence, the spatial feature of the node is extracted and processed via a graph convolution network, and the sequence of the processing results is used as historical prior information of the node influence to constitute a time sequence feature; The topological structure feature extraction includes calculating the degree centrality, eigenvector centrality, HITS value, closeness centrality, betweenness centrality and K-shell value of the node; The semantic feature extraction includes encoding the text description of the node using a pre-trained semantic feature extraction model to obtain a semantic vector representation of the node, and one-hot encoding or embedding encoding the type feature and attribute feature of the node.
7. The method of claim 1, wherein, The combination of the structured knowledge context and the user query into a prompt word and the input of the large language model to generate an answer includes: A prompt word template is constructed using the structured knowledge context and the user query to instruct the large language model to explain the core layer knowledge, appropriately explain the important layer knowledge and briefly mention the auxiliary layer knowledge; The prompt word is input into the large language model to generate a hierarchical answer.
8. A Tibetan medicine knowledge graph retrieval device, characterized in that, The device includes: A construction module for collecting Tibetan medicine knowledge from multiple source heterogeneous data, performing entity recognition and relationship extraction, and constructing a Tibetan medicine knowledge graph taking entities as nodes and relationships as edges; An extraction module for extracting the topological structure feature and spatial feature of the node by constructing a local subnetwork centered on the node, extracting the semantic feature of the node using a pre-trained semantic feature extraction model, and extracting the time sequence feature reflecting the change of the node influence based on the sequence of the local subnetworks; A fusion module for performing feature fusion in the space and time dimensions of the topological structure feature, the semantic feature, the spatial feature and the time sequence feature to obtain the influence representation of the node; A receiving module for performing query encoding and entity recognition based on the query information input by the user to obtain a query vector, calculating the semantic similarity of the query vector and the nodes of the knowledge graph, and performing weighted ranking combining the influence representation of the node to select a preset number of nodes as the retrieval result; A generation module for hierarchically dividing the retrieval result according to the influence of the node and generating a structured knowledge context; and combining the structured knowledge context and the user query into a prompt word and inputting the large language model to generate an answer.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 7.
10. A computer device, comprising: The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of claims 1 to 7.