Papers
Topics
Authors
Recent
Search
2000 character limit reached

Maximally Contained Rewritings

Updated 3 July 2026
  • Maximally contained rewritings are a formal framework in query answering using views for CQACs, ensuring that only the certain answers are captured.
  • They leverage a Datalog^AC transformation to manage arithmetic comparisons and apply inverse-rule methods for efficient query rewriting.
  • The framework delineates tractable boundaries and complexity distinctions, which are crucial for effective data integration and information exchange.

Maximally contained rewritings (MCRs) are a central concept in the theory of query answering using views, particularly for conjunctive queries with arithmetic comparisons (CQACs). An MCR encodes all possible certain answers to a target query, leveraging contained rewritings over a specified set of views and is uniquely determined within a union-of-CQACs (U-CQAC) query language under the open-world assumption (OWA). This framework is critical in understanding both algorithmic feasibility and theoretical limitations in the presence of arithmetic constraints, especially those involving semi-interval (SI) comparisons.

1. Formal Framework and Definitions

Let

Q:h(X‾)  :−  e1(X‾1),…,ek(X‾k),  βQQ\quad:\quad h(\overline X)\;:-\;e_1(\overline X_1),\dots,e_k(\overline X_k),\;\beta_Q

be a CQAC query over base schema R\cal R, where eie_i are relational atoms and βQ\beta_Q is a conjunction of arithmetic comparisons. A set of CQAC views $\V = \{V_1, \ldots, V_n\}$ is assumed, with each VjV_j similarly defined.

A rewriting RR of QQ using $\V$ is any CQAC whose atoms mention only predicates VjV_j. R\cal R0 is a contained rewriting if, for every instance R\cal R1 (for some database R\cal R2),

R\cal R3

A maximally contained rewriting R\cal R4 is a contained rewriting such that for every other contained rewriting R\cal R5 using R\cal R6 in language R\cal R7,

R\cal R8

Equivalently, R\cal R9 is defined by the (possibly infinite) union of all contained rewritings: eie_i0 This MCR captures precisely the certain answers to eie_i1 with respect to view instance eie_i2, i.e., eie_i3, where

eie_i4

This characterization assures that MCRs do not overgenerate answers and are maximal among all contained rewritings in their expressive class (Afrati et al., 12 Sep 2025).

2. Containment and Expansion in CQACs

The containment property crucial for MCR construction is based on view-expansion. For a rewriting eie_i5 with body view atoms eie_i6, its expansion eie_i7 is obtained by unfolding each eie_i8 using its CQAC definition and suitably renaming variables. Containment then reduces to query containment in the CQAC sense: eie_i9 Maximal containment requires that βQ\beta_Q0 subsumes every other contained rewriting, which corresponds to returning the intersection (across base instances) of what βQ\beta_Q1 could return given the constraints imposed by the views, in all completions consistent with the available view data.

3. Algorithmic Construction of MCRs

While Minicon-style algorithms suffice for plain conjunctive queries, CQACs introduce arithmetic complications. The paper identifies the prominent tractable subclass of CQACs—when βQ\beta_Q2 is in the class βQ\beta_Q3 (restricted to SI comparisons and at most one right-SI comparison).

The construction follows a two-stage process:

  1. DatalogβQ\beta_Q4 Transformation: A βQ\beta_Q5 CQAC βQ\beta_Q6 is transformed into a DatalogβQ\beta_Q7 program βQ\beta_Q8 by encoding SI comparisons as unary predicates (e.g., βQ\beta_Q9), including mapping rules for SI-ACs, coupling rules enforcing their Boolean structure, link rules for constants in comparisons, and transitive closure rules for the order predicate $\V = \{V_1, \ldots, V_n\}$0.
  2. Inverse-Rule MCR Construction: Each view is similarly transformed into a CQ using the new predicate symbols; existing Datalog MCR algorithms (e.g., the inverse-rule method) are then applied to compute the MCR in Datalog$\V = \{V_1, \ldots, V_n\}$1. The result is reverse-transformed back to a union of CQACs by interpreting the unary/binary predicates as their associated arithmetic comparison constraints.

