Knowledge graph reasoning method based on topological structure and mixed semantics

By adopting topological structure and hybrid semantic encoding methods in knowledge graph reasoning, strong edge features and topological structure encoding are used to generate a hybrid representation of the relationship path, which solves the problem that existing methods fail to fully utilize topological structure and mixed semantic information, and improves Improve the accuracy and efficiency of knowledge graph reasoning.

CN118690858APending Publication Date: 2024-09-24KASHGAR ELECTRONIC INFORMATION IND TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410837786.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Existing knowledge graph reasoning methods fail to fully utilize the topological structure information and mixed semantic information of relationship paths, resulting in limited performance when understanding and inferring complex relationships.

Method used

A knowledge graph reasoning method based on topological structure and mixed semantics is adopted, node structure feature embedding is obtained through strong edge feature coding, and topological structure coding and mixed semantic coding are combined to generate a hybrid representation of the relationship path to improve reasoning accuracy.

Benefits of technology

Effectively utilizing the relationship path topology and mixed semantic information in the knowledge graph improves the accuracy and efficiency of knowledge graph reasoning, especially showing better performance when processing complex relationship paths.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690858A
    Figure CN118690858A
Patent Text Reader

Abstract

The invention discloses a knowledge graph inference method based on a topological structure and mixed semantics, which comprises the following steps of: obtaining node structure feature embedding xu by node feature coding: marking nodes in a relation path graph by using strong edge features, and obtaining node structure feature embedding xu according to a marked value, a first neural network and a second neural network; performing topological structure coding to obtain a final score s: calculating a node structure information score sst of the target nodes, calculating a semantic similarity score sse of the two target nodes, and calculating the final score s = sst + sse; the step of obtaining the relation path mixed representation # imgabs0 # through mixed semantic coding comprises the steps that explicit text representation pt is extracted, implicit semantic representation pl is extracted, the pt and the pl are fused through a third neural network to generate the representation # imgabs1 #, and the final representation of the problem is obtained through the representation # imgabs2 #. According to the method, the topological structure information and the mixed semantic information of the relation path in the knowledge graph can be fully utilized, and the reasoning accuracy and effectiveness of the knowledge graph are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of knowledge graph reasoning, and specifically relates to a knowledge graph reasoning method based on topological structure and hybrid semantics. Background Art

[0002] Knowledge graph reasoning uses existing knowledge to deduce and predict missing information. This is an effective way to solve the problems of incomplete and uncertain knowledge graphs, and is also one of the key technologies to improve the quality of knowledge graphs. According to the differences in the technical means of implementing knowledge graph reasoning, it can be classified into reasoning methods based on neural networks, reasoning methods based on symbolic logic, and reasoning methods based on a combination of the two.

[0003] Among them, neural network-based knowledge graph reasoning methods convert entities and relations in knowledge graphs into vector representations of various dimensions by using shallow embedding models, such as translation-based models, multiplication-based models, and deep learning-based neural network models. Although these models perform well in reasoning about simple relations, their performance may be limited in more complex reasoning scenarios, and they lack clear reasoning paths or rules to explain their decision-making process.

[0004] The core purpose of the reasoning method based on symbolic logic is to mine universal logical rules from the knowledge graph, which can guide people to start from a specific head entity and follow these rules to find and reason in order to obtain the correct tail entity. This method is usually intolerant of uncertainty and errors in the data, which may impose certain restrictions on their use in practical applications.

[0005] Both neural network-based reasoning methods and symbolic logic-based reasoning methods have their limitations, but they are indeed complementary and can provide more powerful reasoning capabilities when used in combination. Logical rules use the high-order dependencies of knowledge graph relationships to provide additional information, which helps improve the accuracy and depth of reasoning. At the same time, the high-quality embeddings learned by the neural reasoning model can provide a more complete and rich knowledge graph for logical rule-based reasoning, thereby enhancing the performance of the overall knowledge graph reasoning framework.

[0006] The existing reasoning methods based on the combination of the two still have some shortcomings:

[0007] First, these methods often do not fully utilize the relationship path topology information in the knowledge graph. The relationship path is the path between entities in the knowledge graph connected by a series of relationships, which reflects the complex relationship between entities. However, existing reasoning methods often only focus on the direct information of entities and relationships, while ignoring the rich topological structure information contained in the relationship path. This leads to certain limitations in the performance of the model when understanding and inferring complex relationships.

