<!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>Query Rewriting Under Ontology Evolution?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Eleni Tsalapati</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giorgos Stoilos</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giorgos Stamou</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>George Koletsos</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>School of Electrical and Computer Engineering, National Technical University of Athens</institution>
          ,
          <addr-line>Zographou Campus, 15780, Athens</addr-line>
          ,
          <country country="GR">Greece</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>One of the most prominent reasoning techniques for query answering is query rewriting. The last years a wide variety of query rewriting systems has been proposed. All of them accept as input a CQ Q and a xed ontology O and produce a rewriting for Q, O. However, in many real world applications ontologies are very often dynamic|that is, new axioms can be added or existing ones removed frequently. In this paper we study the problem of computing a rewriting for a CQ over an ontology that has been evolved (i.e., a set of new axioms has been added to O), by exploiting the information computed for the extraction of the initial rewriting. Our goal is to avoid computing the target rewriting from scratch or repeating computations that have already been conducted for the initial rewriting. We study the problem theoretically and we specify the form that the input information must have for the e cient computation of the new rewriting based on some of the known query rewriting systems (QuOnto, Requiem, Rapid, Naya). Moreover, we present a practical algorithm which we implemented and evaluated against the query rewriting system Requiem obtaining encouraging results.</p>
      </abstract>
      <kwd-group>
        <kwd>Ontologies</kwd>
        <kwd>Query Rewriting</kwd>
        <kwd>Ontology Evolution</kwd>
        <kwd>Axiom Addition</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Conjunctive query answering constitutes a central problem of many applications
which involve managing datasets consisting of very large sets of data assertions.
The last years conjunctive query answering has become one of the most
prominent reasoning tasks in Description Logics. This is witnessed by both the high
number of publications on this research area, to mention only few [
        <xref ref-type="bibr" rid="ref10 ref15 ref9">15, 9, 10</xref>
        ], and
the increasing number of query answering engines such as [
        <xref ref-type="bibr" rid="ref15 ref5">5, 15, 18</xref>
        ], in the last
decade.
      </p>
      <p>
        Unfortunately, it is proved that the problem of answering conjunctive queries
