Abstract
Knowledge Graphs (KGs) are evolving from simple collections of binary triples to complex hyper-relational structures that capture nuanced real-world information through n-ary facts and qualifiers. However, existing Complex Query Answering (CQA) models often struggle with the structural complexity and logical diversity of these hyper-relational graphs. We present NQE (N-ary Query Embedding), a novel framework that leverages a dual-heterogeneous Transformer encoder and fuzzy logic theory to perform first-order logic (FOL) reasoning over n-ary facts. NQE is the first model to support the full range of FOL operations—including intersection, union, and negation—in hyper-relational settings, achieving state-of-the-art performance on benchmark datasets.
Beyond Triples: The Hyper-Relational Challenge
Traditional KGs represent data as simple (subject, relation, object) triples. While effective for basic facts, this format fails to capture context-dependent information. For instance, the fact that "Michael Jackson received a Grammy Award" is incomplete without specifying the work ("We Are the World") or the specific award category. Such facts are hyper-relational, involving multiple entities and qualifiers.
Answering complex queries on these graphs requires reasoning over multi-hop paths and logical constraints. Previous CQA methods were largely restricted to binary relations or limited subsets of logical operators. NQE addresses these gaps by providing a flexible embedding model capable of handling arbitrary n-ary structures and complex logical formulas.
The NQE Architecture
NQE introduces two primary innovations to handle the structural and logical demands of hyper-relational CQA:
1. Dual-Heterogeneous Transformer Encoder
To predict missing elements within an n-ary fact (n-ary projection), NQE employs a specialized Transformer. Unlike standard attention mechanisms, this encoder explicitly models node heterogeneity (distinguishing between entities and relations) and edge heterogeneity (capturing 14 distinct internal roles within a hyper-relational fact). This allows the model to learn rich, context-aware representations of complex facts.
2. Fuzzy Logic Embeddings
NQE embeds entities and queries into a fuzzy logic space $[0, 1]^d$. By treating logical operators (AND, OR, NOT) as mathematically rigorous t-norms and t-conorms, the model ensures that reasoning follows classical logical axioms. This makes the logical operations interpretable and consistent across different query structures.
Benchmarking and Results
The researchers evaluated NQE on the standard WD50K-QE benchmark and a newly introduced dataset, WD50K-NFOL. The latter includes 16 types of n-ary FOL queries, specifically testing negation and disjunction in hyper-relational contexts.
Key results include:
- Superior Accuracy: NQE outperformed the previous state-of-the-art (StarQE) by an average of 11.37% on WD50K-QE.
- Logical Completeness: It successfully handled complex queries involving negation ($\neg$) and disjunction ($\vee$), which were previously unaddressable by hyper-relational models.
- Strong Generalization: Models trained only on simple one-hop queries showed remarkable zero-shot performance on complex multi-hop and branching queries.
Conclusion
NQE represents a significant advancement in Knowledge Graph reasoning. By bridging the gap between hyper-relational data structures and formal logic, it enables more sophisticated querying of real-world information. While the current model introduces some computational overhead due to the Transformer architecture, its ability to handle the full spectrum of first-order logic on n-ary facts sets a new standard for the field.
Summary updated