<!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 higher-order query answering over Hi (DL-Lite ) knowledge bases</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Maurizio Lenzerini</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Lorenzo Lepore</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Antonella Poggi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dipartimento di Ingegneria Informatica, Automatica e Gestionale “Antonio Ruberti”- Sapienza Universita` di Roma Via Ariosto</institution>
          <addr-line>25, I-00183 Roma</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The language Hi (DL-LiteR) is obtained from DL-LiteR by adding meta-modeling features, and is equipped with a query language that is able to express higher-order queries. We investigate the problem of answering a particular class of such queries, called instance higher-order queries posed over Hi (DL-LiteR) knowledge bases (KBs). The only existing algorithm for this problem is based on the idea of reducing the evaluation of a higher-order query Q over a Hi (DL-LiteR) KB to the evaluation of a union of first-order queries over a DL-LiteR KB, built from Q by instantiating all metavariables in all possible ways. Even though of polynomial time complexity with respect to the size of the KB, this algorithm turns out to be inefficient in practice. In this paper we present a new algorithm, called Smart Binding Planner (SBP), that compiles Q into a program, that issues a sequence of first-order conjunctive queries, where each query has the goal of providing the bindings for meta-variables of the next ones, and the last one completes the process by computing the answers to Q. We also illustrate some experiments showing that, in practice, SBP is significantly more efficient than the previous approach.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Description Logics (DLs) are popular formalisms for expressing ontologies, where an
ontology is regarded as a formal specification of the concepts that are relevant in the
domain of interest, together with the relationships between concepts. In many
applications, the need arises of modeling and reasoning about metaconcepts and
metaproperties. Roughly speaking, a metaconcept is a concept whose instances can be themselves
concepts, and a metaproperty is a relationship between metaconcepts. Metaconcept
representation is needed, for example, in formal ontology, where specific metaproperties
(e.g., rigidity) are used to express relevant aspects of the intended meaning of the
elements in an ontology. More generally, the idea of representing concepts and
properties at the metalevel has been exploited in several sub-fields of Knowledge
Representation and Computer Science, including semantic networks, early Frame-based and
Description-based systems [
        <xref ref-type="bibr" rid="ref1 ref10">10, 1</xref>
        ], and conceptual modeling languages [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. The notion
of metaclass is also present in virtually all object-oriented languages, including modern
programming languages (see, for instance, the Java class “class”).
      </p>
      <p>To see an example of metamodeling, consider the domain of computers, where we
want to describe the properties of single computer machines (concept Computer in
Figure 1), like the serial number and the manufacture date, the properties of the computer
models (Model), like the name and the country where computer machines of that
models are produced, and the category (Category) of the various models. Thus, for instance,
one could assert that a specific computer machine (e.g. ko94-pol) is an instance of
Alienware (subconcept of Computer), where Alienware is an instance of Laptop model
(subconcept of Model), and Laptop model is an instance of Portable category
(subconcept of Category).</p>
      <p>InstC(ko94-po1, Alienware)
InstC(Alienware, Laptop Model)
InstC(Laptop Model, Portable Category)
InstR(ko94-po1, Alienware, has model)
IsaC(Alienware, Computer)
IsaC(Computer,Exists(manufacture date))
IsaC(Exists(serial number),Computer)
IsaC(Computer,Exists(has model))
IsaC(Laptop Model, Model)
IsaC(Model,Exists(has category))
IsaC(Exists(Inv(has category)), Category)
IsaC(Exists(Inv(produced in)), Country)
IsaC(Portable Category, Category)
DisjC(Alienware, iMac)
DisjC(Portable Category, Non Portable Category)</p>
      <p>InstC(jh56i-09, iMac)
InstC(iMac, Desktop Model)
InstC(Desktop Model, Non Portable Category)
InstR(jh56i-09, iMac, has model)
IsaC(iMac, Computer)
IsaC(Computer,Exists(serial number))
IsaC(Exists(Inv(has model)), Model)
IsaC(Exists(has model),Computer)
IsaC(Desktop Model, Model)
IsaC(Exists(has category),Model)
IsaC(Model,Exists(name))
IsaC(Model,Exists(produced in))
IsaC(Non Portable Category, Category)</p>
      <p>DisjC(Laptop Model, Desktop Model)
(a) List of assertions</p>
      <p>(b) Diagrammatic representation</p>
      <p>Obviously, the benefit of using metamodeling is greatly limited if one cannot
express metaqueries on the knowledge base. A metaquery is an expression that combines
predicates and metapredicates in order to extract complex patterns from the knowledge
base. In particular, in a metaquery, variables can appear in predicate positions. In the
example above, one might be interested in asking for all computer machines that are
instances of a model that is an instance of Portable category, thus traversing three levels
of the instance-of relation.</p>
      <p>
        It is well-known that in logic, higher-order constructs are needed for a correct
representation of concepts and properties at the meta-level. However, current research
on Description Logics only rarely addresses the issue of extending the language with
higher-order constructs (see, for instance, [
        <xref ref-type="bibr" rid="ref11 ref13 ref2 ref5 ref9">2, 5, 11, 13, 9</xref>
        ]). The starting point of our
investigation is the work presented in [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ], where the authors propose a method to
add medamodeling facilities to Description Logics, and study algorithms for answering
metaqueries in a particular logic, called Hi (DL-LiteR). The logic Hi (DL-LiteR) is
obtained from DL-LiteR [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] by adding suitable constructs for metaconcepts and
metaproperties modeling. Since the logics of the DL-Lite family are equipped with query
answering algorithms with nice computational properties with respect to the size of the
data, we believe that Hi (DL-LiteR) is a good candidate for a language that can be
used in ontology-based data access applications requiring to model metaconcepts and
metaproperties.
      </p>
      <p>
        It was shown in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] that answering higher-order unions of conjunctive queries
(HUCQs) over Hi (DL-LiteR) KBs is in general intractable, while answering
instancebased HUCQ (IHUCQ) has the same complexity as answering standard (i.e., fist-order)
unions of conjunctive queries over DL-LiteR KBs.
      </p>
      <p>
        In particular, in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] the authors present a query answering technique based on the
idea of first transforming an IHUCQ Q over a Hi (DL-LiteR) KBs H into a IHUCQ
Q0 and then computing the certain answers to Q0 over H seen as a standard DL-LiteR
KB. The goal of the technique was essentially to show that the data complexity class of
query answering does not change if we add metamodeling to DL-LiteR. However, the
technique presented in the paper turns out to be impractical in real world cases. Indeed,
in most cases, the query answering algorithm computes the union of a huge number of
metaground IHCQs, most of which can be in fact empty. This is due to the fact that the
metagrounding is computed “blindly”, i.e., by essentially instantiating in all possible
ways all variables with the elements that are in predicate positions.
      </p>
      <p>In this paper, we present a new algorithm for answering IHUCQs posed over
Hi (DL-LiteR) knowledge bases, called Smart Binding Planner (SBP). The basic idea
of the algorithm is to compile the query q into a program expressed in a Datalog-like
language, that issues a sequence of first-order conjunctive queries, where each query
has the goal of providing the bindings for meta-predicates of the next ones, and the last
one completes the process by computing the answers to q. We also illustrate some
preliminary experiments showing that, in practice, SBP is significantly more efficient than
the previous approach.</p>
      <p>
        Note that our query language corresponds to a subset of SPARQL 1.1 interpreted
under the OWL 2 direct semantics entailment regime [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], in particular the subset
constituted by unions of conjunctive queries using only atoms on the instance-of relations.
Thus, our algorithm can be seen as a first effective approach to answering such queries,
but in the context where the KB has richer meta-modeling features than just punning.
      </p>
      <p>
        The paper is organized as follows. In Section 2 we describe the Hi (DL-LiteR)
logic. In section 3 we discuss the problem of expressing and evaluating IHUCQs in
Hi (DL-LiteR), and we briefly illustrate the algorithm presented in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. In Section 4 we
present our new algorithm, and Section 5 describes a set of experiments aiming at
illustrating the behavior of our algorithm and at comparing it with the previous technique.
Section 6 concludes the paper.
2
      </p>
      <p>
        Hi (DL-LiteR)
In the following we recall the basics of Hi (DL-LiteR) [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], by first presenting its syntax
and then its semantics. Following [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], we can characterize a traditional DL L by a set
OP (L) of operators, used to form concept and role expressions, and a set of MP (L)
of metapredicates, used to form assertions. Each operator and each metapredicate have
an associated arity. If symbol S has arity n, then we write S=n to denote such a
symbol and its arity. For DL-LiteR, we have: (i) OP (DL-LiteR) = fInv =1; Exists =1g,
which stand for “inverse role”, and “existential restriction”, (ii) MP (DL-LiteR) =
fInst C =2; Inst R=3; IsaC =2; IsaR=2; Disj C =2; Disj R=2g, which stand for instance,
isa and disjoint assertions on both concepts and roles.
      </p>
      <p>Syntax. Given a countably infinite alphabet S of element names, we inductively define
the set of expressions for Hi (DL-LiteR), denoted by EDL-LiteR (S), over the alphabet S
as follows:
– if e 2 S, then e 2 EDL-LiteR (S);
– if e 2 EDL-LiteR (S), and e is not of the form Inv (e0) (where e0 is any expression),
then Inv (e) 2 EDL-LiteR (S);
– if e 2 EDL-LiteR (S), then Exists (e) 2 EDL-LiteR (S).</p>
      <p>Intuitively, expressions denote elements, i.e., individuals, concepts and roles, of the
knowledge base. The names in S are the symbols denoting the atomic elements, while
the expressions denote either atomic elements, inverses of atomic elements (when
interpreted as roles), or projections of atomic elements on either the first or the second
component (again, when interpreted such elements as roles).</p>
      <p>The basic building blocks of a Hi (DL-LiteR) knowledge base are assertions. A
DL-LiteR-assertion, or simply assertion, over the alphabet S for Hi (DL-LiteR) is a
statement of one of the forms</p>
      <p>a1(e1; e2); a2(e1; e2; e3)
where a1 2 MP (DL-LiteR) is either Inst C ; IsaC ; IsaR; Disj C ; Disj R, a2 is Inst R,
and e1; e2; e3 are expressions in EDL-LiteR (S). Thus, an assertion is simply an application
of a metapredicate to a set of expressions, which intuitively means that an assertion is
an axiom that predicates over a set of individuals, concepts or roles. A Hi(DL-LiteR)
knowledge base (KB) over S is a finite set of Hi (DL-LiteR)-assertions over S.</p>
      <p>
        For the sake of brevity, we do not include here the semantics of Hi (DL-LiteR) and
we refer the reader to [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. We refer to [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] also for the notions of expressions occurring
as respectively object,concept and role argument in one assertion.
3
      </p>
      <p>Querying Hi (DL-LiteR) knowledge bases
In this section we address the issue of querying Hi (DL-LiteR) knowledge bases.
Specifically, we define queries over Hi (DL-LiteR) knowledge bases and report on the only
query answering technique over such knowledge bases we are aware of. In the next
section, we will then propose our new technique for query answering.</p>
      <p>In order to define Hi (DL-LiteR) queries, we first need to introduce the
notion of “atom”. We consider a countably infinite alphabet of variables V,
disjoint from S, and a countably infinite alphabet of query predicates, each with its
arity, disjoint from all other alphabets. An atom over S and V (or simply, an
atom) has the form a1(e1; e2); a2(e1; e2; e3) where a1 2 MP (DL-LiteR) is either
Inst C ; IsaC ; IsaR; Disj C or Disj R, a2 is Inst R, and each ei is either an expression in
EDL-LiteR (S) or a variable in V, i.e., ei 2 EDL-LiteR (S) [ V. In the above assertions, a1
and a2 are called the predicates of the atom.</p>
      <p>A higher-order conjunctive query (HCQ) of arity n is a formula of the form
q(u1; : : : ; un) a1; : : : ; am where n 0, m 1, q is a query predicate of arity
n (which is also the arity of the query), each ai is an atom, and each ui is either in V
and occurs in some aj , or it is in EDL-LiteR (S). As usual, the tuple u = (u1; : : : ; un)
is called the target of the query q and the variables in u are its distinguished
variables. The other variables of the query are called existential variables. Also, similarly
to names within assertions, we say that a variable occurs as concept argument or role
argument within an atom, depending on its position. Variables occurring as concept or
role arguments are called metavariables. A higher-order union of conjunctive queries
(HUCQ) of arity n is a set of HCQs of arity n with the same query predicate. Also a
HUCQ is metaground if it does not contain any metavariable.</p>
      <p>A HCQ is called instance higher-order conjunctive query (IHCQ) if each of its
atoms has Inst C and Inst R as predicate. A HUCQ containing only IHCQs is called
instance higher-order union of conjunctive queries (IHUCQ).</p>
      <p>Finally, a higher-order query is called Boolean if it has arity 0.</p>
      <p>Example 1. Consider the Hi (DL-LiteR) KB H in Figure 1. Suppose one needs to
retrieve all items, together with their model and the model category, but only if the model
category is classified as ’Portable Computer’. The IHCQ expressing this need is the
following:
q(x; y; z)</p>
      <p>Inst C (x; y); Inst C (y; z); Inst C (z;’Portable Category’)</p>
      <p>In order to define the semantics of queries, we now introduce the notion of
assignment. Indeed, to interpret non-ground terms, we need assignments over interpretations,
where an assignment over h ; Ioi is a function : V ! . Given an
interpretation I = h ; Ioi and an assignment over I, the interpretation of terms is specified
by the function ( )Io; : EDL-LiteR (S) [ V ! defined as follows: (i) if e 2 S then
eIo; = eIo ; (ii) if e 2 V then eIo; = (e); (iii) op(e)Io; = opIo (eIo; ).</p>
      <p>Finally, we define the semantics of atoms, by defining the notion of satisfaction of
an atom with respect to an interpretation I and an assignment over I as follows:
– I; j= Inst C (e1; e2) if e1Io; 2 (e2Io; )Ic ;
– I; j=Inst R(e1; e2; e3) if he1Io; ; e2Io; i2(e3Io; )Ir ;
– I; j= IsaC (e1; e2) if (e1Io; )Ic (e2Io; )Ic ;
– I; j= IsaR(e1; e2) if (e1Io; )Ir (e2Io; )Ir ;
– I; j= Disj C (e1; e2) if (e1Io; )Ic \ (e2Io; )Ic = ;;
– I; j= Disj R(e1; e2) if (e1Io; )Ir \ (e2Io; )Ir = ;.</p>
      <p>Let I be an interpretation and an assignment over I. A Boolean HCQ q of the
form q a1; : : : ; an is satisfied in I; if every query atom ai is satisfied in I; .
Given a Boolean HCQ q and a Hi (DL-LiteR) KB H, we say that q is logically implied
by H (denoted by H j= q) if for each model I of H there exists an assignment such
that q is satisfied by I; . Given a non-Boolean HCQ q of the form q(e1; : : : ; en)
a1; : : : ; am, a grounding substitution of q is a substitution such that e1 ; : : : ; en are
ground terms. We call e1 ; : : : ; en a grounding tuple. The set of certain answers to
q in H, denoted by cert (q; H), is the set of grounding tuples e1 ; : : : ; en that make
the Boolean query q a1 ; : : : ; an logically implied by H. These notions extend
immediately to HUCQs.</p>
      <p>
        As we said in the introduction, in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] the authors present a query answering
technique based on the idea of first transforming a IHUCQ Q over a Hi (DL-LiteR) KBs
H into a metaground IHUCQ Q0 and then computing the certain answers to Q0 over H
seen as a standard DL-LiteR KB.1 It was shown that query answering with such a
technique is in AC0 w.r.t. the number of instance assertions, in PTIME w.r.t. KB complexity,
and NP-complete w.r.t. combined complexity. While describing, in the following, the
technique of [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] in more details, we introduce notions that we use in the next sections.
      </p>
      <p>
        Given a Hi (DL-LiteR) KB H, we respectively denote by Roles(H) and
Concepts(H) the sets Roles(H) = fe; Inv (e)je 2 EDL-LiteR (S) and e occurs as role
1 In fact, in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], the authors consider KBs equipped with mappings, and therefore their technique
aims at rewriting the initial query over the actual data sources. Here, we ignore this aspect and
adapt their algorithm to our scenario.
argument in Hg and Concepts(H) = fe j e 2 EDL-LiteR (S) and e occurs as concept
argument in Hg [ fExists (e); Exists (Inv (e)) j e 2 EDL-LiteR (S) and e occurs as role
argument in Hg. Given two IHCQs q, q0 and a KB H, we say that q0 is a partial
metagrounding of q with respect to H if q0 = (q) where is a partial substitution of the
metavariables of q such that for each metavariable x of q, either (x) = x, or: (i) if
x occurs in concept position in q, then (x) 2 Concepts(H); (ii) if x occurs in role
position in q, then (x) 2 Roles(H). Given a IHCQ q and a KB H, we denote by
P M G(q; H) the IHUCQ constituted by the union of all the partial metagroundings of
q w.r.t. H. Moreover given a IHUCQ Q and a KB H, we denote by P M G(Q; H) the
IHUCQ formed by Sq2Q P M G(q; H).
      </p>
      <p>
        With these notions in place, the algorithm of [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], which we denote as
COMPUTEPMG, can be described as follows. Given a IHUCQ Q and a Hi (DL-LiteR) KB
H, it first computes the query P M G(Q; H) and then returns the certain answers to
the query P M G(Q; H) with respect to H. It is worth noting that, although polynomial
w.r.t. the number of instance assertions in H, COMPUTEPMG can be very inefficient
in practice, in the sense that it computes the union of a huge number of IHCQs, most
of which can be in fact empty. This is due to the fact that the partial metagrounding
is computed “blindly”, i.e., by instantiating in all possible ways, all metavariables with
elements of Concepts(H) and Roles(H).
4
      </p>
      <p>New algorithm for answering IHUCQs in Hi (DL-LiteR)
In this section we present the Smart Binding Planner (SBP) algorithm, aiming at
reducing the number of metaground queries to be evaluated. The algorithm is based on
a process that computes a sequence of metaground IHCQs, where each query has the
goal of providing both the answers to the query, and the bindings for metavariables of
the next ones.</p>
      <p>Before delving into the details of the SBP algorithm, we shortly sketch its three
main steps. First, it splits the query into a sequence of subqueries (function
SPLITANDORDER) such that the evaluation of the i-th subquery provides the bindings to
instantiate the metavariables of the (i + 1)-th subquery. Second, based on such subqueries
ordering, it builds a program (function DHQPSYNTHESIS), expressed in a specific
language named Datalog-based Higher Order Query Plan (DHQP). Then, as third and
final step, it evaluates the DHQP program (function EVALUATEDHQP).</p>
      <p>In the following, we start by presenting the DHQP language and illustrating the
function EVALUATEDHQP. We then define the two other functions that are used by
SBP, namely the functions SPLITANDORDER and DHQPSYNTHESIS, and finally we
present the complete algorithm SBP, and discuss its properties.
4.1</p>
      <p>The DHQP language
Let A and AI be two pairwise disjoint alphabets, disjoint from S and V, called,
respectively, the alphabet of bridge predicates and the alphabet of intensional predicates,
each one with an associated arity. Intensional and bridge predicates are used to form a
DHQP program, which, intuitively, is constitued by an ordered set of Datalog-like rules
whose head predicate is an intensional predicate in AI , and whose body contains an
atom with a bridge predicate in A . Every bridge predicate of arity n has an
associated IHCQ of arity n, denoted def ( ). Moreover, some of the n arguments of each
bridge predicate are classified as “to-be-bound”. When we write a bridge predicate,
we indicate the variables corresponding to such arguments by underlining them.
Intuitively, the underlined variables of the bridge predicate are those variables that are to
be bound to ground expressions whenever we want to evaluate the query def ( ). Also,
the bridge predicate is used to denote the relation where we store the certain answers
of a set of metaground IHCQs, each one obtained by def ( ) by substituting the
underlined variables of with a ground expression. Variables of the query def ( ) that
appear underlined in the corresponding bridge predicate are called input variables of
the query. Note that, when we write the query predicate of def ( ), we underline the
query input variables.</p>
      <p>We now provide the definition of the syntax of a DHQP program. Let m be a
nonnegative integer, let be a sequence ( 0; : : : ; m) of m + 1 bridge predicates in A ,
and let I be a sequence (I0; : : : ; Im) of m + 1 intensional predicates in AI .</p>
      <p>A DHQP program P over and I is a sequence of m + 1 DHQP rules
r0; r1; : : : ; rm, such that
– r0, called the base rule of P , has the form I0(v) 0(w), where every variable
in v occurs in w.
– for each 1 j m, rule rj has the form Ij (v) Ij 1(u); j (w), where every
variable in v occurs in u or w, and every variable in u which is not an underlined
variable in w appears in v.</p>
      <p>For every 0 j m, we say that rj defines Ij using j . In the case of 1 j m,
we say that rj defines Ij using j based on Ij 1.
= ( 0=1; 1=2; 2=2), with q 0 , q 1 ,
Example 2. Let I = (I0=1; I1=2; I2=3), and
and q 2 defined as follows:
– q 0 (z) = Inst C (z; Portable Category),
– q 1 (z; y) = Inst C (y; z),
– q 2 (y; y) = Inst C (x; y).</p>
      <p>The following is a DHQP program over</p>
      <p>and I, called P :
r0 : I0(z)
r1 : I1(y; z)
r2 : I2(x; y; z)
0(z)
I0(z); 1(z; y)</p>
      <p>I1(y; z); 2(y; x)</p>
      <p>We now turn our attention to the semantics of a DHQP program. Toward this goal,
we introduce the notion of instantiation of an IHCQ. Given an IHCQ q, an n-tuple x of
variables of q, and an n-tuple t of expressions in EDL-LiteR (S), the x-instantiation of q
with t, denoted IN ST (q; x t), is the IHCQ obtained from q by substituting each xi
in x with the expression ti in t, for i 2 f1; : : : ; ng. Note that a partial metagrounding
of q with respect to H is an x-instantiation of q with any n-tuple t = (t1; t2; : : : ; tn),
where x = (x1; x2; : : : ; xn) contains only metavariables in q, and such that, for every
i 2 f1; : : : ; ng, ti 2 Concept(H) if xi occurs as concept argument within q, and
ti 2 Role(H) if xi occurs as role argument.</p>
      <p>Let P be a DHQP program constituted by the rules (r0; : : : ; rm). We specify the
semantics of P operationally, i.e., we define an algorithm, called EVALUATEDHQP,
that, given as input a DHQP program P , and a Hi (DL-LiteR) KB H, computes the
result of evaluating P with respect to a H as follows:
– Consider rule r0, and compute the extension of I0 as the certain answers to the
query P M G(q 0 ; H) over the KB H.
– For each 1 i m, consider rule ri, and compute the extension of Ii by
evaluating the Datalog rule Ii(v) Ii 1(u); i(w) , where the extension of Ii 1
is the result computed when considering rule ri 1, and the extension of i is
constituted by the certain answers of the query P M G(q0; H) over the KB H, with
q0 constructed as follows: St2 w0 (Ii 1) IN ST (q i ; w0 t), where w0 denotes
the input variables of q i occurring both in u and in w, and w0 (R) denotes the
projection of relation R onto the arguments corresponding to w0.</p>
      <p>– Return the extension of the predicate Im as the result of evaluating P over H.
Example 3. Consider the DHQP program P described in Example 2, and the KB H in
Figure 1. The algorithm EVALUATEDHQP(P; H) proceeds as follows. First, it
considers rule r0 and computes the certain answers of the metaground query q 0 with respect
to H, which, in this case, produces the following result: f(Laptop Model)g. By means
of the rule r0, this result becomes also the extension of I0. Then, it considers rule r1,
and, for each tuple of I0 (in this case, only one) evaluates the query resulting from the
zinstantiation of q 1 with the tuple itself; this means that the certain answers to the
metaground query q(y) Inst C (y; Laptop Model) (i.e., f(Alienware)g) are computed and
stored in the relation 1(z; y). Such certain answers are used in rule r1 to compute the
extension of I1, which becomes f(Laptop Model; Alienware)g. Finally, the algorithm
considers r2, and computes the final result f(ko94-po1; Alienware; Laptop Model)g:
3. For every atom a, it marks every variable that is a metavariable and occurs in an
atom a0 such that d(a0) &lt; d(a). Intuitively, if a variable within an atom is marked,
then bindings for such a variable will be provided in order to evaluate the query
with body that atom by using a standard DL-LiteR reasoner.
4. For every i 2 f0; mg, where m is the maximal atom depth, it defines an IHCQ
q i whose arity is the number of variables occurring in some atom at depth i, and
whose form is q i (u i ; ui) b i , where u i contains all variables that are marked
in some atom at depth i, ui contains all unmarked variables occurring in some atom
at depth i that also belong to x or, for i &lt; m are marked in some atom at depth
i + 1, and b i is the conjunction of all atoms at depth i. Intuitively, atoms having
the same depth will be evaluated in the same query.</p>
      <p>The queries q 0 ; : : : ; q m built by SPLITANDORDER(q) will be used by the function
DHQPSYNTHESIS to construct the DHQP program whose evaluation will return the
answers to q.</p>
      <p>Example 4. Consider the IHCQ presented in Example 1. The result of the
SPLITANDORDER function is the sequence B = (q 0 ; q 1 ; q 2 ) presented in Example 2.
Given a IHCQ q with target tuple x, and the sequence (q 0 ; q 1 ; : : : ; q m ) obtained
by SPLITANDORDER(q), DHQPSYNTHESIS builds a DHQP program constituted by
m + 1 as follows:
– The base rule has the form I0(v) 0(w), where def ( 0) = q 0 , each variable
of w that is an input variable of q 0 is underlined, and v is such that: if m = 0, then
v coincides with x, otherwise v is constituted by all the variables in w that are in
x, and all the variables in w in position of input arguments in q 1 .
– For j 2 f1; : : : ; mg, the j-th rule defining Ij based on Ij 1 has the form Ij (v)
Ij 1(u); j (w) where def ( j ) = q j , each variable of w that is an input variable
of q j is underlined, and v is such that if j = m, then v coincides with x, otherwise
v is constituted by all the variables in w and u that are in x, and all the variables
in w and u in position of input arguments in q j+1 .</p>
      <p>Example 5. Consider the IHCQ Q presented in Example 1 and the sequence of queries
B obtained by executing SPLITANDORDER(Q), as shown in Example 4. It is easy to
see that, by executing DHQPSYNTHESIS(x,B), where x = (x; y; z) is the target tuple
of Q, we obtain the DHQP program presented in Example 2.
4.4</p>
      <p>The SBP Algorithm
We are now ready to describe the algorithm SBP. As shown in the following, the
algorithm iterates over the various IHCQs in IHUCQ input query Q. At each iteration, the
IHCQ q under exam is first split into subqueries, that are ordered on the basis of
bindings that the evaluation of a subquery provides for variables of subsequent subqueries.
On the basis of the ordering of subqueries, q is then compiled into a DHQP program,
and then such a program is evaluated over H. The result of such evaluation constitutes
the resulting set of answers R.</p>
      <p>Algorithm SBP(Q,H)
input IHUCQ Q of arity n, Hi (DL-LiteR) KB H
output Set of n-tuples of expressons in EDL-LiteR (S)
begin</p>
      <p>R = ;
for each q 2 Q</p>
      <p>B = SPLITANDORDER(q);
P = DHQPSYNTHESIS(q,B);</p>
      <p>R = R [ EVALUATEDHQP(P , H)
return R
end
The following theorem shows termination and correctness of the algorithm.
Theorem 1. Given a Hi (DL-LiteR) KB H and an IHUCQ q over H, the SBP(q; H)
terminates and computes the certain answers of Q over H.</p>
      <p>It is also easy to characterize the complexity of SBP. The following theorem
provides such a charaterization.</p>
      <p>Theorem 2. Answering IHUCQs over Hi (DL-LiteR) KBs with SBP is PTIME w.r.t.
both instance and KB complexity, and NP-complete w.r.t. combined complexity.
5</p>
    </sec>
    <sec id="sec-2">
      <title>Experiments</title>
      <p>In this section we show the results of a preliminary set of tests that were carried out to
compare the performances of SBP with that of the algorithm COMPUTEPMG presented
at the end of Section 3. Such set of tests compares the evaluation time of the IHCQ q of
Example 1 over four different extensions to the KB H in Figure 1. The extensions we
have taken into account are the following.</p>
      <p>– Extension A. The ontology is obtained by adding to the ontology H 30000
assertions of the form Inst C (ki,Alienware) and 30000 assertions of the form
Inst C (ki,iMac) where ki 6= kj for 1 i; j 60000 and i 6= j, and each ki is
a new name not occurring in any of the assertions of ontology H;
– Extension B. The ontology is obtained by adding to A the following set of
assertions fIsaC (Tablet Model, Model), IsaC (iPad, Computer), Inst C (Tablet Model,
Portable Category), Inst C (iPad, Tablet Model)g;
– Extension C. The ontology is obtained by adding to B 30000 assertions of the
form Inst C (ki,iPad) where ki 6= kj for 1 i; j 30000 and i 6= j, and each ki is
a new name not occurring in any of the assertions of ontology B;
– Extension D. The ontology is obtained by adding to A the following set of
assertions fIsaC (Server Model, Model), IsaC (RackR230, Computer), Inst C (Server
Model, Non Portable Category), Inst C (RackR230, Server Model)g.</p>
      <p>The results of the tests are summarized in Table 1. Each row in the table shows
the behaviors of the algorithms SBP and COMPUTEPMG when computing the
certain answers to q over a given ontology. Columns in the table show: (i) the considered
ontology, (ii) the number of concept expressions in its intensional assertions, (iii) the
behaviour of SBP in terms of number of metaground IHCQs executed, and execution
time, (iv) the beaviour of COMPUTEPMG).</p>
      <p>First we notice that, when executed on the same ontology, SBP is up to 110 times
faster then COMPUTEPMG. The reason of that improvement is due to the smart
grounding instantiation of the metavariables of q performed by SBP. For instance, to evaluate
q over the ontology A, COMPUTEPMG issues 361 metaground IHCQs obtained by
considering all the substitutions in Concepts(A) for the two metavariables occurring
in the atoms of q, thus leading to jConcepts(A)j2 = 192 = 361 metaground IHCQs
that have to be evaluated whereas SBP induces the evaluation of only 3 metaground
IHCQs. Second, we observe that the increase of the size of the ontology has different
impacts on the two algorithms performances. Specifically, while the performance of
COMPUTEPMG worsen as soon as assertions with new expressions are added to the
intensional part of the ontology, this does not necessarily happen for SBP.
6</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusion</title>
      <p>
        We have presented a new technique to answer IHCUQs over Hi (DL-LiteR) KBs, which
improves the one presented in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] by avoiding the blind grounding of metavariables that
may cause query answering to become impractical.
      </p>
      <p>We have illustrated a first set of experiments showing the advantage of using our
strategy. In addition to the set of simple tests described above, at the time of this writing
we are running a set of tests involving real world ontologies. These new experiments
confirm that answering IHUCQs with the COMPUTEPMG strategy can be very
inefficient, and that SBP is a promising direction to pursue.</p>
      <p>However, we are aware that there are other possible optimization that we can study
to improve the work presented here. One notable example is the management of
cycles in the dependency graph. Presently, we assign the same depth to all of the atoms
occurring in a cycle but there are cases where breaking the cycle, thus assigning
different depth to the involved atoms, can allow to further reduce the number of metaground
queries that have to be considered during the evaluation of the correspondent program.
Our future works will be focused on identifying those cases, and studying other possible
optimization strategies.</p>
      <p>
        Acknowledgements: Work partially supported by the EU under FP7, project Optique
(Scalable End-user Access to Big Data), grant n. FP7-318338.
2 The evaluation reported here refers to experiments carried out using MASTRO [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] as reasoner
computing the certain answers to metaground queries posed to DL-LiteR KBs
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>G.</given-names>
            <surname>Attardi</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Simi</surname>
          </string-name>
          .
          <article-title>Consistency and completeness of OMEGA, a logic for knowledge representation</article-title>
          .
          <source>In Proc. of IJCAI'81</source>
          , pages
          <fpage>504</fpage>
          -
          <lpage>510</lpage>
          ,
          <year>1981</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>L.</given-names>
            <surname>Badea</surname>
          </string-name>
          .
          <article-title>Reifying concepts in description logics</article-title>
          .
          <source>In Proc. of IJCAI'97</source>
          , pages
          <fpage>142</fpage>
          -
          <lpage>147</lpage>
          ,
          <year>1997</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Poggi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Rodriguez-Muro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ruzzi</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D. F.</given-names>
            <surname>Savo</surname>
          </string-name>
          .
          <article-title>The Mastro system for ontology-based data access</article-title>
          .
          <source>Semantic Web J.</source>
          ,
          <volume>2</volume>
          (
          <issue>1</issue>
          ):
          <fpage>43</fpage>
          -
          <lpage>53</lpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          .
          <article-title>Tractable reasoning and efficient query answering in description logics: The DL-Lite family</article-title>
          .
          <source>J. of Automated Reasoning</source>
          ,
          <volume>39</volume>
          (
          <issue>3</issue>
          ):
          <fpage>385</fpage>
          -
          <lpage>429</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>S.</given-names>
            <surname>Colucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T. Di</given-names>
            <surname>Noia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. Di</given-names>
            <surname>Sciascio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. M.</given-names>
            <surname>Donini</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Ragone</surname>
          </string-name>
          .
          <article-title>Second-order description logics: Semantics, motivation, and a calculus</article-title>
          .
          <source>In Proc. of DL</source>
          <year>2010</year>
          , volume
          <volume>573</volume>
          <source>of CEUR, ceur-ws.org</source>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>G. De Giacomo</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Lenzerini</surname>
            , and
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Rosati</surname>
          </string-name>
          .
          <article-title>Higher-order description logics for domain metamodeling</article-title>
          .
          <source>In Proc. of AAAI</source>
          <year>2011</year>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>F.</given-names>
            <surname>Di Pinto</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          .
          <article-title>Ontology-based data access with dynamic TBoxes in DL-Lite</article-title>
          .
          <source>In Proc. of AAAI</source>
          <year>2012</year>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>B.</given-names>
            <surname>Glimm</surname>
          </string-name>
          and
          <string-name>
            <given-names>C.</given-names>
            <surname>Ogbuji</surname>
          </string-name>
          .
          <article-title>Sparql 1.1 entailment regimes</article-title>
          .
          <source>W3C reccomendation, W3C</source>
          ,
          <year>2013</year>
          . Available at http://www.w3.org/TR/sparql11-entailment/.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>B.</given-names>
            <surname>Glimm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rudolph</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Volker</surname>
          </string-name>
          .
          <article-title>Integrated metamodeling and diagnosis in owl 2</article-title>
          .
          <source>In Proc. of ISWC</source>
          <year>2010</year>
          , pages
          <fpage>257</fpage>
          -
          <lpage>272</lpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. F. Lehmann, editor.
          <source>Semantic Networks in Artificial Intelligence. Pergamon Press, Oxford (United Kingdom)</source>
          ,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>B.</given-names>
            <surname>Motik</surname>
          </string-name>
          .
          <article-title>On the properties of metamodeling in OWL</article-title>
          .
          <source>J. of Logic and Computation</source>
          ,
          <volume>17</volume>
          (
          <issue>4</issue>
          ):
          <fpage>617</fpage>
          -
          <lpage>637</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>J. Mylopoulos</surname>
            ,
            <given-names>P. A.</given-names>
          </string-name>
          <string-name>
            <surname>Bernstein</surname>
            , and
            <given-names>H. K. T.</given-names>
          </string-name>
          <string-name>
            <surname>Wong</surname>
          </string-name>
          .
          <article-title>A language facility for designing database-intensive applications</article-title>
          .
          <source>ACM Trans. on Database Systems</source>
          ,
          <volume>5</volume>
          (
          <issue>2</issue>
          ):
          <fpage>185</fpage>
          -
          <lpage>207</lpage>
          ,
          <year>1980</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <given-names>J. Z.</given-names>
            <surname>Pan</surname>
          </string-name>
          and
          <string-name>
            <surname>I. Horrocks. OWL</surname>
          </string-name>
          <article-title>FA: a metamodeling extension of OWL DL</article-title>
          .
          <source>In Proc. of WWW</source>
          <year>2006</year>
          , pages
          <fpage>1065</fpage>
          -
          <lpage>1066</lpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>