<!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>From Classical to Consistent Query Answering under Existential Rules</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Thomas Lukasiewicz</string-name>
          <email>thomas.lukasiewicz@cs.ox.ac.uk</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Maria Vanina Martinez</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andreas Pieris</string-name>
          <email>pieris@dbai.tuwien.ac.at</email>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gerardo I. Simari</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Departamento de Ciencias e Ingenier ́ıa de la Computacio ́n, Universidad Nacional del Sur and CONICET</institution>
          ,
          <country country="AR">Argentina</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Department of Computer Science, University of Oxford</institution>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Institute of Information Systems, Vienna University of Technology</institution>
          ,
          <country country="AT">Austria</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Querying inconsistent ontologies is an intriguing new problem that gave rise to a flourishing research activity in the description logic (DL) community. The computational complexity of consistent query answering under the main DLs is rather well understood; however, little is known about existential rules. The goal of the current work is to perform an in-depth analysis of the complexity of consistent query answering under the main decidable classes of existential rules enriched with negative constraints. Our investigation focuses on the standard inconsistency-tolerant semantics, namely, the AR semantics. We establish generic complexity results, which demonstrate the tight connection between classical and consistent query answering. These results allow us to obtain in a uniform way a relatively complete picture of the complexity of our problem.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>An ontology is an explicit specification of a conceptualization of an area of interest. One
of the main applications of ontologies is in ontology-based data access (OBDA), where
they are used to enrich the extensional data with intensional knowledge. In this setting,
description logics (DLs) and rule-based formalisms such as existential rules are popular
ontology languages, while conjunctive queries (CQs) form the central querying tool. In
real-life applications, involving large amounts of data, it is possible that the data are
inconsistent with the ontology. Since standard ontology languages adhere to the
classical FOL semantics, inconsistencies are nothing else than logical contradictions. Thus,
the classical inference semantics fails terribly when faced with an inconsistency, since
everything follows from a contradiction. This demonstrates the need for developing
inconsistency-tolerant semantics.</p>
      <p>
        There has been a recent and increasing focus on the development of such semantics
for query answering purposes. Consistent query answering, first developed for relational
databases [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and then generalized as the AR semantics for several DLs [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], is the most
widely accepted semantics for querying inconsistent ontologies. The AR semantics is
based on the idea that an answer is considered to be valid if it can be inferred from each
of the repairs of the extensional data set D, i.e., the ⊆-maximal consistent subsets of
D. The complexity of query answering under the AR semantics when the ontology is
described using one of the central DLs is rather well understood. The data and
combined complexity were studied in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] for a wide spectrum of DLs, while the work [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]
identifies cases for simple ontologies (within the DL-Lite family) for which tractable
data complexity results can be obtained. On the other hand, little is known when the
ontology is described using existential rules (a.k.a. tuple-generating dependencies (TGDs)
and Datalog± rules), that is, formulas of the form ∀X∀Y(φ(X, Y) → ∃Z(ψ(X, Z))),
and negative constraints (NCs) of the form ∀X(φ(X) → ⊥), where ⊥ denotes the truth
constant false.
      </p>
      <p>
        Our main goal in this work is to perform an in-depth analysis of the data and
