Knowledge graph completion method and device, medium and equipment

By constructing multi-relational graphs and using graph neural networks to extract and fusion relationship embeddings, the problem of assuming that relationships are known and semantic associations in the prior art is solved, and the efficiency and accuracy of knowledge graph completion are achieved.

CN119398154AInactive Publication Date: 2025-02-07TIANJIN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411703616.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-02-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art assumes that all relationships are known in knowledge graph completion, difficult to deal with emerging relationships, and ignores semantic associations between relationships.

Method used

By constructing a multi-relational graph, relationship pairs in topological patterns are extracted and relationship embeddings are extracted using graph neural networks. Adaptive weighted aggregation strategy is used to fuse relationship embeddings of different topological patterns to generate multi-modal relationship embeddings. These embedding guide map neural networks are used to update entity embeddings and finally knowledge graph completion is performed based on embedding scoring candidate entities.

Benefits of technology

Effectively capture diverse relationship types and their changes, aggregate semantic relationships between relationships in different topological patterns, and improve the accuracy and flexibility of knowledge graph completion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119398154A_ABST
    Figure CN119398154A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph completion method and device, a medium and equipment, and relates to the technical field of knowledge graphs. Obtaining a query triple and a plurality of candidate entities in the knowledge graph to be complemented; constructing a multi-relation graph according to the relation pair in each topological mode in the knowledge graph to be complemented; extracting relation embedding of a topological mode in the multi-relation graph through a first graph neural network; fusing the relation embedding of each topological mode by using an adaptive weighted aggregation strategy to obtain multi-mode relation embedding; guiding the second graph neural network to aggregate neighbor entities in the to-be-complemented knowledge graph by using multi-mode relation embedding so as to update entities in the to-be-complemented knowledge graph, and obtaining multi-mode entity embedding; and inserting each candidate entity into the query triad, scoring each candidate entity according to multi-mode relation embedding and multi-mode entity embedding, and taking the candidate entity with the highest score as a missing entity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge graph technology, and in particular to a knowledge graph completion method, device, medium and equipment. Background Art

[0002] Knowledge graphs are structured directed graph datasets whose data is stored in the form of triples. The nodes of a directed graph represent head or tail entities, and the edges represent the relationships between entities. Knowledge graphs play a fundamental role in various applications such as recommendation systems and question-answering systems because they can enhance data interoperability, reasoning capabilities, and semantic query capabilities. Due to the inherent incompleteness and inaccuracy in the construction and maintenance process, knowledge graph completion came into being.

[0003] In the prior art, inductive knowledge graph completion is used to predict missing triples between new entities that are not observed during training. They divide entities and relations into observed entities or relations (observed in training) and unobserved entities or relations (not observed in training).

[0004] However, unlike dealing with unobserved entities, existing inductive knowledge graph completion methods assume that all relations are known, thereby learning relations in a direct way. This assumption has certain limitations in practical applications, because new relations may continue to emerge; and it focuses on learning the embedding of new entities, ignoring the semantic associations between relations. Summary of the invention

[0005] Based on this, in order to solve the technical problems in the prior art, the present invention provides a knowledge graph completion method, device, medium and equipment.

[0006] The present invention provides a knowledge graph completion method, comprising:

[0007] Obtain the query triples and several candidate entities in the knowledge graph to be completed;

[0008] Extract the topological patterns in the knowledge graph to be completed. Each topological pattern contains a number of relationship pairs that are used to reflect the connection relationship between entities in the corresponding topological pattern. Construct a multi-graph corresponding to the topological pattern based on the relationship pairs in each topological pattern, and splice the multi-graphs corresponding to each topological pattern to obtain a multi-relationship graph containing all topological patterns.

[0009] The first graph neural network is used to extract the relational embedding of the topological pattern in the multi-relational graph; and the relational embedding of each topological pattern is fused using an adaptive weighted aggregation strategy to obtain a multi-modal relational embedding; the multi-modal relational embedding is used to guide the second graph neural network to aggregate the neighbor entities in the knowledge graph to be completed, so as to update the entities in the knowledge graph to be completed and obtain a multi-modal entity embedding;