[0008] Secondly, the existing reasoning methods based on the combination of the two have also failed to deeply explore the mixed semantic information in the relationship path. In the knowledge graph, the relationship path not only contains the direct connection between entities, but also implies a variety of semantic information, such as the directionality of the relationship, the hierarchy of the relationship, etc. These mixed semantic information are crucial for accurately understanding the relationship between entities. However, the existing reasoning methods often lack effective processing of these mixed semantic information, which affects the accuracy of reasoning. Summary of the invention

[0009] In order to solve the above problems, the present invention provides a knowledge graph reasoning method based on topological structure and hybrid semantics, which can make full use of the topological structure information and hybrid semantic information of the relationship path in the knowledge graph to improve the accuracy and effectiveness of knowledge graph reasoning.

[0010] The technical solution adopted by the present invention is:

[0011] In a first aspect, the present application discloses a knowledge graph reasoning method based on topological structure and hybrid semantics, comprising the following steps:

[0012] Node feature encoding obtains node structure feature embedding x u , including: using strong edge features to mark the nodes in the relationship path graph, and obtaining the node structure feature embedding x according to the mark value, the first neural network, and the second neural network u ;

[0013] The topological structure encoding obtains the final score s, including: according to the x u Calculate the node structure information score s of the target node st , using the fusion features to calculate the semantic similarity score s of the two target nodes se , calculate the final score s = s st +s se ; Wherein, the fusion feature is to convert the x u and the original node attribute z u Fusion

[0014] Hybrid semantic encoding to obtain hybrid representation of relation paths Includes: Extracting explicit textual representations of relationship paths t , extract the implicit semantic representation of the relationship path p l , the p t With p l Generate the relationship path hybrid representation through the third neural network fusion

[0015] Using the relationship path hybrid representation Get the final representation of the problem.

[0016] As an optional technical solution, the node structure feature is embedded in x u The acquisition includes:

[0017] Calculate the optimal path distance of any given head node and tail node, the optimal path distance is generated by the transfer path sampling method, the transfer path is sampled k times, and a strong edge feature is obtained;

[0018] The obtained strong edge features are used to mark the nodes in the relationship path graph, and the nodes in the paths of different lengths are marked with different marking values;

[0019] For each node in the relationship path graph, an initial node structure feature embedding is generated for each node according to the tag value, the node structure feature is encoded by the first neural network, and then the node structure feature embedding x is obtained by the second neural network. u .

[0020] As an optional technical solution, the calculation of the score s includes:

[0021] Learn the structural information of the two target nodes and the topological structure information between the nodes in the relationship path graph;

[0022] The Hadmard product of the structural features of the two target nodes is used as one of the inputs of the fourth neural network to obtain the node structure information score s st , wherein the Hadmard product is a Hadamard product;

[0023] For the topological structure information between the two target nodes, the original node attributes and the node structure features are embedded into x u Obtaining the fusion feature through the fifth neural network fusion;

[0024] The fusion feature is used as one of the inputs of the sixth neural network to obtain the final representation output h of the two target nodes. g ;

[0025] The final representation output h g As the second input of the fourth neural network, the semantic similarity score s is obtained. se ;

[0026] The node structure information score s will be obtained st With the semantic similarity score s se The score s is obtained by adding them together.

[0027] As an optional technical solution, the relationship path is mixed to represent The generation includes:

[0028] For a single path, a relation symbolic representation is used to generate a textual relation path from the symbolic representation, in which each textual description of entities and relations in the path is surrounded by a specified tag. The labeled textual relation path is input into the text encoder to extract the explicit textual representation p of the relation path. t ;

[0029] Extract relation embedding from the pre-trained knowledge graph embedding model, and obtain the implicit semantic representation p of the relation path from the relation embedding l ;

[0030] The explicit text representation p t and the implicit semantic representation p l Fusion with the third neural network to generate the relationship path hybrid representation

[0031] As an optional technical solution, the final representation is obtained by: mixing the representation according to the relationship path A rotation transformation and a scaling transformation are generated and combined using the rotation transformation and the scaling transformation into a final representation of the problem, which contains the real part and the imaginary part of the complex space.

[0032] In a second aspect, the present application also discloses a knowledge graph reasoning device based on topological structure and hybrid semantics, the device comprising:

[0033] Node feature encoding module, used for node feature encoding to obtain node structure feature embedding x u , which uses strong edge features to mark the nodes in the relationship path graph, and obtains the node structure feature embedding x according to the tag value, the first neural network, and the second neural network u ;

