Device, data structure and computer-implemented method for answering a first-order logical query based on a knowledge graph
The method employs cone embeddings and rotation operations within a directed acyclic computation graph to address the challenge of answering complex queries on incomplete knowledge graphs, enhancing query resolution efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- DE · DE
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2026-04-16
AI Technical Summary
Existing technologies face challenges in efficiently answering complex queries on incomplete knowledge graphs by accurately identifying relevant entities and relationships and drawing inferences about their connections.
A computer-implemented method using cone embeddings and rotation operations in a complex embedding space, combined with a directed acyclic computation graph, to efficiently determine answers to first-order logical queries on knowledge graphs.
This approach enables efficient and accurate identification of entities that satisfy logical queries by minimizing the distance between ground-truth response entity embeddings, thereby improving the accuracy and speed of query resolution.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
State of the art
[0001] The invention relates to a device, a data structure and a computer-implemented method for answering a first-order logical query based on a knowledge graph.
[0002] Answering complex queries on an incomplete knowledge graph requires inferences about the available information in the knowledge graph to generate answers to a complex logical query. The task involves identifying the relevant entities and relationships in the knowledge graph needed to answer the query and drawing inferences about the connections between them. Disclosure of the invention
[0003] The device and the computer-implemented method for answering a first-order logical query based on a knowledge graph provide the answer efficiently.
[0004] The computer-implemented procedure for answering the first-order logical query based on the knowledge graph comprises: providing the knowledge graph and the first-order logical query, wherein the logical query defines a logical operation on a first triple and a second triple, the first triple comprising a cone embedding representing a first set containing at least one entity of the knowledge graph, a cone embedding representing a second set containing at least one entity of the knowledge graph, and an embedding of a rotation operation between the two cone embeddings of the first triple in a complex embedding space, the second triple comprising a cone embedding representing a third set containing at least one entity of the knowledge graph, and a cone embedding representing a fourth set containing at least one entity of the knowledge graph.and comprises an embedding of a rotation operation between the two cone embeddings of the second triple in the complex embedding space, wherein one of the cone embeddings represents an answer to the logical query, determining a directed acyclic computation graph for the logical query depending on the logical query, wherein the computation graph defines a sequence for performing the rotation operations, determining the answer to the logical query,Determining the answer involves applying rotation operations to the conic embeddings in accordance with the order defined by the computation graph. This combines the advantages of conic embeddings as a well-specified geometric representation for query embedding and the rotation operator as a powerful algebraic operation for pattern inference. The procedure defines each relationship as a rotation from the source entity set to the response / intermediate entity set and performs neural logic operators on the selected entity sets in a complex vector space of conic embeddings.
[0005] For training purposes, the procedure can include providing the logical query along with a ground-truth response entity cone embedding and training at least some of the embeddings as a function of a distance between the ground-truth response entity cone embedding and the cone embedding that represents the response to the logical query, in particular to minimize the distance.
[0006] For training purposes, the procedure can include providing the logical query along with a negative sample and training at least some of the embeddings as a function of a distance between the negative sample and the cone embedding representing the response to the logical query, in particular to maximize the distance.
[0007] For testing purposes, the procedure may include providing the logical query that includes an entity cone embedding of a given entity in the knowledge graph, providing a given ground truth cone embedding of a given response entity associated with the given entity, determining the answer to the logical query that includes the entity cone embedding of the given entity, and testing the embeddings of the rotation operations as a function of the distance between the answer determined for the logical query that includes the entity cone embedding of the given entity and the cone embedding of the given ground truth cone embedding of the given response entity.
[0008] Determining the answer can involve identifying, depending on the cone embedding representing the answer to the logical query, one or more entities from the knowledge graph that constitute the answer(s). This means that the entity(ies) from the knowledge graph that are valid answers according to the procedure are provided.
[0009] A device for answering a first-order logical query based on a knowledge graph comprises at least one processor and at least one memory, wherein the at least one memory is designed to store instructions which, when executed by the at least one processor, cause the device to execute a procedure, wherein the at least one processor is designed to execute the instructions.
[0010] A computer program for answering a first-order logical query based on a knowledge graph can be provided, wherein the computer program includes instructions which, when executed by the computer, cause the computer to perform a procedure.
[0011] A data structure for answering a first-order logical query based on a knowledge graph can be provided, wherein the data structure includes at least one data field for the knowledge graph or an embedding of the knowledge graph, wherein the logical query defines a logical operation on a first triple and a second triple, wherein the first triple comprises a cone embedding representing a first set containing at least one entity of the knowledge graph, a cone embedding representing a second set containing at least one entity of the knowledge graph, and an embedding of a rotation operation between the two cone embeddings of the first triple in a complex embedding space, wherein the second triple comprises a cone embeddingwhich represents a third set comprising at least one entity of the knowledge graph, a cone embedding representing a fourth set comprising at least one entity of the knowledge graph, and an embedding of a rotation operation between the two cone embeddings of the second triple in the complex embedding space, wherein one of the cone embeddings represents a response to the logical query, wherein the data structure comprises at least one array for a directed acyclic computation graph for the logical query depending on the logical query or an embedding of the computation graph, wherein the computation graph defines a sequence for executing the rotation operations, and wherein the data structure comprises at least one array for the response to the logical query.
[0012] For training purposes, the data structure can include at least one data field for a ground-truth response entity cone embedding and a distance between the ground-truth response entity cone embedding and the cone embedding that represents the response to the logical query.
[0013] For testing purposes, the data structure can include at least one data field for a result of testing the embeddings of the rotation operations depending on the distance between the response determined for the logical query, which includes the entity cone embedding of the specified entity, and the cone embedding of the specified ground truth cone embedding of the specified response entity.
[0014] Further examples can be derived from the following description and the drawing. The following applies to the figures: Fig. Figure 1 schematically shows a device for answering a first-order logical query based on a knowledge graph. Fig. 2a schematically shows a model of a symmetrical relationship. Fig. 2b schematically shows a model of a reversal, Fig. 2c shows a schematic model of a composition, Fig. Figure 3 shows a flowchart with steps of a process device for answering the first-order logical query based on the knowledge graph. Fig. Figure 4 schematically shows a data structure for answering the first-order logical query based on the knowledge graph.
[0015] Fig. Figure 1 schematically shows a device 100 for answering a first-order logical query based on a knowledge graph.
[0016] The device 100 comprises at least one processor 102 and at least one memory 104.
[0017] The at least one processor 102 is designed to execute instructions which, when executed by the at least one processor 102, cause the device 100 to execute a procedure for answering the first-order logical query based on the knowledge graph.
[0018] The at least one memory 104 is designed to store the instructions. The at least one memory 104 is designed to store the knowledge graph.
[0019] The knowledge graph comprises entities and relationships. An example knowledge graph G includes a set V of entities (nodes) and a set E of relationships (edges).
[0020] The exemplary knowledge graph is represented as a set of a factual triple. G={(si,pj,ok)}⊂V×E×V defined where p j∈ E represents a predicate, s j ∈ V represents a subject and o k ∈ V represents an object.
[0021] An example of a first-order logical query q[V?] includes a variable V?, which represents a response entity from the knowledge graph G, and a variable V, which represents an entity from the knowledge graph G, or variables V i The exemplary first-order logical query q[V?] comprises an entity constant representing an entity from the knowledge graph G, or entity constants representing a single entity from the knowledge graph G. The exemplary first-order logical query q[V?] comprises a relationship constant representing a relationship from the knowledge graph G, or relationship constants representing a single relationship from the knowledge graph G.
[0022] The first-order logical query q[V?] includes triples.
[0023] Each triple of the first-order logical query q[V?] can comprise a single constant representing a relationship from the knowledge graph G, a first variable representing an entity from the knowledge graph G, and a second variable representing an entity from the knowledge graph G. Each triple of the first-order logical query q[V?] can comprise a first constant representing a relationship from the knowledge graph G, a second constant representing an entity from the knowledge graph G, and a variable representing an entity from the knowledge graph G.
[0024] The first-order logical query q[V?] includes, for example, an existential quantifier. A conjunction ∧, a disjunction ∨, and a negation ¬ are used to define logical operations on the triples. A universal quantifier ∀ may not be included, since in real-world knowledge graphs no entity is connected to all other entities.
[0025] An example of how to represent the first-order logical query q[V?] is the disjunctive normal form (DNF), which is described, for example, in Davey, BA and Priestley, HA, Introduction to lattices and order, Cambridge University Press, 2002.
[0026] The DNF represents the first-order logical query q[V?] as a disjunction of conjunctions. V a ⊂ V is a non-variable anchor entity set representing the at least two entity constants, V1,...,V kare existence-quantified restricted variables that represent a respective entity of the knowledge graph G, and V? is the target variable, i.e., it represents the response entity to the first-order logical query q[V?].
[0027] A first-order logical query q in disjunctive normal form is: q[V?]=V?.∃V1,….Vk:c1∨c2∨⋯∨cn. where c i Conjunctions are, i.e., c i = e i , Λ · · · Λ e im , where e ij = r(v a, V) or ¬r(va,V) or r(V', V) or ¬r(V',V),v a ∈ V a , V ∈ {V? , V1,...,V k},V ∈ {V1,...,V k} and V ≠ V'.
[0028] The relational function r j (·,·) ∈ R is a binary function r j : V × V → (true, false}, which corresponds to the predicate p j a triple (s i , p j , o k ) ∈ G from the knowledge graph G corresponds to, where r j (si , o k ) = true if and only if (s i , p j , o k ) is a de facto triple. This means for all (s i , p j , o k ) ∈ G, r j (s i , o k ) = true.
[0029] Answering the first-order logical query q[V?] involves finding a set of entities. 〚q〛⊂V, where v∈〚q〛 if and only if q[v] is true.
[0030] A computation graph can be used to find the set of entities. 〚q〛 can be used. For a specific first-order logical query q[V?], the computation graph comprises nodes representing entity sets and edges representing logical operations on entity sets.
[0031] The logical operators are mapped to the edges of the computation graph according to the following rules: Given a set of entities S ⊂ V and the relational function r ∈ R, a projection operator P gives the neighboring entities U. v∈S N (v, r) from, where N (v, r) is the set of entities such that r(v, v') = true for all v' ∈ N (v, r).
[0032] The conjunction operator is mapped to a cutting operator I. If n sets of entities (S1, S2,... , S n Given}, the intersection operator I forms an intersection to ∩i=1n Sn to obtain.
[0033] The disjunction operator is mapped to a union operator U. If n sets of entities (S1, S2, ..., S) n Given}, the union operator U forms a set union in order to ∪i=1n Sn to obtain.
[0034] The negation operator is mapped to a complement operator C. If an entity set S ⊂ V is given, then CS = V\S.
[0035] Answering the first-order logical query q[V?] involves finding a cone embedding that defines an embedding domain of the set of entities. 〚q〛 modeled.
[0036] The set of entities 〚q〛 is embedded in a Cartesian product of sector cones. The set of entities 〚q〛 is, for example, embedded in the Cartesian product of sector cones, as described in Zhanqiu Zhang, Jie Wang, Jiajun Chen, Shuiwang Ji and Feng Wu, 2021, Cone: Cone embeddings for multi-hop reasoning over knowledge graphs, in Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurlPS 2021, December 6-14, 2021, virtual, pages 19172-19183.
[0037] The cone embedding of the set of entities 〚q〛 For example: Vqc=(θax,θap) where θ axE [-π, π) d Axes are and θ ap E [0, 2π] d Openings are. The conical embedding of a single entity v ∈ V is, for example, v = (θ ax , 0) defined, where 0 is a d-dimensional vector in which all elements are zero.
[0038] Relationships in the knowledge graph G can form certain patterns. Relationships can be symmetrical or antisymmetrical. Some relationships can be inverses of other relationships.
[0039] Answering the first-order logical query q[V?] involves modeling the first-order logical query q[V?] as a rotation operation on a conic embedding or as successive rotation operations on conic embeddings in a complex space. An example of the rotation operation is described in Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang, 2019, Rotate: Knowledge graph embedding by relational rotation in complex space, CoRR, abs / 1902.10197.
[0040] An exemplary first cone 200 is located between an upper barrier. hUj and a lower barrier hLj defined.
[0041] Fig. Figure 2a shows the modeling of a symmetrical relationship between the first cone 200 and a second cone 200', which is located between an upper bound hUj' and a lower barrier hLj' is defined and exhibits a symmetrical relationship to the first cone 200. The symmetrical relationship is modeled by a counterclockwise rotation r from the first cone 200 to the second cone 200'. The symmetrical relationship is modeled by the counterclockwise rotation r from the second cone 200' to the first cone 200.
[0042] Fig. Figure 2b shows the modeling of a reversal between the first cone 200 and the second cone 200'. The reversal is modeled by a first counterclockwise rotation r1 from the first cone 200 to the second cone 200'. The reversal is modeled by a second counterclockwise rotation r2 from the second cone 200' to the first cone 200.
[0043] Fig. Figure 2c shows the modeling of the combination of the first cone 200 and the second cone 200' to form a third cone 200". The combination is modeled by a first counterclockwise rotation r1 from the first cone 200 to the second cone 200'. The combination is modeled by a second counterclockwise rotation r2 from the second cone 200' to the third cone 200". The combination is modeled by a third counterclockwise rotation r3 from the first cone 200 to the third cone 200".
[0044] Fig. Figure 3 shows a flowchart that includes the steps of the procedure.
[0045] The procedure includes step 302.
[0046] Step 302 involves providing the first-order logical query q[V?] and the knowledge graph G.
[0047] The procedure is described using an example of a first-order logical query q[V?], which includes a logical operation, e.g., a conjunction, on a first triple (h1,r1,t1) and a second triple (h2,r2,t2), where h1, h2 represent a respective conic embedding in a head of the respective triple, r1, r2 represent a respective rotation operation in the respective triple, and t1, t2 represent a respective rotated conic embedding in an end of the respective triple.
[0048] The head of the first triple (h1, r1, t1) comprises the cone embedding of a single constant entity of the knowledge graph G.
[0049] The end of the first triple (h1, r1, t1) includes the cone embedding of the variable V, which represents the entity of the knowledge graph G.
[0050] The head of the second triple (h2, r2, t2) comprises the cone embedding of the variable V?, which represents the response entity of the knowledge graph G.
[0051] The end of the second triple (h2, r2, t2) includes the cone embedding of the variable V, which represents the entity of the knowledge graph G.
[0052] The first-order logical query q[V?] defines a condition for the variable V?, which represents the response entity from the knowledge graph G. According to the example, an entity from the knowledge graph G is a valid response entity if the condition is met.
[0053] The relationships of the respective triples in the first-order logical query q[V?] define a respective rotation operation on the conic embeddings that represent the respective heads of the respective triple.
[0054] The relationships of the respective triples include, for example, a respective rotation operation embedding.
[0055] The procedure includes step 304.
[0056] Step 304 involves determining the computation graph for the first-order logical query q[V?] as a function of the logical operation.
[0057] The computation graph for the first-order logical query q[V?] defines a sequence for performing the rotation operations.
[0058] In accordance with the exemplary first-order logical query q[V?], which includes the conjunction of the first triple (h1, r1, t1) and the second triple (h2, r2, t2), the computation graph defines that the conic embedding h1 is rotated with the rotation operation r1 to determine the conic embedding t1, and the conic embedding h2 is rotated with the rotation operation r2 to determine the conic embedding t2.
[0059] Following the example, the computation graph is a directed acyclic graph tree. The logical operations are performed in the order defined by the directed acyclic graph tree.
[0060] This is explained using the example of the conjunction of the first triple (h1, r1, t1) and the second triple (h2, r2, t2), where the head h1 of the first triple is a constant representing an entity of the knowledge graph G, the tail c1 of the first triple is a variable V representing an entity of the knowledge graph G, the head h2 of the second triple is the variable V? representing the response entity from the knowledge graph G, and the tail t2 of the second triple is the variable V representing the entity of the knowledge graph G.
[0061] The computation graph is the acyclic graph tree, which includes the head h1 of the first triple as the anchor node, an intermediate node representing the variable V, and a response node representing the variable V?.
[0062] The computation graph includes a tree relationship between the anchor node and the intermediate node, defining the rotation according to relationship r1 or rotations according to relationship r1 in the first triple. The computation graph also includes a tree relationship between the intermediate node and the response node, defining the rotation according to relationship r2 in the second triple. For example, each tree relationship defines the counterclockwise rotation for symmetry or the inversion or counterclockwise rotations for composition.
[0063] The result of the rotation according to relation r1 in the first triple is a conic embedding representing a first set of entities from the knowledge graph G. The result of the rotation according to relation r2 in the second triple is a conic embedding representing a second set of entities from the knowledge graph G. The conjunction defines that the rotation according to relation r2 in the second triple is performed on the conic embedding representing the first set of entities.
[0064] The procedure includes step 306.
[0065] Step 306 involves determining the answer to the logical query q[V?] by applying the rotation operations to the conic embeddings in accordance with the order defined by the computation graph.
[0066] To determine the answer to the first-order logical query q[V?], for example, the cone embedding for the head h2 of the second triple representing the response entity, i.e., V?, is determined.
[0067] The procedure includes step 308.
[0068] Step 308 includes training.
[0069] For training purposes, the first-order logical query q[V?] is provided along with a ground-truth response entity cone embedding. The ground-truth response entity cone embedding can be a cone with a zero opening, meaning that the upper and lower bounds of the cone embedding representing the response entity are identical.
[0070] During training, the distance between the upper bound and a lower bound of the cone embedding that is determined, and the ground truth response entity cone embedding is minimized.
[0071] The distance is minimized, for example, by learning embeddings of the anchor node entities or embeddings of the rotation operations, i.e., the parameters that define the rotation operations.
[0072] For example, the logical query is provided along with the ground truth response entity cone embedding. Subsequently, at least some of the embeddings are learned based on the distance between the ground truth response entity cone embedding and the cone embedding representing the response to the logical query. The training includes, for example, learning the embeddings that minimize this distance.
[0073] The training may involve providing negative samples and maximizing the distance between the embedding representing the response and the negative samples.
[0074] The procedure includes step 310.
[0075] Step 310 includes testing.
[0076] For testing purposes, the logical operators parameterized with the parameters from the training are executed along the computation graph, starting with the learned embeddings of the anchor node entities.
[0077] The training includes, for example, learning to answer the input of the first-order logical query q[V?], which comprises the knowledge graph G and the first-order logical query q[V?]. A multi-layered perceptron network can be trained to select a response entity from the knowledge graph G depending on the input.
[0078] The multilayer perceptron network is learned, for example, from a low-dimensional vector representation of the input.
[0079] The response entity for the first-order logical query is determined, for example, by the multi-layered perceptron network, which is trained to select a response entity from the knowledge graph G depending on the input.
[0080] Fig. Figure 4 schematically shows a data structure 400 for answering the first-order logical query based on the knowledge graph.
[0081] The data structure 400 includes at least one data field 402 for the knowledge graph, the first-order logical query, the particularly directed acyclic computation graph and the answer to the logical query and / or an embedding thereof.
[0082] The data structure 400 can include at least one data field 402 for a ground truth response entity cone embedding and a distance between the ground truth response entity cone embedding and the cone embedding that represents the answer to the logical query.
[0083] The data structure 400 can include at least one data field 402 for a result of testing the embeddings of the rotation operations depending on the distance between the response obtained for the logical query that includes the entity cone embedding of the specified entity and the cone embedding of the specified ground truth cone embedding of the specified response entity.
[0084] The result can be pass, fail, or a digital display thereof. QUOTES INCLUDED IN THE DESCRIPTION
[0000] This list of documents cited by the applicant was automatically generated and is included solely for the reader's convenience. The list is not part of the German patent or utility model application. The DPMA accepts no liability for any errors or omissions. Cited non-patent literature
[0000] Davey, BA and Priestley, HA, Introduction to lattices and order, Cambridge University Press, 2002
[0025] Zhanqiu Zhang, Jie Wang, Jiajun Chen, Shuiwang Ji and Feng Wu, 2021, Cone: Cone embeddings for multi-hop reasoning over knowledge graphs, in Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurlPS 2021, 6-14. December 2021, virtual, pages 19172-19183
[0036] Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie und Jian Tang, 2019, Rotate: Knowledge graph embedding by relational rotation in complex space, CoRR, abs / 1902.10197
[0039]
Citation Information
Patent Citations
Knowledge graph multi-hop reasoning-oriented cone embedding method
CN113449075A
Multi-hop reasoning question and answer method and system based on type information enhanced cylinder embedding
CN118504686A
CN000113449075A
CN000118504686A