Temporal Conjunctive Queries in Expressive DLs with Non-simple Roles

In Ontology-Based Data Access (OBDA), user queries are evaluated over a set of facts under the open world assumption, while taking into account background knowledge given in the form of a Description Logic (DL) ontology. Motivated by situation awareness applications, temporal conjunctive queries (TCQs) have recently been proposed as a useful extension of traditional OBDA to support the processing of temporal information. This paper extends the existing complexity analysis of TCQ entailment to very expressive DLs underlying the OWL 2 standard, and in contrast to previous work also allows for queries containing transitive roles.


Introduction
Given a (man-made or natural) dynamical system that changes its states over time, it is sometimes useful to monitor the behavior of the system in order to detect and then react to critical situations [2]. To achieve this, one can monitor the running system using sensors (e.g., heart rate and blood pressure sensors for a patient) and store the (possibly aggregated and preprocessed) values in a database. Critical situations (such as "blood pressure too high") can then be described by database queries, and detecting them can be realized through query answering. However, such a pure database solution is unsatisfactory for several reasons. First, one cannot assume that the sensors provide a complete description of the current state of the system, which clashes with the closed world assumption used by database systems. Second, though one usually does not have a complete specification of the system's behavior, one may have some background knowledge restricting the possible states of the system, which can help to detect more situations.
These problems are addressed by so-called ontology-based data access (OBDA) [13,27], where (i) the preprocessed and aggregated data are stored in a Description Logic (DL) ABox, which is interpreted with open world assumption, and (ii) the background knowledge is represented in a TBox (ontology) expressed in an appropriate DL. DLs [4] can be used to formalize knowledge using concepts, which represent sets of elements of an application domain, and roles, which describe binary relations between elements. For example, the concept Patient can be used to model the set of all patients in a hospital, while isTreatedWith represents a relationship between patients and treatments. Concept constructors can then be used to build complex concepts out of atomic concepts and roles. For example, Patient ∃isTreatedWith.Antibiotics describes patients treated with antibiotics. In the TBox, one can state subconcept-superconcept relationships, such a ∃isTreatedWith.Antibiotics ∃finding.BacterialInfection, which says that antibiotics treatment is given only if there is a bacterial infection. In the ABox, one can state specific facts about individuals, such as isTreatedWith(BOB, PENICILLIN).
When monitoring a dynamical system, the situation to be recognized may also depend on states of the system at different points in time (such as "fluctuating heart rate"). For this reason, OBDA was extended to the temporal case in [1,3]. In [3] the complexity of answering temporal conjunctive queries (TCQs) w.r.t. TBoxes was investigated for TBoxes expressed in DLs between ALC and SHQ. The results are concerned both with data complexity (which is measured only in the size of the data) and with combined complexity (which additionally takes the size of the query and the TBox into account). In addition, the paper considers rigid concepts and roles, whose interpretations must not change over time.
We extend the results of [3] in two directions. First, while being quite expressive, SHQ does not contain the constructors nominals and inverse roles, which are quite useful in many applications. Here, we also consider logics that have these two constructors. However, the main difference is that, though SHQ can express transitivity of roles and sub-role relationships, transitive roles and roles with transitive subroles must not occur in queries in [3]. In the present paper, we dispense with this restriction, which unfortunately leads to a dramatic increase in complexity that reflects the results for standard (atemporal) queries (see [14,21] and Table 2.11).
As an example that illustrates the benefit of transitive roles in queries, assume that we want to recognize patients who have previously had myocarditis, i.e., an inflammation of the heart muscle. This can be expressed using the TCQ This query is looking for a patient that, at some past time point, had (as part) a heart that itself had as part a muscle that was inflamed. In this example, we assume that the role partOf is transitive and rigid. Transitivity implies that the inflamed muscle was also part of the patient and rigidity ensures that the heart is not part of different patients at different points in time. In addition, we assume that Heart and Muscle are rigid (hearts and muscles stay hearts and muscles over time), but Patient and Inflamed are non-rigid (the muscle may, e.g., cease to be inflamed and the patient may be discharged).
In the next section, we introduce the DLs investigated in this paper, as well as TCQs and their semantics. We also give an overview over the already known and the new complexity results (see Table 2.11). Section 3 investigates the complexity of answering certain atemporal queries in a fine-grained way. The reason is that, similar to [3], we split the task of answering TCQs into propositional temporal reasoning on the one hand, and answering atemporal queries on the other hand. In Section 4, we then determine the combined complexity of answering TCQs whereas in Section 5 we deal with the data complexity.

