Complex query answering (CQA) is an essential task for multi-hop and logical reasoning on knowledge graphs (KGs). Currently, most approaches are limited to queries among binary relational facts and pay less attention to n-ary facts (n>=2) containing more than two entities, which are more prevalent in the real world. Moreover, previous CQA methods can only make predictions for a few given types of queries and cannot be flexibly extended to more complex logical queries, which significantly limits their applications. To overcome these challenges, in this work, we propose a novel N-ary Query Embedding (NQE) model for CQA over hyper-relational knowledge graphs (HKGs), which include massive n-ary facts. The NQE utilizes a dual-heterogeneous Transformer encoder and fuzzy logic theory to satisfy all n-ary FOL queries, including existential quantifiers, conjunction, disjunction, and negation. We also propose a parallel processing algorithm that can train or predict arbitrary n-ary FOL queries in a single batch, regardless of the kind of each query, with good flexibility and extensibility. In addition, we generate a new CQA dataset WD50K-NFOL, including diverse n-ary FOL queries over WD50K. Experimental results on WD50K-NFOL and other standard CQA datasets show that NQE is the state-of-the-art CQA method over HKGs with good generalization capability. Our code and dataset are publicly available.
翻译:复杂查询回答(CQA)是知识图谱(KGs)上进行多跳和逻辑推理的关键任务。当前大多数方法局限于二元关系事实间的查询,较少关注现实世界更普遍存在的、涉及两个以上实体的N元事实(n≥2)。此外,现有CQA方法仅能对少数既定类型的查询进行预测,无法灵活扩展至更复杂的逻辑查询,这严重限制了其应用场景。为解决上述挑战,本文提出一种新型的N元查询嵌入(NQE)模型,用于包含海量N元事实的超关系知识图谱(HKGs)上的CQA任务。NQE采用双异质Transformer编码器与模糊逻辑理论,可满足所有N元一阶逻辑(FOL)查询,包括存在量词、合取、析取与否定。我们同时提出并行处理算法,能够在一个批次内训练或预测任意类型的N元FOL查询,无论每种查询的具体形式如何,均具有良好的灵活性与可扩展性。此外,我们基于WD50K生成了包含多样化N元FOL查询的新CQA数据集WD50K-NFOL。在WD50K-NFOL及其他标准CQA数据集上的实验结果表明,NQE是HKGs上具备良好泛化能力的当前最优CQA方法。我们的代码和数据集已公开。