[0010] Each candidate entity is inserted into the query triple, each candidate entity is scored according to the multimodal relation embedding and multimodal entity embedding, and the candidate entity with the highest score is used as the missing entity to complete the knowledge graph.

[0011] Furthermore, the multi-relational graph containing all topological patterns is obtained as a three-dimensional tensor A∈R K×M×M In the form of, |K|=6, which are 6 topological patterns; M is the number of edges in the knowledge graph to be completed; each slice in the three-dimensional tensor A corresponds to the adjacency matrix of a relationship pair in a specific topological pattern.

[0012] Furthermore, the use of the adaptive weighted aggregation strategy to fuse the relationship embedding of each topological pattern is achieved through multi-head attention, specifically including:

[0013] Use K independent attention heads to perform feature extraction on each layer of the relation embedding multi-relation graph, and concatenate and weight the feature embeddings extracted by each attention head to obtain a multi-modal relation embedding:

[0014]

[0015] Among them, R is the set of relations; β r represents the aggregation weight; It is the topological pattern relation embedding extracted by the first graph neural network; is the normalized attention coefficient calculated by the kth attention mechanism; is the weight matrix of the linear transformation associated with the kth attention head; is the relation embedding obtained in the rth relation graph; is the relationship node r in the lth layer of the multi-relationship graph j The embedding vector of i is the adjacency matrix of the lth layer of the multi-relational graph; σ(·) is the activation function, is the weight matrix of the lth layer of the multi-relation graph; is the attention score; y (l) is the row weight vector; is the concatenation operation of the embedded vector, || represents the concatenation operation; W (l) is the weight matrix used to process the node connection embedding.

[0016] Further, the method of using multimodal relation embedding to guide the second graph neural network to aggregate neighbor entities in the knowledge graph to be completed so as to update the entities in the knowledge graph to be completed and obtain multimodal entity embedding specifically includes:

[0017] Aggregate neighbor entity information through the second graph neural network to update the corresponding entity embedding:

[0018]

[0019] in, Represents the connection entity v j and entity v i The specific relationship k The relation vector at level L; R ji Represents the entity v j To entity v i The relationship set of fq(v j ) represents entity v j Frequency of occurrence;

[0020] Calculate the attention score of each entity pair and the relationship between entity pairs, and normalize the attention score through the softmax function:

[0021]

[0022] in, represents the attention weight; Represents the connection entity v j , entity v i and the relationship j Embedding of W (l) is the weight matrix used to process node connection embedding; σ(·) is the activation function; is the normalized attention score;

[0023] Neighboring entities and related relations are weighted based on the normalized attention scores, and the node embedding is updated according to the weighted results:

[0024]

[0025] Among them, aggr(h i ) (l) is the weighted sum of all adjacent entities and related relations; is the multimodal entity embedding obtained after updating.

[0026] Furthermore, the topology modes include a head-to-tail topology mode, a tail-to-tail topology mode, a head-to-head topology mode, a tail-to-head topology mode, a parallel topology mode and a loop topology mode.

[0027] The present invention provides a knowledge graph completion device, comprising:

[0028] The data collection module is used to obtain the query triples and several candidate entities in the knowledge graph to be completed;

[0029] A multi-relation graph construction module is used to extract topological patterns in the knowledge graph to be completed. Each topological pattern contains a number of relationship pairs that are used to reflect the connection relationship between entities in the corresponding topological pattern. A multi-graph corresponding to the topological pattern is constructed based on the relationship pairs in each topological pattern. The multi-graphs corresponding to each topological pattern are spliced ​​to obtain a multi-relation graph containing all topological patterns.

[0030] The relation and entity embedding learning module is used to extract the relation embedding of the topological pattern in the multi-relation graph through the first graph neural network; and use the adaptive weighted aggregation strategy to fuse the relation embedding of each topological pattern to obtain the multi-modal relation embedding; use the multi-modal relation embedding to guide the second graph neural network to aggregate the neighbor entities in the knowledge graph to be completed, so as to update the entities in the knowledge graph to be completed and obtain the multi-modal entity embedding;

[0031] The knowledge graph completion module is used to insert each candidate entity into the query triple, score each candidate entity according to the multimodal relation embedding and multimodal entity embedding, and complete the knowledge graph with the highest scoring candidate entity as the missing entity.