Preliminaries
In this section, we recall the basic notions of DLs and TCQs. Throughout the paper, let N C , N R , and N I be non-empty, pairwise disjoint sets of concept names, role names, and individual names, respectively. Definition 2.1 (Syntax of DLs). A role r is either a role name, i.e., r ∈ N R , or an inverse role; see the first part of Table 2.2. The set of concepts is inductively defined starting from concept names A ∈ N C using the constructors in the second part of Table 2.2, where r, s are roles, a, b ∈ N I , n ∈ N, and C, D are concepts. The third part of Table 2.2 shows how axioms are defined.
Moreover, a TBox is a finite set of general concept inclusions (GCIs), an RBox is a finite set of role inclusions and transitivity axioms, and an ABox is a finite set of assertions, i.e., concept assertions and role assertions. A knowledge base (KB) K = (A, T , R) consists of an ABox A, a TBox T , and an RBox R.
Which constructors and types of axioms are available depends on the specific DL.
In ALC, negation, conjunction, and existential restriction are the only allowed constructors. Also, no inverse roles, role inclusions and transitivity axioms are allowed in ALC. If additional concept constructors or types of axioms are allowed, this is denoted by concatenating a corresponding letter: I means inverse roles, O means nominals, Q means at-most restrictions, and H means role inclusions. Thus, the DL ALCHI is the extension of ALC that also allows for nominals and inverse roles. The extension of ALC with transitivity axioms is denoted by S. Hence, the DL allowing for all the constructors and types of axioms introduced here is called SHOIQ. We sometimes write L-concept (L-KB, . . . ) for some DL L to make clear which DL is used.
The semantics of DLs are defined in a model-theoretic way.