[0034] A topology encoding module is used for topology encoding to obtain a final score s, which is calculated based on the x u Calculate the node structure information score s of the target node st , and use the fusion features to calculate the semantic similarity score s of the two target nodes se , calculate the final score s = s st +s se ; Wherein, the fusion feature is to convert the x u and the original node attribute z u Fusion

[0035] Hybrid semantic encoding module, used to mix semantic encoding to obtain hybrid representation of relation paths It extracts the explicit textual representation of the relationship path p t , and extract the implicit semantic representation p of the relationship pathl , and then the p t With p l Generate the relationship path hybrid representation through the third neural network fusion

[0036] The final representation generation module is used to use the relationship path to mix the representation Get the final representation of the problem.

[0037] As an optional technical solution, the node feature encoding module is also used for:

[0038] Calculate the optimal path distance of any given head node and tail node, the optimal path distance is generated by the transfer path sampling method, the transfer path is sampled k times, and a strong edge feature is obtained;

[0039] The obtained strong edge features are used to mark the nodes in the relationship path graph, and the nodes in the paths of different lengths are marked with different marking values;

[0040] For each node in the relationship path graph, an initial node structure feature embedding is generated for each node according to the tag value, the node structure feature is encoded by the first neural network, and then the node structure feature embedding x is obtained by the second neural network. u .

[0041] As an optional technical solution, the topology structure encoding module is also used to:

[0042] Learn the structural information of the two target nodes and the topological structure information between the nodes in the relationship path graph;

[0043] The Hadmard product of the structural features of the two target nodes is used as one of the inputs of the fourth neural network to obtain the node structure information score s st , wherein the Hadmard product is a Hadamard product;

[0044] For the topological structure information between the two target nodes, the original node attributes and the node structure features are embedded into x u Obtaining the fusion feature through the fifth neural network fusion;

[0045] The fusion feature is used as one of the inputs of the sixth neural network to obtain the final representation output h of the two target nodes. g ;

[0046] The final representation is output as h g As the second input of the fourth neural network, the semantic similarity score s is obtained. se ;

[0047] The node structure information score s will be obtained st With the semantic similarity score s se The score s is obtained by adding them together.

[0048] As an optional technical solution, the hybrid semantic encoding module is also used for:

[0049] For a single path, a relation symbolic representation is used to generate a textual relation path from the symbolic representation, in which each textual description of entities and relations in the path is surrounded by a specified tag. The labeled textual relation path is input into the text encoder to extract the explicit textual representation p of the relation path. t ;

[0050] Extract relation embedding from the pre-trained knowledge graph embedding model, and obtain the implicit semantic representation p of the relation path from the relation embedding l ;

[0051] The explicit text representation p t and the implicit semantic representation p l Fusion with the third neural network to generate the relationship path hybrid representation

[0052] As an optional technical solution, the final representation generation module is further used to: mix the representation according to the relationship path A rotation transformation and a scaling transformation are generated and combined using the rotation transformation and the scaling transformation into a final representation of the problem, which contains the real part and the imaginary part of the complex space.

[0053] The beneficial effects of the present invention are:

[0054] This application can make full use of the topological structure information and mixed semantic information of the relationship path in the knowledge graph to improve the accuracy and effectiveness of knowledge graph reasoning. By adopting a node feature encoding method based on strong edge features, the importance of entity nodes at different positions in the information transmission process is captured. Using a topological structure encoding method based on a graph neural network, the structural information of the relationship path is effectively integrated and utilized. By pre-training embeddings to provide embedded representations of entities and relationships in the path to support the hybrid semantic encoder, the encoder's relationship representation ability is improved, and the accuracy and efficiency of knowledge graph reasoning are effectively improved. At the same time, a hybrid semantic framework is used to capture explicit and implicit semantic information in the relationship path. This method can more accurately capture the path topological structure information and mixed semantic information of the relationship, so that it has better performance when processing complex relationship paths, thereby improving the accuracy of knowledge graph reasoning. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1Schematic diagram of the flow of a knowledge graph reasoning method based on topological structure and hybrid semantics in an exemplary embodiment.

[0056] Figure 2 Schematic diagram of the structure of a coding model integrating strong edge features and topological structure in an exemplary embodiment.

[0057] Figure 3 Schematic diagram of the structure of a hybrid semantic framework model in an exemplary embodiment.

