• No results found

Temporal description logic for ontology based data access

N/A
N/A
Protected

Academic year: 2020

Share "Temporal description logic for ontology based data access"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

BIROn - Birkbeck Institutional Research Online

Artale, A. and Kontchakov, Roman and Wolter, F. and Zakharyaschev,

Michael (2013) Temporal description logic for ontology-based data access.

In: Rossi, F. (ed.)

Proceedings of the Twenty-Third International Joint

Conference on Artificial Intelligence. California, U.S.: AAAI Press, pp.

711-717. ISBN 9781577356332.

Downloaded from:

Usage Guidelines:

Please refer to usage guidelines at

or alternatively

(2)

Temporal Description Logic for Ontology-Based Data Access

Alessandro Artale

1

, Roman Kontchakov

2

, Frank Wolter

3

and Michael Zakharyaschev

2 1

Faculty of Computer Science

Free University of Bozen-Bolzano, Italy

3

Department of Computer Science,

University of Liverpool, U.K.

2

Department of Computer Science and

Information Systems

Birkbeck, University of London, U.K.

Abstract

Our aim is to investigate ontology-based data ac-cess over temporal data with validity time and ontologies capable of temporal conceptual mod-elling. To this end, we design a temporal descrip-tion logic, TQL, that extends the standard ontol-ogy languageOWL 2 QL, provides basic means for temporal conceptual modelling and ensures first-order rewritability of conjunctive queries for suit-ably defined data instances with validity time.

1

Introduction

One of the most promising and exciting applications of de-scription logics (DLs) is to supply ontology languages and query answering technologies for ontology-based data ac-cess (OBDA), a way of querying incomplete data sources that uses ontologies to provide additional conceptual infor-mation about the domains of interest and enrich the query vocabulary. The current W3C standard language for OBDA is OWL 2 QL, which was built on the DL-Lite family of DLs [Calvanese et al., 2006; 2007]. To answer a con-junctive query q over an OWL 2 QL ontology T and in-stance data A, an OBDA system first ‘rewrites’ q and T

into a new first-order query q0 and then evaluates q0 over

A(without using the ontology). The evaluation task is per-formed by a conventional relational database management system. Finding efficient and practical rewritings has been the subject of extensive research [P´erez-Urbinaet al., 2009; Rosati and Almatelli, 2010; Kontchakovet al., 2010; Chor-taraset al., 2011; Gottlobet al., 2011; K¨oniget al., 2012]. Another fundamental feature of OWL 2 QL, supplementing its first-order rewritability, is the ability to capture basic conceptual data modelling constructs [Berardi et al., 2005; Artaleet al., 2007].

In applications, instance data is often time-dependent: em-ployment contracts come to an end, parliaments are elected, children are born. Temporal data can be modelled by pairs consisting of facts and their validity time; for example,

givesBirth(diana,william,1982). To query data with validity time, it would be useful to employ an ontology that provides a conceptual model for both static and temporal aspects of the domain of interest. Thus, when querying the fact above,

one could use the knowledge that, ifxgives birth toy, thenx becomes a mother ofyfrom that moment on:

♦PgivesBirthvmotherOf, (1)

whereP reads ‘sometime in the past.’ OWL 2 QL does not

support temporal conceptual modelling and, rather surpris-ingly, no attempt has yet been made to lift the OBDA frame-work to temporal ontologies and data.

Temporal extensions of DLs have been investigated since 1993; see [Gabbayet al., 2003; Lutzet al., 2008; Artale and Franconi, 2005] for surveys and [Franconi and Toman, 2011; Guti´errez-Basulto and Klarman, 2012; Baaderet al., 2012] for more recent developments. TemporalisedDL-Lite log-ics have been constructed for temporal conceptual data mod-elling [Artaleet al., 2010]. But unfortunately, none of the existing temporal DLs supports first-order rewritability.

The aim of this paper is to design a temporal DL that containsOWL 2 QL, provides basic means for temporal con-ceptual modelling and, at the same time, ensures first-order rewritability of conjunctive queries (for suitably defined data instances with validity time).

The temporal extension TQL of OWL 2 QL we present here is interpreted over sequencesI(n),n∈ Z, of standard

DL structures reflecting possible evolutions of data. TBox axioms are interpreted globally, that is, are assumed to hold in all of theI(n), but the concepts and roles they contain can vary in time. ABox assertions (temporal data) are time-stamped unary (for concepts) and binary (for roles) predicates that hold at the specified moments of time. Concept (role) inclusions ofTQL generaliseOWL 2 QL inclusions by al-lowing intersections of basic concepts (roles) in the left-hand side, possibly prefixed with temporal operatorsP(sometime

in the past) or♦F (sometime in the future). Among other

things, one can express inTQL that a concept/role name is rigid (or time-independent), persistent in the past/future or instantaneous. For example, F♦PPerson v Person states

that the concept Person is rigid, PhasName v hasName

says that the rolehasNameis persistent in the future, while

givesBirthuPgivesBirthv ⊥implies thatgivesBirthis

in-stantaneous. Inclusions such as♦PStartu♦FEndvEmployed

represent convexity (or existential rigidity) of concepts or roles. However, in contrast to most existing temporal DLs, we cannot use temporal operators in the right-hand side of inclu-sions (e.g., to say that every student will eventually graduate:

StudentvFGraduate).

(3)

In conjunctive queries (CQs) overTQL knowledge bases, we allow time-stamped predicates together with atoms of the form(τ < τ0)or(τ=τ0), whereτ, τ0are temporal constants

denoting integers or variables ranging over integers.

Our main result is that, given aTQL TBoxT and a CQ