Definition 2.3 (Semantics of DLs). An interpretation is a pair
where ∆ I is a non-empty set (called domain), and · I is a mapping assigning a set A I ⊆ ∆ I to every A ∈ N C , a binary relation r I ⊆ ∆ I × ∆ I to every r ∈ N R , and a domain element a I ∈ ∆ I to every a ∈ N I , such that a I = b I for all a, b ∈ N I with a = b (unique name assumption (UNA)). This function · I is extended to roles and concepts inductively as shown in the first two parts of Table 2.2, where S denotes the cardinality of the set S.
Moreover, I is a model of the axiom α (written I |= α) if the condition in the third part of Table 2.2 is satisfied, where · + denotes the transitive closure. Furthermore, I is a model of a set of axioms X (written I |= X ) if it is a model of all axioms α ∈ X , and I is a model of a KB K = (A, T , R) (written I |= K) if is is a model of A, T , and R. We call K consistent if it has a model.
For an RBox R, we call a role name r ∈ N R transitive (w.r.t. R) if every model of R is a model of trans(r). Moreover, r is a subrole of a role name s ∈ N R (w.r.t. R) if every model of R is a model of r s. Finally, r is simple w.r.t. R if it has no transitive subrole. Deciding whether r ∈ N R is simple can be done in time polynomial in the size of R by a simple reachability test. Unfortunately, the problem of deciding whether a given SHQ-KB K = (A, T , R) is consistent is undecidable in general [19]. To regain decidability, we need to make the following syntactic restriction: if n r.C occurs in K, then r must be simple w.r.t. R.
To enable a better separation of the influence the ABoxes have on the complexity of reasoning, we assume in the following that concept assertions use only concept names that also occur in the TBox, and that role assertions use only role names that occur in the TBox or the RBox. One can still simulate a complex concept assertion C(a) using A(a) and A ≡ C, where the latter stands for the two GCIs A C and C A.
Before we can define temporal queries, we need to lift the notions of knowledge bases and interpretations to a temporal setting. For this purpose, we assume that there are designated sets N RC ⊆ N C of rigid concept names and N RR ⊆ N R of rigid role names. Intuitively, the interpretation of a rigid name is not allowed to change over time. All individual names are implicitly assumed to be rigid. A concept or role name that is not rigid is called flexible.
• I i |= T and I i |= R for all i ≥ 0, and • I respects rigid names, i.e., we have We denote the set of all individual names occurring in a TKB K by Ind(K). The syntax of TCQs is defined by combining ordinary conjunctive queries via the operators of LTL [3,26].
Note that in contrast to [3], we allow also non-simple roles to occur in CQs. A union of conjunctive queries (UCQ) is a disjunction of CQs, which is defined as . Further, a CQ-literal is either a CQ or a negated CQ. We denote the set of individual names occurring in a TCQ φ by Ind(φ), the set of variables occurring in φ by Var(φ), the set of free variables of φ by FVar(φ). A TCQ φ with FVar(φ) = ∅ is called Boolean. As in [3], we assume without loss of generality that all CQs are connected, i.e., all variables and individual names are related (transitively) by roles.
An infinite sequence of interpretations I = (I i ) i≥0 over a common domain ∆ is a model of a Boolean TCQ φ at time point i ≥ 0 iff I, i |= φ holds, which is defined as follows: Given a TCQ φ, a mapping a : where a(φ) is the Boolean TCQ obtained from φ by replacing the free variables according to a.
As usual [3], in the following we consider only the TCQ entailment problem, which can be used to compute all certain answers. For this purpose, we analyze the satisfiability problem, which has the same complexity as non-entailment. We examine both the combined complexity where the whole TKB and the TCQ are considered as the input, and the data complexity, where TBox, RBox, and TCQ are fixed, i.e., the complexity is measured only w.r.t. the sequence of ABoxes.
In the remainder of this section, we recall the basic approach from [3] to decide satisfiability by splitting it into two separate satisfiability problems, one for the temporal component and one for the DL component. In the following, let K = ((A i ) 0≤i≤n , T , R) be a TKB and φ be a TCQ to be checked for satisfiability. The propositional abstraction φ p of φ is the propositional LTL-formula obtained from φ by replacing all CQs by propositional variables. We assume that α 1 , . . . , α m are the CQs occurring in φ, and that each α i is replaced by the propositional variable p i , 1 ≤ i ≤ m. We now consider a set S ⊆ 2 {p 1 ,...,pm} , which intuitively specifies the worlds that are allowed to occur in an LTL-structure satisfying φ p . However, guessing such an S and then testing whether φ p has a model at time point n that uses only the worlds from S is not sufficient for checking whether φ has a model w.r.t. K. We must also check whether S can indeed be induced by some sequence of interpretations that is a model of K. In the following, let Definition 2.7 (r-satisfiability). The set S is r-satisfiable w.r.t. ι and K if there exist interpretations J 1 , . . . , J k and I 0 , . . . , I n that share the same domain, respect rigid names, 1 are models of T and R, and additionally each This notion formalizes the rigidity constraints that have to be satisfied by S. The temporal part of the satisfiability problem is described next.
These two checks together suffice to determine the satisfiability of φ w.r.t. K.
The original proof of this result in [3] considers only SHQ, but is actually independent of any specific DL. The complexity of the t-satisfiability problem is obviously also DL-agnostic, and hence we can reuse another result from [3].
Proposition 2.10. Deciding t-satisfiability of φ p w.r.t. S and ι can be done in Exp w.r.t. combined complexity, and in P w.r.t. data complexity. A question mark indicates that the precise complexity is unknown even for the atemporal CQ entailment problem. For SHOIQ, it is not even known whether this problem is decidable, while for ALCHOIQ it is only known to be decidable, but no better upper bound has been found so far [25,28]. The shown lower bounds follow from the complexity of satisfiability of ALC-LTL formulae [5] and the complexity of atemporal CQ entailment. More precisely, the latter problem is co-NP-hard in data complexity already for ALE [29]. Under combined complexity, it is co-NExp-hard for ALCO [23] and S [14], 2-Exp-hard for SH [14] and ALCI [21], and co-2-NExp-hard for ALCOIQ [18].
query. In a nutshell, we reduce the satisfiability of such a conjunction to UCQ non-entailment and exploit existing algorithms for this atemporal problem. We consider here only the sublogics SHIQ, SHOQ, and SHOI, which enjoy (a variant of) the so-called forest model property [11], which means that every consistent KB formulated in one of these logics has a model that basically consists of several tree-shaped structures whose roots are arbitrarily interconnected by roles (disregarding role connections due to nominals or transitive roles).
To show the results in the following sections, however, we need to conduct a more fine-grained analysis of the complexity of the atemporal query entailment algorithms. The main insight is that, while UCQ entailment in SHIQ, SHOQ, and SHOI is in 2-Exp w.r.t. combined complexity, the number of CQs in the UCQ only has an exponential influence on the complexity of this decision problem. Likewise, for data complexity, assuming that the number of CQs in the UCQ is linear instead of constant usually has no influence on the complexity. Unfortunately, to the best of our knowledge, the precise data complexity of UCQ entailment is known only for SHIQ, ALCHOQ, and ALCHOI, while for SHOQ and SHOI it is still open [25].
In the following, we consider the size of a CQ ψ (written |ψ|) to be the number of symbols in ψ, ignoring constant expressions like '(' and '∧', considering each name and variable to be of size 1, and further ignoring the prefix ∃y 1 , . . . , y m since these variables also occur in the atoms of ψ. For example, ∃x, y.r(x, y) ∧ A(x) has size 5. We could also assume that each name or variable is represented by a binary string denoting its name, and hence of size logarithmic in the size of ψ, but this would not affect our complexity results. Similarly, the size of a knowledge base is computed by ignoring the concept constructors, and hence considers only the number of occurrences of names in the axioms. Proof. We start as in [3] by reducing the decision whether ψ has a model w.r.t. K to a UCQ non-entailment problem. We instantiate the positive CQs ρ 1 , . . . , ρ by omitting the existential quantifiers and replacing all variables by fresh individual names. The set A ρ of all resulting assertions can be viewed as an additional ABox. To ensure that the UNA is satisfied, we additionally consider equivalence relations ≈ on Ind(A ∪ A ρ ) with the additional restriction that no two names from Ind(A) may be equivalent. We denote by A ≈ the ABox resulting from A ρ by replacing each new individual name by a fixed representative of its equivalence class, where this representative is an element of Ind(A) whenever possible. It can be shown as in [3] that ψ is satisfiable w.r.t. K iff there is such an equivalence relation ≈ for which Note that the number of equivalence relations ≈ is exponential in the total number of variables in ρ 1 , . . . , ρ , which is bounded by · ψ , but each is of size polynomial in · ψ . Hence, one can either enumerate all such equivalences in time exponential in · ψ , or guess one of them in time polynomial in · ψ .
We now consider the case that K is formulated in SHIQ. By [16,Lemma 23], for the non-entailment test (1), it suffices to find a so-called extended knowledge base , where A and T are formulated in SHIQ , i.e., SHIQ extended by role conjunctions, such that K is consistent. By [16, Lemma 20 and Definition 21], the size of each (A , T ) is bounded by p(o · (|K| + · ψ )) p( ψ ) for some polynomial p, where the term · ψ represents the size of the additional ABox A ≈ . The bound given in [16] is exponential in the total size of the UCQ, i.e., o · ψ , but the exponential blowup comes only from the rewriting of each individual CQ σ i . Moreover, all pairs (A , T ) can be enumerated in time bounded by 2 p(o·(|K|+ · ψ )) p( ψ ) . It is important to note that the size of the longest role conjunction occurring in (A , T ) is bounded by a polynomial in ψ . Hence, by [16,Lemma 28], one can check the consistency of K in time bounded by 2 p (o·(|K|+ · ψ )) p ( ψ ) for some polynomial p . This means that we can decide satisfiability of ψ w.r.t. K by enumerating all equivalence relations and extended KBs as above and testing each of them for consistency within the claimed time bound.
If T , R, and ψ are fixed, then one can guess ≈ in time polynomial in . Following the proof of [16,Theorem 35], one can also guess K in time p(o · (|A| + )), and the following consistency test can be done in (deterministic) polynomial time in the size of the ABox A ∪ A ≈ ∪ A , which is polynomial in o · (|A| + ). This establishes the second bound for the case of SHIQ.
In the case that K is formulated in SHOQ, it again suffices to find a certain extended knowledge base K = (A ∪ A ≈ , T ∪ T , R) that is consistent in order to decide (1) [17]. The additional TBox T is formulated in SHOQ , and the length of the longest role conjunction in T is bounded polynomially in ψ . Actually, in [17] the ABox is assumed to be internalized into the TBox, but we keep it separate here to keep track of the size of A ≈ , which is · ψ . The size of each extended knowledge base is again bounded by p(o · (|K| + · ψ )) p( ψ ) , while their number is at most knowledge base K formulated in ALCHOQ , the size of which is still bounded by p (o · (|K| + · ψ )) p ( ψ ) for a polynomial p . By [20,Theorem 3.33], 3 the latter test can be done in time bounded by 2 p (o·(|K|+ · ψ )) p ( ψ ) , and hence we obtain the claimed result. 4 For SHOI, we analyze the automata-based construction from [11,12]. There, the KB (A ∪ A ≈ , T , R) is first reduced to a polynomial-size ALCOIb reg KB K by replacing all roles by regular role expressions simulating all (transitive) subroles. Then, a polynomial-sized fully enriched automaton (an extended two-way alternating tree automaton with parity acceptance condition (2ATA) [8]) A K is constructed that accepts all so-called interpretation trees that correspond to models of K . This can be transformed into an equivalent (one-way) nondeterministic parity tree automaton (1NTA) A K with a number of states bounded by 2 p(|K|+ · ψ ) and constant index (size of the parity condition) [11,30]. Note that the size of the input alphabet of all these automata is also exponential in |K| + · ψ . In the next step, a 1NTA A ¬σ i is constructed that accepts an interpretation tree iff it does not contain a match for σ i . The construction in [11,12] can be adapted such that the number of states of A ¬σ i is double exponential in the size of σ i , i.e., ψ , but does not depend on |K| or , while its index is exponential in ψ . 5 Finally, an automaton A K |=σ 1 ∨···∨σo can be constructed that recognizes the intersection of the languages accepted by A K , A ¬σ 1 , . . . , A ¬σo , and hence accepts all interpretation trees that witness the non-entailment (1). This automaton has at most 2 p (|K|+ · ψ ) p ( ψ ) states and its index is bounded by 2 p ( ψ ) for some polynomial p . The claim now follows from the fact that (non)emptiness of 1NTAs can be decided in time polynomial in the number of states and input symbols and exponential in the index [15].
Finally, we consider the logics ALCHOQ and ALCHOI and assume that T , R, and ψ are fixed. The paper [24] describes a nondeterministic tableaux algorithm for SHIQ, SHOQ, and SHOI, where queries are restricted to simple roles. The main approach to decide non-entailment is to nondeterministically build a so-called completion graph, and then check whether it is not possible to map the variables of the input query to the nodes of this graph in order to satisfy the query. By [24, Lemma 4.2, Proposition 4.4, and Footnote 12], the size of such a completion graph is polynomial in (i) the number of individual names occurring in the input KB and triple exponential in (ii) the number of role atoms in the largest disjunct of the input query. Under our complexity assumptions, (i) is linear in |A| and and (ii) is constant. Since we can assume that the Boolean CQs σ 1 , . . . , σ o do not share variables, it then suffices to check for each CQ σ i individually whether it is not possible to map its variables into the completion graph to satisfy its atoms. This can be checked by a deterministic algorithm in time polynomial in the number o of CQs and the size of the completion graph [24]. Hence, we obtain the claimed results.

