Abstract

In this paper we study a problem motivated by the management of changes in databases. It turns out that several such change scenarios, e.g., the separately studied problems of view maintenance (propagation of data changes) and view adaptation (propagation of view definition changes) can be unified as instances of query reformulation using views provided that support for the relational difference operator exists in the context of query reformulation. Exact query reformulation using views in positive relational languages is well understood, and has a variety of applications in query optimization and data sharing. Unfortunately, most questions about queries become undecidable in the presence of difference (or negation), whether we use the foundational set semantics or the more practical bag semantics. We present a new way of managing this difficulty by defining a novel semantics, ℤ-relations, where tuples are annotated with positive or negative integers. ℤ-relations conveniently represent data, insertions, and deletions in a uniform way, and can apply deletions with the union operator (deletions are tuples with negative counts). We show that under ℤ-semantics relational algebra (**image**) queries have a normal form consisting of a single difference of positive queries, and this leads to the decidability of their equivalence. We provide a sound and complete algorithm for reformulating **image** queries, including queries with difference, over ℤ-relations. Additionally, we show how to support standard view maintenance and view adaptation over set or bag semantics, through an excursion into the ℤ-semantics setting. Our algorithm turns out to be sound and complete also for bag semantics, albeit necessarily only for a subclass of **image**. This subclass turns out to be quite large and covers generously the applications of interest to us. We also show a subclass of **image** where reformulation and evaluation under ℤ-semantics can be combined with duplicate elimination to obtain the answer under set semantics. We investigate related complexity questions, and we also extend our results to queries with built-in predicates.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call