- The paper establishes that query containment for CQACs with semi-interval constraints is tractable (NP-complete) in certain cases by leveraging the homomorphism property.
- It presents a formal framework and mapping-based technique to normalize queries and evaluate arithmetic comparisons for effective containment entailment.
- The study demonstrates that maximally contained rewritings in Datalog enable efficient computation of certain answers in data integration scenarios.
Semi-Interval Comparison Constraints in Query Containment and Certain Answer Computation
Introduction and Problem Statement
This paper rigorously analyzes the computational complexity of query containment for conjunctive queries with arithmetic comparisons (CQACs), focusing on the impact of semi-interval comparison constraints. The central problem is: given two CQAC queries $Q$ and $Q'$, is $Q'$ contained in $Q$? While general CQAC containment is known to be $\Pi_2^p$-complete, the paper identifies broad classes of queries—specifically those with semi-interval arithmetic comparisons in the containing query—where containment is tractable (NP-complete). The work further investigates the complexity of computing certain answers in the context of answering CQAC queries using CQAC views, establishing conditions under which maximally contained rewritings (MCRs) compute all certain answers efficiently.
The paper formalizes CQACs as select-project-join queries augmented with arithmetic comparisons, denoted $Q = Q_0 + \beta$, where $Q_0$ are relational subgoals and $\beta$ are arithmetic comparison subgoals. Semi-interval comparisons are classified as left semi-interval (LSI: $var \leq const$ or $var < const$) and right semi-interval (RSI: $var \geq const$ or $var > const$), with further distinctions between open and closed intervals.
Query containment for CQACs is tested via containment mappings and containment entailment, requiring normalization of queries to ensure each variable appears only once in relational subgoals and constants are replaced by variables with explicit equalities. The containment entailment is expressed as:
$\phi: \beta_2 \Rightarrow \mu_1(\beta_1) \vee \cdots \vee \mu_k(\beta_1)$
where $\mu_i$ are all containment mappings from the containing to the contained query.
Complexity Results for Query Containment
The paper delineates the complexity landscape for CQAC containment under various constraints:
- General CQACs: $\Pi_2^p$-complete.
- Containing query with only one AC: NP-complete, normalization not required.
- Containing query with only closed LSIs: NP-complete via the homomorphism property (HP).
- Containing query with open LSIs and shared constants: $\Pi_2^p$-complete.
- Containing query with LSIs and a single RSI (RSI1): NP-complete under certain conditions.
The dichotomy between NP and $\Pi_2^p$-complete is sharply illustrated by the presence of open LSIs and shared constants, which can elevate the problem's complexity. The homomorphism property is shown to hold for several classes, allowing containment to be decided by a single mapping.
Figure 1: Finding an MCR for CQAC queries with semi-interval constraints, illustrating the transformation to Datalog and the construction of contained rewritings.
Containment Entailment Analysis
The paper provides a detailed analysis of containment entailment, leveraging a sound and complete set of elemental implications for arithmetic comparisons. It demonstrates that for queries with only LSIs on the right-hand side of the containment implication (in minimal form), the entailment reduces to a single disjunct, except in cases involving disequality ($\neq$). This structural property underpins the tractability of containment in these cases.
Figure 2: Illustration of containment entailment for a CQAC example, showing the mapping structure and the logical dependencies among arithmetic comparisons.
Certain Answer Computation and Maximally Contained Rewritings
In the context of data integration, the paper addresses the computation of certain answers—tuples guaranteed to be in the query result for any database consistent with the view instance. It proves that for CQAC queries and views, an MCR in the language of union of CQACs computes exactly all certain answers. For queries with semi-interval comparisons and a single RSI, the paper constructs MCRs in the language of Datalog with arithmetic comparisons, enabling polynomial-time computation of certain answers.
The construction involves transforming the containing query into a Datalog program and the contained query into a CQ, with auxiliary predicates encoding the semi-interval constraints. The inverse rule algorithm is employed to find the MCR, and a reverse transformation maps the result back to the original CQAC language.
Trade-offs, Limitations, and Open Problems
The results establish clear boundaries for tractable containment and certain answer computation in CQACs with semi-interval constraints. However, the complexity escalates when both LSIs and RSIs are present in the containing query, or when open intervals and shared constants are allowed. The paper identifies open problems, such as the complexity of containment when the containing query has multiple LSIs and RSIs, and the existence of MCRs in the language of union of CQACs for broader classes.
Implications and Future Directions
The theoretical findings have direct implications for query optimization, data integration, and view-based query answering in systems supporting arithmetic comparisons. The identification of tractable subclasses enables efficient containment checks and certain answer computation, which are critical for scalable query processing and data exchange. The transformation techniques and Datalog-based algorithms provide a foundation for practical implementations in database engines.
Future research may explore:
- Extending the tractable subclasses to more general forms of arithmetic comparisons.
- Investigating equivalent rewritings for acyclic CQACs with arithmetic constraints.
- Developing efficient algorithms for MCR construction in cases where the homomorphism property does not hold.
- Analyzing the impact of additional constraints (e.g., dependencies, nested queries) on containment and certain answer computation.
Conclusion
This paper provides a comprehensive complexity analysis of query containment and certain answer computation for CQACs with semi-interval comparison constraints. It delineates the tractable cases, establishes the boundaries of computational hardness, and presents practical algorithms for MCR construction and certain answer computation. The results advance the theoretical understanding of query processing with arithmetic comparisons and inform the design of efficient data integration and query answering systems.