Combined Complexity of TCQ Entailment
Let K = ((A i ) 0≤i≤n , T , R) be a TKB, φ be a TCQ, and assume for now that a set S = {X 1 , . . . , X k } ⊆ 2 {p 1 ,...,pm} and a mapping ι : {0, . . . , n} → {1, . . . , k} are given. For our complexity results, we employ the copying technique from [3,5] for deciding whether S is r-satisfiable w.r.t. ι and K. The idea is to introduce enough copies of all flexible names in order to combine the separate satisfiability tests of Def. 2.7 into one big atemporal satisfiability test.
Formally, for all i, 1 ≤ i ≤ k + n + 1, and every flexible concept name A (every flexible role name r) occurring in T or R, we introduce a copy A (i) (r (i) ). We call A (i) (r (i) ) the i-th copy of A (r). The conjunctive query α (i) (the axiom β (i) ) is obtained from a CQ α (an axiom β) by replacing every flexible name by its i-th copy. Similarly, for 1 ≤ ≤ k, the conjunction of CQ-literals χ (i) is obtained from χ (see Definition 2.7) by replacing each CQ α j by α (i) j . Finally, we define T S,ι := {β (i) | β ∈ T and 1 ≤ i ≤ k + n + 1}, R S,ι := {γ (i) | γ ∈ R and 1 ≤ i ≤ k + n + 1}.
The following result, which reduces r-satisfiability to an atemporal satisfiability problem, was shown in [3] for SHQ with simple roles in queries, but it remains valid in our setting since it does not depend on the DL under consideration.
Together with Lemma 3.1, this allows us to show our first complexity results.
Theorem 4.2. Let L be a DL that contains ALCI or SH and is contained in SHIQ, SHOQ, or SHOI. Then TCQ entailment in L is 2-Exp-complete w.r.t. combined complexity, and in Exp w.r.t. data complexity.
Proof. The lower bound directly follows from 2-Exp-hardness of CQ entailment in SH [14] and ALCI [21]. To check a TCQ φ for satisfiability w.r.t. a TKB K, we first enumerate all possible sets S and mappings ι, which can be done in 2-Exp. For each of these double exponentially many pairs (S, ι), we then check t-satisfiability of φ p w.r.t. S and ι in exponential time (see Proposition 2.10) and test S for r-satisfiability w.r.t. ι and K (using Proposition 4.1). By Proposition 2.9, φ has a model w.r.t. K iff at least one pair passes both tests.
For the r-satisfiability test, observe that the conjunction of CQ-literals χ S,ι contains exponentially many (negated) CQs, each of size polynomial in the size of φ, and that T S,ι and R S,ι are of exponential size in the size of K. By Lemma 3.1, the satisfiability of χ S,ι w.r.t. (T S,ι , R S,ι ) can thus be checked in double exponential time in the size of φ and K. For the data complexity, observe that the number of CQs in χ S,ι is linear in the size of the input ABoxes, and their size only depends on φ (the size of a single assertion is constant). Moreover, T S,ι and R S,ι are of size linear in n. Lemma 3.1 thus yields the claimed upper bound.
By the same arguments, it is easy to see that TCQ entailment in ALCHOIQ is decidable since this is the case for UCQ (non-)entailment [28].