over ontologies expressed using expressive ontology languages (like those
underpinning the Web Ontology Language OWL 2) is of high computational
complexity [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. Hence, languages of low expressivity (like those underpinning the OWL
2 QL and OWL 2 EL fragments) have been proposed in the literature for which
? Work was supported by 'Linked Heritage" and an FP7 Marie Curie CIG grant
query answering is tractable w.r.t. the size of data [
        <xref ref-type="bibr" rid="ref15 ref5 ref9">5, 15, 9</xref>
        ] and e cient systems
can be implemented. One of the most prominent techniques for query answering
over such languages is query rewriting. Given a query Q and an ontology O, a
rewriting R of Q w.r.t. O is a set of clauses (usually Datalog rules or unions of
CQs) such that for any database the answers of Q over the database and the
ontology coincide with the answers of the rewriting R over the database. Thus,
R can be used for nding the answers by translating it into a (recursive) SQL
query.
      </p>
      <p>
        Hitherto, numerous query rewriting systems have been developed in the
literature [
        <xref ref-type="bibr" rid="ref13 ref15 ref5 ref6 ref9">5, 15, 18, 9, 6, 13, 20</xref>
        ]. Prominent examples include QuOnto1, Requiem2,
Quest3, Nyaya4, Rapid5 and IQAROS6 while several of them employ
sophisticated optimisations in order to reduce either the size of the computed rewriting
or the computation time. Despite the very encouraging results, a drawback of
these systems is that they assume that the input ontology over which, given a
CQ they compute the target rewriting, is xed. However, in many applications
ontologies are dynamic, in the sense that they can change in time [
        <xref ref-type="bibr" rid="ref16 ref3 ref7">7, 3, 16</xref>
        ]. More
precisely, a new set of axioms can be incorporated into an existing ontology or
be contracted. For example, the NCI Thesaurus7 is maintained by a
multidisciplinary team of editors, who add about 900 new entries each month. While, at
the same time, between two consecutive versions of the ontology 220,000 axioms
were deleted [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. In such scenarios all aforementioned systems would compute a
rewriting for the input query over the new ontology from scratch discarding any
information previously computed, although it is expected that the new rewriting
has a signi cant overlap with the initial one.
      </p>
      <p>Recently we studied the problem of computing a query rewriting of a CQ
w.r.t. an ontology that has been contracted directly from a rewriting of the
CQ w.r.t. the initial ontology [19]. In the current paper we study the following
problem: Given a query Q, an ontology O, a set R computed for the extraction of
a rewriting of Q w.r.t. O and a set of axioms ON , compute a rewriting of Q w.r.t.
O [ ON from R and O without repeating the same computations8. Firstly, we
study the problem theoretically and we specify the form that the input R must
have according to query rewriting system used (Requiem, QuOnto, Naya and
Rapid). Next, we provide a novel algorithm that computes a rewriting for the
extended ontology which is compatible with the inference systems underpinning
these rewriting systems. We prove that our algorithm is correct in the sense that
when evaluating the computed rewriting over the system's data we obtain the
whole set of correct answers.
1 http://www.dis.uniroma1.it/quonto/
2 http://www.cs.ox.ac.uk/isg/tools/Requiem/
3 http://ontop.inf.unibz.it/
4 http://mais.dia.uniroma3.it/Nyaya/Home.html
5 http://www.image.ece.ntua.gr/~achort/rapid.zip
6 http://code.google.com/p/iqaros/
7 https://wiki.nci.nih.gov/display/VKC/NCI+Thesaurus+Terminology
8 Note that we assume O [ ON to be consistent w.r.t. the input data and we don't
handle cases where inconsistencies need to be resolved</p>
      <p>Finally, we have optimised and implemented our algorithm using Requiem
and conducted an experimental evaluation using both benchmark ontologies and
an E LHI fragment of the realistic medical ontology GALEN. We compared the
performance of our system to the performance of the query rewriting system
Requiem and we obtained encouraging results.</p>
      <p>
        The algorithm proposed in this paper can be exploited by cutting-edge
technologies like ontology-based data access and ontology-based data integration.
For instance, an innovative algorithm for ontology-based data integration under
ontology evolution has recently been suggested in the literature [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], in which
every new rewriting is computed from scratch, hence our algorithm could further
improve its e ciency.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <p>In this section we introduce all necessary terminology and demonstrate the
relevant de nitions assuming that the reader is familiar with rst-order logic.</p>
      <p>We use standard notions of rst-order constants, variables, function symbols
terms, substitutions, predicates, atoms, (ground) formulae, sentences, clauses
and entailment (j=). A fact is a ground atom and an instance is a nite set
of facts. A tuple (vector) of variables (constants) is denoted by ~x (~a). For a
formula, with (~x) we denote that ~x are the free variables of , while for a
substitution, is the result of applying to . Satis ability and entailment
are de ned as usual.</p>
      <p>
        Existential Rules An existential rule [
        <xref ref-type="bibr" rid="ref2 ref4">2, 4</xref>
        ] is a sentence of the form
8~x:8~z:[ (~x; ~z) ! 9~y: (~x; ~y)]
(1)
where (~x; ~z) and (~x; ~y) are conjunctions of atoms and ~x; ~y and ~z are pair-wise
disjoint. Formula is the body, formula is the head, and universal quanti ers
are often omitted. If = ? then the rule is called constraint. If ~y is empty, the
rule is called datalog.
      </p>
      <p>
        Many popular Horn ontology languages, such as DL-LiteR [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], E LHI [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], as
well as Datalog [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] can be captured by existential rules. So in the context of
this paper we de ne an ontology O as a nite set of existential rules. An E LHI
or a DL-LiteR ontology can be transformed into normal form by systematically
replacing conjunctions of atoms with atomic ones along the lines of [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ].
      </p>
      <p>Every existential rule of a normalised E LHI or DL-LiteR ontology can be
translated to at most two clauses. We often make no distinction between an
existential rule and its equivalent representation as one or two clauses. Also,
as query rewriting algorithms operate over clauses, for the rest of this work we
assume that ontologies are sets of clauses.</p>
      <p>Given two clauses c1, c2 we say that c1 subsumes c2 if there exists a
substitution such that every literal in c1 appears in c2.</p>
      <p>Queries A query Q is a nite set of sentences containing a distinct query
predicate Q. A tuple of constants ~a is an answer to Q w.r.t an ontology O and
instance I if the arity of ~a agrees with the arity of Q and O [ I [ Q j= Q(~a). We
denote with cert(Q; O [ I) the answers to Q w.r.t. O [ I. A query Q is a union
of conjunctive queries (UCQ) if it is a set of datalog rules containing Q in the
head but not in the body. A UCQ is a conjunctive query (CQ) if it has exactly
one rule. To simplify the presentation, we often abuse notation and identify a
CQ with the only rule it contains.</p>
      <p>
        Query Rewriting Intuitively, a rewriting of Q w.r.t. O is another query that
captures all the information from O relevant for answering Q over an arbitrary
instance I [
        <xref ref-type="bibr" rid="ref15 ref5 ref9">5, 15, 9</xref>
        ]. UCQs and datalog are common target languages for query
rewriting.
      </p>
      <p>De nition 1. A datalog rewriting of a CQ Q w.r.t. an ontology O is a set of
datalog rules R s.t. for each instance I using only predicates from O we have
cert(Q; O [ I) = cert(R; I)
The rewriting R is a UCQ rewriting if it is a UCQ with query predicate Q whose
body atoms contain only predicates from O.</p>
      <p>
        Inference Rules An inference rule is a n+1 relation on clauses. We denote the
elements of such a relation as hc1; : : : cn; ci, and we call them inferences. We say
that an inference hc1; : : : cn; ci is sound if fc1; : : : cng j= c. An inference system
is a collection of inference rules. Proof of a clause c from a set of clauses N
w.r.t. is a sequence of clauses c1; : : : ; cm, s.t. c = cm and each ci is either an
element of N or else the conclusion of an inference by from N [ fc1; : : : ; ci 1g.
For a set of clauses N and a clause c, we denote with N ` c, if there exists a
proof of c from N using the rules of the inference system . A set of clauses N
is called saturated with respect to , and we denote it as N , if the conclusion
of any inference from N by is an element of N [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Rewriting Extended Ontologies</title>
      <p>In this section we present an algorithm for computing a rewriting of a query Q
w.r.t. an ontology O0, given a set R computed for the extraction of the initial
rewriting of Q w.r.t. an ontology O such that O O0. We specify the nature
of R according to the inference system used. Our goal is to reuse as much of
the information in R as possible, focusing on computing only the new elements
that are due to the information in O0 n O. The input data are assumed to be
consistent w.r.t. the input ontology O0 and under this assumption one can ignore
the constraint rules.</p>
      <p>The next example illustrates the key ideas behind the algorithms we will
present next.</p>
      <p>Example 1. Consider an ontology O consisting of the following clauses:
c1 = P (x; y)
c2 = S(x; f (x))</p>
      <p>S(x; y)
A(x)
and consider also the query Q = Q(x) S(x; y) ^ P (x; y). Applying QuOnto or
Rapid to compute a rewriting for Q w.r.t. O will produce the following inferences:
hQ; c1; Q1i, where Q1 = Q(x)
hQ1; c2; Q2i, where Q2 = Q(x)</p>
      <p>S(x; y)
A(x)
The set of queries R = fQ; Q1; Q2g consists a rewriting of Q w.r.t. O.</p>
      <p>Assume now that the original ontology O is revised by a domain expert
who adds the new clause c3 = S(x; f (x)) B(x), obtaining the new ontology
O0 = O [ fc3g. A rewriting for Q w.r.t. O0 consists of the set R0 = R [ fQ3g,
where Q3 = Q(x) B(x) which can again be computed using any
state-of-theart algorithm.</p>
      <p>However, in the process of computing R0 all systems we are aware of would
recompute also all queries in R0 n fQ3g although these have been computed
before. Instead, R0 can be computed from R by applying the inference rules of
a rewriting algorithm using only the newly added clauses. For example, by the
inference hQ1; c3; Q3i, we can obtain Q3 in one step, without recomputing Q1
and Q2. }</p>
      <p>The previous example suggests that to compute a rewriting for an extended
ontology we can only perform the new inferences that are \activated" by the
newly added clauses. Initially, these will be the inferences that contain in their
premises a clause from the new set of clauses. However, these inferences will
trigger new ones since their conclusions along with clauses from O0 may infer
new clauses, which again, in the same way, may \activate" new inferences, and
so forth until no new inferences can be triggered.</p>
      <p>The ability to e ciently compute a rewriting for an extended ontology given a
precomputed rewriting depends greatly on the inference system used to compute
the input rewriting. Many inference systems, like the ones that underpin Rabid
and QuOnto, consist of inference rules whose conclusion is always a CQ. Next,
we de ne formally this class of inference systems.</p>
      <p>De nition 2. A query-oriented inference rule is an inference rule of the form
hQ; c1; : : : ; cn; Q0i, where Q, Q0 are CQs and c1; : : : ; cn are clauses. A
queryoriented inference system is an inference system that consists of query-oriented
inference rules.</p>
      <p>
        However, the rewriting algorithms that rely on query-oriented inference
systems can only support ontologies of low expressivity, like DL-LiteR ontologies.
For more expressive ontologies, such as E LHI-ontologies, rewriting algorithms
that rely on di erent inference systems are required. As the following example
illustrates, one such system whose inference system does not satisfy De nition
2 is Requiem [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ].
      </p>
      <p>Example 2. Consider the ontology O of Example 1 and the query Q = Q(x)
R(x; y) ^ P (x; y). Requiem will initially compute the saturation of Q, O by
conducting the following inferences:
hc1; c2; c4i, where c4 = P (x; f (x))</p>
      <p>A(x);
hQ; c4; Q0i, where Q0 = Q(x)</p>
      <p>R(x; f (x)) ^ A(x)
obtaining the saturation set Rs = fc4; Q; Q0g [ O. Then, Requiem will return
the rewriting R = fQ; c1g of Q w.r.t. O by extracting the function-free subset
of Rs. Assume now that the knowledge in O is revised and we add the clause
c5 = R(x; y) P (x; y) hence obtaining the new ontology O0 = O [ fc5g. A
rewriting for Q w.r.t. O0 consists of the set R0 = fQ; Q1; c1; c5g, where Q1 =
Q(x) A(x).</p>
      <p>Suppose that we attempt to compute R0 from R and O0. Then, according
to the inference system that underpins Requiem, the inferences (2), (3) and the
inferences:
hc5; c4; c6i, where c6 = R(x; f (x))</p>
      <p>A(x)
hQ; c6; Q00i, where Q00 = Q(x)</p>
      <p>A(x) ^ P (x; f (x))
hQ0; c6; Q1i and
hQ00; c4; Q1i, where Q1 = Q(x)</p>
      <p>A(x)
will be performed to compute the new rewriting. In contrast to the previous
example, we observe that R0 cannot be computed from R, O0 without repeating
the intermediate inferences (2) and (3).</p>
      <p>However, we can avoid repeating these inferences by applying the inference
rules of Requiem to the set fc5g [ Rs. In this way, Requiem will compute R0 by
performing only the inferences (4), (5), (6) and (7).
}
The previous example suggests that there are query rewriting algorithms that
compute a rewriting by producing new intermediate clauses which may be
discarded from the output. It also illustrates that for such algorithms, the
rewriting of an extended ontology can be e ciently computed if, instead of the initial
rewriting R for a CQ Q and an ontology O, the saturation of the set Q [ O by
the inference system of the algorithm is provided. Intuitively, this is a reasonable
claim since a clause with functionals, which is not contained in the nal
rewriting, and a new clauses can trigger new inferences, crucial for the nal form of
the rewriting.</p>
      <p>Next we de ne formally the class of inference systems that these algorithms
are relied on.</p>
      <p>De nition 3. An axiom-oriented inference rule is an inference rule of the form
hc1; : : : ; cn; ci, where the set of clauses fc1; : : : ; cng contains at most one query
and c is either a query or a clause. An axiom-oriented inference system is an
inference system that consists of axiom-oriented inference rules.
3.1</p>
      <p>The Add Algorithm
As described previously, it is possible to compute a rewriting of a query Q w.r.t.
an ontology O0, given an inference system and a set of clauses R generated
(2)
(3)
(4)
(5)
(6)
(7)
Algorithm 1 Add(O; R; ON ; )</p>
      <sec id="sec-3-1">
        <title>Input: an ontology O, a set of clauses R, the set of new clauses ON ,</title>
        <p>system.</p>
        <p>Output: R0 new rewriting
an inference</p>
      </sec>
      <sec id="sec-3-2">
        <title>Add c to Rnew</title>
        <p>Pick clauses c01; : : : ; c0j 1 2 R, clauses c0j ; : : : ; c0k 1 2 ON , clauses
c0k; : : : ; c0m 2 O s.t. hc01; : : : ; c0m; c0i is an inference by .</p>
      </sec>
      <sec id="sec-3-3">
        <title>Add c0 to Rnew</title>
        <p>Pick clauses c010; : : : ; c0s0 1 2 Rnew, clauses c0s0; : : : ; c0t0 2 ON [ O [ R s.t.
hc010; : : : ; c0t0; c00i is an inference by .</p>
      </sec>
      <sec id="sec-3-4">
        <title>8: Add c00 to Rnew</title>
      </sec>
      <sec id="sec-3-5">
        <title>9: until no new clauses up to variable renaming are added to Rnew 10: return R0 = fc 2 Rnew [ R j c is function-freeg</title>
        <p>from Q and an ontology O, with O O0, by performing only the necessary new
inferences. The nature of the set R depends on the type of the inference system.
If is query-oriented then R constitutes a rewriting of Q w.r.t. O, while if
is axiom-oriented then R is the set (Q [ O) . It is reasonable to store R, as for
large ontologies its recomputation from scratch can be a very time consuming
process.</p>
        <p>Such a detailed algorithm that relies on a query-oriented or an axiom-oriented
inference system is depicted in Algorithm 1. Algorithm Add accepts as input the
ontology O, the set of clauses R, the set of new clauses ON = O n O and a sound
0
inference system . Then, the algorithm proceeds as follows. First, it initialises
a new set Rnew which will contain the new inferred clauses. Next, it attempts
to produce a new clause from R and ON via the inference system (line: 3).
The new clause is added to the set Rnew. However, the inference of the rst step
may not produce new clauses, as clauses from O do not necessarily appear in its
premises, although they may be required for this purpose. For instance, if R is
a UCQ rewriting then the clauses of O are not contained in R. For this reason,
the algorithm conducts an extra inference which contains in its premises clauses
from R and from both O and ON (line: 5). The algorithm adds the produced
clause to Rnew. Then, the algorithm adds to Rnew the conclusion of any inference
that has in its premises clauses from Rnew and from any of the sets ON , O, R
(line: 7). The algorithm iterates over these three types of inferences until no new
clauses can be produced up to variable renaming. When this process terminates,
the algorithm returns the function-free subset of Rnew [ R.</p>
        <p>It is easy to see that the worst-case complexity of Add is the same with
the complexity of the query rewriting system based on the inference system ,
since Add performs only inference rules of . Next we show the correctness of
Algorithm 1.</p>
        <p>Theorem 1. Let O be an ontology, let Q be a CQ and be a sound query
(resp. axiom)-oriented inference system. Let R be a UCQ rewriting for Q, O
(resp. R = (Q [ ON ) ) and let ON be a nite set of clauses. When applied to
O, R, ON and Algorithm 1 terminates. Let R0 be the set of clauses produced
by the algorithm; then, R0 is a UCQ (resp. datalog) rewriting for Q; O [ ON .
Proof. First we will show that the algorithm terminates. Since the rewriting of
Q w.r.t. O [ ON is nite and , on which Algorithm 1 is based on, is sound
we conclude that the algorithm does not produce in nite set of clauses up to
variable renaming. Also, given that it stops when no new clauses up to variable
renaming can be produced we conclude that the algorithm will terminate.</p>
        <p>It su ces to prove for each istance I that cert(R0; I) = cert(Q; O [ ON [ I).
It is obvious that cert(R0; I) cert(Q; O [ ON [ I), since the algorithm is based
on a sound inference system and hence, produces only sound clauses.</p>
        <p>Now we will prove that cert(Q; O [ ON [ I) cert(R0; I). Let R00 be a UCQ
(resp. datalog)-rewriting for Q, O [ ON resulted from a rewriting algorithm that
relies on the query (axiom)-oriented inference system . Since cert(Q; O [ ON [
I) = cert(R00; I), it su ces to prove that for every clause c s.t. R00 ` c it holds
that R0 ` c. Since R R0, we will prove this only for the clauses resulted from
a sequence of inferences that at least one of them contains in its premises clauses
from ON . The proof will be by induction.</p>
        <p>Suppose that c is produced by one inference, i.e. that c1; : : : ; ci 1 2 R,
ci; : : : ; cj 1 2 O, cj ; : : : ; cn 2 ON exist s.t. hc1; : : : ; ci; : : : ; cj ; : : : ; cn; ci is an
inference by . Then, it is obvious from the structure of the algorithm that either
c 2 R0 or there is a c0 2 R0 s.t. c0 is equivalent up to variable renaming with c,
i.e. R0 ` c. Suppose that c is produced after k inferences, i.e. Q [ O [ ON ` ck
and c1; : : : ; cn 1 2 O, cn; : : : ; cm 2 ON exist s.t. hck; c1; : : : ; cn; : : : ; cm; ci is an
inference by . Since ck 2 R0, from induction hypothesis, it is easy to conclude
from the structure of Algorithm 1 that either c 2 R0 or there is a c0 2 R0 s.t. c0
is equivalent up to variable renaming with c, i.e. R0 ` c tu</p>
        <p>A potential performance bottleneck of Algorithm 1 is that it may perform
unnecessary inferences. For example, if a clause c produced from the inference of
line 3 is subsumed from another clause of R or Rnew then every inference that
has in its premises c or any of its descendants is unnecessary since both c and its
descendants are redundant. Hence, in each of the lines 4, 6, 8 a produced clause
should be added to Rnew only if it is not subsumed from another clause of R
or Rnew. Also, the performance of the algorithm will be further optimised if we
execute the standard subsumption checking algorithm over the input set R and
then serve the resulted set, instead of R, as input to the algorithm.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Evaluation</title>
      <p>We have implemented Algorithm 1 enhanced with the optimisations described in
the previous section in a prototype tool called AddOnto. AddOnto also performs
subsumption checking before returning the nal rewriting. Our implementation
relies on the query rewriting system Requiem9. We have evaluated AddOnto tool
using both benchmark ontologies expressed in DL-LiteR and a realistic ontology
expressed in ELHI.</p>
      <p>
        Regarding DL-LiteR, we used the framework proposed in [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], which consists
of eight test ontologies together with a set of ve hand-crafted test queries for
each ontology. Concerning ELHI, we used an ELHI fragment (149 rules) of
the medical ontology GALEN (39,243 rules), together with ve manually
constructed queries. All experiments were conducted on an Intel(R) Core (TM) with
a 3.20GHz processor and 4GB of RAM.
      </p>
      <p>For the evaluation of our tool we proceeded as follows. Initially we removed
a rule r from each test ontology for every query. Next, we transformed the
rules of the contracted ontology to clauses obtaining the set O and we
computed the saturation R (since the inference system that underpins Requiem
is axiom-oriented) of Q [ O via . Then, we executed AddOnto with input
hO n ON ; R0; ON ; i, where the set ON contains the clauses that correspond to
the rule r and R0 is R after the subsumption checking and is computed o -line.
This process was repeated for each rule of the ontology, and we recorded the
mean time among the total set of its rules. Tables 1, 2 show the average
computation time (in ms) for every ontology and query. Since our implementation is
based on Requiem we compare our implementation against the standard
(nonmodi ed) version of Requiem. For Requiem we measured the time to compute
the rewriting of each query w.r.t. the whole respective ontology from scratch.
Note that both tools returned rewritings of the same size so we do not present
these numbers for brevity.
9 However, we plan to use other systems as well in the future.</p>
      <p>From the results demonstrated in the Tables 1 and 2, we note that in most
cases the time required to calculate the new rewriting is negligible. In half of the
DL-LiteR ontologies and queries (Table 1) AddOnto computes a new rewriting
almost instantaneously in less than 0.05 seconds. The results obtained for the
GALEN ontology were also encouranging (Table 2) and especially for the query
Q5 compared to the corresponding performance of Requiem. Concerning the
DL-LiteR ontologies, a large di erence compared to Requiem can be noticed in
P 5X as well as in ontologies U X and AX which are particularly hard. Note,
however, that we were not able to obtain results for ontology AX query Q5
as Requiem that we based AddOnto on did not terminate after 9 hours. It is
clear from both tables that AddOnto outperforms Requiem. This is an expected
result since AddOnto is provided with the saturation of (O n frg) [ Q and has
to compute only the new inferences resulted from the addition of r.</p>
      <p>Concerning the case of the ontology AX and the query Q5 we noticed in [19]
that there is a speci c rule (r98 = AssistiveDevice(x) ! Device(x)) in AX whose
removal reduces the size of the rewriting signi cantly. Hence, we removed this
rule from the ontology and we calculated with Requiem a rewriting of Q5 w.r.t.
AX n fr98g. The output minimal rewriting was computed in 29 seconds and
contained 2,546 CQs. Then, we executed AddOnto with ON = fr98g obtaining,
in 17 minutes, the nal minimal rewriting of Q5 w.r.t. AX, which contains 32,921
CQs. This result leads us to the conclusion that the rule r98 causes explosion of
the size of the rewriting. Also, we conclude that the order by which the rules are
taken during the resolution process is crucial for the e ciency of the algorithm.</p>
      <p>Although in all cases AddOnto outperforms Requiem, we notice that there
are some relatively hard cases for AddOnto. Such cases are the computation of
the rewriting of the queries Q4, Q5 w.r.t. ontology P 5X and of the rewriting
of the queries Q2, Q3, Q4 w.r.t. ontology AX. We will further investigate the
reasons for these time performances with graphs of the time performance vs the
added rule, in order to observe the behaviour of each rule separately.</p>
      <p>The graph of P 5X ontology that appears in Fig. 1 shows that the time
performance increases signi cantly when the rules r4 (AUX0(x; y) ! edge(x; y)),
r9 (AUX1(x; y) ! edge(x; y)) and r13 (AUX2(x; y) ! edge(x; y)) are added. This
happens because, as it was pointed in [19] these rules are crucial for the nal
form of the output rewriting, as when any of them was removed the size of the
rewriting was greatly decreased. This can be easily explained by observing that
Fig. 1. Time performance of AddOnto for the computation of the minimal rewriting
for ontologies P 5X and AX for CQs Q4, Q5 and Q2{Q4 respectively when an rule r
added.
the atoms AUX0(x; y), AUX1(x; y), AUX2(x; y) have many descendants in the
ontology, while the atom edge(x; y) appears in all test queries.</p>
      <p>Regarding AX ontology, we notice from the corresponding graph of Fig. 1
that for every added rule and every query, the time performance of AddOnto
is above a certain value. For instance, in the case of query Q3 the algorithm
requires more than 15 seconds to compute the new rewriting, for any ON . This
is a surprising result since it was shown in [19] that there are rules in AX, like
the rule r151 = Ability(x) ! 9y:AUX0(x; y)), that do not a ect the rewriting.
However, after further investigation of the time results of each subprocess, we
noticed that the process of the subsumption checking that is performed in the
end of AddOnto is mostly responsible for this behaviour. For instance, in the
case of Q4, when rule r151 is added, then 5,386 ms are required only for the
subsumption checking process. This can be explained by the large size (3,163
CQs) of the input set to the subsumption checking process.
5</p>
    </sec>
    <sec id="sec-5">
      <title>Conclusions</title>
      <p>In the current paper we have presented and studied a novel problem in the
area of query rewriting. More precisely, we have studied query rewriting of xed
queries over evolved ontologies|that is, over ontologies for which one or more
axioms have been added. We presented a practical algorithm which, given a
set of clauses R generated from an input query Q and an ontology O, and
given a set of axioms ON to be added to O, computes a rewriting R0 for Q,
O [ ON without recomputing the same clauses. Our algorithm is compatible
with rewriting calculi such as those underpinning Requiem, QuOnto, Naya and
Rapid. We have implemented and evaluated the algorithm over the rewriting
system Requiem and have obtained encouraging results.</p>
      <p>Regarding future work we plan to investigate the same problem under the
assumption that the new set of axioms may introduce inconsistencies in the
Knowledge Base. We also plan to further evaluate our algorithm rstly by using
larger and more realistic ontologies and secondly against other state-of-the-art
rewriting systems.
18. Rosati, R., Almatelli, A.: Improving query answering over DL-Lite ontologies. In:
Proceedings of the Twelfth International Conference on Principles of Knowledge
Representation and Reasoning (KR 2010) (2010)
19. Tsalapati, E., Stoilos, G., Stamou, G.B., Koletsos, G.: Query rewriting under
ontology contraction. In: Krotzsch, M., Straccia, U. (eds.) RR. Lecture Notes in
Computer Science, vol. 7497, pp. 172{187. Springer (2012)
20. Venetis, T., Stoilos, G., Stamou, G.: Incremental query rewriting for OWL 2 QL.</p>
      <p>In: Proceedings of the 25th International Workshop on Description Logics (DL
2012), Rome, Italy (2012)</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Bachmair</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ganzinger</surname>
          </string-name>
          , H.:
          <article-title>Resolution theorem proving</article-title>
          .
          <source>In: Robinson and Voronkov [17]</source>
          , pp.
          <volume>19</volume>
          {
          <fpage>99</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Baget</surname>
            ,
            <given-names>J.F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Leclere</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mugnier</surname>
            ,
            <given-names>M.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Salvat</surname>
          </string-name>
          , E.:
          <article-title>On rules with existential variables: Walking the decidability line</article-title>
          .
          <source>Arti cial Intelligence</source>
          <volume>175</volume>
          (
          <issue>9</issue>
          {10),
          <volume>1620</volume>
          {
          <fpage>1654</fpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Booth</surname>
          </string-name>
          , R., Meyer, T.,
          <string-name>
            <surname>Varzinczak</surname>
            ,
            <given-names>I.J.:</given-names>
          </string-name>
          <article-title>First steps in EL contraction</article-title>
          .
          <source>In: Proceedings of the Workshop on Automated Reasoning about Context and Ontology Evolution (ARCOE</source>
          <year>2009</year>
          )
          <article-title>(</article-title>
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Cal</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gottlob</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lukasiewicz</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Marnette</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pieris</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          : Datalog+/
          <article-title>-: A family of logical knowledge representation and query languages for new applications</article-title>
          .
          <source>In: Proceedings of the 25th Annual IEEE Symposium on Logic in Computer Science (LICS</source>
          <year>2010</year>
          ). pp.
          <volume>228</volume>
          {
          <issue>242</issue>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Calvanese</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Giacomo</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <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>
          :
          <article-title>Tractable reasoning and e cient query answering in description logics: The dl-lite family</article-title>
          .
          <source>J. Autom. Reason</source>
          .
          <volume>39</volume>
          (
          <issue>3</issue>
          ),
          <volume>385</volume>
          {429 (Oct
          <year>2007</year>
          ), http://dx.doi.org/10.1007/ s10817-007-9078-x
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Chortaras</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Trivela</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stamou</surname>
          </string-name>
          , G.:
          <article-title>Optimized query rewriting in OWL 2 QL</article-title>
          . In
          <source>: Proceedings of the 23rd International Conference on Automated Deduction (CADE 23)</source>
          , Polland. pp.
          <volume>192</volume>
          {
          <issue>206</issue>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Cuenca</given-names>
            <surname>Grau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            ,
            <surname>Kharlamov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Zheleznyakov</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          :
          <article-title>Ontology contraction: Beyond propositional paradise</article-title>
          .
          <source>In: Alberto Mendelzon International Workshop on Foundations of Data Management (AMW)</source>
          .
          <source>Ouro Preto</source>
          ,
          <source>Brazil (Jun</source>
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Goncalves</surname>
            ,
            <given-names>R.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Parsia</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sattler</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          :
          <article-title>Analysing multiple versions of an ontology: A study of the nci thesaurus</article-title>
          . In: Rosati,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Rudolph</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Zakharyaschev</surname>
          </string-name>
          , M. (eds.)
          <article-title>Description Logics</article-title>
          .
          <source>CEUR Workshop Proceedings</source>
          , vol.
          <volume>745</volume>
          .
          <string-name>
            <surname>CEUR-WS.org</surname>
          </string-name>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Gottlob</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Orsi</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pieris</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Ontological queries: Rewriting and optimization</article-title>
          .
          <source>In: Proceedings of the 27th International Conference on Data Engineering</source>
          ,
          <string-name>
            <surname>ICDE</surname>
          </string-name>
          <year>2011</year>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Imprialou</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stoilos</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grau</surname>
            ,
            <given-names>B.C.</given-names>
          </string-name>
          :
          <article-title>Benchmarking ontology-based query rewriting systems</article-title>
          .
          <source>In: Proceedings of the Twenty-Sixth AAAI Conference on Arti cial Intelligence (AAAI</source>
          <year>2012</year>
          ). AAAI Press (
          <year>July 2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Kondylakis</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Plexousakis</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Ontology evolution without tears</article-title>
          .
          <source>Web Semantics: Science, Services and Agents on the World Wide Web</source>
          <volume>19</volume>
          (
          <issue>2</issue>
          ) (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Lutz</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>The complexity of conjunctive query answering in expressive description logics</article-title>
          .
          <source>In: Proceedings of the 4th International Joint Conference on Automated Reasoning</source>
          ,
          <string-name>
            <surname>IJCAR</surname>
          </string-name>
          <year>2008</year>
          . pp.
          <volume>179</volume>
          {
          <issue>193</issue>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Orsi</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pieris</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Optimizing query answering under ontological constraints</article-title>
          .
          <source>Proceedings of the VLDB Endowment</source>
          <volume>4</volume>
          (
          <issue>11</issue>
          ),
          <volume>1004</volume>
          {
          <fpage>1015</fpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Perez-Urbina</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Horrocks</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Motik</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>E cient query answering for OWL 2</article-title>
          .
          <source>In: Proc. of the Int. Semantic Web Conference (ISWC2009)</source>
          . Chantilly,
          <string-name>
            <surname>VA</surname>
          </string-name>
          , USA. (
          <year>October 2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Perez-Urbina</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Motik</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Horrocks</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          :
          <article-title>Tractable query answering and rewriting under description logic constraints</article-title>
          .
          <source>Journal of Applied Logic</source>
          <volume>8</volume>
          (
          <issue>2</issue>
          ),
          <volume>186</volume>
          {
          <fpage>209</fpage>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Ribeiro</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wassermann</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Antoniou</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Flouris</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pan</surname>
          </string-name>
          , J.:
          <article-title>Belief contraction in web-ontology languages</article-title>
          .
          <source>In: Proceedings of the 3rd International Workshop on Ontology Dynamics (IWOD-09)</source>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Robinson</surname>
            ,
            <given-names>J.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          . (eds.):
          <article-title>Handbook of Automated Reasoning (in 2 volumes)</article-title>
          .
          <article-title>Elsevier and</article-title>
          MIT Press (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>