[0032] The present invention provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned knowledge graph completion method is implemented.

[0033] The present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned knowledge graph completion method when executing the program.

[0034] At least one of the above technical solutions adopted by the present invention can achieve the following beneficial effects:

[0035] In the knowledge graph completion method provided by the present invention, different topological patterns and relationship pairs are represented by constructing a multi-relationship graph, and each topological pattern represents a different connection relationship between entities, which enables the model to capture a variety of relationship types and their changes, and to flexibly respond to new relationships; the relationship embedding and entity embedding of the knowledge graph obtained based on the multi-relationship graph can effectively aggregate the semantic associations between relationships in different topological patterns, thereby avoiding the shortcomings of traditional methods that only focus on a single relationship or ignore the interactions between relationships; it helps to complement the introduction of new entities and the semantic consistency between existing relationships. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0037] Figure 1 A schematic diagram of a knowledge graph completion method provided by the present invention;

[0038] Figure 2 This is a schematic diagram of the knowledge graph completion model structure provided by the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in combination with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] Knowledge graphs are structured directed graph datasets whose data is stored in the form of triples. The nodes of a directed graph represent the head or tail entity, and the edges represent the relationship between entities. Knowledge graphs play a fundamental role in various applications such as recommendation systems and question-answering systems because they can enhance data interoperability, reasoning capabilities, and semantic query capabilities. Due to the inherent incompleteness and inaccuracy in the construction and maintenance process, knowledge graph completion has emerged. Traditional knowledge graph completion mainly focuses on link prediction or entity completion based on existing knowledge to fill in missing information, such as embedding-based methods TransE and RotatE. However, these methods belong to transductive learning, that is, all entities and relations are known in the training and reasoning stages, so it is difficult to handle new entities and new relations. In recent years, some scholars have introduced inductive knowledge graph completion to predict missing triples between new entities that are not observed during training. They divide entities and relations into observed entities or relations (observed in training) and unobserved entities or relations (not observed in training). However, unlike dealing with unobserved entities, existing inductive knowledge graph completion methods assume that all relations are known, thereby performing transductive learning of relations. This assumption has certain limitations in practical applications, as new relations may also continue to emerge. More importantly, most existing inductive methods focus on learning the embedding of new entities, while the embedding of relations is often obtained through random initialization or direct processing, which inevitably ignores the semantic associations between relations. The inductive knowledge graph completion model is divided into traditional inductive scenarios, semi-inductive scenarios, and full inductive scenarios. The main distinguishing indicator is the proportion of new relations, i.e., fully known relations (traditional), partially known relations (semi), and completely unknown relations (full).

[0041] The purpose of the present invention is to overcome the problem of learning new entity and new relationship representations in inductive scenarios, and propose a new inductive knowledge graph completion model based on graph neural networks that can adapt to the proportion of new relationships. At the same time, the global topological relationship graph is generated using the relationship topology structure to further learn the representation of new relationships and new entities. The updated relationship representation will also guide the update of the entity representation to achieve two-way promotion. In order to achieve the above purpose, the technical solution adopted by the present invention is a relationship graph generation method based on a graph convolutional network and graph self-attention, which further updates the relationship representation and aggregates the entity representation according to the existing relationship graph. The method is: using a graph convolutional network to construct a global relationship graph for each topological structure, integrating the topological structure into the above relationship graph to learn the global relationship embedding, which is further used to update the entity embedding. The generated global relationship graph spans different topological structures, which ensures that even if the relationship changes between training and reasoning, the relationship interaction graph can remain consistent. When the relationship changes during the reasoning process, the interaction between the relationships will also be retained and captured by the global relationship graph, thereby effectively generalizing to the knowledge graph completion of the inductive scenario. The training process of the entire model uses the Adam optimizer to train the neural network parameters.

[0042] Example 1

[0043] Figure 1 The process of the knowledge graph completion method of this embodiment is shown. Figure 1 The method is described in detail and specifically comprises the following steps:

[0044] S1: Obtain the query triples and several candidate entities in the knowledge graph to be completed.