Data Complexity without Rigid Roles
To obtain a tight bound on the data complexity if we disallow rigid role names, we follow a different approach from [3]. Similarly to the previous section, we decide r-satisfiability of S w.r.t. ι and K by constructing conjunctions of CQ-literals of which we want to check satisfiability. However, we do not compile the whole r-satisfiability check into just one conjunction. More precisely, we define the conjunctions of CQ-literals γ i ∧ χ S , 0 ≤ i ≤ n, w.r.t. (T S , R S ), where This separates the consistency checks for the individual ABoxes A i , 1 ≤ i ≤ n, from each other. For r-satisfiability, we additionally have to make sure that rigid consequences of the form A(a) for a rigid concept name A ∈ N RC and an individual name a ∈ N I are shared between all the conjunctions γ i ∧ χ S . It suffices to do this for the set RCon(T ) of rigid concept names occurring in T since those that occur only in ABox assertions cannot affect the entailment of the TCQ φ.
For this purpose, we guess a set D ⊆ 2 RCon(T ) that fixes the combinations of rigid concept names that are allowed to occur in the models of γ i ∧ χ S , and a function τ : Ind(φ) ∪ Ind(K) → D that assigns to each individual name one such combination. To express this formally, we extend the TBox by the axioms in where A Y are fresh rigid concept names and, for every Y ⊆ RCon(T ), ¬A.
The size of T τ is bounded polynomially in the sizes of D and RCon(T ), which are constant w.r.t. data complexity. We now extend the conjunctions γ i ∧ χ S by in order to fix the behavior of the rigid concept names on the named individuals.
We need one more definition to formulate the main lemma of this section. We say that an interpretation I respects D if which means that every combination of rigid concept names in D is realized by a domain element of I, and conversely, the domain elements of I may only realize those combinations that occur in D. Proof. For the "if" direction, assume that I i , 0 ≤ i ≤ n, are the required models for γ i ∧ χ S ∧ ρ τ w.r.t. (T S ∪ T D , R S ). We can assume w.l.o.g. that their domains ∆ i are countably infinite and for each Y ∈ D there are countably infinitely many elements d ∈ (C Y ) I i . For SHIQ, this is a consequence of the Löwenheim-Skolem theorem and the fact that the countably infinite disjoint union of I i with itself is again a model of γ i ∧ χ S ∧ ρ τ and (T S ∪ T D , R S ). The latter follows from the observation that for any CQ there is a homomorphism into I i iff there is a homomorphism into the disjoint union of I i with itself. One direction is trivial, while whenever there is a homomorphism into the disjoint union, we can construct a homomorphism into I i by replacing the elements in the image of this homomorphism by the corresponding elements of ∆ i . It is easy to see that the resulting homomorphism still satisfies all atoms of the CQ.
Due to the presence of nominals, this construction does not work in the sublogics ALCHOQ and ALCHOI since domain elements may need to be connected to specific named domain elements, of which there cannot be infinitely many copies, but only one. We adapt the construction by requiring that the countably many copies of I i overlap on the set {a I i | a ∈ N I }. Hence, there may be infinitely many copies of domain elements connected to each named domain element. In ALCHOI, this already suffices since the behavior of the infinitely many unnamed copies is the same, which does not affect the satisfaction of any concepts or query atoms on the named elements.
However, in ALCHOQ this may cause number restrictions to be violated. For example, a could be required to have at most 10 r-successors, whereas after our construction it may have infinitely many. In this case, we can without loss of generality make the further assumption that I i is a quasi-forest model of γ i ∧χ S ∧ρ τ and (T S ∪ T D , R S ) [11,20]. 6 This means that each named individual acts as the root for a tree of domain elements, and there can only be role connections between elements x and y if either y is a child node of x in such a tree or y is a named individual, i.e., y = a I i for some a ∈ N I . Since ALCHOQ does not contain inverse roles, it is not possible for a concept to refer upwards in a tree, but only directly back to a root. We can thus adapt the construction by copying the unnamed part of I i countably often, and removing all role connections of the form (a I i , x), where x is an unnamed domain element, except for the connections in the original I i . Note that we still copy the role connections back to the named elements, as these are necessary to satisfy nominal concepts. This construction ensures that all number restrictions remain satisfied. Due to the absence of inverse roles, the KB (T S ∪ T D , R S ) is still satisfied. The conjunction γ i ∧ χ S ∧ ρ τ also remains satisfied by the same arguments as for SHIQ and the fact that all CQs are connected.
Having ensured that the domain of I i is countably infinite and for each Y ∈ D there are countably infinitely many elements d ∈ (C Y ) I i , we can partition the domains ∆ i into the countably infinite sets ∆ i (Y ) := {d ∈ ∆ i | d ∈ (C Y ) I i } for each Y ∈ D. By the assumptions above and the fact that all I i satisfy ρ τ and T D , there are bijections π i : ∆ 0 → ∆ i , 1 ≤ i ≤ n, such that • π i (a I 0 ) = a I i for all a ∈ Ind(φ) ∪ Ind(K).
Thus, we can assume that the models I i actually share the same domain and interpret the rigid names in RCon(T ) and Ind(φ) ∪ Ind(K) in the same way.
The remainder of the proof can proceed exactly as in [3].
The restriction imposed by D can be expressed as the conjunction of CQ-literals where A D is a fresh concept name that is defined by the axiom A D ≡ Y ∈D ¬A Y in the TBox. We denote by T S the resulting extension of T S ∪ T D , and have now reduced the r-satisfiability of S w.r.t. ι and K to the consistency of γ i ∧χ S ∧ρ τ ∧σ D w.r.t. (T S , R S ).
Theorem 5.2. Let L be a DL that contains ALE and is contained in SHIQ, ALCHOQ, or ALCHOI. Then TCQ entailment in L is co-NP-complete w.r.t. data complexity.
Proof. The lower bound follows from co-NP-hardness of instance checking in ALE [29]. To test satisfiability of a TCQ φ w.r.t. a TKB K, we employ the same approach as before, but instead guess S and ι. Note that S is of constant size in the size of the ABoxes and ι is of linear size. Hence, this first step can be done in nondeterministic polynomial time. The t-satisfiability test required for Proposition 2.9 can be done in polynomial time by Proposition 2.10, and for the r-satisfiability test, we use Lemma 5.1.
Following the reduction described above, we guess a set D ⊆ 2 RCon(T ) and a function τ : Ind(φ) ∪ Ind(K) → D, which can be done in nondeterministic polynomial time since D only depends on T and τ is of size linear in the size of the input ABoxes. Next, we check the satisfiability of the polynomially many conjunctions γ i ∧ χ S ∧ ρ τ ∧ σ D w.r.t. (T S , R S ). Note that χ S , σ D , T S , and R S do not depend on the input ABoxes, while γ i and ρ τ are of polynomial size. Furthermore, the size of the CQs in γ i and ρ τ is constant. Hence, Lemma 3.1 yields the desired NP upper bound for these satisfiability tests.