[0058] Figure 4 It is a principle block diagram of a knowledge graph reasoning device based on topological structure and hybrid semantics in an exemplary embodiment. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0060] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0061] Example

[0062] like Figure 1 As shown, this embodiment discloses a knowledge graph reasoning method based on topological structure and hybrid semantics, including the following steps:

[0063] Node feature encoding obtains node structure feature embedding x u , including: using strong edge features to mark the nodes in the relationship path graph, and obtaining the node structure feature embedding x according to the mark value, the first neural network, and the second neural network u ; Among them, the first neural network can be a graph convolutional neural network, and the second neural network can be an MLP neural network.

[0064] The topological structure encoding obtains the final score s, including: according to the x u Calculate the node structure information score s of the target node st , using the fusion features to calculate the semantic similarity score s of the two target nodes se , calculate the final score s = sst +s se ; Wherein, the fusion feature is to convert the x u and the original node attribute z u Fusion

[0065] Hybrid semantic encoding to obtain hybrid representation of relation paths Includes: Extracting explicit textual representations of relationship paths t , extract the implicit semantic representation of the relationship path p l , the p t With p l Generate the relationship path hybrid representation through the third neural network fusion Wherein, the third neural network may be an MLP neural network;

[0066] Using the relationship path hybrid representation Get the final representation of the problem.

[0067] As an optional implementation, the node structure feature is embedded in x u The acquisition includes:

[0068] Calculate the optimal path distance of any given head node and tail node, the optimal path distance is generated by the transfer path sampling method, the transfer path is sampled k times, and a strong edge feature is obtained;

[0069] The obtained strong edge features are used to mark the nodes in the relationship path graph, and the nodes in the paths of different lengths are marked with different marking values;

[0070] For each node in the relationship path graph, an initial node structure feature embedding is generated for each node according to the tag value, the node structure feature is encoded by the first neural network, and then the node structure feature embedding x is obtained by the second neural network. u .

[0071] As an optional implementation manner, the calculation of the score s includes:

[0072] Learn the structural information of the two target nodes and the topological structure information between the nodes in the relationship path graph;

[0073] The Hadmard product of the structural features of the two target nodes is used as one of the inputs of the fourth neural network to obtain the node structure information score s st , wherein the Hadmard product is a Hadamard product; wherein the fourth neural network may be an MLP neural network;

[0074] For the topological structure information between the two target nodes, the original node attributes and the node structure features are embedded into x uObtaining the fusion feature by fusing the fifth neural network; wherein the fifth neural network may be an MLP neural network;

[0075] The fusion feature is used as one of the inputs of the sixth neural network to obtain the final representation output h of the two target nodes. g ;

[0076] The final representation output h g As the second input of the fourth neural network, the semantic similarity score s is obtained. se ;

[0077] The node structure information score s will be obtained st With the semantic similarity score s se The score s is obtained by adding them together.

[0078] As an optional implementation, the relationship path is mixed to represent The generation includes:

[0079] For a single path, a relation symbolic representation is used to generate a textual relation path from the symbolic representation, in which each textual description of entities and relations in the path is surrounded by a specified tag. The labeled textual relation path is input into the text encoder to extract the explicit textual representation p of the relation path. t ;

[0080] Extract relation embedding from the pre-trained knowledge graph embedding model, and obtain the implicit semantic representation p of the relation path from the relation embedding l ;

[0081] The explicit text representation p t and the implicit semantic representation p l Fusion with the third neural network to generate the relationship path hybrid representation

[0082] As an optional implementation, the final representation is obtained by: mixing the representation according to the relationship path A rotation transformation and a scaling transformation are generated and combined using the rotation transformation and the scaling transformation into a final representation of the problem, which contains the real part and the imaginary part of the complex space.

[0083] The method provided in this embodiment further expands the traditional reasoning method and introduces topological structure encoding technology to better integrate and utilize the structural information of the relationship path. Through technologies such as graph attention networks, effective aggregation of entity neighborhood structure information is achieved, and a node feature encoding method based on strong edge features is proposed, thereby enhancing the model's ability to capture node structure feature information. At the same time, through the topological structure encoding method based on graph neural networks, the model's processing ability for path structure information is further improved. In addition, this embodiment designs a hybrid semantic framework based on relational paths, aiming to capture explicit and implicit semantic information in relational paths. By introducing pre-trained embedding modules such as rotation and scaling mechanisms, the performance of the model in processing multi-hop paths is improved, thereby further improving the accuracy of reasoning.

