<!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>Mapping Data to Higher-Order Description Logic Knowledge Bases</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Floriana Di Pinto</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giuseppe De Giacomo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <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>Riccardo Rosati</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dipartimento di Informatica e Sistemistica Antonio Ruberti Sapienza Universita` di Roma</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this paper we introduce the notion of mapping-based knowledge base (MKB), to formalize those ontology-based data access (OBDA) scenarios where both the extensional and the intensional level of the ontology are determined by suitable mapping assertions involving the data sources. We study reasoning over MKBs in the context of Hi (DL-LiteR), a higher-order version of the DL DL-LiteR. We show that answering queries posed to MKBs expressed in Hi (DL-LiteR) can be done efficiently through FOL rewriting: hence, query answering can be delegated to a DBMS, as in the case of traditional OBDA systems.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>
        Ontology-based data access (OBDA) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] is a recent application of Description Logics
(DLs) that is gaining momentum. The idea behind OBDA is to use a DL ontology as
a means to access a set of data sources, so as to mask the user from all
applicationdependent aspects of data, and to extract useful information from the sources based
on a conceptual representation of the domain, expressed as a TBox in a suitable DL.
In current approaches to OBDA, the intensional level of the ontology (the TBox) is
fixed once for all at design time, and the mapping assertions specify how the data at the
sources correspond to instances of the concepts, roles, and attibutes in the TBox. More
precisely, the various mapping assertions determine a sort of virtual ABox, in which
the individual objects are built out from data, and the instance assertions are specified
through the relationships between the sources and the elements of the ontology.
      </p>
      <p>
        Several OBDA projects have been carried out in the last years [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], and OBDA
systems have been designed to support OBDA applications [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. The experience gained in
this work has shown that there are important aspects that are missing in current OBDA
technology. In this paper, we concentrate on three such aspects.
      </p>
      <p>The first aspect is related to the need of making the intensional level of the
ontology more dynamic. Indeed, in real applications, the information about which are the
concepts and roles that are relevant in the domain of interest is often stored in the data
sources. Consider, for example, the database D of a motor industry shown in figure 1,
storing data about different types of cars (table T-CarTypes), and various cars of
such types (table T-Cars) manufactured by the firm. The key observation is that the
database D stores information not only about the instances of concepts, but also about
the concepts themselves, and their relationships. For example, table T-CarTypes tells
us that there are four concepts in our ontology that are subconcepts of the concept Car,
and, implicitely, tells us that they are mutually disjoint. Table T-Cars, on the other
T-CarTypes
Code TypeName
T1
T2
T3
T4</p>
      <p>Coupe´
SUV
Sedan
Estate
NumberPlate CarType EngineSize BreakPower</p>
      <p>AB111
AF333
BR444
AC222
BN555
BP666</p>
      <p>T1
T2
T2
T4
T3
T1
hand, provides information about the instances of the various concepts, as well as other
properties about such instances.</p>
      <p>
        The second aspect is related to the need of metamodeling constructs in the
language used to specify the ontology [
        <xref ref-type="bibr" rid="ref4 ref6">4, 6</xref>
        ]. Metamodeling allows one to treat concepts
and properties as first-order citizens, and to see them as individuals that may constitute
the instances of other concepts, called meta-concepts. In our example, it is convenient
to introduce in the ontology the concept Car-Type, whose instances are exactly the
subconcepts of cars stored in table T-CarTypes. In this way, we allow users to
dynamically acquire knowledge about relevant car types through simple queries asking
for the instances of the meta-concept Car-Type.
      </p>
      <p>
        The third aspect deals with the need of designing tractable algorithms for query
answering in OBDA systems. In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], it is argued that, since the data sources used in
OBDA systems are likely to be very large, such systems should be based on DLs that
are tractable in data complexity. In particular, [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] advocates the use of the DL-Lite
family, that allows for First-Order Logic (FOL) rewritability of (unions of) conjunctive
queries. We remind the reader that in a DL enjoing FOL rewritability, query answering
can be divided in two steps. In the first step, called rewriting, using the TBox only, the
query q is transformed into a new FOL query q0, and in the second step q0 is evaluated
over the ABox. The correctness of the whole method relies on the fact the answers to
q0 over the ABox coincide with the certain answers to q over the whole ontology. The
challenge is now to design tractable query answering algorithms even in cases where
the mappings relate data at the sources both to the extensional and the intensional level
of the ontology, and meta-concepts and meta-roles are used in the queries. In this paper,
we address the above aspects, and present the following contributions.
      </p>
      <p>(i) We introduce the notion of mapping-based knowledge base (MKB) (Section 3),
to formalize the situation where both the extensional and the intensional level of the
ontology are determined by suitable mapping assertions involving the data sources.</p>
      <p>
        (ii) We describe the higher-order DL Hi (DL-LiteR) (Section 2), based on the
approach presented in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. In that paper, it is shown how, starting from a traditional DL
L, one can define its higher-order version, called Hi(L). Here, we apply this idea, and
present Hi (DL-LiteR), which is the higher-order version of DL-LiteR [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>(iii) We show that answering queries posed to MKBs expressed in Hi (DL-LiteR)
can be done efficiently through FOL rewriting (Section 4). More specifically, we
describe an algorithm that, given a query q over a MKB, rewrites q into a FOL query that
is evaluated taking into account only the mapping assertions MA of the MKB
involving the extensional level of the ontology. Hence query answering can be delegated to a
DBMS, as in the case of traditional OBDA systems.</p>
      <p>
        Higher-order DL-LiteR
In this section, we describe the higher-order DL Hi (DL-LiteR), based on the approach
presented in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Every traditional DL L is characterized by a set OP (L) of operators,
used to form concept and role expressions, and a set of MP (L) of meta-predicates, used
to form assertions. Each operator and each meta-predicate 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
– OP (DL-LiteR) = fInv =1; Exists =1g;
– MP (DL-LiteR) = fInst C =2; Inst R=3; IsaC =2; IsaR=2; Disj C =2; Disj R=2g.
      </p>
      <p>We assume that the reader is familiar with DL-LiteR. Therefore, the intuitive
meaning of all the above symbols should be clear. The formal specification of their semantics
will be given shortly.</p>
      <p>Syntax. We assume the existence of two disjoint, countably infinite alphabets: S, the
set of names, and V, the set of variables. Intutively, the names in S are the symbols
denoting the atomic elements of a Hi(DL-LiteR) knowledge base. The building blocks
of such a knowledge base are assertions, which in turn are based on terms and atoms.</p>
      <p>We inductively define the set of terms, denoted by DL-LiteR (S; V), over the
alphabets S and V for Hi(DL-LiteR) as follows:
– if E 2 S then E 2 DL-LiteR (S; V);
– if V 2 V then V 2 DL-LiteR (S; V);
– if C=n 2 OP (DL-LiteR) and t1; : : : ; tn 2 DL-LiteR (S; V) then C(t1; : : : ; tn) 2</p>
      <p>DL-LiteR (S; V).</p>
      <p>Ground terms, i.e., terms without variables, are called expressions, and the set of
expressions is denoted by DL-LiteR (S).</p>
      <p>A DL-LiteR-atom, or simply atom, over the alphabets S and V for Hi(DL-LiteR)
is a statement of the form M (E1; : : : ; En) where M 2 MP (DL-LiteR), n is the arity
of M , and for every 1 i n, Ei 2 DL-LiteR (S; V). If X is a subset of V, a is
a DL-LiteR-atom, and all variables appearing in a belongs to X, then a is called an
X-atom in DL-LiteR.</p>
      <p>Ground DL-LiteR-atoms, i.e., DL-LiteR-atoms without variables, are called
DL-LiteR-assertions, or simply assertions. Thus, an assertion is simply an application
of a meta-predicate to a set of expressions. Intuitively, an assertion is an axiom that
predicates over a set of individuals, concepts or roles.</p>
      <p>A Hi(DL-LiteR) knowledge base (KB) over S is a set of DL-LiteR-assertions over
S. To agree with the usual terminology of DLs, we use the term TBox to denote a set of
IsaC , IsaR, Disj C and Disj R assertions, and the term ABox to denote a set of Inst C
and Inst R assertions.</p>
      <p>Semantics. Our definition of semantics for Hi (DL-LiteR) is based on the notion of
interpretation structure. An interpretation structure is a triple = h ; Ic; Iri where:
(i) is a non-empty (possibly countably infinite) set; (ii) Ic is a function that maps
each d 2 into a subset of ; and (iii) Ir is a function that maps each d 2 into a
subset of . In other words, treats every element of simultaneously as: (i) an
individual; (ii) a unary relation, i.e., a concept, through Ic; and (iii) a binary relation,
i.e., a role, through Ir.</p>
      <p>An interpretation for S (simply called an interpretation, when S is clear from the
context) over the interpretation structure is a pair I = h ; Ioi, where
– = h ; Ic; Iri is an interpretation structure, and
– Io is a function that maps:
1. each element of S to a single object in ; and
2. each element C=n 2 OP (DL-LiteR) to an n-ary function CIo : n !
that satisfies the conditions characterizing the operator C=n. In particular, the
conditions for the operators in OP (DL-LiteR) are as follows:
(a) for each d1 2 , if d = Inv Io (d1) then dIr = (d1Ir ) 1;
(b) for each d1 2 , if d = Exists (d1) then dIc = fe j 9e1 s.t. he; e1i 2
d1Ir g.</p>
      <p>We extend Io to ground terms in DL-LiteR (S) inductively as follows: if C=n 2
OP (DL-LiteR), then (C(t1; : : : ; tn))Io = CIo (E1Io ; : : : ; EnIo ).</p>
      <p>We now turn our attention to the interpretation of terms in Hi (DL-LiteR). 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
defined as follows:
( )Io; : DL-LiteR (S; V) !
– if t 2 S then tIo; = tIo ;
– if t 2 V then tIo; = (t);
– if t is of the form C(t1; : : : ; tn), then tIo; = CIo (t1Io; ; : : : ; tIno; ).</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; i 2 (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>A Hi (DL-LiteR) KB H is satisfied by I if all the assertions in H are satisfied by I1.
As usual, the interpretations I satisfying H are called the models of H. A Hi (DL-LiteR)
KB H is satisfiable if it has at least one model.
3</p>
    </sec>
    <sec id="sec-2">
      <title>Mapping-based knowledge bases</title>
      <p>As we said in the previous section, a Hi (DL-LiteR) KB is simply a set of assertions.
One might think of such a set of assertions as explicitly stated by the designer of the
KB. This is a reasonable assumption only in those cases where the ontology is managed
by an ad-hoc system, and is built from scratch for the specific application. However, in
many applications, it is of interest to derive the KB directly from a set of data sources,
so that the assertions of the KB are defined by specific mappings to such data sources.
The resulting notion will be called mapping-based knowledge base.</p>
      <p>In the following, we assume that the data sources are expressed in terms of the
relational data model. In other words, all the technical development presented in the rest
1 We do not need to mention assignments here, since all assertions in H are ground.
of this section assumes that the set of sources to be linked to the knowledge base is one
relational database. Note that this is a realistic assumption, since many data federation
tools are now available that are able to wrap a set of heterogeneous sources and present
them as a single relational database.</p>
      <p>
        When mapping relational data sources to a knowledge base over S, one should
take into account that sources store “data values”, and such data values should not
be confused with the elements in S. To face this impedance mismatch problem, [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]
proposes to structure the mapping assertions in such a way that the elements of the
knowledge base are denoted by terms built out from data values stored at the sources
using special function symbols. Although we could in principle follow the same idea
here, for the sake of simplicity, in this paper we assume that the relational data sources
store directly elements of S. Note, however, that all the results presented in the next
sections easily extend to the case where mappings build complex terms for denoting the
elements of the knowledge base.
      </p>
      <p>We are now ready to provide the definition of mapping-based knowledge base.
Definition 1. A Hi (DL-LiteR) mapping-based knowledge base (MKB) is a pair K =
hDB ; Mi such that: (i) DB is a relational database; (ii) M is a mapping, i.e. a set
of mapping assertions, each one of the form (x) ; , where is an arbitrary FOL
query over DB of arity n &gt; 0 with free variables x = hx1; : : : ; xni, and is an
X-atom in DL-LiteR, with X = fx1; : : : ; xng.</p>
      <p>In the following, if K = hDB ; Mi is a MKB, then we denote by MA the set of
mapping assertions from M whose head predicate is either Inst C or Inst R.
Furthermore, we denote by MT the set M n MA, i.e., the set of mapping assertions from M
whose head predicate belongs to the set fIsaC ; IsaR; Disj C ; Disj Rg. We call a
mapping M an instance-mapping if M = MA, i.e., if the metapredicates Inst C and Inst R
are the only ones to appear in the right-hand side of the mapping assertions in M.</p>
      <p>In order to define the semantics of a Hi (DL-LiteR) MKB K = hDB ; Mi, we need
to define when an interpretation satisfies an assertion in M with respect to a database
DB . To this end, we make use of the notion of ground instance of an atom, and the
notion of answer to a query over DB . Let be an X-atom with X = fx1; : : : ; xng, and
let v be a tuple of arity n with values from DB . Then the ground instance [x=v] of is
the formula obtained by substituting every occurrence of xi with vi (for i 2 f1; ::; ng) in
. Also, if DB is a relational database, and q is a query over DB , we write ans( ; DB )
to denote the set of answers to q over DB .</p>
      <p>We now specify when an interpretation satisfies a mapping assertion with respect to
a database. We say that an interpretation I satisfies the mapping assertion (x) ;
with respect to the database DB , if for every tuple of values v 2 ans( ; DB ), the
ground atom [x=v] is satified by I. We say that I is a model of K = hDB ; Mi if I
satisfies every assertion in M with respect to DB .</p>
      <p>The following example shows how Hi (DL-LiteR) mapping-based knowledge bases
can be used to model real world situations in a suitable manner.</p>
      <p>Example 1. Consider the database D shown in the introduction. We define a
Hi (DL-LiteR) MKB K1 = hD; Mi, where the mapping M is defined as follows:
– M1: fy j T-CarTypes(x; y)g ; IsaC (y; Car)
– M2: f(x; z) j T-Cars(x; y; t; u; v; q) ^ T-CarTypes(y; z)g ; Inst C (x; z)
– M3: f(x; y) j T-CarTypes(z1; x) ^ T-CarTypes(z2; y) ^ x 6= yg ; Disj C (x; y)
Intuitively, M1 states that every type of car (whose name appears in the second column
of table T-CarTypes, i.e. Coupe´, SUV, Sedan, etc.) is a Car. M2, instead, indicates how
to correctly retrieve the instances of different types of cars (e.g. car with plate number
AB111 has to be retrieved as an instance of the concept Coupe´, cars with plate numbers
AF333 and BR444 as instances of the concept SUV, and so on). Finally, the intended
meaning of assertion M3 is that different types of cars are pairwise disjoint (e.g. a
Coupe´ is not a SUV, a SUV is not a Sedan, and so on). Obviously, mapping assertions
are always written by people who know the semantics of the information stored in
the database. Notice that the mapping assertions in M are able to model the car-types
hierarchy without knowing a priori (i.e. at design-time) all the different kinds of cars
that are produced by the motor industry.</p>
      <p>Suppose now that the motor industry decides to introduce new types of cars to its
car fleet, and in particular it decides to produce Campers and Caravans as well, thus
extending the hierarchy. As one can imagine, these new kinds of cars share some
common characteristics with the previous car types, even though not all of them. Therefore,
it might be a reasonable choice for the database designers to introduce a new relational
table in D:</p>
      <p>T-NewCars NumberPlate CarType Height Weight EngineSize BreakHorsePower
CM777
CM888
CV333
CV222</p>
      <p>Camper 2,50 mt 680 Kg 4000 cc
Camper 2,20 mt 550 Kg 3000 cc
Caravan 2,30 mt 620 Kg 3000 cc
Caravan 2,50 mt 580 Kg 4000 cc
200 bhp
150 bhp
200 bhp
250 bhp
The new situation can be modeled in our framework by simply adding to M the
following mapping assertions:
– M4: fy j T-NewCars(x; y; t; u; v; q)g ; IsaC (y; Car)
– M5: f(x; z) j T-NewCars(x; z; t; u; v; q)g ; Inst C (x; z)
– M6: f(x; y) j T-NewCars(z1; x) ^ T-NewCars(z2; y) ^ x 6= yg ; Disj C (x; y)
where mapping M4 states that the new kinds of cars (Camper and Caravan) are Cars,
the second assertion indicates how to correctly retrieve their instances, (e.g. car with
plate number CM777 as an instance of Camper), and mapping M6 states that the new
types of cars are pairwise disjoint (i.e. a Camper is not a Caravan).</p>
      <p>Notice that if (instead of creating a new table) the new kinds of cars had been simply
introduced into the initial table T-CarTypes (thus without modifying D in any way), the
new concepts (Camper and Caravan) would been automatically detected at run-time by
mappings M1-M3, whitout requiring any further mapping definition.</p>
      <p>Next, we introduce the notion of query, which in turn relies on the notion of “query
atom”. Intuitively, a query atom is a special kind of atom, constituted by a
metapredicate applied to a set of arguments, where each argument is either an expression
or a variable. More precisely, we define the set of q-terms to be DL-LiteR (S) [ V. We
define a query atom as an atom constituted by the application of a meta-predicate in
MP (DL-LiteR) to a set of q-terms, and we call a query atom ground if no variable
occurs in it. A query atom whose meta-predicate is Inst C or Inst R is called an
instancequery atom. A higher-order conjunctive query (HCQ) of arity n is an expression of
the form q(x1; : : : ; xn) a1; : : : ; am where q, called the query predicate, is a symbol
not in S [ V, every xi belongs to V, every ai is a (possibly non-ground) query atom,
and all variables x1; : : : ; xn occur in some aj . The variables x1; : : : ; xn are called the
free variables (or distinguished variables) of the query, while the other variables
occurring in a1; : : : ; am are called existential variables. A HCQ constituted by instance
atoms only is called an instance HCQ (IHCQ). A higher-order union of conjunctive
queries (HUCQ) of arity n is a set of HCQs of arity n with the same query predicate.
A HUCQ constituted by instance HCQs only is called an instance HUCQ (IHUCQ). A
HCQ/HUCQ is called Boolean if it has no free variables.</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; .
A Boolean HUCQ Q is satisfied in I; if there exists a Boolean HCQ q 2 Q that is
satisfied in I; . A Boolean HUCQ Q is satisfied in I, written I j= Q, if there exists
an assignment over I such that Q is satisifed in I; . Given a Boolean HUCQ Q and
a Hi (DL-LiteR) KB K, we say that Q is logically implied by K (denoted by K j= Q) if
for each model I of K there exists an assignment such that Q is satisfied by I; .</p>
      <p>Given a non-Boolean HUCQ q of the form q(t1; : : : ; tn) a1; : : : ; am, a
grounding substitution of q is a substitution such that t1 ; : : : ; tn are ground terms. We
call t1 ; : : : ; tn a grounding tuple. The set of certain answers to q in K is the set of
grounding tuples t1 ; : : : ; tn that make the Boolean query q a1 ; : : : ; an
logically implied by K. Notice that, in general, the set of certain answers may be infinite
even if the KB is finite. Therefore, it is of interest to define suitable notions of safeness,
which guarantee that the set of answers is bounded. This issue, however, is beyond the
scope of the present paper. Indeed, in this paper, we focus on Boolean queries only, so
as to address the computation of certain answers as a decision problem.
Example 2. Let us refer to the MKB K1 = hD; Mi of example 1. Interesting queries
that can be posed to K1 include: (i) Return all the instances of Car manufactured by
the motor industry, each one with its own type: q(x; y) Inst C (x; y); Inst C (y; Car);
(ii) Return all the concepts which car with plate number ’AB111’ belongs to: q(x)
Inst C (0AB1110; x).
4</p>
    </sec>
    <sec id="sec-3">
      <title>Query answering</title>
      <p>In this section, we study the problem of answering IHUCQs over Hi (DL-LiteR) MKBs.
Our query answering technique is based on query rewriting, so we will first deal with the
problem of computing a perfect reformulation of a IHUCQ over a Hi (DL-LiteR) KB.
Then, we will present a query answering algorithm for MKBs based on the above
perfect reformulation technique. In the following, we assume that the MKB is consistent.
This does not constitute a limitation, since it is possible to show that checking
consistency of a MKB can also be done through query answering, by means of techniques
analogous to the ones defined for DL-Lite.</p>
      <p>We start with some auxiliary definitions. Given an assertion = Inst C (e1; e2), we
say that e2 occurs as a concept argument in . Given an assertion = Inst R(e1; e2; e3),
we say that e3 occurs as a role argument in . Given an assertion = IsaC (e1; e2),
we say that e1 and e2 occur as concept arguments in . Given an assertion =
IsaR(e1; e2), we say that e1 and e2 occur as role arguments in . Given an assertion
= Disj C (e1; e2), we say that e1 and e2 occur as concept arguments in . Given an
assertion = Disj R(e1; e2), we say that e1 and e2 occur as role arguments in .</p>
      <p>A DL atom is an atom of the form N (t) or N (t1; t2), where N is a name
and t; t1; t2 are either variables or names. An extended CQ (ECQ) is a
conjunction of DL atoms, Inst C atoms and Inst R atoms. An extended UCQ (EUCQ) is
a union of ECQs. Given an atom , Pred ( ) denotes the term appearing in
predicate position in (such a term may be either a variable or an expression). Given
a TBox T , we denote by Concepts(T ) the set fe; Exists (e); Exists (Inv (e)) j
e 2 E and e occurs as a concept argument in T g and denote by Roles(T ) the set
fe; Inv (e) j e 2 E and e occurs as a role argument in T g. Given a mapping M and
a database DB , we denote by Retrieve(M; DB ) the Hi (DL-LiteR) KB H defined as:
H = f (t) j (x) ;
2 M and DB j=
(t)g
Given an instance-mapping M and an ABox A, we say that A is retrievable through
M if there exists a database DB such that A = Retrieve(M; DB ).</p>
      <p>
        Query rewriting. We start by providing an intuitive explanation of our rewriting
technique. The basic idea is to reduce the perfect reformulation of an IHUCQ over a
Hi (DL-LiteR) TBox to the perfect reformulation of a standard UCQ over a DL-LiteR
TBox, which can be done e.g. by the algorithm PerfectRef presented in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. To do so,
we have to first transform a IHUCQ into a standard UCQ, actually an EUCQ. This is
done through a first partial grounding of the query (through the function PMG ) and then
through the functions Normalize and presented below. Once computed the perfect
reformulation of the EUCQ, we then have to transform the EUCQ back into a IHUCQ,
through the functions Denormalize and presented below.
      </p>
      <p>Given two IHCQs q; q0 and a TBox T , we say that q0 is a partial metagrounding of
q with respect to T if q0 = (q) where is a partial substitution of the metavariables
of q with the expressions occurring in T such that, for each metavariable x of q, either
(x) = x or: (i) if x occurs in a concept position in q, then (x) 2 Concepts(T ); (ii)
if x occurs in a role position in q, then (x) 2 Roles(T ). Given an IHCQ q and a TBox
T , we denote by PMG (q; T ) the set of all partial metagroundings of q with respect to
T , i.e., the following IHUCQ Q:</p>
      <p>Q = fq0 j q0 is a partial metagrounding of q with respect to T g
Moreover, given a IHUCQ Q and a TBox T , we define PMG (Q; T ) as the IHUCQ
Sq2Q PMG (q; T ).</p>
      <p>Given an instance atom , we define Normalize( ) as follows:
– if = Inst C (e1; e2) and e2 has the form Exists (e0) where e0 is an expression
which is not of the form Inv (e00), then Normalize( ) = Inst R(e1; ; e0);
– if = Inst C (e1; e2) and e2 has the form Exists (Inv (e0)) where e0 is any
expression, then Normalize( ) = Inst R( ; e1; e0);
– if = Inst R(e1; e2; e3) and e3 is of the form Inv k(e0) where k 1 and k is
an even number and e0 is an expression which is not of the form Inv (e00), then
Normalize( ) = Inst R(e1; e2; e0);
– if = Inst R(e1; e2; e3) and e3 is of the form Inv k(e0) where k 1 and k is
an odd number and e0 is an expression which is not of the form Inv (e00), then
Normalize( ) = Inst R(e2; e1; e0).
Given an IHCQ q 1; : : : ; n, Normalize(q) returns the IHCQ q
Normalize( 1); : : : ; Normalize( n). Finally, given an IHUCQ Q, we define
Normalize(Q) as Sq2Q Normalize(q).</p>
      <p>Given an IHCQ q and an instance-mapping M, Denormalize(q; M) is the IHUCQ
Q defined inductively as follows:
– q 2 Q;
– if q0 2 Q and q0 contains an atom of the form Inst R(t1; ; t2), and either
Exists (t2) occurs in M or Exists (x) (where x is a variable) occurs in M, then
the query obtained from q0 by replacing with the atom Inst C (t1; Exists (t2))
belongs to Q;
– if q0 2 Q and q0 contains an atom of the form Inst R( ; t1; t2), and
either Exists (Inv (t2)) occurs in M or Exists (Inv (x)) (where x is a variable)
occurs in M, then the query obtained from q0 by replacing with the atom
Inst C (t1; Exists (Inv (t2))) belongs to Q;
– if q0 2 Q and q0 contains an atom of the form Inst R(t1; t2; t3) and either Inv (t2)
occurs in M or Inv (x) (where x is a variable) occurs in M, then the query obtained
from q0 by replacing with the atom Inst R(t2; t1; Inv (t3))) belongs to Q.
Finally, given an IHUCQ Q and a mapping M, we define Denormalize(Q; M) as
Sq2Q Denormalize(q; M).</p>
      <p>
        Given an IHUCQ Q and a TBox T , we denote by PerfectRef (Q; T ) the EUCQ
returned by the query rewriting algorithm for DL-LiteR shown in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].2
      </p>
      <p>We now define the functions and which translate IHUCQs into EUCQs and
vice versa. Given an IHCQ q and a TBox T , (q; T ) is the ECQ obtained from q as
follows: (i) for each atom of q of the form Inst C (t1; t2), if t2 2 Concepts(T ) then replace
the atom with the atom t2(t1); (ii) for each atom of q of the form Inst R(t1; t2; t3), if
t3 2 Roles(T ) then replace the atom with the atom t3(t1; t2). Then, given an IHUCQ
Q, we define (Q; T ) = f (q; T ) j q 2 Qg.</p>
      <p>Given a ECQ q and a TBox T , (q; T ) is the IHCQ obtained from q as
follows: (i) for each atom of q of the form t2(t1), replace the atom with the atom
Inst C (t1; t2); (ii) for each atom of q of the form t3(t1; t2), replace the atom with the
atom Inst R(t1; t2; t3). Then, given an IHUCQ Q, we define (Q; T ) = f (q; T ) j
q 2 Qg.</p>
      <p>We are now ready to formally define our rewriting algorithm, which takes as input
a IHUCQ, a TBox and an instance-mapping, and returns a new IHUCQ.
ALGORITHM RewriteIUCQ (Q; T ; M)
INPUT: Boolean IHUCQ Q, DL-LiteR TBox T , instance-mapping M
OUTPUT: Boolean IHUCQ Q0</p>
      <p>Q0 = PMG (Q; T );
Q1 = Normalize(Q0);
Q2 = (Q1; T );
Q3 = PerfectRef (Q2; T );
Q4 = (Q3; T );
Q0 = Denormalize(Q4; M);
return Q0;
2 We are actually considering a slight generalization of the algorithm, which allows for the
presence of a ternary relation (Inst R) in the query.</p>
      <p>The IHUCQ returned by RewriteIUCQ (Q; T ; M) constitutes a perfect
reformulation of the query Q with respect to the TBox T and the mapping M, as formally stated
by the following theorem.</p>
      <p>Theorem 1. Let T be a TBox, let M be an instance-mapping and let Q be a IHUCQ.
Then, for every ABox A that is a retrievable through M, T [ A j= Q iff A j=
RewriteIUCQ (Q; T ; M).</p>
      <p>Query answering. Based on the above query rewriting technique, we now present
an algorithm for query answering over MKBs. Our idea is to first compute a DL-LiteR
TBox by evaluating the mapping assertions involving the predicates IsaC , IsaR, Disj C ,
Disj R over the database of the MKB; then, such a TBox is used to compute the perfect
reformulation of the input IHUCQ.</p>
      <p>
        To complete query answering, we now have to consider the mapping of the
predicates Inst C and Inst R, and to reformulate the query thus obtained replacing the above
predicates with the corresponding FOL queries of the mapping assertions. In this way
we obtain a FOL query expressed on the database. This second rewriting step, usually
called unfolding, can be performed by the algorithm UnfoldDB presented in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].3
      </p>
      <p>In the following, given a mapping M and a database DB , we denote by DB MA
the database constituted by every relation R of DB such that R occurs in MA.
Analogously, we denote by DB MT the database constituted by every relation R of DB such
that R occurs in MT . We are now ready to present our query answering algorithm.
ALGORITHM Answer (Q; K)
INPUT: Boolean IHUCQ Q, Hi (DL-LiteR) MKB K = hDB ; Mi
OUTPUT: true if K j= Q, false otherwise</p>
      <p>T = Retrieve(MT ; DB MT );
Q0 = RewriteIUCQ (Q; T ; MA);
Q00 = UnfoldDB(Q0; MA);
if DB MA j= Q00
then return true
else return false
The algorithm starts by retrieving the TBox from the DB through the mapping MT .
Then, it computes the perfect reformulation of the query with respect to the retrieved
TBox, and next computes the unfolding of such a query with respect to the mapping
MA. Finally, it evaluates the query over the database.</p>
      <p>
        The following property can be proved by slightly extending the proof of correctness
of the algorithm UnfoldDB shown in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
      </p>
      <p>Lemma 1. Let M be an instance-mapping and let Q be a IHUCQ. Then, for every
database DB , hM; DB i j= Q iff DB MA j= UnfoldDB(Q; M).
3 Here we assume that the algorithm UnfoldDB takes as input a EUCQ and an instance-mapping.</p>
      <p>
        This corresponds to actually considering a straightforward extension of the algorithm
presented in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] in order to deal with the presence of the ternary predicate Inst R.
      </p>
      <p>The above lemma allows us to prove correctness of the algorithm Answer .
Theorem 2. Let K = hDB ; Mi be a Hi (DL-LiteR) MKB, let Q be a IHUCQ. Then,
K j= Q iff Answer (Q; K) returns true.</p>
      <p>Finally, from the algorithm Answer we are able to derive the following complexity
results for query answering over Hi (DL-LiteR) MKBs.</p>
      <p>
        Theorem 3. Let K = hDB ; Mi be a Hi (DL-LiteR) MKB, and let Q be a IHUCQ.
Deciding whether K j= Q is in AC0 with respect to the size of DB MA , is in PTIME
with respect to the size of K, and is NP-complete with respect to the size of K [ Q.
5
In this paper we have investigated the possibility of generating a knowledge base on the
fly, while computing instance queries, from data stored in data sources through asserted
mappings. A key point to obtain such a degree of flexibility is relying on higher-order
description logics which blur the distinction between classes/roles at the intensional
level and individuals at the extensional level. This paper is only scratching the surfaces
of the immense possibilities that this approach opens. For example, we may allow the
coexistence of multiple TBoxes within the same data sources, and allow the user to
select which TBox to load when querying the system, possibly depending on the query,
much in the spirit of [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. The user can in principle even compose on the fly the TBox to
use when answering a query. Obviously notions such as authorization views acquire an
intriguing flavor in this setting (hiding intensional as well as extensional knowledge),
as well as consistency, since we may even allow for contradicting assertions to coexist
as long as they are not used together when performing query answering.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <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 Journal</source>
          ,
          <volume>2</volume>
          (
          <issue>1</issue>
          ):
          <fpage>43</fpage>
          -
          <lpage>53</lpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <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>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          .
          <article-title>Ontologybased database access</article-title>
          .
          <source>In Proc. of SEBD</source>
          <year>2007</year>
          , pages
          <fpage>324</fpage>
          -
          <lpage>331</lpage>
          ,
          <year>2007</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>
          , 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="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>W.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kifer</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D. S.</given-names>
            <surname>Warren. HILOG</surname>
          </string-name>
          :
          <article-title>A foundation for higher-order logic programming</article-title>
          .
          <source>J. of Logic Programming</source>
          ,
          <volume>15</volume>
          (
          <issue>3</issue>
          ):
          <fpage>187</fpage>
          -
          <lpage>230</lpage>
          ,
          <year>1993</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <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="ref6">
        <mixed-citation>
          6.
          <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 id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>J.</given-names>
            <surname>Parsons</surname>
          </string-name>
          and
          <string-name>
            <given-names>Y.</given-names>
            <surname>Wand</surname>
          </string-name>
          .
          <article-title>Emancipating instances from the tyranny of classes in information modeling</article-title>
          .
          <source>ACM Trans. on Database Systems</source>
          ,
          <volume>25</volume>
          (
          <issue>2</issue>
          ):
          <fpage>228</fpage>
          -
          <lpage>268</lpage>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>A.</given-names>
            <surname>Poggi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</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>Linking data to ontologies</article-title>
          .
          <source>J. on Data Semantics</source>
          , X:
          <fpage>133</fpage>
          -
          <lpage>173</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>D. F.</given-names>
            <surname>Savo</surname>
          </string-name>
          ,
          <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>
            <surname>M.</surname>
          </string-name>
          <article-title>Rodr´ıguez-</article-title>
          <string-name>
            <surname>Muro</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          <string-name>
            <surname>Romagnoli</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Ruzzi</surname>
            , and
            <given-names>G. Stella.</given-names>
          </string-name>
          <article-title>MASTRO at work: Experiences on ontology-based data access</article-title>
          .
          <source>In Proc. of DL</source>
          <year>2010</year>
          , volume
          <volume>573</volume>
          <source>of CEUR, ceur-ws.org</source>
          , pages
          <fpage>20</fpage>
          -
          <lpage>31</lpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>