q, one can construct a unionq0of CQs such that the answers toqoverT and any temporal ABoxAcan be computed by evaluatingq0 overAextended with the temporal precedence relation<between the moments of time inA. For example, the querymotherOf(x, y, t)over (1) can be rewritten as

motherOf(x, y, t)∨ ∃t0 (t0< t)∧givesBirth(x, y, t0) .

Note that the addition of the transitive relation<to the ABox is unavoidable: without it, there exists no first-order rewriting even for the simple example above [Libkin, 2004, Cor. 4.13]. From a technical viewpoint, one of the challenges we are facing is that, in contrast to known OBDA languages with CQ rewritability (including fragments of datalog± [Cal`ı et al., 2012]), witnesses for existential quantifiers outside the ABox are not independent from each other but interact via the temporal precedence relation. For this reason, a reduction to known languages appears to be impossible and a novel ap-proach to rewriting has to be found. We also observe that straightforward temporal extensions ofTQL lose first-order rewritability. For example, query answering over the ontol-ogy{StudentvFGraduate}is shown to be non-tractable.

All omitted proofs can be found in [Artaleet al., 2013].

2

TQL

: a Temporal Extension of

OWL 2 QL

ConceptsCandrolesSofTQLare defined by the grammar:

R ::= ⊥ | Pi | Pi−,

B ::= ⊥ | Ai | ∃R,

C ::= B | C1uC2 | ♦PC | ♦FC,

S ::= R | S1uS2 | ♦PS | ♦FS,

whereAi is a concept name, Pi arole name(i ≥ 0), and

♦P and♦F are temporal operators ‘sometime in the past’ and

‘sometime in the future,’ respectively. We call concepts and roles of the formBandRbasic. ATQL TBox,T, is a finite set ofconceptandrole inclusionsof the form

CvB, SvR,

which are assumed to hold globally (over the whole timeline). Note that theF /P-free fragment ofTQL is an extension of

the description logic DL-LiteHhorn [Artale et al., 2009] with

role inclusions of the form R1 u · · · uRn v R; it

prop-erly containsOWL 2 QL(the missing role constraints can be safely added to the language).

ATQL ABox,A, is a (finite) set of atomsPi(a, b, n)and Ai(a, n), where a, b are individual constants and n ∈ Z

a temporal constant. The set of individual constants in A

is denoted byind(A), and the set of temporal constants by tem(A). ATQL knowledge base(KB) is a pairK= (T,A), whereT is a TBox andAan ABox.

Atemporal interpretation, I, is given by the ordered set

(Z, <)oftime pointsand standard (atemporal) interpretations

I(n) = (∆I,·I(n)), for eachn

Z. Thus,∆I 6=∅ is the

common domain of allI(n),aIi(n)∈∆I,AIi(n)⊆∆Iand

PiI(n) ⊆ ∆I ×∆I. We assume that aIi(n) = aIi(0), for alln ∈ Z. To simplify presentation, we adopt the unique

name assumption, that is,aIi(n)6=ajI(n)fori6=j(although the obtained results hold without it). The role and concept constructs are interpreted inIas follows, wheren∈Z:

⊥I(n)=

(for both concepts and roles),

(Pi−)I(n)={(x, y)|(y, x)∈PiI(n)},

(∃R)I(n)={x|(x, y)∈RI(n), for somey},

(C1uC2)I(n)=C I(n) 1 ∩C

I(n) 2 ,

(PC)

I(n)={x|xCI(m), for somem < n},

(FC)

I(n)={x|xCI(m), for somem > n},

(S1uS2)I(n)=S I(n) 1 ∩S

I(n) 2 ,

(PS) I(n)

={(x, y)|(x, y)∈SI(m), for somem < n},

(FS) I(n)=

{(x, y)|(x, y)∈SI(m), for somem > n}. Thesatisfaction relation|=is defined by taking

I |=Ai(a, n) iff aI(n)∈A I(n) i ,

I |=Pi(a, b, n) iff (aI(n), bI(n))∈PI (n) i ,

I |=CvB iff CI(n)⊆BI(n), for alln∈Z,

I |=SvR iff SI(n)⊆RI(n), for alln∈Z.

If all inclusions inT and atoms inAare satisfied inI, we callIamodelofK= (T,A)and writeI |=K.

Aconjunctive query(CQ) is a (two-sorted) first-order for-mulaq(~x, ~s) =∃~y, ~t ϕ(x, ~~ y, ~s, ~t), whereϕ(~x, ~y, ~s, ~t)is a con-junction of atoms of the formAi(ξ, τ),Pi(ξ, ζ, τ),(τ =σ)

and(τ < σ), withξ,ζ being individual terms—individual constants or variables in~x, ~y—andτ, σtemporal terms— temporal constants or variables in~t,~s. In apositive existential query(PEQ)q, the formulaϕcan also contain∨. Aunion of CQs(UCQ) is a disjunction of CQs (so every PEQ is equiva-lent to an exponentially larger UCQ).

Given a KBK = (T,A)and a CQq(~x, ~s), we call tuples ~a⊆ind(A)and~n⊆tem(A)acertain answertoq(~x, ~s)over

Kand writeK |=q(~a, ~n), ifI |=q(~a, ~n)for every modelI

ofK(understood as a two-sorted first-order model).

Example 1 Suppose Bob was a lecturer at UCL between timesn1andn2, after which he was appointed professor on

a permanent contract. To model this situation, we use indi-vidual names,e1ande2, to represent the two events of Bob’s

employment. The ABox will containn1< n2and the atoms

lect(bob, e1, n1),lect(bob, e1, n2),prof(bob, e2, n2+ 1). In

the TBox, we make sure that everybody is holding the corre-sponding post over the duration of the contract, and include other knowledge about the university life:

♦Plectu♦Flectvlect, ♦Pprofvprof, ∃lectvLecturer, ∃profvProfessor,

Professorv ∃supervisesPhD, ProfessorvStaff,

♦PsupervisesPhDu♦FsupervisesPhDvsupervisesPhD,

(4)

We can now obtain staff who supervised PhDs between times k1andk2by posing the following CQ:

∃y, t (k1< t < k2)∧Staff(x, t)∧supervisesPhD(x, y, t)

.

The key idea of OBDA is to reduce answering CQs over KBs to evaluating FO-queries over relational databases. To obtain such a reduction forTQLKBs, we employ a very basic type of temporal databases. With everyTQL ABoxA, we associate a data instance[A]which contains all atoms from

Aas well as the atoms (n1 < n2) such thatni ∈ Zwith

mintem(A) ≤ ni ≤ maxtem(A) andn1 < n2. Thus,

in addition to A, we explicitly include in[A] the temporal precedence relation over theconvex closureof the time points that occur inA. (Note that, in standard temporal databases, the order over timestamps is built-in.) The main result of this paper is the following:

Theorem 2 Letq(~x, ~s)be a CQ andT aTQLTBox. Then one can construct a UCQ q0(~x, ~s)such that, for any con-sistent KB (T,A) such that A contains all temporal con-stants fromq, any~a ⊆ ind(A)and~n ⊆ tem(A), we have

(T,A)|=q(~a, ~n)iff[A]|=q0(~a, ~n).

Such a UCQq0(~x, ~s)is called arewritingforqandT. We begin by showing how to compute rewritings for CQs over KBs with empty TBoxes.

For an ABoxA, we denote byAZtheinfinitedata instance

which contains the atoms inAas well as all(n1< n2)such

that n1, n2 ∈ Zandn1 < n2. It will be convenient to

re-gard CQsq(~x, ~s)assetsof atoms, so that we can write, e.g., A(ξ, τ)∈q. We say thatqistotally orderedif, for any tem-poral termsτ, τ0inq, at least one of the constraintsτ < τ0, τ = τ0 or τ0 < τ is inqand the set of such constraints is consistent (in the sense that it can be satisfied inZ). Clearly, every CQ is equivalent to a union of totally ordered CQs (note that the empty union is⊥).

Lemma 3 For every UCQq(~x, ~s), one can compute a UCQ

q0(~x, ~s)such that, for any ABoxAcontaining all temporal constants fromqand any~a⊆ind(A),~n⊆tem(A), we have

AZ|=q(~a, ~n) iff [A]|=q0(~a, ~n).

Proof.We assume that every CQq0inqis totally ordered. In each suchq0, we remove a bound temporal variablettogether

with the atoms containingtif at least one of the following two conditions holds:

– there is no temporal constant or free temporal variable τ with(τ < t)∈ q0, and for no temporal termτ0 and

atom of the formA(ξ, τ0)orP(ξ, ζ, τ0)inq0do we have

(τ0< t)or(τ0 =t)inq0;

– the same as above but with<replaced by>.

It is readily checked that the resulting UCQ is as required. q

Example 4 Suppose T = {FC v A, ♦PA v B} and q(x, s) = B(x, s). Then, for any A, a ∈ ind(A), n ∈

tem(A), we have(T,A)|=q(a, n)iffAZ|=q0(a, n), where

q0(x, s) =B(x, s) ∨ ∃t (t < s)∧A(x, t)

∨ ∃t, r (t < s)∧(t < r)∧C(x, r) .

Note, however, thatq0 isnota rewriting forqandT. Take, for example,A = {C(a,0)}. Then(T,A) |= B(a,0)but

[A]6|=q0(a,0). A correct rewriting is obtained by replacing

the last disjunct inq0 with∃r C(x, r); it can be computed by applying Lemma 3 toq0and slightly simplifying the result.

In view of Lemma 3, from now on we will only focus on rewritings overAZ.

The problem of finding rewritings for CQs and TQL TBoxes can be reduced to the case where the TBoxes only contain inclusions of the form

B1uB2vB, ♦FB1vB2, ♦PB1vB2, R1uR2vR, ♦FR1vR2, ♦PR1vR2.

We say that such TBoxes are innormal form.

Theorem 5 For every TQL TBoxT, one can construct in polynomial time a TQL TBox T0 in normal form ( possi-bly containing additional concept and role names)such that

T0 |=T and, for every modelI ofT, there exists a model of T0that coincides withIon all concept and role names inT.

Suppose now that we have a UCQ rewritingq0 for a CQ qand the TBoxT0 in Theorem 5. We obtain a rewriting for qandT simply by removing fromq0those CQs that contain symbols occurring inT0 but not in T. From now on, we

assume thatallTQLTBoxes are in normal form. The set of role names inT and with their inverses is denoted byRT,

while|T |is the number of concept and role names inT. We begin the construction of rewritings by considering the case when all concept inclusions are of the formCvAi, so

existential quantification∃Rdoes not occur in the right-hand side.TQL TBoxes of this form will be calledflat. Note that RDFS statements can be expressed by means of flat TBoxes.

3

UCQ Rewriting for Flat TBoxes

LetK = (T,A) be a KB with a flat TBoxT (in normal form). Our first aim is to construct a modelCKofK, called thecanonical model, for which the following theorem holds:

Theorem 6 For any consistent KBK = (T,A)with flatT

and any CQq(~x, ~s), we haveK |=q(~a, ~n)iffCK |=q(~a, ~n),

for all tuples~a⊆ind(A)and~n⊆Z.

The construction uses a closure operator,cl, which applies the rules(ex),(c1)–(c3),(r1)–(r3)below to a set,S, of atoms of the formR(u, v, n),A(u, n),∃R(u, n)or(n < n0);cl(S)

is the result of (non-recursively) applying those rules toS,

cl0(S) =S, cli+1(S) =cl(cli(S)), cl∞(S) =[

i≥0

cli(S).

(ex) IfR(u, v, n)∈ Sthen add∃R(u, n),∃R−(v, n)toS;

(c1) if(B1uB2 v B) ∈ T andB1(u, n),B2(u, n) ∈ S,

then addB(u, n)toS;

(c2) if(PBvB

0)∈ T,B(u, m)∈ Sfor somem < nand

noccurs inS, then addB0(u, n)toS;

(c3) if(FBvB0)∈ T,B(u, m)∈ Sfor somem > nand noccurs inS, then addB0(u, n)toS;

(r1) if(R1uR2vR)∈ T andR1(u, v, n),R2(u, v, n)are

(5)

(r2) if(PR vR0)∈ T,R(u, v, m)∈ Sfor somem < n

andnoccurs inS, then addR0(u, v, n)toS;

(r3) if(FR vR0)∈ T,R(u, v, m)∈ S for somem > n

andnoccurs inS, then addR0(u, v, n)toS.

Note first thatK = (T,A)is inconsistent iff⊥ ∈cl∞(AZ).

IfKis consistent, we define thecanonical modelCKofKby taking∆CK =ind(A),a ACK(n)iffA(a, n) cl(AZ),

and(a, b) ∈ PCK(n)iffP(a, b, n) cl(AZ), forn

Z.

(AsT is flat, atoms of the form∃R(u, n)can only be added by (ex).) This gives us Theorem 6. The following lemma shows that to constructCKwe actually need only a bounded number of applications ofclwhich does not depend onA:

Lemma 7 SupposeT is a flat TBox, let nT = (4· |T |)4.

Thencl∞(AZ) =clnT(AZ), for any ABoxA.

Proof. It is not hard to see thatcl∞(S)can be obtained by first exhaustively applying(r1)–(r3), then(ex), and after that

(c1)–(c3). Since no recursion of(ex)is needed, it is sufficient to bound the recursion depth for applications of(r1)–(r3)and

(c1)–(c3)separately. As both behave similarly, we focus on

(r1)–(r3). One can show that it is enough to consider ABoxes with two individuals, say aandb, and it is not difficult to find a bound for the recursion depth of the separated rule sets

(r1),(r2)and, respectively,(r1),(r3); the interesting part of the analysis is how often one has to alternate between appli-cations of(r1),(r2)and applications of(r1),(r3). The key observation here is that each alternation introduces a fresh

cross over (i.e., a pair(R1, R2)of roles such that there are m1, m2 ∈ Zwithm1+ 1 ≥ m2, R1(a, b, n) ∈ S for all n≤m1, andR2(a, b, n)∈ Sfor alln≥m2). The number

of such cross overs is bounded by|T |2, and so the number

of required alternations between exhaustively applying(r1),

(r2)and(r1),(r3)is bounded by|T |2.

q

We now use Lemma 7 to construct a rewriting for any flat TBoxT and CQq(~x, ~s). For a conceptCand a roleS, denote by C] and S] their standard FO-translations; for example,

(FA)

](ξ, τ) = t((τ < t)A(ξ, t))and(R)](ξ, τ) =

∃y R(ξ, y, τ). Now, given a PEQ ϕ, we set ϕ0↓ = ϕand define, inductively,ϕ(n+1)↓as the result of replacing every

– A(ξ, τ)withA(ξ, τ)∨W

(CvA)∈T(C](ξ, τ))n↓,

– P(ξ, ζ, τ)withP(ξ, ζ, τ)∨W

(SvP)∈T(S

](ξ, ζ, τ))n↓.

Finally, we set

extTq(~x, ~s) = (q(~x, ~s))nT↓.

Clearly,extTq(~x, ~s)is a PEQ, and so can be equivalently trans-formed into a UCQ. Denote byT⊥ the result of replacing ⊥with a fresh concept name, say F, in all concept inclu-sions and with a fresh role name, sayQ, in all role inclusions of T. Clearly(T⊥,A)is consistent for any ABox A. Let q⊥ = (∃x, t F(x, t))∨(∃x, y, t Q(x, y, t)). By Theorem 6 and Lemma 7, we obtain:

Theorem 8 LetT be a flat TBox andq(~x, ~s)a CQ. Then, for any consistent KB(T,A), any~a⊆ind(A)and~n⊆Z,

(T,A)|=q(~a, ~n) iff AZ|=extT

q(~a, ~n).

(T,A)is inconsistent iff(T⊥,A)|=q.

Thus, we obtain a rewriting forqandT using Lemma 3.

4

Canonical Models for Arbitrary TBoxes

Canonical models for consistent KBs K = (T,A) with not necessarily flat TBoxesT (in normal form) can be con-structed starting fromAZand using the rules given in the

pre-vious section together with the following one:

( ) if∃R(u, n) ∈ S andR(u, v, n) ∈ S/ for anyv, then addR(u, v, n)toS, for some fresh individual namev; in this case we writeu n

Rv.

Denote bycl1the closure operator under the resulting 8 rules.

Again,Kis inconsistent iff⊥ ∈cl∞1 (AZ). IfKis consistent,

we define thecanonical modelCKforKby the setcl∞1 (AZ)

in the same way as in Section 3 but taking the domain∆CK to contain all the individual names incl∞1 (AZ).

Theorem 9 For every consistentK = (T,A)and every CQ

q(~x, ~s), we have K |= q(~a, ~n) iff CK |= q(~a, ~n), for any

tuples~a⊆ind(A)and~n⊆Z.

Example 10 LetK= (T,A)withA={A(a,0)}andT =

{Av ∃R, PRvQ, ∃Q

v ∃S,

♦PQvP, ♦PSvS 0}.

A fragment of the modelCKis shown in the picture below:

a

0 A

1 2

v u1

u2

R Q Q P S S S0

We say that the individuals a ∈ ind(A)are ofdepth0in

CK; now, if uis of depthdinCK andu nR v, for some n∈ZandR, thenvis ofdepthd+ 1inCK. Thus, bothu1

andu2in Example 10 are of depth 2 andvis of depth 1. The

restriction ofCK, treated as a set of atoms, to the individual

names of depth≤dis denoted byCd

K. Note that this set is not

necessarily closed under the rule( ).

In the remainder of this section, we describe the structure ofCK, which is required for the rewriting in the next section.

We splitCK into two parts: one consists of the elements in ind(A), while the other contains the fresh individuals intro-duced by( ). As this rule always usesfreshindividuals, to understand the structure of the latter part it is enough to con-sider KBs of the formKT,R= (T ∪ {Av ∃R},{A(a,0)})

with freshA. We begin by analysing the behaviour of the atomsR0(a, u, n)entailed byR(a, u,0), wherea 0

Ru.

Lemma 11 (monotonicity) Leta 0R uinCKT,R. If either m < n < 0 or 0 < n < m, thenR0(a, u, n) ∈ CKT,R

impliesR0(a, u, m)∈ CKT,R;moreover, ifn < m=−|RT|

or |RT| = m < n, then R0(a, u, n) ∈ CKT,R iff R0(a, u, m)∈ CKT,R.

The atomsR0(a, u, n)entailed byR(a, u,0)inCKT,R via (r1)–(r3), also have an impact, via(ex), on the atoms of the formB(a, n)andB(u, n)inCKT,R. Thus, in Example 10, R(a, v,0)entails ∃Q(a, n), forn > 0. To analyse the be-haviour of such atoms, it is helpful to assume thatT is in

concept normal form(CoNF) in the following sense: for ev-ery roleR∈RT, the TBoxT contains

∃RvA0R, ♦F∃RvA −1

R , ♦FA −m

R vA

−m−1

R ,

♦P∃RvA1R, PA m R vA

(6)

for0≤m≤ |RT|and some conceptsAiR, and

AmR v ∃R0, for|m| ≤ |RT|andR0(a, v, m)∈ CKT,R.

∃R A0R

A−R1 A−R2

A−R3 A1R A 2

R A

3 R

(In Example 10, CK will contain the atoms A1R(a, n) and A2

R(a, n+ 1), forn≥ 1.) By Lemma 11, ifT is in CoNF,

then we can compute the atomsB(a, n)andB(u, n)inCKT,R

without using the rules(r1)–(r3). Lemma 11 also implies that we can add the inclusions above (with freshAi

R) toT if

re-quired, thereby obtaining a conservative extension ofT; so from now on we always assumeT to be in CoNF. These ob-servations enable the proof of the following two lemmas. The first one characterises the atomsB(u, n)inCKT,R:

Lemma 12 (monotonicity) Leta 0

R uinCKT,R. If either m < n <0or0 < n < m, thenB(u, n) ∈ CKT,R implies B(u, m) ∈ CKT,R; moreover, if eithern < m = −|T |or |T |=m < n, thenB(u, n)∈ CKT,R iffB(u, m)∈ CKT,R.

The second lemma characterises the ABox part ofCKand

is a straightforward generalisation of Lemma 7:

Lemma 13 For any KBK= (T,A)and any atomαof the formA(a, n),∃R(a, n)orR(a, b, n), wherea, b ∈ ind(A)

andn∈Z, we haveα∈ CKiffα∈clnT(AZ).

An obvious extension of the rewriting of Theorem 8 pro-vides, for every CQq(~x, ~s), a UCQextTq(~x, ~s)such that for all~a⊆ind(A)and~n⊆Zof the appropriate length,

C0

K|=q(~a, ~n) iff AZ|=extTq(~a, ~n). (2)

Moreover, for a basic concept∃R, we find a UCQextTR(ξ, τ)

such that, for anya∈ind(A)andn∈Z,∃R(a, n)∈ CKiff

AZ|=extT

∃R(a, n).

We now use the obtained results to show that one can find all answers to a CQqover aTQL KBKby only consider-ing a fragment ofCKwhose size is polynomial in|T |and|q|.

This property is called thepolynomial witness property [Got-tlob and Schwentick, 2011]. Denote byCd,`

K , ford, ` ≥ 0,

the restriction ofCd

K to the moments of time in the interval

[mintem(A)−`,maxtem(A) +`].

Letq(~x, ~s)be a CQ. Tuples~a⊆ind(A)and~n⊆tem(A)

give a certain answer toq(~x, ~s)overK = (T,A)iff there is ahomomorphismhfromqtoCK, which maps individual (temporal) terms of q to individual (respectively, temporal) terms ofCKin such a way that the following conditions hold:

– h(~x) =~aandh(b) =b, for allb∈ind(A);

– h(~s) =~nandh(m) =m, for allm∈tem(A);

– h(q)⊆ CK,

where h(q) denotes the set of atoms obtained by replac-ing every term in q with its h-image, e.g., P(ξ, ζ, τ) with P(h(ξ), h(ζ), h(τ)),(τ1< τ2)withh(τ1)< h(τ2), etc.

Now, using the monotonicity lemmas for the temporal di-mension and the fact that atoms of depth>|RT|in the

canon-ical models duplicate atoms of smaller depth, we obtain

Theorem 14 There are polynomialsf1andf2such that, for

any consistentTQLKBK= (T,A), any CQq(~x, ~s)and any

~a⊆ind(A)and~n⊆tem(A), we haveK |=q(~a, ~n)iff there is a homomorphismh: q→ CKsuch thath(q)⊆ CKd,`, where d=f1(|T |,|q|)and`=f2(|T |,|q|).

We are now in a position to define a rewriting for any given CQ andTQL TBox.

5

UCQ Rewriting

Supposeq(~x, ~s) is a CQ and T a TQL TBox (in CoNF). Without loss of generality we assumeqto be totally ordered. By asub-queryofq we understand any subsetq0 ⊆q con-taining all temporal constraints(τ < τ0)and(τ = τ0)that occur inq. In the rewriting forqandT given below, we con-sider all possible splittings ofqinto two sub-queries (sharing the same temporal terms). One is to be mapped to the ABox part of the canonical modelC(T,A), and so we can rewrite it

using (2). The other sub-query is to be mapped to the non-ABox part ofC(T,A)and requires a different rewriting.

For every R ∈ RT, we construct the setCKd,`T,R, whered

and`are provided by Theorem 14. Lethbe a map from a sub-queryqh⊆qtoCd,`

KT,Rsuch thath(qh)⊆ C d,`

KT,R. Denote by Xhthe set of individual termsξinqhwithh(ξ) =a, and let Yhbe the remaining set of individual terms inqh. We callh

awitness forRif

– Xhcontains at most one individual constant;

– every term inYhis a quantified variable inq;

– qhcontains all atoms inqwith a variable fromYh.

Lethbe a witness for R. Denote by the union of all

n

R0 inCd,`KT

,R. Clearly, is a tree order on the individuals

inCd,`

KT,R, with roota. LetTh be its minimal sub-tree

con-tainingaand theh-images of all the individual terms inqh. For eachv ∈ Th\ {a}, we take the (unique) momentg(v)

withu g(v)R v, for someuandR, and setg(a) = 0. For A(y, τ) ∈ qh, we say that h(y)realisesA(y, τ). For any P(ξ, ξ0, τ) ∈ qh, there are u, u0 ∈ Th withu u0 and {u, u0} = {h(ξ), h(ξ0)}; we say thatu0 realisesP(ξ, ξ0, τ). Let~rbe a list of fresh temporal variablesru, foru∈Th\{a}.

Consider the following formula, whose free variables arera

and the temporal variables ofqh:

th=∃~r ^

u v

δg(v)−g(u)(ru, rv)∧ ^

urealisesα(ξ,τ)~

δh(τ)−g(u)(ru, τ)

,

where the formulasδn(t, s)say thattis at leastnmoments befores: that is,δ0(t, s)is(t=s)andδn(t, s)is

∃s1, . . . , sn−1(t < s1<· · ·< sn−1< s), ifn >0, ∃s1, . . . , s|n|−1(t > s1>· · ·> s|n|−1> s), ifn <0.

Take a fresh variablexhand associate withhthe formula

wh= ∃ra∃xh

extTR(xh, ra) ∧ ^

h(ξ)=a

(ξ=xh) ∧ th

.

To give the intuition behindwh, suppose thatC(T,A)|=gwh,

(7)

g(xh) ∈ ind(A)such that ∃R(g(xh), g(ra)) ∈ C(T,A), so

(g(xh), g(ra))is the root of a substructure ofC(T,A)

isomor-phic toCKT,Rin which the variables fromYhcan be mapped

according toh. For temporal terms, the formulath cannot

specify the values prescribed byh: without¬in UCQs, we can only say thatτis at least (not exactly)nmoments before τ0. However, by Lemmas 11 and 12, this is still enough to ensure thatgandhgive a homomorphism fromqhtoC(T,A).

Example 15 LetT be the same as in Example 10 and let

q(x, t) =∃y, z, t0 (t < t0)∧Q(x, y, t)∧S0(y, z, t0).

The maph={x7→a, y7→v, z 7→u1, t7→1, t0 7→2}is a

witness forR, withqh=qandwhis the following formula

∃ra∃xh extT∃R(xh, ra)∧(xh=x)∧

∃rv∃ru1 δ 0(r

a, rv)∧δ1(rv, ru1)∧δ 1(r

v, t)∧δ1(ru1, t 0)

.

We can now define a rewriting forq(~x, ~s)andT. Let T be the set of all witnesses for q and T. We call a subset S⊆Tconsistentif(Xh1∪ Yh1)∩(Xh1∪ Yh2)⊆ Xh1∩ Xh2,

for any distincth1, h2 ∈ S. Assuming that ~y contains all

the quantified variables inq andq\S is the sub-query of

qobtained by removing the atoms inqh,h ∈S, other than

(τ < τ0)and(τ=τ0), we set:

q∗(~x, ~s) = ∃~y _

S⊆T Sconsistent

^

h∈S

wh ∧ extTq\S

.

Theorem 16 LetT be aTQLTBox in CoNF andq(~x, ~s)a totally ordered CQ. Then, for any consistent KB(T,A)and any tuples~a⊆ind(A)and~n⊆Z,

(T,A)|=q(~a, ~n) iff AZ|=q(~a, ~n).

(T,A)is inconsistent iff(T⊥,A)|=q.

Theorem 2 now follows by Lemma 3.

6

Non-Rewritability

In this section, we show that the languageTQLis nearly opti-mal as far as rewritability of CQs and ontologies is concerned. We note first, that the syntax ofTQLallows concept inclu-sions and role incluinclu-sions; ‘mixed’ axioms such as the datalog ruleA(x, t)∧R(x, y, t)→B(x, t)are not expressible. The reason is that mixed rules often lead to non-rewritability, as is well known from the DLEL. For example, there does not exist an FO-query q(x, t) such that (T,A) |= A(a, n) iff

AZ |= q(a, n)for T = {A(y, t)R(x, y, t) A(x, t)}

since such a query has to express that at time-pointtthere is anR-path fromxto someywithA(y, t).

Second, it would seem to be natural to extendTQLwith the temporal next/previous-time operators as concept or role con-structs. However, again this would lead to non-rewritability: any FO-rewriting forA(x, t)and{PA v B,PB v A}

has to express that there existsn≥0such thatA(x, t−2n)

orB(x, t−(2n+ 1)), which is impossible [Libkin, 2004]. Another natural extension would be inclusions of the form A v FB. (Note that inclusions of the form A v ∃R.B

are expressible inOWL 2 QL.) But again such an extension

would ruin rewritability. The reason is that temporal prece-dence<is a total order, and so one can construct an ABox

Aand a UCQq(x) =q1∨q2such that(T,A)|=q(a)but

(T,A)6|=qi(a),i= 1,2, forT ={AvFB}. Indeed, we

takeA={A(a,0), C(a,1)}and

q1(x) =∃t(C(x, t)∧B(x, t)),

q2(x) =∃t, t0((t < t0)∧C(x, t)∧B(x, t0)).

In fact, by reduction of 2+2-SAT [Schaerf, 1993], we prove the following:

Theorem 17 Answering CQs over the TBox{AvFB}is

CONP-hard for data complexity.

7

Related Work

The Semantic Web community has developed a variety of ex-tensions of RDF/S and OWL with validity time [Motik, 2012; Puglieseet al., 2008; Gutierrezet al., 2007]. The focus of this line of research is on representing and querying time stamped RDF triples or OWL axioms. In contrast, in our language only instance data are time stamped , while the ontology for-mulates time independent constraints that describe how the extensions of concepts and roles can change over time. In the temporal DL literature, a similar distinction has been dis-cussed as the difference between temporalised axioms and temporalised concepts/roles; the expressive power of the re-spective languages is incomparable [Gabbay et al., 2003; Baaderet al., 2012].

In Theorem 8, we show rewritability using boundedness of recursion. This connection between first-order definabil-ity and boundedness is well known from the datalog and logic literature where boundedness has been investigated ex-tensively [Gaifman et al., 1987; van der Meyden, 2000; Kreutzeret al., 2007]. Grohe and Schwandtner [2009] inves-tigate boundedness for datalog programs on linear orders; the results are different from ours since the linear order is the only predicate symbol of the datalog programs considered and no further restrictions (comparable to ours) are imposed.

8

Conclusion

In this paper, we have proved UCQ rewritability for conjunc-tive queries andTQL ontologies over data instances with va-lidity time. Our focus was solely on the existence of rewrit-ings, and we did not consider efficiency issues such as finding shortest rewritings, using temporal intervals in the data rep-resentation or mappings between temporal databases and on-tologies. We only note here that these issues are of practical importance and will be addressed in future work. It would also be of interest to investigate the possibilities to increase the expressive power of both ontology and query language. For example, we believe that the extension ofTQL with the next/previous time operators, which can only occur in TBox axioms not involved in cycles, will still enjoy rewritability. We can also increase the expressivity of conjunctive queries by allowing the arithmetic operations+and×over tempo-ral terms, which would make the CQA(x, t)and the TBox

(8)

References

[Artale and Franconi, 2005] A. Artale and E. Franconi. Tem-poral description logics. In Handbook of Temporal Rea-soning in Artificial Intelligence, Foundations of Artificial Intelligence, pages 375–388. Elsevier, 2005.

[Artaleet al., 2007] A. Artale, D. Calvanese, R. Kontchakov, V. Ryzhikov, and M. Zakharyaschev. Reasoning over ex-tended ER models. InProc. of ER-2007, volume 4801 of

LNCS, pages 277–292. Springer, 2007.

[Artaleet al., 2009] A. Artale, D. Calvanese, R. Kontchakov, and M. Zakharyaschev. The DL-Lite family and relations.

J. of Artifical Intelligence Research, 36:1–69, 2009. [Artaleet al., 2010] A. Artale, R. Kontchakov, V. Ryzhikov,

and M. Zakharyaschev. Complexity of reasoning over tem-poral data models. InProc. of ER-2010, volume 6412 of

LNCS, pages 174–187. Springer, 2010.

[Artaleet al., 2013] A. Artale, R. Kontchakov, F. Wolter, and M. Zakharyaschev. Temporal Description Logic for Ontology-Based Data Access (Extended Version). CoRR, abs/1304.5185, 2013.

[Baaderet al., 2012] F. Baader, S. Ghilardi, and C. Lutz. LTL over description logic axioms. ACM Trans. Comput. Log., 13(3):21, 2012.

[Berardiet al., 2005] D. Berardi, D. Calvanese, and G. De Giacomo. Reasoning on UML class diagrams.

Artificial Intelligence, 168(1–2):70–118, 2005.

[Cal`ıet al., 2012] A. Cal`ı, G. Gottlob, and T. Lukasiewicz. A general datalog-based framework for tractable query an-swering over ontologies. J. Web Sem., 14:57–83, 2012.

[Calvaneseet al., 2006] D. Calvanese, G. De Giacomo, D. Lembo, M. Lenzerini, and R. Rosati. Data complex-ity of query answering in description logics. In Proc. of KR 2006, pages 260–270, 2006.

[Calvaneseet al., 2007] D. Calvanese, G. De Giacomo, D. Lembo, M. Lenzerini, and R. Rosati. Tractable rea-soning and efficient query answering in description log-ics: The DL-Lite family. J. of Automated Reasoning, 39(3):385–429, 2007.

[Chortaraset al., 2011] A. Chortaras, D. Trivela, and G. Sta-mou. Goal-oriented query rewriting for OWL 2 QL. In

Proc. of DL 2011, volume 745 ofCEUR-WS, 2011. [Franconi and Toman, 2011] E. Franconi and D. Toman.

Fixpoints in temporal description logics. In Proc. of IJ-CAI 2011, pages 875–880, 2011.

[Gabbayet al., 2003] D. Gabbay, A. Kurucz, F. Wolter, and M. Zakharyaschev. Many-dimensional modal logics: the-ory and applications. Studies in Logic. Elsevier, 2003.

[Gaifmanet al., 1987] H. Gaifman, H. G. Mairson, Y. Sagiv, and M. Y. Vardi. Undecidable optimization problems for database logic programs. InProc. of LICS 87, pages 106– 115, 1987.

[Gottlob and Schwentick, 2011] G. Gottlob and T. Schwentick. Rewriting ontological queries into

small nonrecursive datalog programs. In Proc. of DL 2011, volume 745 ofCEUR-WS, 2011.

[Gottlobet al., 2011] G. Gottlob, G. Orsi, and A. Pieris. On-tological queries: Rewriting and optimization. InProc. of ICDE 2011, pages 2–13. IEEE Computer Society, 2011. [Grohe and Schwandtner, 2009] M. Grohe and G.

Schwandt-ner. The complexity of datalog on linear orders. Logical Methods in Computer Science, 5(1), 2009.

[Guti´errez-Basulto and Klarman, 2012] V. Guti´errez-Basulto and S. Klarman. Towards a unifying approach to representing and querying temporal data in description logics. InProc. of RR 2012, volume 7497 ofLNCS, pages 90–105. Springer, 2012.

[Gutierrezet al., 2007] C. Gutierrez, C. A. Hurtado, and A. A. Vaisman. Introducing time into RDF. IEEE Trans. Knowl. Data Eng., 19(2):207–218, 2007.

[K¨oniget al., 2012] M. K¨onig, M. Lecl`ere, M.-L. Mugnier, and M. Thomazo. A sound and complete backward chain-ing algorithm for existential rules. InProc. of RR 2012, volume 7497 ofLNCS, pages 122–138. Springer, 2012. [Kontchakovet al., 2010] R. Kontchakov, C. Lutz,

D. Toman, F. Wolter, and M. Zakharyaschev. The combined approach to query answering in DL-Lite. In

Proc. of KR 2010. AAAI Press, 2010.

[Kreutzeret al., 2007] S. Kreutzer, M. Otto, and N. Schweikardt. Boundedness of monadic FO over acyclic structures. In Proc. of ICALP 2007, pages 571–582, 2007.

[Libkin, 2004] L. Libkin. Elements Of Finite Model Theory. Springer, 2004.

[Lutzet al., 2008] C. Lutz, F. Wolter, and M. Zakharyaschev. Temporal description logics: A survey. InProc. of TIME 2008, pages 3–14. IEEE Computer Society, 2008. [Motik, 2012] B. Motik. Representing and querying validity

time in RDF and OWL: A logic-based approach. J. Web Sem., 12:3–21, 2012.

[P´erez-Urbinaet al., 2009] H. P´erez-Urbina, B. Motik, and I. Horrocks. A comparison of query rewriting techniques for DL-Lite. InProc. of DL 2009, volume 477 of CEUR-WS, 2009.

[Puglieseet al., 2008] A. Pugliese, O. Udrea, and V. S. Sub-rahmanian. Scaling RDF with time. In Proc. of WWW 2008, pages 605–614, 2008.

[Rosati and Almatelli, 2010] R. Rosati and A. Almatelli. Im-proving query answering over DL-Lite ontologies. In

Proc. of KR 2010. AAAI Press, 2010.

[Schaerf, 1993] A. Schaerf. On the complexity of the in-stance checking problem in concept languages with exis-tential quantification. J. of Intel. Inf. Systems, 2:265–278, 1993.

References

Related documents

It is clear that the radiative forcing of carbon dioxide emitted to the atmosphere is affecting our global mean sea level rise by causing thermal expansion of the

The significant contemporaneous correlation between expenditure changes and income changes reported in Panel B of Table 5 implies that expenditure changes are not dominanted

When a charge is submitted by one physician who provides both the technical and professional components of a radiology procedure, designated by no attached modifier, the

Office of Dietary Supplements, National Institutes of Health, Bethesda, Maryland, and Jean Mayer USDA Human Nutrition Research Center on Aging, Tufts University, Boston,

Cabaran kepada usaha dan langkah kepada pihak berkuasa agama untuk mengelakkan tercetusnya sebarang bentuk polemik, kontroversi dan ketegangan yang cuba ditimbulkan oleh

Here we report a case with advanced gastric cancer who developed symptoms of myositis after initiation of nivolumab as the third-line chemotherapy, which was difficult to diagnose

That is why in some countries (e.g., in Albania), newly established higher education programmes in Public Health were abolished due to non-employability of