[0084] In order to better understand the present application, the above-mentioned embodiment method is further explained below.

[0085] The method provided in this embodiment uses a graph attention network to aggregate entity neighborhood structure information, proposes node feature encoding based on strong edge features, and proposes topological structure encoding based on graph neural network based on path structure information, thereby enhancing the model's ability to capture path structure information, and capturing explicit and implicit semantic information in its relationship path through a hybrid semantic framework to improve the accuracy of knowledge graph reasoning.

[0086] Specifically, refer to Figure 2 and Figure 3 , which is further explained in the following parts:

[0087] S1: Path discovery by fusing strong edge features and topological structure encoding.

[0088] The strong edge feature annotation module is used to enable it to utilize the location information of each node in the rule instance path graph, and on this basis, the graph neural network and multi-layer perceptron are used to encode the topological structure information, so that it can more fully aggregate the path topological structure information of the rule instance path graph and realize path discovery that integrates strong edge features and topological structure encoding.

[0089] Learning the node features of entities in the knowledge graph, the strong edge feature uses the node location information of the entity to achieve the purpose of annotating the nodes in the rule instance path graph by calculating the optimal path distance of any given head and tail nodes. The optimal path distance is generated by the transfer path sampling method. Each transfer path sampling randomly selects a transfer relay node to calculate the optimal path distance from the given head node to the transfer relay node, and the optimal path distance from the transfer relay node to the tail node. This transfer path sampling is performed k times to obtain the strong edge feature:

[0090]

[0091] Among them, v i Indicates the specified head node, v j Indicates the specified tail node, v k ∈DeliveryArea represents the delivery node of the delivery relay area, Avg represents the average function, Indicates the specified head node v i To relay node v k The optimal path distance Represents the relay node v k To the specified end node v j The optimal path distance.

[0092] The entity nodes of the rule instance path graph are marked using strong edge features, and the nodes in paths of different lengths are marked with different discrete values ​​t u , where t u The sum of the two strong edge features is rounded down to get:

[0093]

[0094] Among them, v h Indicates the specified head node, v t Indicates the specified tail node. u Use one-hot encoding to generate the initial structural embedding of node u

[0095]

[0096] For each node in the rule instance path graph, an initial node structure embedding is generated for each node according to the tag value, and a graph convolutional neural network GCN (i.e., the first neural network) is applied to encode the node structure features:

[0097]

[0098] Apply MLP1 (i.e., the second neural network) to obtain the final node structure feature embedding x u :

[0099]

[0100] Among them, G r represents the set of nodes in the rule instance path graph, and N(u) represents the neighborhood of node u.

[0101] S2: Topological structure encoding based on graph neural network.

[0102] The node structure information can be obtained by embedding the node structure features. The node structure information score s st for:

[0103]

[0104] Among them, x i With x j are the target nodes v respectively. i With v j The structural feature embedding of , the symbol ° represents the Hadmard product, that is, the Hadamard product.

[0105] Node structure feature embedding x u and the original node attribute z u First, through MLP3 (fifth neural network) fusion, the node structure feature embedding and the original node attributes are mapped to the same feature space to obtain the fusion feature:

[0106] m u =MLP3(x u +z u )

[0107] Fusion feature m u As input, the deep graph neural network model can learn from the node structure features and the original node features, and use the resulting fusion features as the initial iterative hidden vector of node u. The features of each node in the graph neural network are iteratively updated by aggregating the features of its neighbors, that is, during each iteration, the hidden vector of node u is updated by aggregating information from its neighborhood N(u):

[0108]

[0109] Among them, Aggregate (k) is the neighborhood aggregation function, Combine (k) Indicates that the aggregated neighborhood vector is combined with its own vector The process of combination. Select the graph neural network model GNN (the sixth neural network) and use the SortPooling layer to obtain the final representation output of the two target nodes:

[0110]

[0111] Then MLP2 (the fourth neural network) is used to predict the semantic similarity score of the two target nodes, expressed as s se =MLP2(h g ),like Figure 2 As shown in the figure, the node structure similarity score and the semantic similarity score are combined as the final existence edge score s = s st +s se .

[0112] S3: A hybrid semantic framework based on relational paths.