Pseudocode summary: QQ3 The MCR constructed in this way is shown to be unique and correct for $\V = \{V_1, \ldots, V_n\}$2 queries with respect to the original CQAC views [(Afrati et al., 12 Sep 2025), Theorems 8.8 & 8.9].

4. Computational Complexity

The complexity of containment and MCR computation depends critically on the structure of arithmetic comparisons in $\V = \{V_1, \ldots, V_n\}$3 and the views. The following table (from Table 1 in the data) summarizes key dichotomies:

CQACs Allowed in $\V = \{V_1, \ldots, V_n\}$4 CQACs Allowed in $\V = \{V_1, \ldots, V_n\}$5 Complexity
arbitrary CQAC one AC + equality NP
arbitrary CQAC closed left-SI only NP
arbitrary CQAC SI + one RSI NP
contains OSI, $\V = \{V_1, \ldots, V_n\}$6 OSI only $\V = \{V_1, \ldots, V_n\}$7-complete
etc. etc. $\V = \{V_1, \ldots, V_n\}$8-complete

For queries where $\V = \{V_1, \ldots, V_n\}$9 (the containing query) uses at most one SI comparison or only (closed) left-SI or right-SI, containment is in NP. With open SI comparisons (OSI) or combination with inequality (VjV_j0), the problem becomes VjV_j1-complete via reduction from VjV_j2-QBF [(Afrati et al., 12 Sep 2025), Theorems 4.1, 4.2, 5.1, 5.3]. The NP-membership proofs rely on the fact that only one containment mapping may be active, allowing for efficient certification (Lemma 5.4, Proposition 6.2).

5. MCRs and the Certain Answers Semantics

For CQACs, MCRs precisely capture all certain answers under the open-world assumption. That is, for any VjV_j3, VjV_j4, and view-instance VjV_j5: VjV_j6 This result holds for the language of U-CQAC, including possibly infinite unions. The proof is by maximality and containment: VjV_j7 includes every possible contained rewriting—thus capturing all certain answers—and does not admit any superfluous ones. In cases where MCRs can be effectively constructed and are finite, the evaluation is in polynomial time with respect to the data (VjV_j8), as each CQAC can be evaluated in PTIME data-complexity [(Afrati et al., 12 Sep 2025), Theorem 7.1, Section 7].

6. Illustrative Examples

Two representative examples illustrate the mechanics and minimality property of MCRs:

Example 1:

VjV_j9

Views: RR0 No single view suffices. The MCR in U-CQAC is the union: RR1 Each RR2 is contained; any other contained rewriting is subsumed. RR3 thus recovers all RR4 with RR5, and RR6 in RR7.

Example 2:

RR8

RR9

A contained (but non-minimal) rewriting: QQ0 Rectified to (by adding implied comparisons), yielding a minimal MCR: QQ1 Algorithmic construction via DatalogQQ2 discovers such minimal self-join rewritings.

7. Significance and Research Context

MCRs provide a canonical solution for answering queries using views in the presence of arithmetic comparisons, particularly under the OWA and for data integration settings. The precise tractability boundaries for containment and certain answer computation, especially for SI and OSI comparisons, distinguish this framework from earlier purely relational cases. This aligns MCR computation for CQACs with seminal work by Chandra & Merlin (1977), Klug (1988), and others on query containment and rewriting, but uniquely addresses cases with arithmetic constraints (Afrati et al., 12 Sep 2025).

The correct and efficient computation of MCRs remains an active area in database theory, as highlighted in recent work by Afrati and Damigos and foundational approaches to inverse-rule rewriting (Duschka & Wagner, 1997). This suggests significant ongoing relevance for applications in probabilistic databases, information integration, and robust data exchange frameworks.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Maximally Contained Rewritings.