Conclusions
Query answering w.r.t. DL ontologies is currently a very active research area. We have extended complexity results for very expressive DLs underlying the web ontology language OWL 2 to the case of temporal queries. Our results show that, w.r.t. worst-case complexity, adding a temporal dimension often comes for free. In fact, in all sublogics of SHOIQ, the upper bounds for the combined complexity of TCQ entailment obtained in this paper for the temporal case coincide with the best known upper bounds for atemporal query entailment (even in the presence of rigid roles). From the application point of view, data complexity is more important since the amount of data is often very large, and in comparison the size of the background knowledge and the user query is small. We have shown that, in many cases, the atemporal data complexity of co-NP does not increase if we consider TCQs with rigid concepts (specifically, in ALCHOQ, ALCHOI, SHIQ, and sublogics). For the remaining logics of Table 2.11, it is an open problem to find a co-NP algorithm even in the atemporal case.
As part of future work, we will try to obtain co-NP upper bounds even in the presence of rigid roles, and study extensions of TCQs with concrete domains and inconsistency-tolerant semantics. Since co-NP is already a rather negative result for data complexity, we could also try to find restricted formalisms with lower data complexity. On the one hand, one could take a less expressive DL to formulate the background ontology, which has already been investigated for EL [10] and DL-Lite H horn [9], but only the latter choice reduces the data complexity (to ALogTime). On the other hand, one could investigate whether the data complexity can be reduced by imposing additional restrictions on the TBox or CQs, as has been done in the atemporal case [6,7,22].