[0113] For a single path use t 1 ,r 1 ,t 2 ,r 2 ,t 3 ,r 3 ,…t k Representation, a textual relationship path P is generated from the representation, where each textual description of the entity and relationship in the path is assigned a tag <r> 、< / r> Surround, that is <r> t 1 < / r> <r> r 1 < / r> … <r> t k < / r> The labeled textual relation path P is fed into the text encoder to extract the textual representation p of the explicit relation path t .

[0114] Extracting relation embeddings from pre-trained knowledge graph embedding models and embedded by these relationships Get the implicit semantics of the relationship path

[0115] Hybrid Representation of Relational Paths in Rule-Instance Path Graph is achieved by replacing explicit text with p t and implicit knowledge graph embedding representation P l Generated by fusion with feedforward neural network FFN (third neural network):

[0116]

[0117] S4: Rotation and scaling module.

[0118] Fusion features for hybrid semantic encoder Use two independent feed-forward neural networks (FFNs) to generate rotation transformations and scaling transformation Represents a d-dimensional real number set. The rotation transformation takes into account the angular relationship between entities, allowing the model to observe and understand the connection between entities from different angles. The scaling transformation adjusts the relative distance between entities, which is crucial for handling relationship paths of different lengths and complexities. q =FFN1(p),a q =FFN2(p), transforming these two rotations and scaling transformation Combined into the final representation of the relationship path r p , which contains the real part Re (Re, RealNumber) and the imaginary part Im (Im, ImagicNumber) of the complex space:

[0119]

[0120] in and They are rotation and scaling in complex space respectively. Their combination provides a stronger representation capability for knowledge graph reasoning tasks. This representation capability not only enhances the model’s understanding of relationship paths, but also improves the accuracy and efficiency in knowledge graph reasoning tasks.

[0121] Given the head entity h∈E, the candidate entity c∈E, and the rule instance path graph E, the score function is:

[0122]

[0123] where s p represents the score of the relationship path, e h represents the embedding representation of the head entity in the triple, r p The final representation of the relationship path, e c Represents the embedding representation of the tail entity in the triple. Calculate the score s from the N candidate entities sampled from the knowledge graph, where N is a hyperparameter. The training target uses the cross entropy loss CE (CE, Classification Error), which is calculated as L = CE (s p ,targets), where targets are represented as true labels. A two-stage reasoning strategy is used to reduce computational cost. In the first stage, given the head entity h and all entities in the rule instance path graph First, for each Calculate p (h,c). Then according to the calculated s p (h,c) selects the top k candidate entities. In the second stage, only the top k candidate entities selected in the first stage are calculated. p (h,c), and calculate their final score s p .

[0124] like Figure 4 As shown, in another embodiment, the present application also discloses a knowledge graph reasoning device based on topological structure and hybrid semantics, the device comprising:

[0125] Node feature encoding module, used for node feature encoding to obtain node structure feature embedding x u , which uses strong edge features to mark the nodes in the relationship path graph, and obtains the node structure feature embedding x according to the tag value, the first neural network, and the second neural network u ;

[0126] A topology encoding module is used for topology encoding to obtain a final score s, which is calculated based on the xu Calculate the node structure information score s of the target node st , and use the fusion features to calculate the semantic similarity score s of the two target nodes se , calculate the final score s = s st +s se ; Wherein, the fusion feature is to convert the x u and the original node attribute z u Fusion

[0127] Hybrid semantic encoding module, used to mix semantic encoding to obtain hybrid representation of relation paths It extracts the explicit textual representation of the relationship path p t , and extract the implicit semantic representation p of the relationship path l , and then the p t With p l Generate the relationship path hybrid representation through the third neural network fusion

[0128] The final representation generation module is used to use the relationship path to mix the representation Get the final representation of the problem.

[0129] As an optional implementation manner, the node feature encoding module is also used for:

[0130] Calculate the optimal path distance of any given head node and tail node, the optimal path distance is generated by the transfer path sampling method, the transfer path is sampled k times, and a strong edge feature is obtained;

[0131] The obtained strong edge features are used to mark the nodes in the relationship path graph, and the nodes in the paths of different lengths are marked with different marking values;

[0132] For each node in the relationship path graph, an initial node structure feature embedding is generated for each node according to the tag value, the node structure feature is encoded by the first neural network, and then the node structure feature embedding x is obtained by the second neural network. u .

[0133] As an optional implementation, the topology structure encoding module is further used for:

