<!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>Querying the Deep Web: Back to the Foundations</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Andrea Cal</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Davide Martinenghi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Igor Razgon</string-name>
          <email>igorg@dcs.bbk.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mart n Ugarte</string-name>
          <email>mugartec@ulb.ac.be</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Dept of Comp. Sci.</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Inf. Syst.</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Birkbeck, Univ. of London</institution>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Dip. di Elettr., Informaz. e Bioing. Politecnico di Milano</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Oxford-Man Inst. of Quantitative Finance University of Oxford</institution>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>Web and Information Tech. Lab. Universite Libre de Bruxelles</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>The Deep Web is the large corpus of data accessible on the Web through forms and presented in dynamically-generated pages, but not indexable as static pages, and therefore invisible to search engines. Deep Web data are usually modelled as relations with so-called access limitations, that is, they can be queried only by selecting certain attributes. In this paper we give some fundamental complexity results on the problem of processing conjunctive (select-project-join) queries on relational data with access limitations.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The term Deep Web (also called Hidden Web) [
        <xref ref-type="bibr" rid="ref5 ref6 ref7">7, 5, 6</xref>
        ] refers to the data content
that is created dynamically as the result of a speci c search on the web. For
example, when we query a White Pages website, the generated output consists of one
or more pages containing the result of a query posed on an underlying database;
these pages cannot be indexed by search engines. When we query whitepages.com
through a form, we are forced to ll in some elds of the form, for instance the
Name eld; the result is then structured as a table. A Deep Web source can be
naturally modelled as a relational table (or a set of relational tables) that can
be queried only according to so-called access patterns, each of which enforces the
selection on some of the attributes (which corresponds to lling the input elds
in the form with values), which are called input attributes. Relational tables
accessible through access patterns are said to have access limitations.
      </p>
      <p>
        Processing structured queries over Deep Web sources is the key problem
