Methods, devices, and media for retrieving question-related subgraphs based on evidence graph patterns.
By constructing a resource association retrieval model and an evidence graph pattern ranking model, the problems of redundancy and omission in subgraph retrieval in existing technologies are solved, and efficient evidence graph pattern derivation is achieved, improving the subgraph retrieval performance and answer hit rate for complex multi-hop problems.
Patent Information
- Application Number
- CN202310327295.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-03-30
AI Technical Summary
Existing technologies do not consider the relationships between atomic resources in a subgraph when performing subgraph retrieval tasks related to problems, resulting in redundancy or omissions in the retrieved subgraphs, and are particularly inadequate in terms of performance for complex multi-hop problems.
By constructing a resource pair retrieval model, natural language questions are transformed into vector representations, and relevant candidates are retrieved from the resource pair vector library. Evidence graph patterns are enumerated, and a ranking model is used for scoring to derive question-related subgraphs, thus avoiding pruning operations in iterative search.
It improves the performance of subgraph retrieval in complex multi-hop problems, reduces redundant information, and increases the answer hit rate.
Smart Images

Figure CN116483959B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology, and relates to natural language processing and knowledge graph technology. It is a method, device and medium for retrieving question-related subgraphs based on evidence graph patterns. Background Technology
[0002] With the development and popularization of internet technology, massive amounts of information are produced and shared. To facilitate users' quick access to target information based on their personalized needs, research on question-answering systems has emerged. These systems accept precise descriptions of query requirements from users using natural language and directly return the corresponding results, with the information retrieval and organization processes automated by computers. Knowledge base question-answering systems typically use structured RDF graph data as their underlying information source, resulting in a massive dataset. Furthermore, the solution to most questions often relies on only a small subgraph of evidence. Therefore, an increasing number of knowledge base question-answering approaches follow the "subgraph retrieval + answer reasoning" paradigm. This involves first using a retrieval module to pre-select a sufficiently small subgraph from the complete RDF graph that provides factual support for the question's solution. Then, an answer reasoning model is used to rank the nodes in the subgraph based on the probability that a node is an answer to the question and returns the results to the user.
[0003] Currently, much work has been done on the task of question-related subgraph retrieval. Methods such as GraftNet and Uniqorn primarily rely on unsupervised word vector or literal matching to determine the relevance of natural language and knowledge base resources, and combine heuristic graph sampling algorithms such as PPR or GST to reduce the size of the subgraph. These methods only require that the atomic resources appearing in the subgraph have a strong literal relevance to the question from the perspective of atomic relevance, without the ability to filter the connection structure formed by the combination of resources. This results in the retrieved subgraphs containing a lot of redundant and irrelevant information while covering the evidence subgraph. Some works have proposed trainable and optimizable subgraph retrieval methods that consider both atomic and combinatorial relevance determination. PullNet integrates subgraph retrieval and answer reasoning during training, iteratively repeating the processes of selecting new facts to add to the subgraph and classifying answer nodes. SR trains the subgraph retrieval model with the goal of restoring the shortest path between the topic entity and the answer entity. Starting from the topic entity, it selects candidate relationships hop-by-hop through a bundle search to expand the path, and finally derives the subgraph based on the searched candidate paths.
[0004] Solving complex multi-hop problems typically relies on evidence from multi-hop related facts surrounding the subject entity. However, the size of the subgraph surrounding the subject entity grows exponentially with the number of hops. To avoid combinatorial explosion caused by traversing all possible facts or path combinations in the K-hop subgraph surrounding the subject entity, PullNet and SR both follow an iterative search paradigm with pruning. This involves expanding the subgraph or path hop-by-hop starting from the subject entity, and filtering candidate combinations at each expansion, pruning off combinations that appear to be of "low quality" at the current stage. This construction paradigm has an inherent flaw: it may prematurely prune correct combinations based on incomplete local information during construction. The longer the path from the subject entity to the answer entity, or the larger the evidence subgraph required to solve the problem, the more severe the negative impact of this flaw becomes. Summary of the Invention
[0005] The problem this invention aims to solve is that existing technologies in the task of relevance subgraph retrieval do not consider the relationships between atomic resources in the subgraph. Some improved schemes, such as PullNet and SR, follow the iterative search paradigm and may prune the correct combination branches. Therefore, existing technologies have the problem of redundancy or omission in the retrieved subgraphs.
[0006] The technical solution of this invention is as follows: a method for retrieving problem-related subgraphs based on evidence graph patterns. This involves traversing nodes and their adjacent edges on an RDF graph in a given knowledge base to construct associated resource pairs. Nodes correspond to entities, and adjacent edges correspond to relations. Associated resource pairs include entity-relation type and relation-relation type. Entity-relation type associated resource pairs describe the association between entities and relations in the knowledge base, semantically equivalent to a triplet pattern containing one entity constant, one relation constant, and one entity variable. Relation-relation type associated resource pairs describe the association between two relations in the knowledge base, semantically equivalent to a graph pattern composed of two triplet patterns containing one relation constant and two entity variables, where the two triplet patterns are connected by a common variable. An offline associated resource pair vector library is then constructed. First, the natural language problem is converted into a vector representation, and candidates with a relevance higher than a set value are retrieved from the associated resource pair vector library. Then, all possible evidence graph patterns are enumerated based on the associated resource pair candidates. Finally, all evidence graph patterns are sorted using a ranking model, and problem-related subgraphs are derived using the top-ranked evidence graph patterns as the subgraph retrieval results.
[0007] Furthermore, this invention retrieves subgraphs related to problem-solving from a given knowledge base by constructing a retrieval process that includes associated resource pair retrieval, evidence graph pattern enumeration, evidence graph pattern sorting, and subgraph derivation, comprising the following steps:
[0008] Step 1) Construct an associated resource pair retrieval model. Use BERT as the encoder to encode the input natural language question into a dense vector representation. In addition, encode the associated resource pairs in the associated resource pair vector library so that the question and associated resource pairs are mapped to the same vector space. Then measure the relevance between the question and associated resource pairs to obtain candidate associated resource pairs.
[0009] Step 2) Use enumeration to combine the candidates of related resources to obtain all legal evidence graph pattern candidates that meet the graph size threshold limit. The evidence graph pattern is a directed graph structure with a tree as the base graph. The edges are constants of specific relations in the knowledge base. There are two types of nodes: constant nodes and variable nodes. Constant nodes correspond to specific entities in the knowledge base, while variable nodes refer to a set of abstract intermediate entities used to connect multiple related facts. Semantically, the evidence graph pattern refers to a set of evidence subgraphs with certain key connection features.
[0010] Step 3) The evidence graph pattern ranking model provides the relevance scores of all legal evidence graph pattern candidates to the question. The evidence graph pattern ranking model is a BERT-based cross encoder with an additional linear layer. The sequence concatenated with the question and each legal evidence graph pattern candidate is taken as input, encoded by BERT, and then transformed into a scalar value through the linear layer to represent the relevance score s(q,egp) between the question and each evidence graph pattern.
[0011] Step 4) Based on the relevance scores s(q,egp), the evidence graph patterns are exported as subgraphs on the given knowledge base from high to low until the set threshold for the number of evidence graph patterns is reached. The method for exporting evidence subgraphs from the evidence graph patterns is as follows: based on the given knowledge base, the variable nodes in the evidence graph patterns are filled with constant entities, and it is ensured that the resulting evidence subgraphs actually exist in the given knowledge base. Finally, the common nodes and edges in these exported subgraphs are merged to obtain a subgraph related to the problem-solving process.
[0012] Based on the above method, the present invention also provides an electronic device, including a storage medium and a processor, for automatically retrieving and returning subgraphs from RDF data in a knowledge base according to a question. The storage medium is used to store a computer program, and the processor is used to execute the computer program. When the computer program is executed, it implements the above-mentioned method for retrieving question-related subgraphs based on evidence graph patterns.
[0013] The present invention also provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed, implements the above-described method for retrieving problem-related subgraphs based on evidence graph patterns.
[0014] This invention provides a subgraph retrieval method that can be trained and optimized without prior pruning during subgraph expansion, thus improving subgraph retrieval performance on complex multi-hop problems. Compared with existing technologies, this invention has the following advantages: By designing a four-stage retrieval framework that sequentially executes associated resource pair retrieval, evidence graph pattern enumeration, evidence graph pattern sorting, and subgraph derivation, this invention ensures that problems are mapped to associated resource pairs, thereby obtaining evidence graph patterns. It transforms the direct retrieval of large-scale problem-related subgraphs into first retrieving small-scale problem-related evidence graph patterns and then deriving the subgraph. This avoids the accumulated pruning overhead caused by existing methods that directly perform iterative subgraph expansion with pruning on large-scale graph data, effectively improving subgraph retrieval performance on complex multi-hop problems. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating the method of the present invention.
[0016] Figure 2 This is a schematic diagram of a key intermediate result of an embodiment of the present invention. Detailed Implementation
[0017] This invention retrieves a small-scale evidence subgraph from a graph-structured knowledge base, providing factual support for solving natural language problems. First, a resource pair retrieval model transforms the natural language problem into a vector representation, and highly relevant candidates are retrieved from an offline-built resource pair vector library. Then, all possible evidence graph patterns are enumerated based on the candidate resource pairs. Finally, a ranking model uniformly sorts all evidence graph patterns, and the top-ranked patterns are used to derive the problem-related subgraph. Based on this method, corresponding electronic devices and computer-readable storage media are provided for the storage and execution of computer programs.
[0018] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can implement it based on the description. The input question is "The country whose capital is Bursa located where?".
[0019] like Figure 1 As shown, this invention proposes a method for retrieving question-related subgraphs based on evidence graph patterns, comprising the following steps:
[0020] Step 1: The input natural language question is transformed into a dense vector representation by the question encoder in the associated resource pair retrieval model. Then, the associated resource pair vector representations with high similarity to the question vector representation are retrieved from the associated resource pair vector representation library after being encoded by the associated resource pair encoder as candidates for associated resource pairs. The specific implementation is as follows.
[0021] Step 1.1: In the offline phase, for a given knowledge base, cache the two types of associated resources, namely "entity-relationship" and "relationship-relationship", by traversing the nodes (entities) and their adjacent edges (relationships) on the graph.
[0022] Entity-relationship type resource pairs: These describe the way entities and relations are associated in a knowledge base. Semantically equivalent, they are triple schemas containing one entity constant, one relation constant, and one entity variable. and There are two association methods, where Ent represents a constant node, Rel represents a constant relationship between adjacent edges, and ? indicates that the node is a variable node, such as ? x representing a variable node. The difference between the two association methods lies in whether the constant entity acts as the subject or object in the triple pattern.
[0023] Relation-relational association resource pairs: These describe the association between two relations in a knowledge base. Semantically equivalent to a graph schema consisting of two triplet schemas, each containing one relation constant and two entity variables, connected by a common variable. Depending on whether the connecting variable acts as the subject or object in the two triplet graph schemas, there are a total of [number missing]. and There are four association methods, where ?x, ?y, and ?z all represent variable nodes, ?x is the common variable connecting two triplet patterns, and Rel1 and Rel2 represent two constant relationships respectively.
[0024] Step 1.2: The associated resource pair retrieval model is essentially a dual encoder based on BERT, consisting of a question encoder and an associated resource pair encoder. Both encoders map the question and associated resource pairs into the same vector space, where the relevance of the two vectors is measured by their dot product. During training, positive examples relevant to the question are selected from the associated resource pair cache, while negative examples are randomly sampled. The dual encoder is trained with the optimization objective of maximizing the dot product of the question vector and the positive example vector while minimizing the cross-entropy loss of the dot product of the question vector and the negative example vector.
[0025] Step 1.3: In the offline stage, the trained associated resource pair encoder encodes all associated resource pairs cached in Step 1.1 into vector representations, thus obtaining the associated resource pair vector representation library.
[0026] Step 1.4: In the online phase, the input natural language question is encoded into a vector representation using the trained question encoder. Then, based on the question representation vector, the top-ranked dot product calculation result is selected from the associated resource pair vector representation library obtained in Step 1.3 as the candidate associated resource pair.
[0027] By implementing step 1, based on the input question "The country whose capital is Bursa located where?", the following candidate related resource pairs can be retrieved from the related resource pair cache: Etc., such as Figure 2 The retrieved associated resource pairs are shown in the image, where each variable node is represented by a dashed circle.
[0028] Step 2: Use enumeration to combine the candidates of associated resources to obtain all possible evidence graph pattern candidates that meet the graph size threshold limit.
[0029] Step 2.1: Select one candidate from the entity-relationship type associated resource pairs to initialize the evidence graph pattern.
[0030] Step 2.2: For each candidate related resource pair, attempt to merge it with the evidence graph pattern candidates generated in the previous round to generate a new round of evidence graph pattern candidates.
[0031] Step 2.2 expands the evidence graph pattern by merging the evidence graph pattern with associated resource pairs. Each merging operation expands a new edge and a new node on a certain variable node in the current evidence graph pattern, as follows:
[0032] For a given variable node on an evidence graph pattern? v egp And a pair of entity-relational related resources to be merged. When merging, simply merge the two variable nodes into the same {? v} egp ,? x}→? v egp So, after merging, what is the current evidence graph pattern in the variable nodes? egp Expand a new edge And a new constant node Ent.
[0033] For a given variable node on an evidence graph pattern? v egp And a relation-relational associated resource pair to be merged. The merge operation requires the variable nodes in the evidence graph schema to be merged. egp The adjacent edges contain If this condition is not met, then it is considered that the relation-relationship type associated resource pair cannot be matched with the evidence graph pattern in the variable? v egp Merge the above; if the condition is met, then first merge... Triple pattern containing Rel1 Delete, then merge the two variables {? v egp ,? x}→? vegp So, after merging, what is the current evidence graph pattern in the variable nodes? egp Expand a new edge And a new variable node? z.
[0034] Step 2.3: Perform a legality screening on the newly generated evidence diagram pattern candidates, and retain only the legal ones.
[0035] The specific definition of the legality of the evidence graph pattern is as follows: if the set of all associated resource pairs derived from the evidence graph pattern is a subset of the associated resource pair candidates obtained in step 1, then the evidence graph pattern is legal; otherwise, it is illegal. The reason for the legality check is that each merging of associated resource pairs may introduce multiple other associated resource pairs into the evidence graph pattern, and it is necessary to ensure that the additional introduced associated resource pairs also exist in the associated resource pair candidates.
[0036] Step 2.4: Determine whether the newly generated evidence graph pattern candidates have reached the threshold limit in terms of graph size. If yes, take the union of the legal evidence graph pattern candidates searched in each round as the output. If no, proceed to step 2.2 to start the next round of search.
[0037] This invention defines an evidence graph pattern to abstractly represent a set of evidence subgraphs with certain key connectivity features. In terms of form, the evidence graph pattern is a directed graph structure with a tree as the base graph. The edges correspond to constants of specific relations in the knowledge base. There are two types of nodes: constant nodes and variable nodes. Constant nodes correspond to specific entities in the knowledge base and are usually directly mentioned in the question statement. Variable nodes refer to a set of abstract intermediate entities used to connect multiple related facts and are usually not directly mentioned in the question statement. Semantically, the evidence graph pattern represents a set of evidence subgraphs with certain key connectivity features. The method of deriving evidence subgraphs from the evidence graph pattern is to fill the variable nodes in the evidence graph pattern with constant entities based on the given knowledge base, ensuring that the resulting evidence subgraph actually exists in the given knowledge base.
[0038] For this embodiment, using the candidate associated resource pairs output in step 1 as input, a combined branch in the process of implementing step 2 is as follows:
[0039] First, select an entity-relationship type associated resource pair. Initialize the evidence diagram pattern Then select the associated resource pair Extend the variable x to the current evidence diagram pattern, modify the variable y to x, and then add it to the current evidence diagram pattern. The extended evidence diagram pattern is as follows: This extension operation additionally introduces associated resource pairs. It exists in the candidates output from step 1, therefore it is valid; continue to the next round of expansion, selecting the associated resource pair. Extending this to the variables in the current evidence graph pattern? Specifically, to x, i.e., after deleting common edges. Later revised What are the variables in the diagram? What is 'a'? And what is 'x'? Extending this to the current evidence diagram pattern, we get... This expansion operation additionally introduces related resource pairs. It exists in the candidates output in step 1, therefore it is valid. At this point, the current combined branch yields three candidate evidence graph patterns:
[0040] Step 3: Use the evidence graph pattern ranking model to give the relevance scores of all candidate evidence graph patterns to the question;
[0041] The essence of the evidence graph pattern ranking model is to add a linear layer to the BERT-based cross encoder. The sequence concatenated with the question and the evidence graph pattern is taken as input, encoded by BERT, and then transformed into a scalar value by the linear layer to represent the relevance score s(q,egp) between the question and the evidence graph pattern.
[0042] During the training phase, positive examples are selected from the candidate evidence graph patterns that provide complete information to support the problem solution, and negative examples are randomly sampled. Each training data point consists of a problem, a positive example, and K negative examples. The training objective is to minimize the loss.
[0043]
[0044] Where q represents the problem, egp + Representative evidence diagram pattern positive example, q,egp represent K negative examples of evidence graph patterns, and s(q,egp) represents the correlation score between the problem output by the linear layer of the model and the evidence graph pattern.
[0045] During the testing phase, each candidate evidence graph pattern is concatenated with the question to obtain the input sequence. The correlation scores are obtained from the input evidence graph pattern ranking model, and finally, the patterns are ranked uniformly according to their scores.
[0046] For an embodiment of the present invention, after performing step 3, the top three evidence graph patterns with the highest relevance scores are:
[0047]
[0048]
[0049]
[0050] like Figure 2 The results of the pattern sorting in the evidence diagram are shown in the middle section.
[0051] Step 4: Based on the relevance scores, export the evidence graph patterns as subgraphs on the given knowledge base in descending order until a set threshold for the number of evidence graph patterns is reached. Finally, merge the common nodes and edges in these exported subgraphs to obtain a problem-related subgraph as output. Specifically, for each evidence graph pattern, use the graph query language SPARQL to map the variable nodes to actual existing constant entities in the given knowledge base, exporting a set of evidence subgraphs. For multiple sets of evidence subgraphs exported from multiple evidence graph patterns, the merging operation refers to merging all subgraphs into one subgraph. The specific merging method is: the vertex set of the new subgraph is the union of the vertex sets of all subgraphs, and the edge set of the new subgraph is the union of the edge sets of all subgraphs. That is, if multiple evidence subgraphs result in N evidence subgraphs G after exporting... 1~N So there are Among them, G merged Let V(G) represent the merged subgraph, V(G) represent the set of vertices in graph G, and E(G) represent the set of edges in graph G.
[0052] For the example, Figure 2 The “Exported Problem-Related Subgraphs” section shows the subgraphs derived from the top three evidence graph patterns. The upper right corner of each entity node indicates the evidence graph pattern number from which it originated.
[0053] The Complex Question Set (CWQ) is a question-answering dataset primarily consisting of multi-hop questions, and existing methods are mainly compared to it. This invention achieves superior subgraph retrieval performance on the CWQ dataset. The SR method, proposed in 2022, is currently the best-performing method for subgraph retrieval. Compared to the SR method (which derives subgraphs using sorted paths), the subgraphs derived using the same number of evidence graph patterns in this invention have a higher answer hit rate, as shown in Table 1. Hits@n is one of the most commonly used metrics in the field of Information Retrieval (IR). As can be seen from Table 1, the solution of this invention greatly improves the quality of the retrieved subgraphs.
[0054] Table 1
[0055] Hits@1 Hits@5 Hits@10 SR 51.5 72.6 79.5 This invention 82.1 89.9 91.2
Claims
1. A method for retrieving problem-related subgraphs based on evidence graph patterns, characterized by: This process involves traversing the nodes and adjacent edges of an RDF graph in a given knowledge base to construct associated resource pairs. Nodes correspond to entities, and adjacent edges correspond to relations. Associated resource pairs include two types: entity-relation and relation-relation. Entity-relational associated resource pairs describe the association between entities and relations in the knowledge base, semantically equivalent to a triplet schema containing one entity constant, one relation constant, and one entity variable. Relation-relational associated resource pairs describe the association between two relations in the knowledge base, semantically equivalent to a graph schema consisting of two triplet schemas containing one relation constant and two entity variables, connected by a common variable. An offline associated resource pair vector library is then constructed. First, the natural language question is converted into a vector representation. Candidates with a relevance higher than a set value are retrieved from the associated resource pair vector library. Then, all possible evidence graph schemas are enumerated based on the associated resource pair candidates. Finally, all evidence graph schemas are ranked using a ranking model, and question-related subgraphs are derived from the top-ranked evidence graph schemas as the subgraph retrieval results. The retrieval process, which involves constructing a retrieval flow for associated resource pairs, evidence graph pattern enumeration, evidence graph pattern sorting, and subgraph derivation, retrieves subgraphs related to problem-solving from a given knowledge base. This includes the following steps: Step 1) Construct an associated resource pair retrieval model. Use BERT as the encoder to encode the input natural language question into a dense vector representation. In addition, encode the associated resource pairs in the associated resource pair vector library so that the question and associated resource pairs are mapped to the same vector space. Then measure the relevance between the question and associated resource pairs to obtain candidate associated resource pairs. Step 2) Use enumeration to combine the candidates of related resources to obtain all legal evidence graph pattern candidates that meet the graph size threshold limit. The evidence graph pattern is a directed graph structure with a tree as the base graph. The edges are constants of specific relations in the knowledge base. There are two types of nodes: constant nodes and variable nodes. Constant nodes correspond to specific entities in the knowledge base, while variable nodes refer to a set of abstract intermediate entities used to connect multiple related facts. Semantically, the evidence graph pattern refers to a set of evidence subgraphs with certain key connection features. Step 3) The evidence graph pattern ranking model provides the relevance scores of all legal evidence graph pattern candidates to the question. The evidence graph pattern ranking model is a BERT-based cross encoder with an additional linear layer. The sequence concatenated with the question and each legal evidence graph pattern candidate is taken as input, encoded by BERT, and then transformed into a scalar value through the linear layer to represent the relevance score s(q,egp) between the question and the evidence graph pattern. Step 4) Based on the relevance scores s(q,egp), the evidence graph patterns are exported as subgraphs on the given knowledge base from high to low until the set threshold for the number of evidence graph patterns is reached. The method for exporting evidence subgraphs from the evidence graph patterns is as follows: based on the given knowledge base, the variable nodes in the evidence graph patterns are filled with constant entities, and it is ensured that the resulting evidence subgraphs actually exist in the given knowledge base. Finally, the common nodes and edges in these exported subgraphs are merged to obtain a subgraph related to the problem-solving process.
2. The method for retrieving problem-related subgraphs based on evidence graph patterns according to claim 1, characterized in that: Step 1) specifically involves: Step 1.1) For a given knowledge base, cache the two types of associated resources, "entity-relationship" and "relationship-relationship", by traversing the nodes and their adjacent edges on the RDF graph; Step 1.2) The associated resource pair retrieval model is based on BERT's dual encoder, which includes a question encoder and an associated resource pair encoder. The question and associated resource pairs are represented in the same vector space, and the correlation between the two vectors is measured by the vector dot product. During the training phase, positive examples related to the problem solution are selected from the associated resource pair cache, and negative examples are randomly sampled. The dual encoder is trained with the optimization objective of maximizing the dot product of the question vector and the positive example vector while minimizing the cross-entropy loss of the dot product of the question vector and the negative example vector. Step 1.3) Use the associated resource pair encoder in the trained dual encoder to encode all the associated resource pairs cached in Step 1.1) into vector representations, and obtain the associated resource pair vector library; In the online retrieval phase (step 1.4), the trained question encoder encodes the input natural language question into a vector representation. Then, based on the question vector, the candidate associated resource pair is selected from the associated resource pair vector library obtained in step 1.3) with the highest dot product calculation result.
3. The method for retrieving problem-related subgraphs based on evidence graph patterns according to claim 1, characterized in that: Step 2) specifically involves: Step 2.1) Select one candidate from the "entity-relationship" associated resource pairs to initialize the evidence graph pattern; Step 2.2) For each candidate associated resource pair, attempt to merge it with the evidence graph pattern candidates generated in the previous round to generate a new round of evidence graph pattern candidates; Step 2.3) Perform a legality screening on the newly generated evidence graph pattern candidates, and retain only the legal ones. The legality judgment is as follows: if the set of all associated resource pairs derived from the evidence graph pattern is a subset of the associated resource pair candidates obtained in step 1), then the evidence graph pattern is said to be legal; otherwise, it is illegal. Step 2.4) Determine whether the newly generated evidence graph pattern candidates have reached the upper limit of the graph size. If yes, take the union of the legal evidence graph pattern candidates searched in each round as the output. If no, proceed to step 2.2) to start the next round of search.
4. The method for retrieving problem-related subgraphs based on evidence graph patterns according to claim 3, characterized in that: In step 2.2), the evidence graph pattern is expanded by merging the evidence graph pattern with associated resource pairs. Each merging operation expands a new edge and a new node on a certain variable node in the current evidence graph pattern, as follows: For a given variable node on an evidence graph pattern? v egp And a pair of entity-relational related resources to be merged. When merging, simply merge the two variable nodes into the same {? v} egp ,? x}→? v egp So, after merging, what is the current evidence graph pattern in the variable nodes? egp Expand a new edge And a new constant node Ent, where Rel represents a constant relationship between adjacent edges, and ? indicates that the node is a variable node; For a given variable node on an evidence graph pattern? v egp And a relation-relational associated resource pair to be merged. The merge operation requires the variable nodes in the evidence graph schema to be merged. egp The adjacent edges contain If this condition is not met, then it is considered that the relation-relationship type associated resource pair cannot be matched with the evidence graph pattern in the variable? v egp Merge the above; if the condition is met, then first merge... Triple pattern containing Rel1 Delete, then merge the two variables {? v egp ,? x}→? v egp So, after merging, what is the current evidence graph pattern in the variable nodes? egp Expand a new edge And a new variable node? z.
5. The method for retrieving problem-related subgraphs based on evidence graph patterns according to claim 1, characterized in that: The specific implementation of the evidence graph pattern ranking model in step 3) is as follows: During the training phase, positive examples are selected from the candidates of legal evidence graph patterns that can provide complete information to support the problem solution. Negative examples are randomly sampled. Each training data point consists of a problem, one positive example, and K negative examples. The training objective is to minimize the loss. Where q represents the problem, egp + Representative evidence diagram pattern positive example, These represent K negative examples of the evidence graph pattern, and s(q,egp) represents the correlation score between the problem output by the linear layer of the model and the evidence graph pattern. During the testing phase, each candidate evidence graph pattern is concatenated with the question to obtain the input sequence. The input evidence graph pattern ranking model is used to obtain the relevance score of each pattern, and finally, the patterns are ranked uniformly according to the scores.
6. The method for retrieving problem-related subgraphs based on evidence graph patterns according to claim 1, characterized in that: In step 4), problem-related subgraphs are obtained by merging multiple problem-related evidence graph patterns exported from the given knowledge base. For each evidence graph pattern, the variable nodes are mapped to actual existing constant entities in the given knowledge base using the graph data query language SPARQL, thus exporting a set of evidence subgraphs. For multiple sets of evidence subgraphs exported from multiple evidence graph patterns, the merging operation refers to merging all the subgraphs into one subgraph. The specific merging method is: the vertex set of the new subgraph is the union of the vertex sets of all subgraphs, and the edge set of the new subgraph is the union of the edge sets of all subgraphs. That is, if multiple evidence subgraphs result in N evidence subgraphs G after exporting... 1~N So there are Among them, G merged Let V(G) represent the merged subgraph, V(G) represent the set of vertices in graph G, and E(G) represent the set of edges in graph G.
7. The method for retrieving problem-related subgraphs based on evidence graph patterns according to claim 1, characterized in that: The two types of associated resource pairs are as follows: Entity-relational resource pairs: Yes There are two association methods, where Ent represents a constant node, Rel represents a constant relation, and ? x represents a variable node. The difference between the two association methods lies in whether the constant entity acts as the subject or object in the triple pattern. Relation-relational associated resource pairs: Based on whether the join variable acts as the subject or object in the two triple graph schemas, there are a total of and There are four association methods, where ?x, ?y, and ?z represent different variable nodes, ?x is the common variable connecting two triplet patterns, and Rel1 and Rel2 represent two constant relationships respectively.
8. An electronic device, characterized in that: The method includes a storage medium and a processor for automatically retrieving and returning subgraphs from RDF data in a knowledge base based on a question. The storage medium is used to store a computer program, and the processor is used to execute the computer program. When the computer program is executed, it implements the method for retrieving question-related subgraphs based on evidence graph patterns as described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that... The computer-readable storage medium stores a computer program, which, when executed, implements the method for retrieving problem-related subgraphs based on evidence graph patterns as described in any one of claims 1-7.
Citation Information
Patent Citations
Question-answering method and system in multi-document scene
CN112632250A
Complex question knowledge base question answering method based on embedded and candidate subgraph pruning
CN112766507A