[0134] Learn the structural information of the two target nodes and the topological structure information between the nodes in the relationship path graph;

[0135] The Hadmard product of the structural features of the two target nodes is used as one of the inputs of the fourth neural network to obtain the node structure information score s st , wherein the Hadmard product is a Hadamard product;

[0136] For the topological structure information between the two target nodes, the original node attributes and the node structure features are embedded into x u Obtaining the fusion feature through the fifth neural network fusion;

[0137] The fusion feature is used as one of the inputs of the sixth neural network to obtain the final representation output h of the two target nodes. g ;

[0138] The final representation output h g As the second input of the fourth neural network, the semantic similarity score s is obtained. se ;

[0139] The node structure information score s will be obtained st With the semantic similarity score s se The score s is obtained by adding them together.

[0140] As an optional implementation, the hybrid semantic encoding module is further used for:

[0141] For a single path, a relation symbolic representation is used to generate a textual relation path from the symbolic representation, in which each textual description of entities and relations in the path is surrounded by a specified tag. The labeled textual relation path is input into the text encoder to extract the explicit textual representation p of the relation path. t ;

[0142] Extract relation embedding from the pre-trained knowledge graph embedding model, and obtain the implicit semantic representation p of the relation path from the relation embedding l ;

[0143] The explicit text representation p t and the implicit semantic representation p l Fusion with the third neural network to generate the relationship path hybrid representation

[0144] As an optional implementation, the final representation generation module is further used to: generate a mixed representation according to the relationship path A rotation transformation and a scaling transformation are generated and combined using the rotation transformation and the scaling transformation into a final representation of the problem, which contains the real part and the imaginary part of the complex space.

[0145] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solution according to the embodiment of the present application can be embodied in the form of a software product, which can be stored in a readable medium or on a network, and includes several instructions to enable an electronic device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present application.

[0146] The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. All technical solutions that fall within the scope defined by the claims of the present invention fall within the protection scope of the present invention.

Claims

1. A knowledge graph reasoning method based on topological structure and hybrid semantics, characterized in that: The following steps are involved: Node Feature encoding obtains node structure feature embedding x u , including: using strong edge features to mark the nodes in the relationship path graph, and obtaining the node structure feature embedding x according to the mark value, the first neural network, and the second neural network u ; The topological structure encoding obtains the final score s, including: according to the x u Calculate the node structure information score s of the target node st , using the fusion features to calculate the semantic similarity score s of the two target nodes se , calculate the final score s = s st +s se ; Wherein, the fusion feature is to convert the x u and the original node attribute z u Fusion Hybrid semantic encoding to obtain hybrid representation of relation paths Includes: Extracting explicit textual representations of relationship paths t , extract the implicit semantic representation of the relationship path p l , the p t With p l Generate the relationship path hybrid representation through the third neural network fusion Using the relationship path hybrid representation Get the final representation of the problem.

2. The knowledge graph reasoning method based on topological structure and hybrid semantics according to claim 1 is characterized in that: The node structure feature embedding x u The acquisition includes: Calculate the optimal path distance of any given head node and tail node, the optimal path distance is generated by the transfer path sampling method, the transfer path is sampled k times, and a strong edge feature is obtained; The obtained strong edge features are used to mark the nodes in the relationship path graph, and the nodes in the paths of different lengths are marked with different marking values; For each node in the relationship path graph, an initial node structure feature embedding is generated for each node according to the tag value, the node structure feature is encoded by the first neural network, and then the node structure feature embedding x is obtained by the second neural network. u .

3. The knowledge graph reasoning method based on topological structure and hybrid semantics according to claim 1 or 2, characterized in that: The calculation of the score s includes: Learn the structural information of the two target nodes and the topological structure information between the nodes in the relationship path graph; The Hadmard product of the structural features of the two target nodes is used as one of the inputs of the fourth neural network to obtain the node structure information score s st , wherein the Hadmard product is a Hadamard product; For the topological structure information between the two target nodes, the original node attributes and the node structure features are embedded into x u Obtaining the fusion feature through the fifth neural network fusion; The fusion feature is used as one of the inputs of the sixth neural network to obtain the final representation output h of the two target nodes. g ; The final representation is output as h g As the second input of the fourth neural network, the semantic similarity score s is obtained. se ; The node structure information score s will be obtained st With the semantic similarity score s se The score s is obtained by adding them together.