[0045] S2: Extract the topological patterns in the knowledge graph to be completed. Each topological pattern contains several relationship pairs that are used to reflect the connection relationship between entities in the corresponding topological pattern; construct a multi-graph corresponding to the topological pattern according to the relationship pairs in each topological pattern, and splice the multi-graphs corresponding to each topological pattern to obtain a multi-relationship graph containing all topological patterns.

[0046] S201: Analyze the global relationship pattern in the input knowledge graph.

[0047] The relationship topology patterns are divided into seven types: "head to tail", "tail to tail", "head to head", "tail to head", "parallel", "loop", and "non-connected". Since "non-connected" is irrelevant to the link prediction task, this pattern is excluded. The six patterns are named "HT", "TT", "HH", "TH", "PARA", and "LOOP". For example, (r1, HT, r2) represents the correlation between r1 and r2, where r2 has the "HT" pattern, indicating that r1 and r2 are connected head to tail. (r1, PARA, r2) means that the two relations have the same head and tail entities, while (r1, LOOP, r2) means that the two relations are like a loop.

[0048] S202: Construct a multi-relationship graph containing six patterns.

[0049] Based on S201, we start to build a multi-relationship graph. In a given knowledge graph, we first need to identify patterns. Each relationship is regarded as a node v, and the connections (topological patterns) between different relationship pairs are regarded as edges e, so as to construct a directed multi-relationship graph. Since the topological structures of different data sets are different, the number of relationships (i.e., nodes in the multi-graph) is also different. Multi-graphs help to extract adjacency matrices with consistent shapes, which is convenient for subsequent operations. Specifically, a three-dimensional tensor is defined Where |K|=6 indicates the topology type, Represents the number of edges (nodes). Each fragment corresponds to the adjacency matrix of a pair of relations of a specific type. Adjacency tensor Represents node v h and v t Whether there is an edge of type e between them can be easily obtained by traversal. By constructing a global relationship graph across different topological modes, it can be ensured that even if the relationships are different during reasoning, the interactions between them remain unchanged and are captured by the global relationship graph. This enables the model to be generalized to inductive scenarios.

[0050] Using the above method, six different patterns of topological relationship graphs are obtained. Each graph is characterized by its adjacency matrix A, which defines the adjacency relationship of each type of relationship.

[0051] S3: Extract the relational embeddings of topological patterns in the multi-relational graph through the first graph neural network; and use the adaptive weighted aggregation strategy to fuse the relational embeddings of each topological pattern to obtain a multimodal relational embedding; use the multimodal relational embedding to guide the second graph neural network to aggregate the neighbor entities in the knowledge graph to be completed, so as to update the entities in the knowledge graph to be completed and obtain a multimodal entity embedding.

[0052] S301: Relational embedding learning.

[0053] By extracting the relational embedding of topological patterns in multi-relational graphs through graph neural networks and performing adaptive weighted fusion, we can not only focus on the correlation between different relationships, but also effectively aggregate semantic information under different patterns, thus avoiding the shortcomings of traditional methods that only focus on a single relationship or ignore the interaction between relationships.

[0054] Forward propagation process and attention for relation embedding learning. For undefined relations and entities, Glorot initialization is used to generate their initial feature vectors. Then, GNN message passing is used to update the feature embeddings of relation nodes and entity nodes. The forward propagation process and attention can be defined as:

[0055]

[0056] in, is the relation embedding obtained in the rth relation graph; is the relationship node r in the lth layer of the multi-relationship graph j The embedding vector of ; σ(·) is the activation function; is the weight matrix of the lth layer of the multi-relation graph; is the attention score; y (l) is the row weight vector; is the concatenation operation of the embedded vector, || represents the concatenation operation; W (l) is the weight matrix used to process the node connection embedding.

[0057] The attention score is extended to the multi-head attention mechanism to effectively stabilize the learning process of the self-attention mechanism. Specifically, K independent attention heads are used to perform the transformation separately, and then the feature embeddings of these attention heads are connected in series to obtain the final comprehensive output feature embedding:

[0058]

[0059] in, is the weight matrix of the linear transformation associated with the kth attention head; is the normalized attention coefficient calculated by the kth attention mechanism.

[0060] Through the above aggregation, the relation embedding of each specific mode is obtained. When building six different relation graphs, these relation embeddings are concatenated and an adaptive weighted aggregation strategy is applied to form the final comprehensive relation embedding:

[0061]

[0062] Among them, R is the set of relations; β r Represents the aggregation weight.

[0063] S302: Entity embedding learning.

[0064] By using multimodal relation embeddings to guide the second graph neural network to aggregate neighbor entities in the knowledge graph to be completed, it helps to dynamically update and complete the entities in the knowledge graph and ensure the semantic consistency between the introduction of new entities and existing relations.

[0065] The original knowledge graph is combined with relation embeddings, and the entity embedding is updated through neighbor aggregation using the attention mechanism. Entity-level aggregation includes embeddings from the entity neighborhood, i.e., self-loops and adjacent relations. The calculation of self-loops is:

[0066]

[0067] in, Represents the connection entity v j and entity v i The specific relationship k The relation vector at level L; R ji Represents the entity v j To entity v i The relationship set of fq(v j ) represents entity v j Frequency of occurrence.

[0068] This approach combines initial features with neighborhood aggregation, enabling entities to capture more complex and diverse structural features in multi-layer relationship graphs. Inspired by GATv2, the attention score for each entity pair and related relationship is calculated as:

[0069]

[0070] in, represents the attention weight; Represents the connection entity v j , entity v i and the relationship j Embedding of W (l) is the weight matrix used to process node connection embedding; σ(·) is the activation function.

[0071] These raw attention scores are converted into interpretable weights by normalizing them using a softmax function, which can be defined as:

[0072]

[0073] in, is the normalized attention score.

[0074] With these normalized attention weights, aggregation is performed, applying the weighted sum of all neighboring entities and related relations to:

[0075]

[0076] Use the aggregated information to update the embedding of the target node by combining the node’s information with that of its neighbors, i.e.:

[0077]

[0078] Among them, aggr(h i ) (l) is the weighted sum of all adjacent entities and related relations; is the multimodal entity embedding obtained after updating.

[0079] S4: Insert each candidate entity into the query triple, score each candidate entity according to the multimodal relation embedding and multimodal entity embedding, and use the candidate entity with the highest score as the missing entity to complete the knowledge graph.

[0080] This embodiment also provides Figure 2 The training process of the knowledge graph completion model structure shown in Figure 2: Changing the positive triples T tr The head or tail entity in the to generate negative triples in Then, we initialize the entities and relations using their respective learned embeddings to set up the forward pass and get the embedding vector for the relation and the embedding vector of the entity Since our goal is to simplify the problem, all link prediction tasks are converted into tasks of predicting tail entities. Therefore, the link prediction of knowledge graph completion is regarded as a query (v i ,r k ,? ). For each candidate entity v j ∈V inf Insert it into the query triple. Then use the knowledge graph embedding scoring function f(v i ,r k ,v j ) returns a scalar value representing the value of the given triple (v i ,r k ,v j ). The entity with the highest score is defined as the missing entity. The margin-based ranking loss is defined as:

[0081]

[0082] After the loss calculation, the gradients are obtained through backpropagation and gradient clipping is applied to maintain stable training dynamics. The parameters are updated at the end of each epoch using the Adam optimizer. Essentially, the process utilizes an optimization loop to update model parameters, integrate loss evaluation, and backpropagate through Adam.

[0083] High-quality representation learning of new entities and new relations is achieved through a relationship graph generation method based on graph convolutional networks and graph self-attention. The present invention ensures that relationship interactions remain consistent during training and reasoning by constructing a global relationship graph spanning different topological structures. The updated relationship representation further guides the update of the entity representation, achieving a two-way promotion effect. By visualizing the global relationship graph, the distribution of relationships and entities in the embedding space can be observed, verifying the effectiveness of this method in capturing relationship interactions and improving representation quality. Therefore, the method of the present invention can effectively complete the knowledge graph in the induction scenarios of different new relationship ratios and obtain high-quality relationship and entity representations.

[0084] Table 1 is a detailed description of the selected test data

[0085] Table 1: Test data

[0086] Dataset name Number of entities Number of relationships NL-50 5311 150 NL-100 2107 99

[0087] Table 2 is a comparison of the experimental results of the present invention and other knowledge graph completion methods in terms of four indicators, where the indicators used are the average ranking (MR) of correct entities, the average reciprocal rank (MRR) of correct entities, and the accuracy of the top 1 / 10 correct entities (Hit@1 and Hit@10).