combined complexity of consistent query answering under the main decidable classes of
existential rules, enriched with negative constraints. Let us recall that the main
(syntactic) conditions on existential rules that guarantee the decidability of query answering
are guardedness [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], stickiness [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and acyclicity. Interestingly, our complexity
analysis shows that a systematic and uniform way for transferring complexity results from
classical to consistent query answering can be formally established.
      </p>
      <p>To briefly summarize the main contributions:
– We present generic complexity results, which demonstrate the tight connection
between classical and consistent query answering (Theorems 1 and 2).
– By exploiting our generic theorems, we obtain a (nearly) complete picture of the
combined and data complexity of consistent query answering (Table 2).</p>
    </sec>
    <sec id="sec-2">
      <title>For more details we refer the reader to [10].</title>
      <p>2</p>
      <sec id="sec-2-1">
        <title>Consistent Query Answering</title>
        <p>In the classical setting of CQ answering, given a database D and a set Σ of TGDs and
NCs, if the models of D and Σ, denoted mods(D, Σ), is empty, then every query is
entailed since everything is inferred from a contradiction.</p>
        <p>Example 1. Consider the database D = {professor (John), fellow (John)}, asserting
that John is both a professor and a fellow, and the set Σ of TGDs and NCs consisting of
∀X(professor (X) → ∃Y (faculty (X) ∧ teaches(X, Y )))</p>
        <p>∀X(fellow (X) → faculty (X))
∀X(professor (X) ∧ fellow (X) → ⊥),
expressing that each professor is a faculty member who teaches a course, each fellow
is a faculty member, and professors and fellows form disjoint sets. It is easy to see
that mods(D, Σ) = ∅, since John violates the disjointness constraint; thus, for every
(Boolean) CQ q, (D ∧ Σ) |= q.</p>
        <p>As said above, the AR semantics is the standard semantics for querying inconsistent
ontologies. A key notion, which is necessary for defining the AR semantics, is that of
repair, which is a ⊆-maximal consistent subset of the given database.</p>
        <p>Definition 1. Consider a database D, and a set Σ of TGDs and NCs. A repair of D and
Σ is some D′ ⊆ D such that (i) mods(D′, Σ) ̸= ∅; and (ii) there is no a ∈ (D \ D′)
for which mods(D′ ∪ {a}, Σ) ̸= ∅. Let rep(D, Σ) be the set of repairs of D and Σ.
Example 2. Consider the database D and the set Σ of TGDs and NCs given in
Example 1. The set of repairs of D and Σ consists of the following subsets of D:
D1 = {professor (John)}</p>
        <p>D2 = {fellow (John)}.</p>
        <p>Clearly, we simply need to remove one of the database atoms in order to satisfy the
single negative constraint occurring in Σ.</p>
        <p>
          The AR semantics [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] is based on the idea that a query can be considered to hold if
it can be inferred from each of the repairs.
        </p>
        <p>Definition 2. Consider a database D, a set Σ of TGDs and NCs, and a Boolean CQ q.
We say that q is entailed by D and Σ under the AR semantics, written (D ∧ Σ) |=AR q,
if (D′ ∧ Σ) |= q, for every D′ ∈ rep(D, Σ).</p>
        <p>Example 3. Consider the database D and the set Σ of TGDs and NCs given in
Example 1, and also the Boolean CQs
q1 = faculty (John)</p>
        <p>q2 = ∃X(teaches(John, X)),
where q1 asks whether John is a faculty member, while q2 asks whether John teaches a
course. Recall that rep(D, Σ) consists of the databases D1 and D2 given in Example 2.
Clearly, (Di ∧ Σ) |= q1, for each i ∈ {1, 2}, and thus (D ∧ Σ) |=AR q1. However, even
if (D1 ∧ Σ) |= q2, (D2 ∧ Σ) ̸|= q2, and therefore (D ∧ Σ) ̸|=AR q2.</p>
        <p>In the sequel, we refer to the problem of consistent (Boolean) CQ answering under
the AR semantics as AR-CQ answering.
3</p>
      </sec>
      <sec id="sec-2-2">
        <title>Generic Complexity Results</title>
        <p>We present two generic complexity results that demonstrate the tight connection
between classical and consistent CQ answering. These results will automatically provide
us with a (nearly) complete picture of the combined and data complexity of AR-CQ
answering under the main classes of TGDs, enriched with NCs. Given a class C of TGDs,
let C⊥ be the formalism obtained by combining C with arbitrary negative constraints.
3.1</p>
        <sec id="sec-2-2-1">
          <title>Combined Complexity</title>
          <p>We first focus on the combined complexity. Since we would like to understand how the
complexity of our problem is affected when some key parameters are fixed, we also
consider the following two variants of the combined complexity: (1) the bounded-arity
combined complexity (ba-combined complexity), which is calculated by assuming that
the arity of the underlying schema is bounded; and (2) the fixed-program combined
complexity (fp-combined complexity), which is calculated by considering the set of
TGDs and negative constraints as fixed. We show the following:
Theorem 1. Assume that CQ answering under a class C of TGDs is C-complete in
(x-)combined complexity, where x ∈ {ba, fp}. Then, the (x-)combined complexity of
AR-CQ answering under C⊥ is (1) Π2p-complete, if C = NP; and (2) C-complete, if
C ⊇ PSPACE is a deterministic class.</p>
          <p>Proof (sketch). Fix a database D, a set Σ ∈ C⊥ of TGDs and NCs, and a CQ q. The
problem of deciding whether (D ∧ Σ) ̸|=AR q can be easily solved via a
guess-andcheck algorithm. We simply need to apply the following steps:
1. Guess an instance D′ ⊆ D;
2. Verify that D′ ∈ rep(D, Σ); and
3. Verify that (D′ ∧ Σ) ̸|= q.</p>
          <p>We can show that steps 2 and 3 are not harder than classical query answering, which
implies that AR-CQ answering under C⊥ is in coNPC. Therefore, (1) If C = NP, then
we get a Π2p upper bound since NPNP = Σ2p and coΣ2p = Π2p; and (2) If C ⊇ PSPACE is
a deterministic class, then we get a C upper bound since NPC = C and coC = C.</p>
          <p>Regarding the lower bounds, the C-hardness result, when C is deterministic class
above PSPACE, follows immediately since CQ answering is a special case of AR-CQ
answering. For the Π2p-hardness, we show, by a reduction from the validity problem of
2QBF formulas, that AR-CQ answering under a single negative constraint ∀X(φ(X) →
⊥), where φ consists of two atoms and it uses a single ternary predicate, while the
database and the query use only binary and ternary predicates, is already Π2p-hard.
3.2</p>
        </sec>
        <sec id="sec-2-2-2">
          <title>Data Complexity</title>
          <p>By providing a similar analysis as above, we can establish the following generic data
complexity result:
Theorem 2. Assume that CQ answering under a class C of TGDs is C-complete in
data complexity. Then, the data complexity of AR-CQ answering under C⊥ is (1)
coNPcomplete, if C ⊆ PTIME; and (2) C-complete, if C ⊇ PSPACE is a deterministic class.</p>
          <p>Let us say that AR-CQ answering under a single negative constraint of the form
∀X(p(X) ∧ s(X) → ⊥) and a fixed query is already coNP-hard, which in turn implies
the coNP-hardness result in Theorem 2. Actually, the latter is implicit [2, Example 5],
and it can be shown by a reduction from a variant of UNSAT, called 2+2UNSAT, where
each clause has two positive and two negative literals, where the literals involve either
regular variables or the truth constant true or false.
4</p>
        </sec>
      </sec>
      <sec id="sec-2-3">
        <title>From Classical to AR-CQ Answering</title>
        <p>
          We now focus on the main decidable classes of TGDs, enriched with NCs, and we
show that the complexity of AR-CQ answering can be obtained in a uniform way by
exploiting our generic complexity theorems. Recall that the main (syntactic) conditions
on TGDs that guarantee the decidability of CQ answering are the following: (1)
guardedness [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ], which guarantees the treelikeness of the underlying canonical models; (2)
2EXPTIME
2EXPTIME
EXPTIME
2EXPTIME
NEXPTIME
2EXPTIME
ba-combined
        </p>
        <p>fp-combined
EXPTIME
EXPTIME</p>
        <p>NP
2EXPTIME
NEXPTIME
2EXPTIME</p>
        <sec id="sec-2-3-1">
          <title>Combined</title>
          <p>2EXPTIME
2EXPTIME
EXPTIME
2EXPTIME
NEXP - PNE
2EXPTIME
ba-combined
EXPTIME
EXPTIME
p
2
2EXPTIME
NEXP - PNE
2EXPTIME</p>
          <p>NP
EXPTIME</p>
          <p>NP
NP
NP</p>
          <p>NP
fp-combined
p
2
EXPTIME
p
2
p
2
p
2
p
2</p>
        </sec>
        <sec id="sec-2-3-2">
          <title>Data</title>
          <p>PTIME
EXPTIME
in AC0
PTIME
in AC0
PTIME</p>
        </sec>
        <sec id="sec-2-3-3">
          <title>Data</title>
          <p>coNP
EXPTIME
coNP
coNP
coNP
coNP</p>
          <p>Guarded
Weakly-Guarded</p>
          <p>Sticky
Weakly-Sticky</p>
          <p>Acyclic
Weakly-Acyclic</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Guarded</title>
      <p>Weakly-Guarded</p>
      <p>Sticky
Weakly-Sticky</p>
      <p>
        Acyclic
Weakly-Acyclic
stickiness [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], which ensures the termination of backward resolution; and (3) acyclicity,
which guarantees the finiteness of the underlying canonical models. Interestingly, each
one of the above conditions has its “weakly” counterpart: weak-guardedness [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ],
weakstickiness [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and weak-acyclicity [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], respectively. The complexity of CQ answering
under the above classes of TGDs is summarized in Table 1. Clearly, Table 1 and
Theorems 1 and 2 imply Table 2, apart from the (ba-)combined complexity for acyclic TGDs
and NCs; let us briefly comment on this.
      </p>
      <p>
        The (ba-)combined complexity of CQ answering under acyclic TGDs has to our
knowledge never been explicitly studied; we show that is NEXPTIME-complete: the
upper bound is obtained by a reduction to nonrecursive logic programming [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], while
the lower bound by a reduction from a TILING problem [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Notice that Theorem 1
does not cover the cases where classical CQ answering is in a nondeterministic class
above PSPACE. Nevertheless, by exploiting the guess-and-check algorithm discussed in
the proof of Theorem 1, we obtain coNPNEXPTIME upper bound. It is implicit in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] that
NPNEXPTIME = PNE, and since PNE is a deterministic class, coPNE = PNE. Consequently,
AR-CQ answering under acyclic TGDs and NCs is in PNE in (ba-)combined complexity;
the NEXPTIME-hardness is inherited from classical query answering.
5
      </p>
      <sec id="sec-3-1">
        <title>Conclusions</title>
        <p>
          In this work, which is a short version of [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ], we performed an in-depth complexity
analysis of the problem of consistent query answering under the main decidable classes
of TGDs, focussing on the AR semantics. Notably, generic complexity results have
been established, which allowed us to obtain a (nearly) complete picture of the
complexity of our problem in a systematic and uniform way. Regarding future work, apart
from bridging the complexity gap for acyclic TGDs, we intend to perform a similar
complexity analysis for other important semantics such as the IAR semantics, that is, a
sound approximation of the AR semantics [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
        </p>
        <p>Acknowledgements. This work has been funded by the EPSRC grant EP/J008346/1.
M.V. Martinez and G.I. Simari are partially supported by Proyecto PIP-CONICET
112-201101-01000. A. Pieris is also supported by the Austrian Science Fund (FWF):
P25207-N23 and Y698.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Arenas</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bertossi</surname>
            ,
            <given-names>L.E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chomicki</surname>
          </string-name>
          , J.:
          <article-title>Consistent query answers in inconsistent databases</article-title>
          .
          <source>In: PODS</source>
          . pp.
          <fpage>68</fpage>
          -
          <lpage>79</lpage>
          (
          <year>1999</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Bienvenu</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>On the complexity of consistent query answering in the presence of simple ontologies</article-title>
          .
          <source>In: AAAI</source>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. Cal`ı,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Gottlob</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Kifer</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          :
          <article-title>Taming the infinite chase: Query answering under expressive relational constraints</article-title>
          .
          <source>J. Artif. Intell. Res</source>
          .
          <volume>48</volume>
          ,
          <fpage>115</fpage>
          -
          <lpage>174</lpage>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. Cal`ı,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Gottlob</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Pieris</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          :
          <article-title>Towards more expressive ontology languages: The query answering problem</article-title>
          .
          <source>Artif. Intell</source>
          .
          <volume>193</volume>
          ,
          <fpage>87</fpage>
          -
          <lpage>128</lpage>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Dantsin</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Complexity of query answering in logic databases with complex values</article-title>
          .
          <source>In: LFCS</source>
          . pp.
          <fpage>56</fpage>
          -
          <lpage>66</lpage>
          (
          <year>1997</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.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Miller</surname>
            ,
            <given-names>R.J.</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>Theor. Comput. Sci</source>
          .
          <volume>336</volume>
          (
          <issue>1</issue>
          ),
          <fpage>89</fpage>
          -
          <lpage>124</lpage>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. Fu¨rer,
          <string-name>
            <surname>M.:</surname>
          </string-name>
          <article-title>The computational complexity of the unconstrained limited domino problem (with implications for logical decision problems)</article-title>
          .
          <source>In: Logic and Machines</source>
          . pp.
          <fpage>312</fpage>
          -
          <lpage>319</lpage>
          (
          <year>1983</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Hemachandra</surname>
            ,
            <given-names>L.A.</given-names>
          </string-name>
          :
          <article-title>The strong exponential hierarchy collapses</article-title>
          .
          <source>J. Comput. Syst. Sci</source>
          .
          <volume>39</volume>
          (
          <issue>3</issue>
          ),
          <fpage>299</fpage>
          -
          <lpage>322</lpage>
          (
          <year>1989</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Lembo</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lenzerini</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rosati</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ruzzi</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Savo</surname>
            ,
            <given-names>D.F.</given-names>
          </string-name>
          :
          <article-title>Inconsistency-tolerant semantics for description logics</article-title>
          .
          <source>In: RR</source>
          . pp.
          <fpage>103</fpage>
          -
          <lpage>117</lpage>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Lukasiewicz</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Martinez</surname>
            ,
            <given-names>M.V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pieris</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Simari</surname>
            ,
            <given-names>G.I.</given-names>
          </string-name>
          :
          <article-title>From classical to consistent query answering under existential rules</article-title>
          .
          <source>In: AAAI</source>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Rosati</surname>
          </string-name>
          , R.:
          <article-title>On the complexity of dealing with inconsistency in description logic ontologies</article-title>
          .
          <source>In: IJCAI</source>
          . pp.
          <fpage>1057</fpage>
          -
          <lpage>1062</lpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>