TL;DR
This paper tackles the challenge of efficiently counting answers to complex database queries, particularly when those queries are enhanced with ontologies or integrity constraints expressed using guarded Tuple-Generating Dependencies (TGDs). The authors provide a comprehensive classification of the computational complexity of this "answer counting" problem, linking it to structural properties of the queries themselves. This work is crucial for building more scalable and practical knowledge-based systems.
What Problem Does This Paper Address?
In modern data management and knowledge representation, we often deal with queries that go beyond simple database lookups. We might want to infer new facts based on an ontology (ontology-mediated querying) or ensure data adheres to certain rules (querying under constraints). Tuple-Generating Dependencies (TGDs) are a powerful formalism for expressing these rules and ontologies. However, when these TGDs are "guarded" (a common and useful restriction), both evaluating and, crucially, counting the answers to queries become computationally challenging.
While previous work has classified the complexity of evaluating such queries, the problem of counting answers (which is often more relevant in practice, especially when dealing with large result sets) has remained less understood. This paper aims to fill that gap by providing a fine-grained classification of the parameterized complexity of answer counting for queries under guarded TGDs, considering various structural measures of the queries.
Methods
The core of this paper is a detailed complexity analysis. The authors leverage the concept of parameterized complexity, where the difficulty of a problem is measured not just by the input size but also by specific "parameters" (like the size or structural complexity of the query). They use Turing fpt-reductions to relate the complexity of different problem variants.
A key technique is the use of structural measures of conjunctive queries (CQs) and unions of CQs (UCQs), such as:
- Treewidth: Measures how "tree-like" a query's graph representation is.
- Contract treewidth: A variation focusing on the query's answer variables.
- Starsize: Related to the number of answer variables in query components.
- Linked matching number: A more refined measure capturing connectivity.
The paper also relies on established procedures like the chase (for materializing consequences of TGDs) and the Chen-Mengel closure (a technique for rewriting UCQs to simplify counting). A significant part of the work involves carefully adapting existing results for CQs without ontologies to the setting with guarded TGDs, highlighting how ontologies can interact with these structural measures in non-trivial ways.
Datasets
Not discussed in the paper. The paper focuses on theoretical complexity analysis and does not involve training or evaluating on specific datasets.
Key Insights and Ideas
- Ontologies add complexity, but structural measures still matter: While adding ontologies or constraints complicates query answering, the paper shows that the inherent structural complexity of the underlying query (CQ/UCQ) remains a primary determinant of answer counting complexity.
- The "ontology effect": The paper demonstrates that an ontology can sometimes make a query with complex structural measures equivalent to a much simpler query. This "ontology effect" means we can't just look at the query's structure in isolation; the ontology plays a crucial role.
- A unified classification: The authors provide a classification that applies consistently to both ontology-mediated querying and querying under constraints, using the same set of complexity classes (FPT, W[1]-equivalent, #W[1]-equivalent, #W[2]-hard, #A[2]-equivalent) and structural measures.
- Meta-problems are decidable: The paper shows that it's decidable whether a given query (with or without ontologies/constraints) is equivalent to one that has small structural measures, which is important for query optimization.
Key Results
The paper presents a detailed classification of the parameterized complexity of answer counting for classes of ontology-mediated queries and constraint queries under guarded TGDs. This classification is based on the boundedness of query structural measures (treewidth, contract treewidth, starsize, linked matching number) and the interaction with the ontology.
Specifically, the paper establishes:
- Upper bounds: Answer counting is in FPT (fixed-parameter tractable) if query treewidth and contract treewidth are bounded.
- Lower bounds: Complexity increases to W[1]-equivalent, #W[1]-equivalent, #W[2]-hard, and #A[2]-equivalent as these structural measures become unbounded, mirroring the classification for queries without TGDs.
- Decidability results: The paper shows that it's decidable whether a query can be rewritten into an equivalent one with small structural measures, both for querying under constraints and for ontology-mediated querying (under certain conditions).
Limitations and Future Work
- Open problems: The paper leaves open the question of whether answer counting in FPT for constraint queries coincides with PTIME. It also leaves open the exact characterization of #W[2]-hardness and #A[2]-equivalence for OMQs and the meta-problem for treewidth when ontologies don't need to be preserved.
- Data schema assumptions: Some results rely on the assumption of a "full data schema" (where all symbols used in the ontology and query appear in the data) or bounded relation arity, though the authors note that upper bounds often hold without these assumptions.
- Generalizations: The authors suggest exploring decidable classes of TGDs beyond guarded ones and investigating frontier-guarded TGDs with unrestricted bodies.
Summary updated