<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>E ectively Updatable Conjunctive Views</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>KRDB Research Centre, Free University of Bozen-Bolzano</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <kwd-group>
        <kwd>(Extended Abstract)</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The view update problem [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] consists in nding suitable ways of consistently and
univocally propagating the changes introduced into a set of the view relations to
the underlying database relations over which the view relations are de ned. This
can be formalised within a general framework [
        <xref ref-type="bibr" rid="ref1 ref7">1,7</xref>
        ] where a view is a function
that associates instances of a database schema with instances of a view schema,
which has a constructive characterisation when each view symbol is de ned in
terms of the database symbols in a concrete query language. A view is updatable
if the changes introduced into the view relations by updates can be
unambiguously propagated back to the underlying database relations over which the view
relations are de ned. This is possible whenever the view is invertible, but
invertibility in itself is not enough for practical purposes, as it merely indicates that
the database instances functionally depend on the corresponding view instances.
What is actually needed is in fact a constructive characterisation of the inverse,
obtained by nding an exact rewriting of each database symbol in terms of the
view symbols, expressed in a query language that is not necessarily the same as
the one used for de ning the view symbols.
      </p>
      <p>
        In the context of relational databases, the study of the invertibility of views
has focused on very restricted settings. Cosmadakis and Papadimitriou [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] limit
their investigation to only two view relations de ned by projections over a single
database relation, which was recently generalised in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] to an arbitrary number of
view relations de ned by acyclic projections, but still over a database consisting
of a single relation. Moreover, the set of integrity constraints considered on the
database schema has been limited to functional and join dependencies in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and
full embedded dependencies in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>
        In this paper, we consider a setting where the view symbols are de ned by
conjunctive queries (CQs) and we show that, when the integrity constraints on
the database schema are strati ed embedded dependencies [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], a view is invertible
precisely if each database symbol has an exact rewriting given by a CQ over the
view schema. We then discuss how such rewritings can be e ectively found using
the Chase &amp; Backchase algorithm [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. As a special case, in combination with the
general criterion for the translatability of view updates we introduced in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], our
results settle the long-standing open issue pointed out in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] of how to solve the
view update problem for a multi-relational database with view relations that are
projections of joins of the database relations.
      </p>
      <p>
        Outline. The rest of the paper is organised as follows: after some preliminaries
