NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Rewriting Consistent Answers on Annotated Data

Phokion G. Kolaitis, Nina Pardal, Jonni Virtema

Abstract

Consistent Query Answering (CQA) is a robust framework for querying inconsistent databases by identifying answers that persist across all possible database repairs. While traditionally applied to boolean relational data, modern data management increasingly relies on annotated data, where tuples are associated with weights, counts, or probabilities. This paper generalizes CQA to annotated databases using semiring semantics. We introduce a new logic, $L_{\mathbb{K}}$, and prove a fundamental trichotomy result: for self-join free conjunctive queries under key constraints, computing the most conservative (minimum) answer is first-order rewritable if and only if the query's attack graph is acyclic. This work bridges the gap between logical consistency and algebraic optimization, providing a unified framework for diverse data semantics including Bag, Tropical, and Fuzzy semirings.

Introduction

In real-world database systems, integrity constraints—such as the rule that a person can have only one birth date—are frequently violated due to data integration errors or lack of centralized control. CQA addresses this by defining a "repair" as a version of the database that satisfies all constraints. A "consistent answer" is then defined as an answer that appears in every possible repair.

While CQA is well-understood for standard relational databases, modern applications often require "annotated" data. For instance, in "bag semantics," we care about the number of times a tuple appears; in optimization contexts, we may care about the minimum cost (Tropical semiring). This paper investigates how to define and efficiently compute consistent answers when data carries these semiring annotations.

Theoretical Framework: Semirings and $L_{\mathbb{K}}$ Logic

The authors utilize naturally ordered positive semirings to represent data annotations. This framework encompasses several critical data models:

  • Bag Semiring: Tracks counts of occurrences.
  • Tropical Semiring: Used for optimization and shortest-path problems.
  • Fuzzy Semiring: Represents degrees of truth or membership.

To handle these annotations, the paper introduces a new variant of First-Order logic, denoted as $L_{\mathbb{K}}$. This logic incorporates two specialized operators:

  1. Minimization ($\nabla$): Captures the "consistent" aspect by seeking the most conservative value across repairs.
  2. Flattening (Supp): A support operator that converts any non-zero weight into a boolean "1," allowing the logic to check for the existence of data regardless of its specific weight.

The Acyclicity Threshold

The core contribution of the paper is identifying the structural boundary between efficient and intractable query answering. This is achieved through the analysis of Attack Graphs, which represent dependencies and conflicts between query variables and database keys.

In standard CQA, a query is considered "rewritable" if it can be transformed into a new formula that can be executed directly on the inconsistent database to produce the consistent answer. The authors demonstrate that this property holds in the annotated setting as well: a query is $L_{\mathbb{K}}$-rewritable if and only if its attack graph is acyclic. This means that for acyclic queries, the consistent answer can be computed with $AC^0$ data complexity, making it highly efficient and parallelizable.

Complexity and Approximation Hardness

Beyond the boundary of rewritability, the paper explores the computational limits of CQA on annotated data. For queries containing "strong cycles" in their attack graphs, the problem becomes significantly more difficult.

Specifically, for the Bag semiring, the authors prove that if a query has a strong cycle, the problem is not only NP-hard to solve exactly but also NP-hard to approximate within any constant factor. This reveals a stark contrast between simple acyclic queries and those with complex dependency structures, where even finding a "close" answer is computationally prohibitive.

Conclusion and Future Directions

This research provides a unified theoretical foundation for querying inconsistent data across a wide range of semiring semantics. By establishing the acyclicity of the attack graph as the definitive threshold for $L_{\mathbb{K}}$-rewritability, the authors extend decades of CQA research into the realm of annotated data.

However, several challenges remain. The current results are limited to self-join free conjunctive queries. Extending this framework to queries where the same relation appears multiple times remains a significant open problem. Additionally, while this paper focuses on "consistent" answers (the minimum value), future work could explore "possible" answers (the maximum value) to provide a complete picture of uncertainty in annotated databases.

Summary updated

BibTeX
@inproceedings{kolaitis2024rewriting,
  author = {Phokion G. Kolaitis and Nina Pardal and Jonni Virtema},
  title = {{Rewriting Consistent Answers on Annotated Data}},
  booktitle = {Proc. ACM Manag. Data},
  year = {2024},
  url = {https://openreview.net/forum?id=LT7GceggEm},
}
Figure