<!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>Practical Datalog Rewriting for Existential Rules</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Zhe Wang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Peng Xiao</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Kewen Wang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Gri th University</institution>
          ,
          <country country="AU">Australia</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Existential rules is an expressive ontology formalism for ontologymediated query answering and as a trade-o , query answering is of high complexity, while several tractable fragments have been identi ed. Existing systems are based on rst-order rewriting methods and the resulting queries can be too large for DBMS to handle. It is shown that datalog rewriting can result in more compact queries but the previous study is mostly theoretical. A practical datalog rewriting algorithm is still missing. In this paper, we ll the gap by proposing a practical datalog rewriting algorithm for conjunctive query answering over existential rules, and establish its correctness over well known fragments of existential rules. Experiments on our prototype system showed superior or comparable performance over state-of-the-art systems on both the compactness of rewritings and the e ciency of query answering.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Existential rules (a.k.a. Datalog and tuple generating dependencies) [2, 6] is a family
of expressive ontology languages. It attracted intensive interest lately due to its
expressive power covering datalog and many Horn description logics, including the core
dialects of DL-Lite and E L [5], which underlay the OWL 2 Pro les. This makes
existential rules an appealing formalism for ontology-mediated query answering. While
the query answering problem is undecidable over the full formalism, several interesting
fragments have been proposed [4, 6, 17] that support tractable query answering.</p>
      <p>A major approach for query answering over ontologies expressed in description
logics or existential rules is query rewriting. Given an ontology and a query q, a
rewriting method transforms them into another query q , which is sometimes in a
di erent query formalism, such that answering q can be handled by conventional
database management systems (DBMSs) and at the same time preserves the
answers to the original ontology-mediated query. The rewriting approach is particularly
promising as it allows ontology-mediated query answering to be implemented on top
of existing highly-optimised database query engines. While many algorithms and
systems have been developed for various description logics [18, 7, 25, 23], particularly for
DL-Lite and E L [15, 20, 22, 12], it is challenging to extend them to more general
existential rules, as existential rules allow predicates of arbitrary arities (instead of only
unary and binary predicates) and variable permutations in the rules.</p>
      <p>Existing systems for query answering over existential rules are typically based on
rst-order rewritings [8, 13, 14], i.e., q is a rst-order query. A limitation of such
an approach is that it can only handle ontologies and queries that are rst-order
rewritable. Well-accepted rst-order rewritable classes are the linear and sticky
existential rules [6]. Yet many practical ontologies do not necessarily fall into these classes,
such as some ontologies formulated in E L. Even for ontologies and queries that are
rst-order rewritable, the results of rewriting can su er from a signi cant blow-up
and become di cult for DBMSs to handle [19].</p>
      <p>On the other hand, taking datalog as the target query language can lead to much
more compact rewritings and it is shown for description logics that executing
(nonrecursive) datalog rewritings is much more feasible for DBMSs than equivalent
rstorder rewritings [12]. All ontologies and queries that are rst-order rewritable are
trivially datalog rewritable, and more datalog rewritable classes are known, such as
the guarded existential rules [9]. However, existing research on datalog rewriting of
existential rules are mostly theoretical [10, 3] (refer to [1] for a detailed discussion).
While several algorithms and systems have been developed for datalog rewriting for
various description logics [7, 12], to the best of our knowledge, a practical system is
still missing for datalog rewriting over more general existential rules.</p>
      <p>In this paper, we ll the gap by presenting both a practical algorithm and a
prototype system for datalog rewriting and query answering over existential rules. Our
algorithm is based on the notion of unfolding [24] and the observation that unfolding
can generate a datalog rewriting whenever it exists. Yet instead of naive unfolding,
to achieve compactness of rewriting, we separate the results of unfolding into short
rules by introducing fresh predicates and reusing such predicates when possible. Such a
separation technique not only reduces the length of generated rules but also facilitates
structure sharing (via the reuse of predicates). While such a rewriting process may
not terminate, we move on to identify classes of ontologies where the rewriting process
terminates and produce correct datalog rewritings, including both a novel class and
several existing well-accepted classes. After that, we introduce a practical algorithm
for computing the datalog rewriting through constructing rewriting graphs, which
again facilitates structure sharing and can be seen as a decomposed representation of
rewritings. Finally, we implemented our algorithm as a prototype system and evaluate
it against the state-of-the-art systems for both existential rules and description logics
on commonly used benchmark ontologies and queries.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <p>Let Nc, Nn, and Nv be disjoint, countably in nite sets of constants, (labelled) nulls,
and variables respectively. A term is either a constant, null, or variable. We assume
standard rst-order logic notions, such as predicates, (ground) atoms, formulas,
entailment (j=) and equivalence ( ). An instance is a (possibly in nite) set of atoms
that contains only constants and nulls. A dataset is a nite ground instance. For a
formula or an instance ', var(') denotes the variables in '.</p>
      <p>An existential rule (or a rule) r is a formula of the form