[0088] Table 2: Comparison results of knowledge graph completion methods

[0089]

[0090] based on Figure 1The knowledge graph completion method shown in the paper constructs a relational graph for each topology from a global perspective (the entire graph), exploits the invariance of the relational structure and uses relative relational embedding to parameterize any unseen relations. In addition, an inductive knowledge graph completion model is proposed, which can aggregate the relational topological graph and the embedding of new entities and relations in a complete inductive scenario to solve the high complexity and limitations associated with closed subgraph sampling. The present invention uses a graph convolutional network and a graph attention network, and the model can be efficiently trained, has strong expansion and the ability to handle new relations, and can be applied to a large number of incomplete knowledge graphs. Experiments in multiple real data sets show that even in the presence of new relations and new entities, the proposed method can still obtain high accuracy, proving the robustness and effectiveness of the method. The present invention has broad application prospects in the fields of social network analysis, recommendation systems, and information retrieval. In summary: a. From a global perspective, the invariance of the relational structure is used to learn the global relational graph to learn robust relational embedding, which is data-driven and does not introduce additional prior knowledge. b. The global topological relational graph is used to promote the relationship embedding and entity embedding. c. Completely unsupervised learning, without relying on manual labeling. d. The model is highly efficient in training and scalable, and can be applied to knowledge graph completion in fully inductive scenarios. e. It can be applied to many fields such as recommendation systems and search.

[0091] The above is a knowledge graph completion method provided by one or more embodiments of the present invention. Based on the same idea, the present invention also provides a corresponding knowledge graph completion device, including:

[0092] The data collection module is used to obtain the query triples and several candidate entities in the knowledge graph to be completed.

[0093] The multi-relationship graph construction module is used to extract topological patterns in the knowledge graph to be completed. Each topological pattern contains several relationship pairs that are used to reflect the connection relationship between entities in the corresponding topological pattern; a multi-graph corresponding to the topological pattern is constructed according to the relationship pairs in each topological pattern, and the multi-graphs corresponding to each topological pattern are spliced ​​to obtain a multi-relationship graph containing all topological patterns.

[0094] The relation and entity embedding learning module is used to extract the relation embeddings of topological patterns in multi-relational graphs through the first graph neural network; and use an adaptive weighted aggregation strategy to fuse the relation embeddings of each topological pattern to obtain a multi-modal relation embedding; use the multi-modal relation embedding to guide the second graph neural network to aggregate neighbor entities in the knowledge graph to be completed, so as to update the entities in the knowledge graph to be completed and obtain a multi-modal entity embedding.

[0095] The knowledge graph completion module is used to insert each candidate entity into the query triple, score each candidate entity according to multimodal relation embedding and multimodal entity embedding, and complete the knowledge graph with the highest score as the missing entity.

[0096] For the specific limitations of the knowledge graph completion device, please refer to the limitations of the knowledge graph completion method above, which will not be repeated here. Each module in the above-mentioned knowledge graph completion device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0097] The present invention also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 The knowledge graph completion method provided.

[0098] The present invention also provides a computer device structure. At the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory. Of course, it may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The knowledge graph completion method provided.

[0099] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0100] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.

Claims

1. A knowledge graph completion method, characterized in that: include: Obtain the query triples and several candidate entities in the knowledge graph to be completed; Extract the topological patterns in the knowledge graph to be completed. Each topological pattern contains a number of relationship pairs that are used to reflect the connection relationship between entities in the corresponding topological pattern. Construct a multi-graph corresponding to the topological pattern based on the relationship pairs in each topological pattern, and splice the multi-graphs corresponding to each topological pattern to obtain a multi-relationship graph containing all topological patterns. Extract relation embeddings of topological patterns in multi-relation graphs through the first graph neural network; And the adaptive weighted aggregation strategy is used to fuse the relational embeddings of each topological pattern to obtain multi-modal relational embeddings; The multimodal relation embedding is used to guide the second graph neural network to aggregate the neighbor entities in the knowledge graph to be completed, so as to update the entities in the knowledge graph to be completed and obtain the multimodal entity embedding. Each candidate entity is inserted into the query triple, each candidate entity is scored according to the multimodal relation embedding and multimodal entity embedding, and the candidate entity with the highest score is used as the missing entity to complete the knowledge graph.

