First Order-Rewritability and Containment of Conjunctive Queries in Horn Description Logics

Meghyn Bienvenu, Peter Hansen, Carsten Lutz, Frank Wolter · OpenReview

Abstract

In the field of Ontology-Mediated Query Answering (OMQA), First-Order (FO) rewritability is a critical property that allows queries posed over an ontology to be executed using standard relational database management systems. While FO-rewritability is well-understood for atomic queries (AQs) in Horn Description Logics (DLs), its behavior for more complex Conjunctive Queries (CQs) has remained largely unexplored. This paper provides the first comprehensive theoretical characterization and complexity analysis of FO-rewritability and query containment for CQs within the Horn family of DLs. We identify a significant complexity jump when inverse roles are introduced and demonstrate that the practical constraint of "rootedness" can mitigate this increase, bringing the problem into more manageable complexity classes.

Introduction

Ontology-Mediated Query Answering (OMQA) leverages structured knowledge bases (ontologies) to improve the querying of incomplete or heterogeneous data. A primary goal in this domain is query rewriting: the process of transforming a user's query and an associated ontology into a new query—typically in SQL—that can be executed directly against a relational database. When such a transformation is possible, the query is said to be First-Order (FO) rewritable.

While lightweight logics such as DL-Lite are designed to guarantee FO-rewritability, more expressive Horn logics, such as the $\mathcal{EL}$ family used in large-scale medical ontologies like SNOMED CT, do not offer such guarantees. Previous research has primarily focused on the FO-rewritability of simple Atomic Queries (AQs). However, real-world applications necessitate the use of Conjunctive Queries (CQs), which allow for multiple conditions and joins. This paper addresses the theoretical gap in characterizing when a CQ is FO-rewritable under a Horn ontology and determines the computational complexity of deciding this property.

Methodology

The authors employ a combination of semantic characterizations and automata-based techniques to analyze the boundaries of FO-rewritability.

Semantic Characterization

The research establishes that FO-rewritability is intrinsically linked to the behavior of queries on "pseudo tree" ABoxes (data structures). Specifically, the authors prove that if a query's behavior on a sufficiently large, tree-like data structure can be captured by examining only a small, local neighborhood, the query is FO-rewritable. This locality property serves as a foundation for the subsequent complexity proofs.

Automata-Based Approach

To determine the complexity of deciding FO-rewritability, the authors translate the problem into the emptiness problem for Two-Way Alternating Parity Automata (TWAPAs). This approach allows them to model the "chase" procedure—a standard reasoning mechanism in DLs—as a tree-walking process. By analyzing the states and transitions of these automata, the authors can bound the computational resources required to decide rewritability.

Normalization and Rootedness

The paper demonstrates that complex ontologies, such as those in Horn-$\mathcal{SHIF}$, can be simplified into a normal form (specifically $\mathcal{ELIHF}_\perp$) without losing properties relevant to FO-rewritability. Furthermore, the authors distinguish between general CQs and "rooted" CQs. A rooted CQ is connected and contains at least one answer variable, a structure that mirrors the vast majority of queries used in practical engineering applications.

Key Insights and Complexity Analysis

The Inverse Role Effect

A central finding of this research is the "inverse role effect." In Description Logics, inverse roles allow for the navigation of relationships in both directions (e.g., navigating from hasParent to isParentOf). The authors reveal that while inverse roles do not significantly impact the complexity of AQs, they cause a massive jump for CQs. Specifically, the complexity of deciding FO-rewritability jumps from EXPTIME to 2EXPTIME when inverse roles are introduced.

Rootedness as a Complexity Mitigant

While the 2EXPTIME worst-case scenario is daunting, the authors show that this complexity is often driven by disconnected or Boolean queries. For rooted CQs, the complexity drops to coNEXPTIME-complete. This suggests that for most practical use cases, the problem is significantly more tractable than the general case suggests. Moreover, the authors note that the "double exponential" factor typically applies to the size of the query, which is usually small, while remaining single exponential relative to the size of the ontology.

Containment and Rewritability

The paper highlights a deep theoretical link between query containment (determining if the results of query A are always a subset of query B) and FO-rewritability. By establishing that containment is decidable within specific complexity classes, the authors provide a pathway for simplifying the search for rewritings.

Summary of Results

The following table summarizes the complexity of deciding FO-rewritability across different logic fragments and query types:

Logic Range Query Type Complexity
$\mathcal{EL}$ to $\mathcal{ELHF}_\perp$ Conjunctive Query (CQ) EXPTIME-complete
$\mathcal{ELI}$ to Horn-$\mathcal{SHIF}$ Conjunctive Query (CQ) 2EXPTIME-complete
$\mathcal{ELI}$ to Horn-$\mathcal{SHIF}$ Rooted CQ coNEXPTIME-complete

Additionally, the authors resolved a long-standing open problem from 1994 regarding monadic Datalog containment, proving it is coNEXPTIME-hard for rooted CQs.

Conclusion

This work provides a foundational theoretical map for FO-rewritability in Horn Description Logics. By identifying the impact of inverse roles and the benefits of query rootedness, the authors have clarified the boundaries of efficient query answering. While this paper focuses on theoretical bounds and does not provide a practical implementation for generating SQL rewritings, the techniques developed—particularly the use of TWAPAs and pseudo trees—lay the groundwork for the next generation of query rewriting engines capable of handling complex conjunctive queries in production environments.

Summary updated

BibTeX
@inproceedings{bienvenu2016first,
  author = {Meghyn Bienvenu and Peter Hansen and Carsten Lutz and Frank Wolter},
  title = {{First Order-Rewritability and Containment of Conjunctive Queries in Horn Description Logics}},
  booktitle = {Description Logics},
  year = {2016},
}
Figure