Consistent Query Answering for Primary Keys and Conjunctive Queries with Counting
Aziz Amezian El Khalfioui, Jef Wijsen
TL;DR
This work resolves the question of which self-join-free conjunctive queries admit parsimonious counting under range semantics for consistent query answering with primary keys. It introduces the syntactic class ${\mathsf{Cparsimony}}$ and proves a tight characterization: a query admits parsimonious counting if and only if it lies in ${\mathsf{Cparsimony}}$, and ${\mathsf{Cforest}}$ is strictly contained within ${\mathsf{Cparsimony}}$. The authors develop a semantic framework for parsimonious counting, including FO rewritings for lower/upper bounds and constructs like optimistic and pessimistic repairs to underpin the counting guarantees. This yields a principled, FO-based approach to compute range counts efficiently for exactly the queries that admit it, with clear implications for CQA tooling and theory. The results deepen understanding of aggregation in CQA and set the stage for extensions to broader query classes and aggregation operators.
Abstract
The problem of consistent query answering for primary keys and self-join-free conjunctive queries has been intensively studied in recent years and is by now well understood. In this paper, we study an extension of this problem with counting. The queries we consider count how many times each value occurs in a designated (possibly composite) column of an answer to a full conjunctive query. In a setting of database repairs, we adopt the semantics of [Arenas et al., ICDT 2001] which computes tight lower and upper bounds on these counts, where the bounds are taken over all repairs. Ariel Fuxman defined in his PhD thesis a syntactic class of queries, called C_forest, for which this computation can be done by executing two first-order queries (one for lower bounds, and one for upper bounds) followed by simple counting steps. We use the term "parsimonious counting" for this computation. A natural question is whether C_forest contains all self-join-free conjunctive queries that admit parsimonious counting. We answer this question negatively. We define a new syntactic class of queries, called C_parsimony, and prove that it contains all (and only) self-join-free conjunctive queries that admit parsimonious counting.