2. The knowledge graph completion method according to claim 1, characterized in that: The multi-relation graph containing all topological patterns is obtained as a three-dimensional tensor A∈R K×M×M In the form of, |K|=6, which are 6 topological patterns; M is the number of edges in the knowledge graph to be completed; each slice in the three-dimensional tensor A corresponds to the adjacency matrix of a relationship pair in a specific topological pattern.

3. The knowledge graph completion method according to claim 2, characterized in that: The use of the adaptive weighted aggregation strategy to fuse the relational embeddings of various topological patterns is achieved through multi-head attention, specifically including: Use K independent attention heads to perform feature extraction on each layer of the relation embedding multi-relation graph, and concatenate and weight the feature embeddings extracted by each attention head to obtain a multi-modal relation embedding: Among them, R is the set of relations; β r represents the aggregation weight; || represents the concatenation operation; It is the topological pattern relation embedding extracted by the first graph neural network; is the normalized attention coefficient calculated by the kth attention mechanism; The weight matrix of the linear transformation associated with the kth attention head; is the relation embedding obtained in the rth relation graph; is the relationship node r in the lth layer of the multi-relationship graph j The embedding vector of i is the adjacency matrix of the lth layer of the multi-relational graph; σ(·) is the activation function, is the weight matrix of the lth layer of the multi-relation graph; is the attention score; y (l) is the row weight vector; is the concatenation operation of the embedding vector; W (l) is the weight matrix used to process the node connection embedding.

4. The knowledge graph completion method according to claim 3, characterized in that: The method of using multimodal relation embedding to guide the second graph neural network to aggregate neighbor entities in the knowledge graph to be completed, so as to update the entities in the knowledge graph to be completed and obtain multimodal entity embedding, specifically includes: Aggregate neighbor entity information through the second graph neural network to update the corresponding entity embedding: in, Represents the connection entity v j and entity v i The specific relationship k The relation vector at level L; R ji Represents the entity v j To entity v i The relationship set of fq(v j ) represents entity v j Frequency of occurrence; Calculate the attention score of each entity pair and the relationship between entity pairs, and normalize the attention score through the softmax function: in, represents the attention weight; Represents the connection entity v j , entity v i and the relationship j Embedding of W (l) is the weight matrix used to process node connection embedding; σ(·) is the activation function; is the normalized attention score; Neighboring entities and related relations are weighted based on the normalized attention scores, and the node embedding is updated according to the weighted results: Among them, aggr(h i ) (l) is the weighted sum of all adjacent entities and related relations; is the multimodal entity embedding obtained after updating.

5. The knowledge graph completion method according to claim 2, characterized in that: The topology modes include a head-to-tail topology mode, a tail-to-tail topology mode, a head-to-head topology mode, a tail-to-head topology mode, a parallel topology mode and a loop topology mode.

6. A knowledge graph completion device, characterized in that: include: The data collection module is used to obtain the query triples and several candidate entities in the knowledge graph to be completed; A multi-relation graph construction module is used to extract topological patterns in the knowledge graph to be completed. Each topological pattern contains a number of relationship pairs that are used to reflect the connection relationship between entities in the corresponding topological pattern. A multi-graph corresponding to the topological pattern is constructed based on the relationship pairs in each topological pattern. The multi-graphs corresponding to each topological pattern are spliced ​​to obtain a multi-relation graph containing all topological patterns. The relation and entity embedding learning module is used to extract the relation embedding of topological patterns in multi-relation graphs through the first graph neural network; And the adaptive weighted aggregation strategy is used to fuse the relational embeddings of each topological pattern to obtain multi-modal relational embeddings; The multimodal relation embedding is used to guide the second graph neural network to aggregate the neighbor entities in the knowledge graph to be completed, so as to update the entities in the knowledge graph to be completed and obtain the multimodal entity embedding. The knowledge graph completion module is used to insert each candidate entity into the query triple, score each candidate entity according to multimodal relation embedding and multimodal entity embedding, and complete the knowledge graph with the highest score as the missing entity.

7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

8. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of claims 1 to 5 is implemented.