in Sec. 2, in Sec. 3 we recall and summarise the framework introduced in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]; in
Sec. 4 we show how view updatability can be checked, and rewritings e ectively
found, when the view symbols are de ned by CQs in a multi-relational database
under strati ed embedded dependencies; we conclude in Sec. 5 by pointing out
future research directions.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <p>A schema is a nite set of relation symbols. Let dom be an arbitrary (possibly
in nite) set of domain values. An instance I of a schema S maps each relation
symbol S in S to a relation SI on dom of appropriate arity, called the extension
of S under I. The set of elements of dom that occur in an instance I is called
the active domain of I and is denoted by adom(I). An instance is nite when
its active domain is, and we always assume instances to be nite. We consider
a database schema R of database symbols and a view schema V of view symbols
not occurring in R. A database state is an instance IR of R and a view state is
an instance IV of V. The set of all database states (resp., view states) is denoted
by R (resp., V). The disjoint union IR ] IV of a database state IR and a view
state IV is the instance, called a global state, of the global schema R [ V, with
active domain adom(IR) [ adom(IV ) and associating each relation symbol S
in R [ V with SIR if S 2 R and with SIV otherwise.</p>
      <p>We consider a satis able ( nite) set of global constraints over R [ V,
consisting of a set R of database constraints over R and a set RV of interschema
constraints over R [ V. The set RV consists of exactly one formula of the form
8x V (x) $ (x) for each V 2 V, where (x) mentions only database symbols
and is called a de nition of V in terms of R. Note that, as R and V are disjoint,
every instance of R [ V satisfying has the form IR ] IV where IR and IV are
a database state and a view state, respectively. A view state IV (resp., database
state IR) is -consistent (or globally consistent or consistent with the global
constraints ) if there is a database state IR (resp., view state IV ) such that IR ] IV
satis es the global constraints . Observe that every legal database state (i.e.,
one that satis es the database constraints R) is globally consistent. We denote
the set of -consistent view states (resp., database states) by V (resp., R ).</p>
      <p>We say that V determines R under (written V R) if, for every IV and
IR; IR0, it is the case that IR = IR0 whenever IR ] IV j= and IR0 ] IV j= . In
other words, models of that agree on the extension of the view symbols also
agree on the extension of the database symbols, which means that in every model
of the latter functionally depends on former. Clearly, under the assumptions
we made on the global constraints , it is always the case that R V, and we
refer to the corresponding functional mapping f : R ! V , associating each
-consistent database state with a -consistent view state, as the view from R
to V induced by . In the rest of the paper, unless speci ed otherwise, whenever
we say \a view" we refer to the (one and only) view from R to V induced by a
set of global constraints as above.</p>
    </sec>
    <sec id="sec-3">
      <title>The View Update Framework</title>
      <p>
        In this section we brie y recapitulate the general view update framework
previously introduced in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. A view update is a function u : V ! V associating each
view state with another, possibly the same. Given a view update that modi es
the current view state, we want to modify the database state accordingly so as
to re ect exactly the changes introduced into the view state. For this to be
possible in an unambiguous way, the view must be updatable, and the view update
translatable, as we formally de ne next.
      </p>
      <p>De nition 1 (Updatability). A view is updatable if V</p>
      <p>
        Note that a view in our sense is always surjective, and V R further implies
injectivity [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], hence the notion of updatability coincides with invertibility.
De nition 2 (Translatability). Let u be a view update and let IV 2 V . We
say that u is translatable on IV if u(IV ) 2 V .
      </p>
      <p>A translatable view update leads to view states in the image of the view f ,
which are therefore reachable from some database state by means of f . In such
a case, when the view is updatable, the changes introduced into the view state
IV by the view update u, resulting in the updated view state IV0 = u(IV ), can
be univocally pushed back by updating the database to the new state f 1(IV0 ).</p>
      <p>However, the fact that V determines R under , even though it ensures that a
view is invertible, does not actually provide a constructive characterisation of its
inverse. In other words, V R guarantees that the extension of the database
symbols functionally depends on that of the view symbols, but it says nothing on
how the former is to be obtained from the latter. In order to e ectively compute
the inverse of a view, we must be able to explicitly express each database symbol
R 2 R in terms of the view symbols V by means of a formula , called an exact
rewriting of R in terms of V under , mentioning only view symbols and such
that j= 8x R(x) $ (x) .</p>
      <p>De nition 3. A view is e ectively updatable if each database symbol has an
exact rewriting in terms of the view symbols under .</p>
      <p>
        Whenever a view update results in a view state IV in V , if a view is e
ectively updatable the changes can be propagated to the database state f 1(IV ) by
computing the extension of each database symbol from its rewriting in terms of
the view symbols. But at this point, the question is: How do we ascertain whether
a view state belongs in fact to V ? The solution consists in constructing what
we call the V-embedding eV of , which is obtained from by replacing every
occurrence of each R 2 R with its rewriting in terms of V. The resulting set of
constraints mentions only view symbols and, as it turns out, is satis ed exactly
by all and only the view states in V . Thus, checking for the translatability of a
view update amounts to checking whether the updated view state satis es eV .
Theorem 1 ([
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]). Let f be an e ectively updatable view, let u be a view update,
and let IV 2 V . Then, u is translatable on IV if and only if u(IV ) j= eV .
Whether a view update u is translatable on a view state IV satisfying eV can
be checked in polynomial time in the size of u(IV ), which is the data complexity
of testing whether a nite relational structure is a model of a FOL theory.
      </p>
      <p>Summing up, for the above machinery to work it is essential to nd a rewriting
of each database symbol in terms of the view symbols, in order to build the
Vembedding of (and thus checking for the translatability of updates) and to
propagate the changes introduced by translatable view updates (by computing
the extension of the database symbols from that of the view symbols). Note that
checking whether a view is invertible, and eventually computing its inverse, is
an operation performed once for all o ine.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Conjunctive Views</title>
      <p>
        In this section, we settle the long-standing open issue pointed out in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], namely
how to solve the view update problem in a multi-relational database with views
that are projections of joins of relations, and we do so in a more general setting
where the view symbols are de ned by CQs and the constraints on the database
schema are embedded dependencies satisfying appropriate restrictions.
Example 1. Let R = fR1; R2g and R consist of the following embedded
dependencies (in this case, inclusion and functional dependencies):1
Let V = fV1; V2; V3g and
      </p>
      <p>RV consist of the following view de nitions:
R1(x; y; z )
R2(z; v; w)
R1(x; y; z ) ^ R1(x0; y; z0 ) ! z = z0 ;
R2(z; v; w) ^ R2(z; v0; w0) ! v = v0 :
! 9v; w R2(z; v; w) ;
! 9x; y R1(x; y; z ) ;
V1(x; y) $ 9z R1(x; y; z) ;
V2(y; z; v) $ 9x; w R1(x; y; z) ^ R2(z; v; w) ;
V3(z; w)
$ 9v</p>
      <p>R2(z; v; w) :
(1a)
(1b)
(1c)
(1d)
(2a)
(2b)
(2c)</p>
      <p>
        The embedded dependencies we consider are required to satisfy the condition
known as strati cation [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], which is based on the notion of chase graph: The chase
graph of a set of embedded dependencies has the dependencies in as nodes
and, for ; 2 , has an edge from to if and only if, intuitively, ring may
cause to re as well (refer to [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] for the formal de nition). Then, is strati ed
if the set of dependencies in every cycle of its chase graph is weakly acyclic [
        <xref ref-type="bibr" rid="ref5 ref6">6,5</xref>
        ].
Note that every weakly acyclic set of dependencies is also strati ed. Indeed, R
of Example 1 is weakly acyclic and, in turn, strati ed.
      </p>
      <p>Our main result establishes that, when the embedded dependencies over the
database schema are strati ed, the view is invertible precisely if each database
symbol has an exact rewriting as a conjunctive query over the view schema.
1 Universal quanti ers are omitted.
Algorithm 1
Theorem 2. Let = R [ RV , where R consists of strati ed embedded
dependencies and each V 2 V is de ned in RV by a CQ. Then, V R if and
only if each R 2 R has an exact CQ rewriting in terms of V under .</p>
      <p>
        The Chase and Backchase (C&amp;B) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] is an algorithm that enumerates the
exact CQ-rewritings of a CQ under constraints. More precisely, given two schemas
S and T , a set of embedded dependencies over S [ T , and an input CQ q over
S, the C&amp;B outputs all the CQs over T which are equivalent to q under . The
C&amp;B is sound and complete, in the sense that it returns all and only the CQs
into which the input CQ can be rewritten (up to homomorphic equivalence)
under the given constraints, whenever the chase is guaranteed to terminate, which
is the case, e.g., for strati ed sets of dependencies. Obviously, the fact that the
output of the C&amp;B is empty for q does not mean that q has no rewriting in terms
of T under , but simply that its rewriting, if any, is not a CQ.
      </p>
      <p>We can use the C&amp;B to look for the rewritings we are interested in. For each
R 2 R, consider the atomic query q(x) = R(x) and proceed as follows:
Chase. Chase q with until no further chase step applies. The resulting query
is the so-called universal plan U .</p>
      <p>Backchase. Every subquery of U over V (i.e., a set of V-atoms from U
mentioning all of q's free variables) is a candidate rewriting of q. Chase each candidate
q0 with step-by-step until no further chase step applies, and at each new step
in the chase sequence check whether a containment mapping from the original
query q can be found. If that is the case, then q0 is a rewriting of q.</p>
      <p>The above is described in more detail in Algorithm 1 and illustrated in our
running example.</p>
      <p>Example 2. Chasing the query q(x; y; z) = R1(x; y; z) with
the following universal plan:
of Example 1 gives
U (x; y; z) = 9v; w R1(x; y; z) ^ R2(z; v; w) ^ V1(x; y) ^ V2(y; z; v) ^ V3(z; w) :
A candidate rewriting of R(x; y; z) in terms of V is the subquery q0(x; y; z) =
9v V1(x; y) ^ V2(y; z; v), that chased with the left-to-right TGDs from (2a) and
(2b) yields the following:
q00(x; y; z) = 9v; z0; x0; w</p>
      <p>V1(x; y) ^ V2 (y ; z; v) ^ R1(x; y; z0) ^ R1(x0; y; z) ^ R2(z; v; w) :
A further chase step with (1c) gives z0 = z, and therefore we can nd a
containment mapping (the identity) from the original query q to q00. Thus, the rewriting
of R1(x; y; z) is 9v V1(x; y) ^ V2(y; z; v). Similarly, we also have that R2(z; v; w)
can be rewritten in terms of V as 9y V2(y; z; v) ^ V3(z; w).</p>
      <p>As it turns out, the constraints considered in Theorem 2 are strati ed, and
this ensures that if an exact CQ-rewriting of R(x) cannot be found by means of
Algorithm 1, then R cannot be expressed at all in terms of the view symbols.
Theorem 3. Let be as in Theorem 2. Then, the procedure Rewrite of
Algorithm 1 is sound and complete for nding the exact rewriting of each database
symbol in terms of the view symbols under . Moreover, V R if and only if
Rewrite(q; ; V) 6= ? for every atomic query q over R.</p>
      <p>
        The results presented above extend the setting of [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], consisting of only one
database symbol, view symbols de ned by acyclic projections and database
constraints given by full dependencies, which is a special case where the rewriting
is known to be the join, rather than a generic CQ.
5
      </p>
    </sec>
    <sec id="sec-5">
      <title>Outlook</title>
      <p>
        We conclude by pointing out and brie y discussing possible research directions
that would be interesting to pursue and investigate further.
{ Consider views de ned by queries expressed in languages beyond CQs. A rst
natural candidate is the class of unions of conjunctive queries.
{ Consider di erent constraints on the database schema. Several su cient
conditions for chase termination have been proposed, e.g., super-weak acyclicity [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ],
safety and inductive restriction [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], some of which extend strati cation, while
some other are incomparable with it. The question is whether the global
constraints satisfy such conditions, as is the case for strati cation when views are
de ned by CQs and database constraints are strati ed embedded
dependencies.
{ Consider constraints also on the view schema. We can allow a set of view
constraints V for which R [ V0 is a set of strati ed embedded dependencies,
where V0 is the set of constraints over R obtained from V by replacing every
occurrence of each view symbol with its CQ-de nition (given in RV ) in terms
of the database symbols. What is interesting to understand is the shape that
such view constraints must have in order to satisfy the above condition.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Bancilhon</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Spyratos</surname>
          </string-name>
          , N.:
          <article-title>Update semantics of relational views</article-title>
          .
          <source>ACM Transactions on Database Systems</source>
          <volume>6</volume>
          (
          <issue>4</issue>
          ),
          <volume>557</volume>
          {575 (Dec
          <year>1981</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Cosmadakis</surname>
            ,
            <given-names>S.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Papadimitriou</surname>
            ,
            <given-names>C.H.</given-names>
          </string-name>
          :
          <article-title>Updates of relational views</article-title>
          .
          <source>Journal of the Association for Computing Machinery</source>
          <volume>31</volume>
          (
          <issue>4</issue>
          ),
          <volume>742</volume>
          {760 (Oct
          <year>1984</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Deutsch</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nash</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Remmel</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>The Chase revisited</article-title>
          .
          <source>In: Proc. of PODS 2008</source>
          . pp.
          <volume>149</volume>
          {
          <fpage>158</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Deutsch</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Popa</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tannen</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Query reformulation with constraints</article-title>
          .
          <source>SIGMOD Record</source>
          <volume>35</volume>
          (
          <issue>1</issue>
          ),
          <volume>65</volume>
          {73 (Mar
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Deutsch</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tannen</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Reformulation of XML queries and constraints</article-title>
          .
          <source>In: Proc. of ICDT 2003. LNCS</source>
          , vol.
          <volume>2572</volume>
          , pp.
          <volume>225</volume>
          {
          <fpage>241</fpage>
          . Springer (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Fagin</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kolaitis</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Miller</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Popa</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>Data exchange: Semantics and query answering</article-title>
          .
          <source>In: Proc. of ICDT 2003. LNCS</source>
          , vol.
          <volume>2572</volume>
          , pp.
          <volume>207</volume>
          {
          <fpage>224</fpage>
          . Springer (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Franconi</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Guagliardo</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>On the translatability of view updates</article-title>
          .
          <source>In: Proc. of AMW. CEUR Workshop Proceedings</source>
          , vol.
          <volume>866</volume>
          , pp.
          <volume>154</volume>
          {
          <fpage>167</fpage>
          .
          <string-name>
            <surname>CEUR-WS.org</surname>
          </string-name>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Marnette</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>Generalized schema-mappings: from termination to tractability</article-title>
          .
          <source>In: Proc. of PODS 2009</source>
          . pp.
          <volume>13</volume>
          {
          <fpage>22</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          , New York, NY, USA (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Meier</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schmidt</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lausen</surname>
          </string-name>
          , G.:
          <article-title>On chase termination beyond strati cation</article-title>
          .
          <source>Proceedings of the VLDB Endowment</source>
          <volume>2</volume>
          (
          <issue>1</issue>
          ),
          <volume>970</volume>
          {981 (Aug
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>