Ontology-Based Query Answering over Datalog-Expressible Rule Sets is Undecidable (Extended Abstract)

David Carral, Lucas Larroque, Michaël ThomazoDL 2025

Introduction

In the field of database theory, Ontology-Based Query Answering (OBQA) represents a significant challenge: how to query data while simultaneously accounting for complex domain-specific rules, or ontologies. A typical rule might specify that if an individual is a "Professor," they must necessarily "Work For" a "University." When these rules are expressed as "existential rules," the problem of answering queries becomes fundamentally undecidable. To circumvent this, researchers have long sought "query rewriting" techniques—transforming complex rule-based queries into simpler languages like Datalog that standard database engines can process.

The Problem: The Search for a Universal Rewriter

While a general algorithm exists to find a Union of Conjunctive Queries (UCQ) rewriting whenever one is possible, the community has lacked a similar "master algorithm" for Datalog. Datalog is significantly more powerful than UCQs due to its support for recursion, making it a highly desirable target language. This research investigates whether a generic Datalog-rewriting algorithm is theoretically possible for the entire class of existential rules.

Methodology

This paper presents a theoretical proof of undecidability using a reduction from the halting problem of Turing machines. The authors demonstrate that if a general Datalog-rewriting algorithm existed, one could use it to solve the Halting Problem—deciding whether an arbitrary program will eventually stop or run forever. Since the Halting Problem is known to be undecidable, the existence of such a general rewriter is logically impossible. The authors constructed a specific set of existential rules and a query where answering the query is equivalent to solving the halting problem, even though the query remains technically "Datalog-expressible."

Key Insights and Ideas

The research highlights several critical distinctions in the landscape of query rewriting:

  • The Datalog Gap: There is a fundamental disconnect between a query being expressible in Datalog and it being effectively rewritable by a general algorithm.
  • The Assumption Paradox: Even when restricting the scope to rule sets known to be Datalog-expressible, the core problem of query answering remains undecidable.
  • Strong vs. Relaxed Rewriting: The authors distinguish between "strong" rewriting (valid for any set of facts) and "relaxed" rewriting (valid only for facts within the original vocabulary). Their proof shows that undecidability holds for both versions.
  • Taxonomy of Success Stories: While a universal rewriter is impossible, many specific fragments of logic allow for successful rewriting. The paper provides a valuable taxonomy of these fragments.
Table 1: Comparison of various rule languages and their Datalog-rewritability status.

As shown in Table 1, specific dialects like Guarded rules or Horn-SHIQ have known Datalog rewritings and implementations. This highlights that while we can rewrite specific "dialects," we cannot create a single algorithm for the "entire language."

Key Results

The primary contribution of this work is the formal mathematical proof that query answering under Datalog-expressible rule queries is undecidable. This result serves as a definitive "Stop" sign for researchers, proving that no constructive, general-purpose algorithm can take any Datalog-expressible existential rule set and automatically produce a corresponding Datalog program.

Limitations and Future Work

The current result applies specifically to Boolean queries (those returning "yes" or "no"). The authors suggest two primary avenues for future exploration:

  1. Answer Datalog Expressibility: Investigating queries that return lists of constants (e.g., names). While suspected to be undecidable, this requires a distinct proof strategy.
  2. Alternative Target Languages: Exploring whether other powerful languages, such as Unions of Boolean Conjunctive Regular Path Queries (UBCRPQs), might offer better properties for general rewriting, though the authors caution that similar undecidability barriers may exist.

Summary updated

BibTeX
@inproceedings{carral2025ontology,
  author = {David Carral and Lucas Larroque and Michaël Thomazo},
  title = {{Ontology-Based Query Answering over Datalog-Expressible Rule Sets is Undecidable (Extended Abstract)}},
  booktitle = {DL},
  year = {2025},
}
Figure