4. The knowledge graph reasoning method based on topological structure and hybrid semantics according to claim 1 or 2, characterized in that: The relationship path is mixed The generation includes: For a single path, a relation symbolic representation is used to generate a textual relation path from the symbolic representation, in which each textual description of entities and relations in the path is surrounded by a specified tag. The labeled textual relation path is input into the text encoder to extract the explicit textual representation p of the relation path. t ; Extract relation embedding from the pre-trained knowledge graph embedding model, and obtain the implicit semantic representation p of the relation path from the relation embedding l ; The explicit text representation p t and the implicit semantic representation p l Fusion with the third neural network to generate the relationship path hybrid representation 5. The knowledge graph reasoning method based on topological structure and hybrid semantics according to claim 4 is characterized in that: The final representation is obtained by: mixing the representation according to the relationship path A rotation transformation and a scaling transformation are generated and combined using the rotation transformation and the scaling transformation into a final representation of the problem, which contains the real part and the imaginary part of the complex space.

6. A knowledge graph reasoning device based on topological structure and hybrid semantics, characterized in that: include: Node feature encoding module, used for node feature encoding to obtain node structure feature embedding x u , which uses strong edge features to mark the nodes in the relationship path graph, and obtains the node structure feature embedding x according to the tag value, the first neural network, and the second neural network u ; A topology encoding module is used for topology encoding to obtain a final score s, which is calculated based on the x u Calculate the node structure information score s of the target node st , and use the fusion features to calculate the semantic similarity score s of the two target nodes se , calculate the final score s = s st +s se ; Wherein, the fusion feature is to convert the x u and the original node attribute z u Fusion Hybrid semantic encoding module, used to mix semantic encoding to obtain hybrid representation of relation paths It extracts the explicit textual representation of the relationship path p t , and extract the implicit semantic representation p of the relationship path l , and then the p t With p l Generate the relationship path hybrid representation through the third neural network fusion The final representation generation module is used to use the relationship path to mix the representation Get the final representation of the problem.

7. The knowledge graph reasoning device based on topological structure and hybrid semantics according to claim 6 is characterized in that: The node feature encoding module is also used for: Calculate the optimal path distance of any given head node and tail node, the optimal path distance is generated by the transfer path sampling method, the transfer path is sampled k times, and a strong edge feature is obtained; The obtained strong edge features are used to mark the nodes in the relationship path graph, and the nodes in the paths of different lengths are marked with different marking values; For each node in the relationship path graph, an initial node structure feature embedding is generated for each node according to the tag value, the node structure feature is encoded by the first neural network, and then the node structure feature embedding x is obtained by the second neural network. u .

8. The knowledge graph reasoning device based on topological structure and hybrid semantics according to claim 6 or 7, characterized in that: The topology encoding module is also used to: Learn the structural information of the two target nodes and the topological structure information between the nodes in the relationship path graph; The Hadmard product of the structural features of the two target nodes is used as one of the inputs of the fourth neural network to obtain the node structure information score s st , wherein the Hadmard product is a Hadamard product; For the topological structure information between the two target nodes, the original node attributes and the node structure features are embedded into x u Obtaining the fusion feature through the fifth neural network fusion; The fusion feature is used as one of the inputs of the sixth neural network to obtain the final representation output h of the two target nodes. g ; The final representation output h g As the second input of the fourth neural network, the semantic similarity score s is obtained. se ; The node structure information score s will be obtained st With the semantic similarity score s se The score s is obtained by adding them together.

9. The knowledge graph reasoning device based on topological structure and hybrid semantics according to claim 6 or 7, characterized in that: The hybrid semantic encoding module is also used for: For a single path, a relation symbolic representation is used to generate a textual relation path from the symbolic representation, in which each textual description of entities and relations in the path is surrounded by a specified tag. The labeled textual relation path is input into the text encoder to extract the explicit textual representation p of the relation path. t ; Extract relation embedding from the pre-trained knowledge graph embedding model, and obtain the implicit semantic representation p of the relation path from the relation embedding l ; The explicit text representation p t and the implicit semantic representation p l Fusion with the third neural network to generate the relationship path hybrid representation 10. The knowledge graph reasoning device based on topological structure and hybrid semantics according to claim 9, characterized in that: The final representation generation module is further used to: mix the representation according to the relationship path A rotation transformation and a scaling transformation are generated and combined using the rotation transformation and the scaling transformation into a final representation of the problem, which contains the real part and the imaginary part of the complex space.