8x:8y:[9z:'(x; z)
(x; y)]
where x, y and z are pairwise disjoint vectors of variables, and '(x; z) and (x; y)
are conjunctions of atoms with variables from respectively x [ z and x [ y. We assume
rules do not contain constants. Variables in x are called frontier variables, denoted
fr(r). and those in z are called existential variables, denoted ext(r). Formula ' is the
head of the rule r, denoted head(r), and formula is the body of r, denoted body(r);
again, they can be seen as (existentially quanti ed conjunctions of) sets of atoms. For
brevity, universal quanti ers in a rule are often omitted, and we sometimes express
rule r as head(r) body(r). A datalog rule r is an existential rule whose head consists
of a single atom and ext(r) is empty.</p>
      <p>A conjunctive query (CQ) q is a rst-order formula of the form 9y:'(x; y), where
x and y are tuples of variables and is a conjunction of atoms containing only
constants and variables from x [ y. Sometimes it is convenient to treat it as a datalog
rule Q(x) '(x; y) where Q is a fresh predicate with arity jxj. If x is empty then q
is a Boolean CQ (BCQ). Answering CQs can be reduced to that of BCQs and hence
w.l.o.g. we consider only BCQs in this paper. For convenience, we assume a xed
renaming between variables and labelled nulls, which allows us to identify a BCQ
with the set of its atoms where all the variables are renamed as nulls, and vice versa.
A union of BCQs (UCQ) is a disjunction of BCQs, which is seen as a nite set of
nite instances.</p>
      <p>An ontology-mediated query (OMQ) is a pair Q = ( ; q) with a nite set of
rules and q a BCQ. The answer of Q over a dataset D is true if [ D j= q, and false
otherwise. A datalog rewriting of an OMQ ( ; q) is a of the form ( ; Q) where is a
datalog program and Q is a nullary predicate, such that for any dataset D, [ D j= q
i [ D j= Q. We call it a strong datalog rewriting if additionally [ fqg j= . Q
is the query predicate of q and sometimes denoted as Qq. When consists of only
non-recursive datalog rule with Q in their heads, the rewriting is a UCQ rewriting.</p>
      <p>The UCQ rewriting of OMQs can be obtained through the notion of piece uni
cation for a given BCQ q and a rule r [16]. First, for a subset q0 of q, a variable occurring
both in q0 and in q n q0 is a separating variable for q0 in q. A piece uni er of q and r is
a triple = (B; H; ), where ; B q, H head(r), and is a most general uni er
between B and H such that the following condition is satis ed for each z 2 ext(r): If
a term t (t 6= z) in B [ H is uni ed with z, i.e., z = t , then t is not a separating
variable for B in q.</p>
      <p>For a set X of variables and a substitution , jX denotes the restricted
substitution to domain X. Another substitution 0 is a safe extension of jX on a set of
variables Y , if 0 coincides with jX and for each y 2 Y , y 0 is a fresh variable.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Datalog Rewriting for OMQs</title>
      <p>In this section, we will introduce a compact datalog rewriting approach, based on the
notion of unfolding for existential rules [24]. A rule r can be unfolded by a rule r0 if
there exists a piece uni er = (B; H; ) of body(r) and r0, and the result of unfolding
r by r0 with is the following rule denoted unf (r; r0):
where 0 is a safe extension of jvar(H) on var(r0) n var(H), 00 is a safe extension of
jfr(r) on ext(r), and z consists of all the variables in the head but not in the body.
The result of exhaustive unfolding for is denoted unfold( ).</p>
      <p>Note that if a strong datalog rewriting exists for an OMQ, then there exists a
subset of its unfolding that consists of datalog rules and is such a datalog rewriting.</p>
      <sec id="sec-3-1">
        <title>Lemma 1. For an OMQ ( ; q), a strong datalog rewriting exists i there exists a</title>
        <p>nite subset unfold( [ fqg) such that ( ; Qq) is such a datalog rewriting.</p>
        <p>Clearly, a naive method to compute a datalog rewriting using the above unfolding
is impractical, as the datalog rules obtained from unfolding can be very large (indeed,
are often of unbounded sizes). In what follows, we introduce a practical approach for
datalog rewriting by breaking up long datalog rules into smaller ones. It is known that
every OMQ ( ; q) can be transformed into an OMQ ( 0; q) whose rule heads have
single atoms in a way that preserves query answering [8]. For convenience, in what
follows, we assume consists of rules of single-atom heads. As a rst step, we present
an alternative operator, which we simply call rewriting, between two existential rules.
De nition 1. For two rules r; r0 and a piece uni er = (B; H; ) of body(r) and
r0, the result of rewriting r by r0 with , denoted rew (r; r0), consists of the following
rules</p>
        <p>
          P(xr0 )
R(v) for each
2 head(r) 00 [ head(r0) 0;
where 0; 00 are as in Equation (
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), v is a tuple of variables in head(r) 00 [ head(r0) 0,
z consists of all the variables in the head but not in the body, and P and R are fresh
predicates with arities jxr0 j and jvj.
        </p>
        <p>
          Note that rule (
          <xref ref-type="bibr" rid="ref5">5</xref>
          ) can be captured by rules (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) and (
          <xref ref-type="bibr" rid="ref4">4</xref>
          ), yet it is included for the
correctness of rewriting in some cases. We mark rule (
          <xref ref-type="bibr" rid="ref5">5</xref>
          ) as temporary which will be
deleted after the rewriting is completed, and we will discuss in next section when the
generation of such temporary rules are not necessary. Also, for rules of the form (
          <xref ref-type="bibr" rid="ref3">3</xref>
          )
that are not datalog rules, we also mark them for deletion.
        </p>
        <p>We can use rew (r; r0) to replace unf (r; r0) in the unfolding of rules and it is not
hard to see that the resulting set of rules are equivalent w.r.t. query answering. Indeed,
if we allow fresh predicates P and R to be further unfolded, then the rewriting process
generates strictly more rules than unfold( ). However, it is clear that allowing the
unfolding of fresh predicates forfeits their purpose, as they were introduced to break
up long rules and their unfolding simply reverses it. Hence, it is natural to disallow
unfolding of such fresh predicates.</p>
        <p>Furthermore, it also does not make sense to introduce a di erent fresh predicate
each time when the \same" piece uni er, i.e., up to variable renaming, is applied.
This is achieved through a label function ( ) that maps each fresh predicate to a set
of atoms. Formally, for predicates P and R in De nition 1, (P) = H = head(r0) 0
and (R) = (head(r)) 00 [ (head(r0)) 0, where (A(x)) = A(x) if A is a (non-fresh)
predicate occurring in the initial rules and otherwise (A(x)) = (A).</p>
        <p>
          Finally, special handling for rewriting a query q by another rule r0 is needed.
In particular, the handling of head atoms is simpler, such that rew (q; r0) replaces
rules (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ){(
          <xref ref-type="bibr" rid="ref5">5</xref>
          ) with the following rules
        </p>
        <p>
          Q
Q
(body(q) n B) [ fP(xr0 ) g;
(body(q) n B) [ body(r0) 0:
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )
(
          <xref ref-type="bibr" rid="ref3">3</xref>
          )
(
          <xref ref-type="bibr" rid="ref4">4</xref>
          )
(
          <xref ref-type="bibr" rid="ref5">5</xref>
          )
(
          <xref ref-type="bibr" rid="ref6">6</xref>
          )
Again, rule (
          <xref ref-type="bibr" rid="ref7">7</xref>
          ) can be captured by rules (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) and (
          <xref ref-type="bibr" rid="ref6">6</xref>
          ), yet it is included for the
correctness of rewriting in some cases. It is also temporary rules to be deleted after the
rewriting is completed.
        </p>
        <p>We are ready to de ne the rewriting of a set of existential rules .</p>
        <p>
          De nition 2. The rewriting of a set of existential rules , denoted rewrite( ) is
the (possibly in nite) set of rules obtained by exhaustively applying rewriting between
each pair of rules r; r0 as in De nition 1 under the following conditions and by deleting
temporary and non-datalog rules at the end:
{ H does not contain any fresh predicate;
{ If r is a query (i.e., has Q in the head), its rewriting follows (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ), (
          <xref ref-type="bibr" rid="ref6">6</xref>
          ) and (
          <xref ref-type="bibr" rid="ref7">7</xref>
          );
{ For each introduced fresh predicate A 2 fP; Rg in an atom of the form A(x), if
there is an atom A0(x0) with A0 another fresh predicate of the same type introduced
in previous rewriting steps such that there is a most general uni er between (A)
and (A0) with x = x0 , then reuse A0 to replace A.
{ Eliminate rule r if there is another rule r0 and a homomorphism from body(r0)
to body(r) such that a safe extension 0 of exists with head(r0) 0 = head(r).
        </p>
        <sec id="sec-3-1-1">
          <title>We use rewritejR( ) (resp., rewriteR( )) with R f(2); : : : ; (7)g to denote the</title>
          <p>variant of rewrite( ) where temporary rules in R are not generated (resp., only rules
in R are generated) during rewriting.</p>
          <p>Example 1. Consider 1 = fr1 : B(y) A(x; y); r2 : 9y:A(x; y) B(x)g and q =
Q A(x; y) ^ A(y; z). The (one step) rewriting of r1 by r2 results the following rules:
r3 : P1(x)
r6 : B(y)</p>
          <p>B(x);
r4 : 9y:R1(x; y)</p>
          <p>P1(x);
R1(x; y); r7 : 9y:[A(x; y) ^ B(y)]</p>
          <p>P1(x);
r5 : A(x; y)</p>
          <p>R1(x; y);
where (P1) = fA(x; y)g and (R1) = fA(x; y); B(y)g.</p>
          <p>Rewriting q by r2, by r1, and then by r2 leads to (not a complete list of) rules:
r8 : Q
r10 : P2(y)
r13 : Q</p>
          <p>P1(x);</p>
          <p>A(z; y);
A(x; y) ^ P1(y); r9 : Q</p>
          <p>A(x; y) ^ B(y);
r11 : Q
r14 : Q</p>
          <p>A(x; y) ^ P2(y); r12 : Q</p>
          <p>A(x; y) ^ A(z; y);</p>
          <p>B(x):
Note that P1 is reused; also, rules r13 and r14 cannot be obtained without keeping
temporary rules r9 and r12 during the rewriting.</p>
          <p>
            Now we establish the soundness and completeness of our datalog rewriting.
Proposition 1. For an OMQ Q = ( ; q), let = rewrite(
rewritej(
            <xref ref-type="bibr" rid="ref5">5</xref>
            )( [ fqg) or = rewritej(
            <xref ref-type="bibr" rid="ref7">7</xref>
            )( [ fqg)). If is
datalog rewriting of Q.
          </p>
          <p>[ fqg) (resp., =
nite then ( ; Qq) is a
Proof (Sketch). We want to show for each dataset D, [D j= q i [D j= Qq. First,
we only need to establish \if" direction for = rewrite( [fqg), which can be checked
inductively through the unfolding of rules in . In particular, consider the unfolding
of (reused) fresh predicates in two rules r1 and r2 of the form Q B1 [ fA(x)g and
A(x) B2, where A is a fresh predicate and B1; B2 do not contain fresh predicates.
Suppose (A) = H(y; z) with some substitution such that y = x, then by the
de nition of rewriting and unfolding, there are rules (up to variable renaming) Q
B1 [ H0 with H0 H and H B2 from unfold( [ fqg). Note that the predicate
reuse condition in De nition 2 ensures that H0 is a piece for uni cation. Thus, the
result of unfolding r1 by r2 is in unfold( [ fqg). This can be extended to the cases
where B1; B2 contain fresh predicates.</p>
          <p>
            Also, we only need to show the \only if" direction for = rewritej(
            <xref ref-type="bibr" rid="ref5">5</xref>
            )( [ fqg)
and = rewritej(
            <xref ref-type="bibr" rid="ref7">7</xref>
            )( [ fqg), and we only need to show for each rule r 2 unfold( [
q ) with head Q, r also occurs in unfold( ) (up to variable renaming). We only
f g
demonstrate the proof for = rewritej(
            <xref ref-type="bibr" rid="ref7">7</xref>
            )( [ fqg). We show this by an induction on
forward chaining, i.e., consider an unfolding chain: (i) r1; : : : ; rn 2 [ fqg, (ii) for
i 2, ri;:::;1 is the result of unfolding ri by ri 1;:::;1, and (iii) rn = q. For the rst two
rules r1; r2 in the chain, r2;1 is of the form (
            <xref ref-type="bibr" rid="ref1">1</xref>
            ), and it has corresponding results of
rewriting, rules (
            <xref ref-type="bibr" rid="ref5">5</xref>
            ) and (
            <xref ref-type="bibr" rid="ref2">2</xref>
            ), denoted r2;1 and r2(2;1). The head of r2;1 is preserved in r2;1
(
            <xref ref-type="bibr" rid="ref5">5</xref>
            ) (
            <xref ref-type="bibr" rid="ref5">5</xref>
            )
for further unfolding and the body of r2;1 can be reconstructed through (unfolding)
r2(5;1) and r2(2;1). For each rule ri (i 2), there is a rule ri(;5:)::;1 in the process of rewriting
(
            <xref ref-type="bibr" rid="ref5">5</xref>
            ) (
            <xref ref-type="bibr" rid="ref2">2</xref>
            ) (
            <xref ref-type="bibr" rid="ref5">5</xref>
            )
that rewrites it to ri;:::;1 and ri;:::;1, such that the head of ri;:::;1 is preserved in ri;:::;1
for further unfolding and the body of ri;:::;1 can be reconstructed through (unfolding)
ri;:::;1 and ri(;2:)::;1. Finally, the body of rn;:::;1 can be reconstructed by unfolding rn(5;:)::;1
(
            <xref ref-type="bibr" rid="ref5">5</xref>
            )
and ri(;2:)::;1 for all 1 i n in . That is, r = rn;:::;1 is in unfold( ).
4
          </p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Datalog Rewritable Classes</title>
      <p>The process of rewriting introduced in the previous section does not necessarily
terminate; for example, it does not terminate on 2 = f9z:A(z; x) A(x; y)g. It is not
hard to see that the termination issue is caused by the generation of temporary rules.
If we disallow the generation of temporary rules, the rewriting always terminates.</p>
      <sec id="sec-4-1">
        <title>Lemma 2. For a set of rules</title>
        <p>nates and the result is nite.</p>
        <p>
          , the computation of rewritej(
          <xref ref-type="bibr" rid="ref5">5</xref>
          );(
          <xref ref-type="bibr" rid="ref7">7</xref>
          )( ) always
termiThis can be seen as follows. Suppose the maximum number of atoms in the initial
rule bodies is m. For each rule of the forms (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ){(
          <xref ref-type="bibr" rid="ref4">4</xref>
          ) and (
          <xref ref-type="bibr" rid="ref6">6</xref>
          ), it has a single atom head
and its body has at most m atoms. Also, for each fresh predicate P, (P) consists of a
single head atom of an initial rule (up to variable renaming). Similarly, for each fresh
predicate R, (R) consists of at most m head atoms of initial rules, as each rewriting
step may add one atom to the head and rule (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) can be rewritten at most m times
(noting that unfolding of fresh predicates is disallowed).
        </p>
        <p>In what follows, we discuss several classes of rules on which ( nite) datalog
rewritings can be obtained by restricting the generation temporary rules. We start by de
ning a novel class called separable rule sets, which is through adapting a marking
procedure from [17].</p>
        <p>We use zr to denote an existential variable z in rule r. For a set of rules , an atom
and a variable x occurring at position i in , we mark the position with a minimum
set of variables M (i; ) satisfying the following conditions: (i) if head(r) = for some
r 2 with x 2 ext(r) then M (i; ) = fxrg; (ii) if head(r) = for some r 2 with
x 2 fr(r) then M (i; ) is the intersection of all M (j; ) s.t. 2 body(r) and x occurs
at position j in atom ; (iii) if 2 body(r) then M (i; ) is the union of M (i; head(r0))
for all r0 2 s.t. r can be unfolded by r0 with uni ed with head(r0).</p>
        <sec id="sec-4-1-1">
          <title>De nition 3. A set of rules is separable if for each rule r 2 , there do not exists</title>
          <p>a variable x shared by two body atoms such that the intersection of all M (i; ), for
each atom 2 body(r) and each position i that x occurs in , is non-empty.
It is not hard to see that 2 is separable.</p>
          <p>The class of shy rule sets is proposed in [17]. Intuitively, a set of rules is shy if no
existential variable occurs in a position of a relation where a join variable occurs in a
rule body, neither can two variables occurring in such (existential-variable) positions
of the body also occur in the same head atom.</p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>Proposition 2. Each rule set that is shy is also separable.</title>
        <p>This can be seen from that any rule set violating separability also violates Condition 1
of shyness [17]. However, the converse of the proposition is not necessarily true and
2 [ fB(x; y) A(x; u) ^ A(y; v)g is such a case.</p>
      </sec>
      <sec id="sec-4-3">
        <title>Proposition 3. For a OMQ ( ; q) such that</title>
        <p>
          fqg) is a datalog rewriting of ( ; q).
[ fqg is separable, rewrite(
          <xref ref-type="bibr" rid="ref2">2</xref>
          );(
          <xref ref-type="bibr" rid="ref6">6</xref>
          )(
[
Intuitively, the proof is based on the fact that the unfolding of rules in [ fqg only
involves a single atom in the body each time, and thus the result of unfolding can be
reconstructed from the result of rewriting even if the bodies are separated.
        </p>
        <p>The class of sticky rule sets is introduced in [6], which are shown to be rst-order
rewritable. The key idea is that fresh variable generated during backward chaining
cannot occur in two separate atoms [21]. The two classes of sticky and separable rules
are incomparable; for instance, 3 = fA(x; y) A(x; z) ^ A(z; y)g is separable but
not sticky, and 1 [ fC(x; y; z) A(x; y) ^ A(y; z)g (where 1 is from Example 1) is
sticky but not separable.</p>
      </sec>
      <sec id="sec-4-4">
        <title>Proposition 4. For a OMQ ( ; q) such that</title>
        <p>
          a datalog rewriting of ( ; q).
is sticky, rewrite(
          <xref ref-type="bibr" rid="ref2">2</xref>
          );(
          <xref ref-type="bibr" rid="ref6">6</xref>
          );(
          <xref ref-type="bibr" rid="ref7">7</xref>
          )(
[ fqg) is
Indeed, the proposition holds for all nite uni cation sets [2], as the backward chaining
always terminates on such rule sets and hence rewrite(
          <xref ref-type="bibr" rid="ref2">2</xref>
          );(
          <xref ref-type="bibr" rid="ref6">6</xref>
          );(
          <xref ref-type="bibr" rid="ref7">7</xref>
          )( [ fqg) (in particular,
rules of the form (
          <xref ref-type="bibr" rid="ref7">7</xref>
          )) is nite. Moreover, if we disallow the reuse of fresh predicates,
the resulting datalog rewriting is a non-recursive one.
        </p>
        <p>Finally, we are also interested in the class of acyclic rule sets, for which various
notions of acyclicity have been proposed [11], which guarantees the termination of
forward chaining (i.e., on certain chase procedures).</p>
      </sec>
      <sec id="sec-4-5">
        <title>Proposition 5. For a OMQ ( ; q) such that</title>
        <p>
          datalog rewriting of ( ; q).
is acyclic, rewritej(
          <xref ref-type="bibr" rid="ref7">7</xref>
          )(
[ fqg) is a
It can be seen from that the acyclicity conditions guarantee the Skolem chase
terminates on critical instances [11], which avoids the generation of in nitely many
Skolemised terms. In our case, it avoids the generation of in nitely many
existential variables in the heads of rules (
          <xref ref-type="bibr" rid="ref5">5</xref>
          ), whereas the sizes of their bodies are always
bounded. Hence, the number of such rules is nite, and rewritej(
          <xref ref-type="bibr" rid="ref7">7</xref>
          )( [ fqg) is nite.
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>A Rewriting Algorithm</title>
      <p>
        In this section, we introduce a practical algorithm for computing datalog rewritings
of the form rewritej(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )( ), which can be con gured to compute rewritej(
        <xref ref-type="bibr" rid="ref5">5</xref>
        );(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )( ) and
rewrite(
        <xref ref-type="bibr" rid="ref2">2</xref>
        );(
        <xref ref-type="bibr" rid="ref6">6</xref>
        );(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )( ). It can also be easily adapted to compute rewritej(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )( ). Inspired
by [12], we compute a decomposed representation of the heads and bodies of the
resulting rules from unfolding, such that (i) the representation is compact due to structure
sharing, (ii) the datalog rewriting rewritej(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )( ) can be conveniently extracted from
such a representation, and (iii) the complete rules from unfolding (e.g., rule (
        <xref ref-type="bibr" rid="ref7">7</xref>
        )) can
be reconstructed via backtracking.
      </p>
      <p>
        For a set of rules whose maximum number of body atoms is m, we de ne a
rewriting graph to be a direct graph (N; E) whose nodes in N are of the form (R; I),
where R and I each consists of at most m atoms, and whose edges in E are labelled
with piece uni ers. Each node n = (R; I) is associated with two fresh predicates Pn
and Rn, and we reuse fresh predicates as in Section 3 through a label function ( ).
For each node n = (R; I), let un = fr(R I) and vn = var(R). Intuitively, an edge
from node n = (R; I) to node n0 = (R0; I0) labelled with = (B; H; ) represents a
set of rules (i.e., rules (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ){(
        <xref ref-type="bibr" rid="ref4">4</xref>
        ) and (
        <xref ref-type="bibr" rid="ref6">6</xref>
        )) obtained during rewriting as follows:
Pn0 (un0 )
      </p>
      <p>
        I0;
9z:Rn0 (vn0 )
(I n B) [ fPn0 (un0 )g;
Rn0 (vn0 ) for each
2 R0;
corresponding to (
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
corresponding to (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) and (
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
corresponding to (
        <xref ref-type="bibr" rid="ref4">4</xref>
        )
where z consists of all the variables in the head but not in the body. For a rewriting
graph G, dlg(G) is the set of datalog rules obtained as above from the edges of G.
      </p>
      <p>
        Now, we present the algorithm for computing rewriting graphs. Note that similar
as the rule elimination in De nition 2, for a new node n = (R; I), if there is an existing
node n0 = (R0; I0) and a homomorphism from I0 to I such that a safe extension 0
of exists with R R0 0, then n should be eliminated. In Algorithm 1, actions with
a are subject to the reuse of fresh predicates and node elimination. Also, 0 and 00
denote safe extensions of as in Equation (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ).
      </p>
      <p>
        In Algorithm 1, we rst initialise the nodes to be the pairs of heads and bodies
of existing rules (line 2) and use a queue to store the nodes representing rules
to be rewritten (line 4 onwards). Since a piece uni er cannot contain a fresh
predicate (by De nition 2 and guaranteed in line 7), only original rules or rules of the
forms (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ), (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ), (
        <xref ref-type="bibr" rid="ref6">6</xref>
        ) and (
        <xref ref-type="bibr" rid="ref7">7</xref>
        ) need to be rewritten, and only original rules or rules of
the form (
        <xref ref-type="bibr" rid="ref4">4</xref>
        ) with head can rewrite such rules. Lines 9{21 are the rewriting process,
with lines 10{12 corresponding to the rewriting of an original rule or a rule (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ), and
lines 13{15 corresponding to that of rules (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) and (
        <xref ref-type="bibr" rid="ref6">6</xref>
        ). The rewriting produces 2 new
node (subject to predicate reuse and node elimination): node n00 represents the
generated rules (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ){(
        <xref ref-type="bibr" rid="ref4">4</xref>
        ) and (
        <xref ref-type="bibr" rid="ref6">6</xref>
        ), and is added to N . It is added to the queue for the further
rewriting of rule (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ); node ny is not added to N but is added to the queue for the
further rewriting of rules (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) and (
        <xref ref-type="bibr" rid="ref6">6</xref>
        ). Note that temporary rules of the form (
        <xref ref-type="bibr" rid="ref7">7</xref>
        ) need
to be generated to ensure the correctness. The generation of their representations is
achieved through backtracking (lines 22{27). It is not hard to verify that rule (
        <xref ref-type="bibr" rid="ref7">7</xref>
        )
corresponds to 9z:Rn(vn) S.
      </p>
      <p>We establish the correctness of Algorithm 1 as follows.
Algorithm 1: Compute Rewriting Graphs
input : A set of existential rules
output: A rewriting graph (N; E)
1 begin
2 initialise N := f(head(r); body(r)) j r 2 g and E := ;;
3 assign fresh predicates Pn; Rn to each n = (R; I) 2 N with (Pn) = (Rn) = R;
4 let be a queue and initially := N ;
5 while 6= ; do
6 take n = (R; I) popped from ;
7 foreach n0 = (R0; I0) 2 N and 2 R0 containing no fresh predicate do
8 consider rule r := I0;
9 foreach piece uni er = (B; H; ) of I and r do
10 if n 2 N then
11 take n00 := (R00; I0 0) where R00 = R 00 [ f 0g if R is a singleton;
otherwise R00 = fPn(un) 00; 0g;
12 assign a fresh predicate Rn00 and let (Rn00 ) := (Pn) 00 [ f 0g;
13
14
15</p>
      <sec id="sec-5-1">
        <title>Theorem 1. For a set of rules , if rewritej(5)( ) is nite then Algorithm 1 computes a nite rewriting graph G such that dlg(G) rewritej(5)( ).</title>
        <p>6</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Experiments</title>
      <p>We have implemented a prototype system Drewer (Datalog REWriting for Existential
Rules), where the piece uni cation implementation is adapted from the rst-order
rewriting system Graal [13], and used RDFox1 as the datalog engine. We conducted
two set of experiments to evaluate the performance of our system. All experiments
were performed on a desktop machine with a processor at 3.30 GHz and 8GB of RAM.
1 https://www.cs.ox.ac.uk/isg/tools/RDFox/</p>
      <p>In the rst set of experiments, we compared our system with state-of-the-art query
rewriting systems regarding the compactness and e ciency of query rewriting. In
particular, Graal is a rst-order rewriting system for existential rules, Iqaros [23] is a
rst-order rewriting system for OWL 2 DL featured in its rewriting minimisation,
and Rapid [22] is a datalog rewriting system for DL-Lite and EL based on optimised
resolution. For benchmark ontologies and queries, we selected 3 commonly used
ontologies [13], which are DL-Lite versions of Adolena (A), OpenGALEN2 (G), and
StockExchange (S). Each of the ontologies comes with 5 conjunctive queries.</p>
      <p>Table 1 records the sizes and times for query rewriting, where sizes are measured
by the numbers of atoms and the times are in milliseconds.</p>
      <p>Ontology</p>
      <p>Query</p>
      <p>UCQ</p>
      <p>Rewriting Size</p>
      <p>Drewer Graal</p>
      <p>Rewriting Time
Drewer Graal Rapid Iqaros
A
G
S</p>
      <p>Both Rapid and Iqaros output minimal rewritings of the same sizes recorded
under \UCQ". To achieve e ciency as well as compactness in rewriting, Graal makes
use of the so called rule compilation, which leads to its small rewriting output. Yet,
the results of rewriting produced by Graal are not standard UCQs, which have to
be evaluated through a special homomorphism mechanism, and thus cannot be
directly handled by DBMSs for datalog engines. We can see that the bene t of datalog
rewriting w.r.t. sizes compared to UCQ rewritings becomes obvious when large UCQ
rewritings are generated ( 50), with two exceptions q2 and q4 on G. This is because
the ontology has a large number of simple axioms. For rewriting times, the
performance of our system is comparable to Graal and Rapid, with an exception on G due
to the reason discussed before.</p>
      <p>In the second set of experiments, we compared our system with existing
end-toend in-memory (as our system is in-memory) query answering systems regarding time
e ciency. We use RDF4j as the data store of Graal. Another system we compared is
Pagoda [25], which is not a standard rewriting system, but a hybrid system combining
a datalog engine and an OWL 2 reasoner. To compare with Graal and Iqaros, we
used the DL-Lite versions of two widely used ontologies, LUBM and Reactome [25].
As Reactome comes with over 100 queries, we randomly selected 5 queries. Table 2
records the times (in seconds) on pre-processing (Pre) and query evaluation (Eval).</p>
      <p>Ontology Query</p>
      <p>Drewer
Pre Eval</p>
      <p>Graal
Pre</p>
      <p>Eval</p>
      <p>Pagoda
Pre Eval</p>
      <p>Iqaros
Pre Eval</p>
      <p>LUBM
Reactome</p>
      <p>Our system showed superior performance in most cases compared to Graal, which
is possibly due to the special homomorphism mechanism implemented in it. both
of which took signi cantly more time in pre-processing. Considering only the query
evaluation times, Drewer is comparable to Pagoda, whereas Pagoda took more
preprocessing time for the materialization of upper-bound and lower-bound datalog
programs. Iqaros shows best performance among all the systems, while the performance
of Drewer is comparable on Reactome. Note that Iqaros is specialised for rst-order
rewritable OWL 2 DL ontologies, whereas Drewer is for more general existential rules.
7</p>
    </sec>
    <sec id="sec-7">
      <title>Conclusion</title>
      <p>In this paper, we have presented a novel approach to datalog rewriting for existential
rules and introduced a new datalog rewritable class, the separable rule sets, which
generalises the class of shy rule sets. Furthermore, we presented a practical algorithm for
computing datalog rewritings and established its correctness. Finally, we implemented
and evaluated our prototype system Drewer, which is to the best of our knowledge,
the rst datalog rewriting system for existential rules. Our system demonstrated
superior or comparable performance compared to state-of-the-art rewriting and query
answering systems.</p>
      <p>For future work, we are working on identifying a more general class of datalog
rewritable existential rules, optimising our rewriting algorithm and implementation,
and conducting further evaluation on more complex ontologies and queries.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>S.</given-names>
            <surname>Ahmetaj</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ortiz</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Simkus</surname>
          </string-name>
          .
          <article-title>Rewriting guarded existential rules into small datalog programs</article-title>
          .
          <source>In Proc. of ICDT-18</source>
          , pp.
          <volume>4</volume>
          :
          <issue>1</issue>
          {4:
          <fpage>24</fpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>J.-F. Baget</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Leclere</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.-L. Mugnier</surname>
            , and
            <given-names>E.</given-names>
          </string-name>
          <string-name>
            <surname>Salvat</surname>
          </string-name>
          .
          <article-title>On rules with existential variables: Walking the decidability line</article-title>
          .
          <source>Artif</source>
          . Intell.,
          <volume>175</volume>
          (
          <fpage>9</fpage>
          -10):
          <volume>1620</volume>
          {
          <fpage>1654</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>M.</given-names>
            <surname>Bienvenu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            ten
            <surname>Cate</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Lutz</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Wolter</surname>
          </string-name>
          .
          <article-title>Ontology-based data access: a study through disjunctive datalog, csp, and MMSNP</article-title>
          .
          <source>In Proc. of PODS-13</source>
          , pp.
          <volume>213</volume>
          {
          <issue>224</issue>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>A.</given-names>
            <surname>Cal</surname>
          </string-name>
          , G. Gottlob, and
          <string-name>
            <given-names>M.</given-names>
            <surname>Kifer</surname>
          </string-name>
          .
          <article-title>Taming the in nite chase: Query answering under expressive relational constraints</article-title>
          .
          <source>J. Artif. Intell. Res.</source>
          ,
          <volume>48</volume>
          :
          <fpage>115</fpage>
          {
          <fpage>174</fpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>A.</given-names>
            <surname>Cal</surname>
          </string-name>
          , G. Gottlob, and
          <string-name>
            <given-names>T.</given-names>
            <surname>Lukasiewicz</surname>
          </string-name>
          .
          <article-title>A general datalog-based framework for tractable query answering over ontologies</article-title>
          .
          <source>J. Web Sem</source>
          .,
          <volume>14</volume>
          :
          <fpage>57</fpage>
          {
          <fpage>83</fpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>A.</given-names>
            <surname>Cal</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Gottlob, and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Pieris</surname>
          </string-name>
          .
          <article-title>Towards more expressive ontology languages: The query answering problem</article-title>
          .
          <source>Artif</source>
          . Intell.,
          <volume>193</volume>
          :
          <fpage>87</fpage>
          {
          <fpage>128</fpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>T.</given-names>
            <surname>Eiter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ortiz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Simkus</surname>
          </string-name>
          ,
          <string-name>
            <surname>T.-K. Tran</surname>
            , and
            <given-names>G.</given-names>
          </string-name>
          <string-name>
            <surname>Xiao</surname>
          </string-name>
          .
          <article-title>Query rewriting for horn-shiq plus rules</article-title>
          .
          <source>In Proc. of AAAI-12</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>G.</given-names>
            <surname>Gottlob</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Orsi, and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Pieris</surname>
          </string-name>
          .
          <article-title>Query rewriting and optimization for ontological databases</article-title>
          .
          <source>ACM Trans. Database Syst</source>
          .,
          <volume>39</volume>
          (
          <issue>3</issue>
          ):
          <volume>25</volume>
          :1{
          <fpage>25</fpage>
          :
          <fpage>46</fpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>G.</given-names>
            <surname>Gottlob</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rudolph</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Simkus</surname>
          </string-name>
          .
          <article-title>Expressiveness of guarded existential rule languages</article-title>
          .
          <source>In Proc. of PODS-14</source>
          , pp.
          <volume>27</volume>
          {
          <issue>38</issue>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. G. Gottlob and
          <string-name>
            <given-names>T.</given-names>
            <surname>Schwentick</surname>
          </string-name>
          .
          <article-title>Rewriting ontological queries into small nonrecursive datalog programs</article-title>
          .
          <source>In Proc. of KR-12</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>B. C.</given-names>
            <surname>Grau</surname>
          </string-name>
          , I. Horrocks, M. Krotzsch,
          <string-name>
            <given-names>C.</given-names>
            <surname>Kupke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Magka</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Motik</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Z.</given-names>
            <surname>Wang</surname>
          </string-name>
          .
          <article-title>Acyclicity notions for existential rules and their application to query answering in ontologies</article-title>
          .
          <source>J. Artif. Intell. Res.</source>
          ,
          <volume>47</volume>
          :
          <fpage>741</fpage>
          {
          <fpage>808</fpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <given-names>P.</given-names>
            <surname>Hansen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Lutz</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Seylan</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Wolter</surname>
          </string-name>
          .
          <article-title>E cient query rewriting in the description logic EL and beyond</article-title>
          .
          <source>In Proc. of IJCAI-15</source>
          , pp.
          <volume>3034</volume>
          {
          <issue>3040</issue>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. M. Konig, M. Leclere, and
          <string-name>
            <given-names>M.-L.</given-names>
            <surname>Mugnier</surname>
          </string-name>
          .
          <article-title>Query rewriting for existential rules with compiled preorder</article-title>
          .
          <source>In Proc. of IJCAI-15</source>
          , pp.
          <volume>3106</volume>
          {
          <issue>3112</issue>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14. M. Konig, M. Leclere,
          <string-name>
            <surname>M.-L. Mugnier</surname>
            , and
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Thomazo</surname>
          </string-name>
          .
          <article-title>Sound, complete and minimal ucq-rewriting for existential rules</article-title>
          .
          <source>Semantic Web</source>
          ,
          <volume>6</volume>
          (
          <issue>5</issue>
          ):
          <volume>451</volume>
          {
          <fpage>475</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>R.</given-names>
            <surname>Kontchakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Lutz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Toman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wolter</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Zakharyaschev</surname>
          </string-name>
          .
          <article-title>The combined approach to query answering in DL-Lite</article-title>
          .
          <source>In Proc. of KR-10</source>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>M. Leclere</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.-L. Mugnier</surname>
            , and
            <given-names>F.</given-names>
          </string-name>
          <string-name>
            <surname>Ulliana</surname>
          </string-name>
          .
          <article-title>On bounded positive existential rules</article-title>
          .
          <source>In Proc. of DL-16</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <given-names>N.</given-names>
            <surname>Leone</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Manna</surname>
          </string-name>
          , G. Terracina, and
          <string-name>
            <given-names>P.</given-names>
            <surname>Veltri</surname>
          </string-name>
          .
          <article-title>E ciently computable datalog9 programs</article-title>
          .
          <source>In Proc. of KR-12</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18. H.
          <string-name>
            <surname>Perez-Urbina</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          <string-name>
            <surname>Motik</surname>
            ,
            <given-names>and I. Horrocks.</given-names>
          </string-name>
          <article-title>Tractable query answering and rewriting under description logic constraints</article-title>
          .
          <source>J. Applied Logic</source>
          ,
          <volume>8</volume>
          (
          <issue>2</issue>
          ):
          <volume>186</volume>
          {
          <fpage>209</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Almatelli</surname>
          </string-name>
          .
          <article-title>Improving query answering over dl-lite ontologies</article-title>
          .
          <source>In Proc. of KR-10</source>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20. G. Stefanoni,
          <string-name>
            <given-names>B.</given-names>
            <surname>Motik</surname>
          </string-name>
          ,
          <string-name>
            <surname>and I. Horrocks.</surname>
          </string-name>
          <article-title>Introducing nominals to the combined query answering approaches for EL</article-title>
          .
          <source>In Proc. of AAAI-13</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <given-names>M.</given-names>
            <surname>Thomazo. Conjunctive Query Answering Under Existential Rules - Decidability</surname>
          </string-name>
          , Complexity, and Algorithms.
          <source>PhD thesis</source>
          , Montpellier 2 University, France,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <given-names>D.</given-names>
            <surname>Trivela</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Stoilos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Chortaras</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G. B.</given-names>
            <surname>Stamou</surname>
          </string-name>
          .
          <article-title>Optimising resolution-based rewriting algorithms for OWL ontologies</article-title>
          .
          <source>J. Web Semant</source>
          .,
          <volume>33</volume>
          :
          <fpage>30</fpage>
          {
          <fpage>49</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23. T. Venetis, G. Stoilos, and
          <string-name>
            <given-names>V.</given-names>
            <surname>Vassalos</surname>
          </string-name>
          .
          <article-title>Rewriting minimisations for e cient ontologybased query answering</article-title>
          .
          <source>In Proc. of ICTAI-16</source>
          , pp.
          <volume>1095</volume>
          {
          <issue>1102</issue>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24.
          <string-name>
            <given-names>Z.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Wang</surname>
          </string-name>
          , and
          <string-name>
            <surname>X. Zhang.</surname>
          </string-name>
          <article-title>Forgetting and unfolding for existential rules</article-title>
          .
          <source>In Proc. of AAAI-18</source>
          , pp.
          <year>2013</year>
          {
          <year>2020</year>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. C.</given-names>
            <surname>Grau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Nenov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kaminski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and I.</given-names>
            <surname>Horrocks</surname>
          </string-name>
          . Pagoda:
          <article-title>Pay-as-you-go ontology query answering using a datalog reasoner</article-title>
          .
          <source>J. Artif. Intell. Res.</source>
          ,
          <volume>54</volume>
          :
          <fpage>309</fpage>
          {
          <fpage>367</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>