in the integration of such sources. Interestingly, when Deep Web sources are
modeled, as mentioned, as relations with access limitations, answering a simple
conjunctive (select-project-join) query on such sources requires, in the worst case,
the evaluation of a recursive Datalog query plan. In such plans, values obtained
as output from a source are used as input for other sources; the compatibility
of values is established by assigning to each attribute of a relation a so-called
r^(X; Y ); s^(Z; Y )
dom(X); r(X; Y )
dom(X); s(X; Y )
{ We show that CQ answering under access limitations is np-complete with
respect to combined complexity; thus, the access limitations do not increase
the complexity of classic query answering (without access limitations).
{ We consider the problem of CQ containment under access limitations, known
to be co-nexptime-complete in its general form [
        <xref ref-type="bibr" rid="ref3 ref4">3, 4</xref>
        ] and thought to be
exptime-complete in the case of queries without constants [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. We rst address
the case of input-only predicates; we show that in such a case the problem
is 2p-complete. As for the hardness, we show that 2p-hardness holds under
stricter conditions: for predicates of arity 6 2 and two abstract domains.
Then we address CQ containment for (input-output) binary predicates; we
conjecture that this problem is also in 2p.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Query Answering</title>
      <p>
        We assume the reader is familiar with the notions of relational schema and
instance, conjunctive query and Datalog program | otherwise, see for instance
the book of Abiteboul et al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. We consider relational schemata whose predicates
are annotated so as to express whether each argument/attribute is input (needs
to be selected) or output ; for instance, riio, of arity 3, has the rst two attributes
as input attributes, and the third as output.
      </p>
      <p>
        In the presence of access limitations on the sources, queries cannot be usually
evaluated as in the traditional case, as we show below. Given a conjunctive query
q, a schema with access limitations (implicit), an instance D and a set I of initial
constants, the answers to q, denoted ans(q; I; D), are obtained starting from the
constants in I and extracting all possible tuples (by using the constants as input
in all possible ways); with the newly obtained constants again all possible tuples
are extracted, and so on, until no new tuple is extracted { see e.g. [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
Example 1. Consider a schema with predicates rio and sio (which contain the
facts of D), a set of initial constants I = fag, and the Boolean CQ q()
r(X; Y ); s(Z; Y ). Assume there is a single abstract domain, represented by the
unary predicate dom, associated with all attributes (arguments). The Datalog
program q for q is shown in Figure 1 (facts of D omitted). The query is rewritten
over the cache relations r^; s^ (rule 1) de ned in the cache rules 2 and 3, which
contain the facts extracted according to rules 2 and 3.
      </p>
      <p>We now come to our result on the decision problem of CQ answering under
access limitations; w.l.o.g., we consider Boolean CQs.</p>
      <p>Theorem 1. CQ answering under access limitations is np-complete with respect
to combined complexity.</p>
      <p>Proof (sketch). For membership we exhibit a non-deterministic algorithm that
performs 6 jDj steps; at each step guesses one of the 6 jDjW jRj possible accesses
to relations. Hardness follows from CQ answering without access limitations.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Query Containment</title>
      <p>De nition 1. Consider two CQs q1; q2 over a schema with access limitations,
as well as a set I of initial constants such that const(q1) [ const(q2) I
(const(q) denotes the constants in a query q, while denotes the in nite
domain of constants); we say that q1 is contained in q2 under access limitations
with respect to I, denoted q1 I q2, if, for every database D for R, we have
ans(q1; I; D) ans(q2; I; D).</p>
      <p>Checking containment amounts to checking containment between two
recursive Datalog programs in the special form presented in Section 2. W.l.o.g., we
consider Boolean CQs as in Section 2. We rst consider the case of input-only
predicates. An input-only n-predicate r is accessed, in an instance D, with an
n-tuple hti of constants of the appropriate domain, and tells (with a Boolean
result) whether r(hti) 2 D. Evidently, this restricts the de nition of
containment to instances composed solely of constants of the initial set I. The following
lemma has a rather straightforward proof. A tight hardness result follows.
Lemma 1. CQ containment under access limitations with input-only predicates
is in 2p.</p>
      <p>Theorem 2. CQ containment under access limitations with input-only
predicates of arity 6 2 and two abstract domains is 2p-hard.</p>
      <p>
        Proof (sketch). The proof is by reduction from a tighter version of
Generalised-Graph-Colouring [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], which is 2p-complete and is de ned as
follows: given a graph F and a positive integer k, is there a two-colouring of the
vertices of F that does not contain a monochromatic (on vertices) clique of k
vertices? We reduce Generalised-Graph-Colouring to non-containment
under the above stated restrictions using a predicate e=2 for edges and a predicate
col =2 to indicate by col (v; c) that the vertex v has colour c.
      </p>
      <p>As a corollary we get tight bounds for the input-only case.</p>
      <p>Corollary 1. CQ containment under access limitations with input-only
predicates is 2p-complete.</p>
      <p>Finally, we studied the binary case with both input and output predicates.
Theorem 3. CQ containment under access limitations with binary predicates
is in 2p.</p>
      <p>
        Proof (sketch). The proof uses the cray sh-chase technique of [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] to check
q1 I q2 in the binary case. Relying on the fact that q2 is \blind" to pairs of
atoms that are more than jq2j steps apart in a join graph, to check the existence
of a counterexample for containment we guess, by means of the cray sh-chase, a
polynomially bound set of atoms representing a fragment of instance that makes
q1 true; then we check whether no homomorphism maps q2 onto such fragment.
4
      </p>
    </sec>
    <sec id="sec-4">
      <title>Discussion</title>
      <p>We have presented some results on our ongoing study of the fundamentals of the
complexity of CQ answering and containment under access limitations.
Interestingly, some of the fundamental problems have been overlooked in the literature,
for instance the complexity of CQ answering under access limitations, for which
we gave a tight bound. We also presented results for the input-only case,
employing techniques that, we believe, pave the way to future investigations. The
binary case is interesting as most knowledge representation formalisms rely on
binary relations; we plan to nd a tight bound for its complexity, proving our
conjecture. Finally, we shall study CQ answering and containment under access
limitations as well as integrity constraints expressed as ontological rules; this has
applications in the intersection between the Semantic Web and the Deep Web.
Acknowledgments. Martn Ugarte and Andrea Cal acknowledge support by the
EU COST action IC1302 \Keystone". Andrea Cal acknowledges partial support
by the EPSRC project \Logic-based Integration and Querying of Unindexed
Data" (EP/E010865/1)".</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Serge</surname>
            <given-names>Abiteboul</given-names>
          </string-name>
          , Richard Hull, and
          <string-name>
            <given-names>Victor</given-names>
            <surname>Vianu</surname>
          </string-name>
          .
          <source>Foundations of Databases. Addison-Wesley</source>
          ,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Michael</given-names>
            <surname>Benedikt</surname>
          </string-name>
          .
          <source>Personal communication</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Michael</given-names>
            <surname>Benedikt</surname>
          </string-name>
          , Georg Gottlob, and
          <string-name>
            <given-names>Pierre</given-names>
            <surname>Senellart</surname>
          </string-name>
          .
          <article-title>Determining relevance of accesses at runtime</article-title>
          .
          <source>In Proc. of PODS</source>
          , pages
          <volume>211</volume>
          {
          <fpage>222</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Andrea</given-names>
            <surname>Cal</surname>
          </string-name>
          and
          <string-name>
            <given-names>Davide</given-names>
            <surname>Martinenghi</surname>
          </string-name>
          .
          <article-title>Conjunctive Query Containment under Access Limitations</article-title>
          .
          <source>In Proc. of ER</source>
          , pages
          <volume>326</volume>
          {
          <fpage>340</fpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Andrea</given-names>
            <surname>Cal</surname>
          </string-name>
          and
          <string-name>
            <given-names>Davide</given-names>
            <surname>Martinenghi</surname>
          </string-name>
          .
          <article-title>Querying data under access limitations</article-title>
          .
          <source>In Proc. of ICDE</source>
          , pages
          <volume>50</volume>
          {
          <fpage>59</fpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Kevin</given-names>
            <surname>Chen-Chuan</surname>
          </string-name>
          <string-name>
            <surname>Chang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Bin</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and Zhen</given-names>
            <surname>Zhang</surname>
          </string-name>
          .
          <article-title>Toward large scale integration: Building a metaquerier over databases on the web</article-title>
          .
          <source>In Proc. of CIDR</source>
          , pages
          <volume>44</volume>
          {
          <fpage>55</fpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Jayant</given-names>
            <surname>Madhavan</surname>
          </string-name>
          , Loredana Afanasiev, Lyublena Antova, and
          <string-name>
            <surname>Alon</surname>
            <given-names>Y.</given-names>
          </string-name>
          <string-name>
            <surname>Halevy</surname>
          </string-name>
          .
          <article-title>Harnessing the deep web: Present and future</article-title>
          .
          <source>In Proc. of CIDR</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Vladislav</given-names>
            <surname>Rutenburg</surname>
          </string-name>
          .
          <article-title>Complexity of generalized graph coloring</article-title>
          .
          <source>In Proc. of MFCS</source>
          , pages
          <volume>573</volume>
          {
          <fpage>581</fpage>
          ,
          <year>1986</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>