The Data Complexity of Description Logic Ontologies

2 downloads 0 Views 424KB Size Report
Nov 8, 2016 - such as AC0, LOGSPACE, and NLOGSPACE. Our main results are as follows (they always apply to all query languages mentioned above). 1.
THE DATA COMPLEXITY OF DESCRIPTION LOGIC ONTOLOGIES

arXiv:1611.02453v1 [cs.AI] 8 Nov 2016

CARSTEN LUTZ AND FRANK WOLTER University of Bremen, Germany e-mail address: [email protected] University of Liverpool e-mail address: [email protected]

A BSTRACT. We analyze the data complexity of ontology-mediated querying where the ontologies are formulated in a description logic (DL) of the ALC family and queries are conjunctive queries, positive existential queries, or acyclic conjunctive queries. Our approach is non-uniform in the sense that we aim to understand the complexity of each single ontology instead of for all ontologies formulated in a certain language. While doing so, we quantify over the queries and are interested, for example, in the question whether all queries can be evaluated in polynomial time w.r.t. a given ontology. Our results include a PT IME /CO NP-dichotomy for ontologies of depth one in the description logic ALCFI, the equivalence of a PT IME /CO NP-dichotomy for ALC- and ALCI-ontologies of unrestricted depth to the famous dichotomy conjecture for CSPs by Feder and Vardi, and the failure of PT IME /CO NP-dichotomy theorem for ALCF -ontologies. Regarding the latter DL, we also show that it is undecidable whether a given ontology admits PT IME query evaluation.

1. I NTRODUCTION In recent years, the use of ontologies to access instance data has become increasingly popular [PLC+ 08, KZ14, BO15]. The general idea is that an ontology provides domain knowledge and an enriched vocabulary for querying, thus serving as an interface between the query and the data, and enabling the derivation of additional facts. In this emerging area, called ontology-mediated querying, it is a central research goal to identify ontology languages for which query evaluation scales to large amounts of instance data. Since the size of the data typically dominates the size of the ontology and the size of the query by orders of magnitude, the central measure for such scalability is data complexity—the complexity of query evaluation where only the data is considered to be an input, but both the query and the ontology are fixed. In description logic (DL), ontologies take the form of a TBox, data is stored in an ABox, and the most important classes of queries are conjunctive queries (CQs) and variations thereof, such as positive existential queries (PEQs). A fundamental observation regarding this setup is that, for expressive DLs such as ALC and SHIQ, the complexity of query evaluation is CO NP-complete and thus intractable [Sch93, HMS07, GLHS08].1 The classical approach to avoid this problem is to replace ALC and SHIQ with less expressive DLs that are ‘Horn’ in the sense that they can 1998 ACM Subject Classification: Logic, Description Logics. Key words and phrases: Description Logic, Ontology-Based Data Access, Data Complexity, Conjunctive Queries. 1When speaking of complexity, we always mean data complexity

LOGICAL METHODS IN COMPUTER SCIENCE

DOI:10.2168/LMCS-???

1

c DATA COMPLEXITY OF ONTOLOGIES

Creative Commons

2

DATA COMPLEXITY OF ONTOLOGIES

be embedded into the Horn fragment of first-order (FO) logic. Horn DLs typicall admit query evaluation in PT IME, examples include a variety of logics from the EL [BBL05] and DL-Lite families [CDGL+ 07] as well as Horn-SHIQ, a large fragment of SHIQ with PT IME query evaluation [HMS07]. It may thus seem that the data complexity of query evaluation in the presence of DL ontologies is understood rather well. However, all results discussed above are on the level of logics, i.e., traditional results about data complexity concern a class of TBoxes that is defined in a syntactic way in terms of expressibility in a certain DL language, but no attempt is made to identify more structure inside these classes. Such a more fine-grained study, however, seems very natural both from a theoretical and from a practical perspective; in particular, it is well-known that ontologies which emerge in practice tend to use ‘expensive’ language constructs that can result in CO NPhardness of data complexity, but they typically do so in an extremely restricted and intuitively ‘harmless’ way. This distinction between hard and harmless cases cannot be analyzed on the level of logics. The aim of this paper is to initiate a more fine-grained study of data complexity that is non-uniform in the sense that it does not treat all TBoxes formulated in the same DL in a uniform way. When taking a non-uniform perspective, there is an important choice regarding the level of granularity. First, one can analyze the complexity on the level of TBoxes, quantifying over the actual query. Then, query evaluation for a TBox T is in PT IME if every query (from the class under consideration) can be evaluated in PT IME w.r.t. T and it is CO NP-hard if there is at least one query that is CO NP-hard to evaluate w.r.t. T . And second, one might take an even more fine-grained approach where the query is not quantified away and the aim is to classify the complexity on the level of ontology-mediated queries (OMQs), that is, combinations of a TBox and an actual query. From a practical perspective, both setups make sense; when the actual queries are fixed at the design time of the application, one would probably prefer to work on the level of OMQs whereas the level of TBoxes seems more appropriate when the queries can be freely formulated at application running time. A non-uniform analysis on the level of OMQs has been carried out in [BtCLW14]. In this paper, we concentrate on the level of TBoxes. The ultimate goal of our approach is as follows: For a fixed DL L and query language Q, classify all TBoxes T in L according to the complexity of evaluating queries from Q w.r.t. T . We consider the basic expressive DL ALC, its extensions ALCI with inverse roles and ALCF with functional roles, and their union ALCFI. As query languages, we cover CQs, acyclic CQs, and PEQs (which have the same expressive power as unions of conjunctive queries, UCQs, which are thus implicitly also covered). It turns out that, even for ALC, fully achieving the above goal is far beyond the scope of a single research paper. In fact, we show that for any of the mentioned query languages, a full classification of the complexity of ALC- and ALCI-TBoxes is essentially equivalent to a full classification of the complexity of non-uniform constraint satisfaction problems with finite templates (CSPs). The latter is a major research programme ongoing for many years that combines complexity theory, graph theory, logic, and algebra [BJK05, KS09, Bul11, Bar14]. In the current paper, we mainly concentrate on understanding the boundary between PT IME and CO NP-hardness of query evaluation w.r.t. DL TBoxes, mostly neglecting other relevant classes such as AC0 , L OG S PACE, and NL OG S PACE. Our main results are as follows (they always apply to all query languages mentioned above). 1. There is a PT IME/CO NP-dichotomy for query evaluation w.r.t. ALCFI-TBoxes of depth one, i.e., TBoxes in which existential and universal restrictions are not nested; moreover, PT IME query

DATA COMPLEXITY OF ONTOLOGIES

3

evaluation coincides with rewritability into monadic Datalog (with inequalities, to capture functional roles). The proof rests on interesting model-theoretic characterizations of polynomial time CQ-evaluation which are discussed below. Note that this is a relevant case since most TBoxes from practical applications have depth one. In particular, all TBoxes formulated in DL-Lite and its extensions proposed in [CDGL+ 07, ACKZ09] have depth one, and the same is true for more than 80 percent of the 429 TBoxes in the BioPortal ontology repository. 2. There is a PT IME/CO NP-dichotomy for CQ-evaluation w.r.t. ALC-TBoxes if and only if Feder and Vardi’s dichotomy conjecture for CSPs is true; the same holds for ALCI-TBoxes. The proof establishes a close link between query evaluation in ALC and CSP. While dichotomy questions are mainly of theoretical interest, linking these two worlds is potentially very relevant also for more applied DL research. 3. There is no PT IME/CO NP-dichotomy for query evaluation w.r.t. ALCF-TBoxes (unless PT IME = NP). This is proved by showing that, for every problem in CO NP, there is an ALCF-TBox for which CQevaluation has the same complexity (up to polynomial time reductions); it then remains to apply Ladner’s Theorem, which guarantees the existence of NP-intermediate problems. Consequently, we cannot expect an exhaustive classification of the complexity of query evaluation w.r.t. ALCFTBoxes. To prove these results, we introduce two new notions that are of independent interest and general utility. The first one is materializability of a TBox T , which means that evaluating a query over an ABox A w.r.t. T can be reduced to query evaluation in a single model of A and T (a materialization). Note that such models play a crucial role in the context of Horn DLs, where they are often called canonical models or universal models. In contrast to the Horn DL case, however, we only require the existence of such a model without making any assumptions about its form or construction. 4. If an ALCFI-TBox T is not materializable, then CQ-evaluation w.r.t. T is CO NP-hard. We also investigate the nature of materializations. It turns out that if a TBox is materializable for one of the considered query languages, then it is materializable also for all others. The concrete materializations, however, need not agree. To obtain these results, we characterize CQ-materializations in terms of homomorphisms and ELIQ-materializations in terms of simulations (an ELIQ is an ELI-instance query, thus the DL version of an acyclic CQ, with a single answer variable). Perhaps in contrary to the intuitions that arise from the experience with Horn DLs, materializability of a TBox T is not a sufficient condition for query evaluation w.r.t. T to be in PT IME (unless PT IME = NP) since the existing materialization might be hard to compute. This leads us to study the notion of unraveling tolerance of a TBox T , meaning that answers to acyclic CQs over an ABox A w.r.t. T are preserved under unraveling the ABox A. In CSP, unraveling tolerance corresponds to the existence of tree obstructions, a notion that characterizes the well-known arc consistency condition and rewritability into monadic Datalog [FV93, Kro10a]. It can be shown that every TBox formulated in Horn-ALCFI (the intersection of ALCFI and Horn-SHIQ) is unraveling tolerant and that there are unraveling tolerant TBoxes which are not equivalent to any Horn-ALCFI-TBox. Thus, the following result yields a rather general (and uniform!) PT IME upper bound for CQ-evaluation. 5. If an ALCFI-TBox T is unraveling tolerant, then query evaluation w.r.t. T is in PT IME.

4

DATA COMPLEXITY OF ONTOLOGIES

Although the above result is rather general, unraveling tolerance of a TBox T is not a necessary condition for CQ-evaluation w.r.t. T to be in PT IME (unless PT IME = NP). However, for ALCFITBoxes T of depth one, being materializable and being unraveling tolerant turns out to be equivalent. For such TBoxes, we thus obtain that CQ-evalutation w.r.t. T is in PT IME iff T is materializable iff T is unraveling tolerant while, otherwise, CQ-evaluation w.r.t. T is CO NP-hard. This establishes the first main result above. Our framework also allows to formally capture some intuitions and beliefs commonly held in the context of CQ-answering in DLs. For example, we show that for every ALCFI-TBox T , CQ-evaluation is in PT IME iff PEQ-evaluation is in PT IME iff ELIQ-evaluation is in PT IME, and the same is true for rewritability into monadic Datalog and for CO NP-hardness. In fact, the use of multiple query languages and in particular of ELI-instance queries does not only yield additional results, but is at the heart of our proof strategies. Another interesting observation in this spirit is that an ALCFI-TBox is materializable iff it is convex, a condition that is also called the disjunction property and plays a central role in attaining PT IME complexity for standard reasoning in Horn DLs such as EL, DL-Lite, and Horn-SHIQ; see for example [BBL05, KL07] for more details. This paper is an extended and revised version of the conference publication [LW12]. Related Work. An early reference on data complexity in DLs is [Sch93], showing CO NP-hardness of ELQs in the fragment ALE of ALC (an ELQ is an ELIQ in which all edges are directed away from the answer variable). A CO NP upper bound for ELIQs in the much more expressive DL SHIQ was obtained in [HMS07] and generalized to CQs in [GLHS08]. Horn-SHIQ was first defined in [HMS07], where also a PT IME upper bound for ELIQs is established; the generalization to CQs can be found in [EGOS08]. See also [KL07, Ros07, OCE08, CDL+ 13] and references therein for the data complexity in DLs and [BGO10, BMRT11] for related work on the guarded fragment and on existential rules. To the best of our knowledge, the conference version of this paper was first to initiate the study of data complexity in ontology-mediated querying at the level of individual TBoxes and the first to observe a link between this area and CSP. There is, however, a certain technical similarity to the link between view-based query processing for regular path queries (RPQs) and CSP found in [CGLV00, CGLV03b, CGLV03a]. In this case, the recognition problem for perfect rewritings for RPQs can be polynomially reduced to non-uniform CSP and vice versa. On the level of OMQs, the data complexity of ontology-mediated querying with DLs has been studied in [BtCLW14]; also here, a connection to CSP plays a central role. In [LSW13, LSW15], the non-uniform data complexity of ontology-mediated query answering is studied in the case where the TBox is formulated in an inexpressive DL of the DL-Lite or EL family and where individual predicates in the data can be given a closed-world reading, which also gives rise to CO NP-hardness of query evaluation; while [LSW13] is considering the level of TBoxes, [LSW15] treats the level of OMQs, establishing a connection to surjective CSPs. The work on CSP dichotomies started with Schaefer’s PT IME/NP-dichotomy theorem, stating that every CSP defined by a two element template is in PT IME or NP-hard [Sch78]. Schaefer’s theorem was followed by dichotomy results for CSPs with (undirected) graph templates [HN90] and several other special cases, leading to the widely known Feder-Vardi conjecture which postulates a PT IME/NP-dichotomy for all CSPs, independently of the size of the template [FV93]. An influential approach to studying the complexity of CSPs is via universal algebra [BJK05], and it has resulted in a confirmation of the Feder Vardi conjecture for ternary CSPs [Bul02]. Interesting results have also

DATA COMPLEXITY OF ONTOLOGIES

5

been obtained for other complexity classes such as AC0 [ABI+ 05, LLT07]. For a recent summary of the state of the art we refer to [Bar14]. 2. P RELIMINARIES We introduce the relevant description logics and query languages, define the fundamental notions studied in this paper, and illustrate them with suitable examples. We shall be concerned with the DL ALC and its extensions ALCI, ALCF, and ALCFI. Let NC , NR , and NI denote countably infinite sets of concept names, role names, and individual names, respectively. ALC concepts are constructed according to the rule C, D := ⊤ | ⊥ | A | C ⊓ D | C ⊔ D | ¬C | ∃r.C | ∀r.C where A ranges over NC and r ranges over NR . ALCI concepts admit, in addition, inverse roles − − from the set N− R = {r | r ∈ NR }, which can be used in place of role names. Thus, A ⊓ ∃r .∀s.B is an example of an ALCI concept. To avoid heavy notation, we set r − := s if r = s− for a role name s; in particular, we thus have (r − )− = r. In DLs, ontologies are formalized as TBoxes. An ALC-TBox is a finite set of concept inclusions (CIs) C ⊑ D, where C, D are ALC concepts, and ALCI TBoxes are defined analogously. An ALCF-TBox (resp. ALCFI-TBox) is an ALC-TBox (resp. ALCI-TBox) that additionally admits functionality assertions func(r), where r ∈ NR (resp. r ∈ NR ∪ N− R ), declaring that r is interpreted as a partial function. Note that there is no such thing as an ALCF concept or an ALCFI concept, as the extension with functional roles does not change the concept language. An ABox A is a non-empty finite set of assertions of the form A(a) and r(a, b) with A ∈ NC , r ∈ NR , and a, b ∈ NI . In some cases, we drop the finiteness condition on ABoxes and then explicitly speak about infinite ABoxes. We use Ind(A) to denote the set of individual names used in the ABox A and sometimes write r − (a, b) ∈ A instead of r(b, a) ∈ A. The semantics of DLs is given by interpretations I = (∆I , ·I ), where ∆I is a non-empty set and ·I maps each concept name A ∈ NC to a subset AI of ∆I and each role name r ∈ NR to a binary relation r I on ∆I . The extension (r − )I of r − under the interpretation I is defined as the converse relation (r I )−1 of r I and the extension C I ⊆ ∆I of concepts under the interpretation I is defined inductively as follows: ⊤I ⊥I (C ⊓ D)I

= ∆I = ∅ = C I ∩ DI

(C ⊔ D)I

= C I ∪ DI

(∃r.C)I

= {d ∈ ∆I | ∃d′ ∈ ∆I : (d, d′ ) ∈ r I and d′ ∈ C I }

(∀r.C)I

= {d ∈ ∆I | ∀d′ ∈ ∆I : (d, d′ ) ∈ r I implies d′ ∈ C I }

An interpretation I satisfies a CI C ⊑ D if C I ⊆ D I , an assertion A(a) if a ∈ C I , an assertion r(a, b) if (a, b) ∈ r I , and a functionality assertion func(r) if r I is a partial function. Note that we make the standard name assumption, that is, individual names are not interpreted as domain elements (like first-order constants), but as themselves. This assumption is common both in DLs and in database theory. The results in this paper do not depend on it. An interpretation I is a model of a TBox T if it satisfies all CIs in T and I is a model of an ABox A if it satisfies all assertions in A. We call an ABox A consistent w.r.t. a TBox T if A and T have a joint model.

6

DATA COMPLEXITY OF ONTOLOGIES

We consider several query languages. A positive existential query (PEQ) q(~x) is a first-order formula with free variables ~x = x1 , . . . , xn constructed from atoms A(x) and r(x, y) using conjunction, disjunction, and existential quantification where A ∈ NC , r ∈ NR , and x, y are individual variables. The variables in ~x are the answer variables of q(~x). A PEQ without answer variables is Boolean. An assignment π for q(~x) in an interpretation I is a mapping from the variables that occur in q(~x) to ∆I . A tuple ~a = a1 , . . . , an in Ind(I) is an answer to q(~x) in I if there exists an assigment π for q(~x) in I such that I |=π q(~x) (in the standard first-order sense) and π(xi ) = ai for 1 ≤ i ≤ n. In this case, we write I |= q(~a). A tuple ~a ∈ Ind(A), A an ABox, is a certain answer to q(~x) in A w.r.t. a TBox T , in symbols T , A |= q(~a), if I |= q(~a) for all models I of T and A. Computing certain answers to a query in the sense just defined is that main querying problem that we are interested in. Although this paper focusses on the theoretical aspects of query answering, we given a concrete example that illustrates the usefulness of query answering with DL ontologies. Example 1. Let T = {Professer ⊑ Academic, Professor ⊑ ∃gives.Course} A = {Student(john), supervisedBy(john, mark), Professor(mark)} q(x, y) = ∃z Student(x) ∧ supervisedBy(x, y) ∧ Academic(y) ∧ gives(y, z) ∧ Course(z) Thus the query asks to return all pairs that consist of a student x and an academic y such that x is supervised by y and y gives a course. Although this information is not directly present in the ABox, because of the TBox it is easy to see that (john, mark) is a certain answer. Apart from PEQs, we also study several fragments thereof. A conjunctive query (CQ) is a PEQ without disjunction. We generally assume that a CQ q(~x) takes the form ∃~y ϕ(~x, ~y ), where ϕ(~x, ~y ) is a conjunction of atoms of W the form A(x) and r(x, y). It is easy to see that every PEQ q(~x) is equivalent to a disjunction i∈I qi (~x), where each qi (~x) is a CQ (such a disjunction is often called a union of conjunctive queries, or UCQ). To introduce relevant fragments of CQs, we recall two further DLs that we use here for querying purposes. EL concepts are constructed from NC and NR according to the syntax rule C, D := ⊤ | A | C ⊓ D | ∃r.C and ELI concepts additionally admit inverse roles. If C is an ELI concept and x a variable, then C(x) is called an ELI query (ELIQ); if C is an EL concept, then C(x) is called an EL query (ELQ). Note that every ELIQ can be regarded as an acyclic CQ with one answer variable, and indeed this is an equivalent definition of ELIQs; in the case of ELQs, it is additionally the case that all edges are directed away from the answer variable. For example, the ELIQ ∃r.(A ⊓ ∃s− .B)(x) is equivalent to the acyclic CQ ∃y1 ∃y2 (r(x, y1 ) ∧ A(y1 ) ∧ s(y2 , y1 ) ∧ B(y2 )). In what follows, we will not distinguish between an ELIQ and its translation into an acyclic CQ with one answer variable and freely apply notions introduced for PEQs also to ELIQs and ELQs. We also sometimes slightly abuse notation and use PEQ to denote the set of all positive existential queries, and likewise for CQ, ELIQ, and ELQ. Example 2. (1) Let T∃,r = {A ⊑ ∃r.A} and q(x) = ∃r.A(x). Then we have for any ABox A, T∃,r , A |= q(a) iff A(a) ∈ A or there are r(a, b), A(b) ∈ A. (2) Let T∃,l = {∃r.A ⊑ A} and q(x) = A(x). For any ABox A, T∃,l , A |= q(a) iff there is an r-path in A from a to some b with A(b) ∈ A; that is, there are r(a0 , a1 ), . . . , r(an−1 , an ) ∈ A, n ≥ 0, with a0 = a, an = b, and A(b) ∈ A.

DATA COMPLEXITY OF ONTOLOGIES

7

(3) Consider an undirected graph G represented as an ABox A with assertions r(a, b), r(b, a) ∈ A iff there is an edge between a and b. Let A1 , . . . , Ak , M be concept names. Then G is k-colorable iff Tk , A 6|= ∃x M (x), where Tk = {Ai ⊓ Aj ⊑ M | 1 ≤ i < j ≤ k} ∪ {Ai ⊓ ∃r.Ai ⊑ M | 1 ≤ i ≤ k} ∪ {⊤ ⊑ ⊔ Ai }. 1≤i≤k

We now introduce the main complexity notions investigated in this paper. An ontology-mediated query (OMQ) is a a pair (T , q(~x)) with T a TBox T and q(~x) a query. The query evaluation problem for (T , q(~x)) is to decide, given an ABox A and ~a in Ind(A), whether T , A |= q(~a). Instead of actually computing certain answers, we concentrate on the query evaluation problem, which is the decision problem version of query answering. In this paper, we are typically interested in joint complexity bounds for all OMQs based on a given TBox and query language. Definition 3. Let T be an ALCFI-TBox and let Q ∈ {CQ, PEQ, ELIQ, ELQ}. Then • Q-evaluation w.r.t. T is in PT IME if for every q(~x) ∈ Q, the query evaluation problem for (T , q(~x)) is in PT IME. • Q-evaluation w.r.t. T is CO NP-hard if there exists q(~x) ∈ Q such that the query evaluation problem for (T , q(~x)) is coNP-hard. Example 4. (1) PEQ-evaluation w.r.t. the TBoxes T∃,r and T∃,l from Example 2 is in PT IME. This follows from the fact that these TBoxes are EL TBoxes (TBoxes using only EL concepts) and it is well known that PEQ-evaluation w.r.t. EL-TBoxes is in PT IME [KL07]. (2) Consider the TBoxes Tk from Example 2 that express k-colorability. For k ≥ 3, CQ-evaluation w.r.t. Tk is CO NP-hard since k-colorability is NP-hard. However, in contrast to the tractability of 2-colorability, CQ-evaluation w.r.t. T2 is still CO NP-hard. This follows from Theorem 18 below and, intuitively, is the case because T2 ‘entails a disjunction’: for A = {B(a)}, we have T2 , A |= A1 (a) ∨ A2 (a), but neither T2 , A |= A1 (a) nor T2 , A |= A2 (a). In addition to the classification of TBoxes according to whether query evaluation is in PT IME or CO NP-hard, we are also interested in whether OMQs based on the TBox are rewritable into more classical database querying languages, in particular into Datalog. A Datalog rule ρ has the form S(~x) ← R1 (~y1 ) ∧ · · · ∧ Rn (~yn ) where n > 0, S is a relation symbol, and R1 , . . . , Rn are relation symbols, that is, concept names and role names. We refer to S(~x) as the head of ρ and R1 (~y1 ) ∧ · · · ∧ Rn (~yn ) as its body. Every variable in the head of ρ is required to occur also in its body. A Datalog program Π is a finite set of Datalog rules with a selected goal relation goal that does not occur in rule bodies. Relation symbols that occur in the head of at least one rule are called intensional relation symbols (IDBs), the remaining symbols are called extensional relation symbols (EDBs). Note that, by definition, goal is an IDB. The arity of the program is the arity of the goal relation. Programs of arity zero are called Boolean. For an ABox A, a Datalog program Π, and ~a from Ind(A) of the same length as the arity of goal, we write A |= Π(~a) if Π returns ~a as an answer on A, defined in the usual way [CGT89]. A Datalog program Π is a Datalog-rewriting of an OMQ (T , q(~x)) if for all ABoxes A and ~a from Ind(A), T , A |= q(~a) iff A |= Π(~a). In this case the OMQ (T , q(~x)) is called Datalog-rewritable. When working with DLs such as ALCFI that include functional roles, it is more natural to admit the use of inequalities in the bodies of Datalog rules instead of working with ‘pure’ programs. We refer to such extended programs as Datalog6= programs and accordingly speak of Datalog6= -rewritability.

8

DATA COMPLEXITY OF ONTOLOGIES

Example 5. (1) The OMQ (T∃,l , A(x)) from Example 2 expressing a form of reachability is rewritable into the Datalog program goal(x) ← P (x),

P (x) ← A(x),

P (x) ← r(x, y) ∧ P (y).

(2) The OMQ (Tk , ∃x M (x)) from Example 2 is Datalog-rewritable iff k ≤ 2 since non-2-colorability can be expressed by a Datalog program but for k ≥ 3, non-k-colorability cannot be expressed by a Datalog program (in fact, not even by a Datalog6= program) [ACY91]. (3) The OMQ ({func(r)}, ∃x M (x)) is rewritable into the Datalog6= program goal() ← r(x, y1 ) ∧ r(x, y2 ) ∧ y1 6= y2 but is not rewritable into pure Datalog. Definition 6. Let T be an ALCFI-TBox and let Q ∈ {CQ, PEQ, ELIQ, ELQ}. Then T is Datalog6= -rewritable for Q if (T , q(~x)) is Datalog6= -rewritable for every q(~x) ∈ Q. Example 7. It is folklore that every EL-TBox is Datalog-rewritable for ELQ, ELIQ, CQ, and for PEQ. Thus, this applies in particular to the TBoxes T∃,l and T∃,r from Example 2. A concrete construction of Datalog-rewritings for ELIQs can be found in the proof of Theorem 24 below. In contrast, the TBox Tk from Example 2 is not Datalog6= -rewritable for ELQ when k ≥ 3 since the OMQ (Tk , ∃x M (x)) is not Datalog6= -rewritable, by Example 5 (2). It is well-known that Datalog6= -programs can be evaluated in PT IME [CGT89], and thus Datalog6= rewritability for Q of a TBox T implies that Q-evaluation w.r.t. T is in PT IME. We shall see later that the converse direction does not hold. We will often be concerned with homomorphisms between ABoxes and between interpretations, defined next. Let A and B be ABoxes. A function h : Ind(A) → Ind(B) is a homomorphism from A to B if it satisfies the following conditions: (1) A(a) ∈ A implies A(h(a)) ∈ B and (2) r(a, b) ∈ A implies r(h(a), h(b)) ∈ B. We say that h preserves I ⊆ NI if h(a) = a for all a ∈ I. Homomorphisms from an interpretation I to an interpretation J are defined analogously as functions h : ∆I → ∆J . Note that these two notions are in fact identical since, up to presentation, ABoxes and finite interpretations are the same thing. In what follows we will not always distinguish between the two presentations. 3. M ATERIALIZABILITY We introduce materializability as a central notion for analyzing the complexity and rewritability of TBoxes. A materialization of a TBox T and ABox A for a class of queries Q is a model of T and A that gives the same answers to queries in Q as T and A do. It is not difficult to see that a materialization for ELIQs is not necessarily a materialization for CQs and that a materialization for ELQs is not necessarily a materialization for ELIQs. We shall call a TBox T materializable for a query language Q if for every ABox A that is consistent w.r.t. T , there is at least one materialization of T and A for Q. Interestingly, we show that materializability of ALCFI-TBoxes does not depend on whether one considers ELIQs, CQs, or PEQs. This result allows us to simply talk about materializable TBoxes, independently of the query language considered. The fundamental

DATA COMPLEXITY OF ONTOLOGIES

9

result linking materializability of a TBox to the complexity of query evaluation is that query evaluation is CO NP-hard w.r.t. non-materializable ALCFI-TBoxes. As a first application, we show that PT IME query evaluation and Datalog6= -rewritability of ALCFI-TBoxes also do not depend on the query language, and the same is true for CO NP-hardness of query evaluation. As a side line, we also consider the case of ALCF where, additionally, materializability for ELIQs coincides with materializability for ELQs. Definition 8. Let T be an ALCFI-TBox and Q ∈ {CQ, PEQ, ELIQ, ELQ}. Then (1) a model I of T and an ABox A is a Q-materialization of T and A if for all queries q(~x) ∈ Q and ~a ⊆ Ind(A), we have I |= q(~a) iff T , A |= q(~a); (2) T is Q-materializable if for every ABox A that is consistent w.r.t. T , there exists a Qmaterialization of T and A. In Point (1) of Definition 8, it is important that the materialization I of T and A is a model of T and A. In fact, for every ABox A that is consistent w.r.t. T , we find an interpretation I such that for every CQ q(~x) and ~a ⊆ Ind(A), I |= q(~a) iff T , A |= q(~a); take, for example, the direct product of all (up to isomorphisms) countable models of T and A. Note that I is, in general, not a model of T . Note that a Q-materialization can be viewed as a more abstract version of the canonical or minimal or universal model as often used in the context of ‘Horn DLs’ such as EL and DL-Lite [LTW09, KLT+ 10, BO15] and more expressive ontology languages based on tuple-generating dependencies (tgds) [CGK13] as well as in data exchange [FKMP05]. In fact, the ELQ-materialization in the next example is exactly the ‘compact canonical model’ from [LTW09]. Example 9. (1) Let T∃,l = {∃r.A ⊑ A} be as in Example 2 and let A be an ABox. Let I be the interpretation obtained from A by adding to AI all a ∈ Ind(A) such that there exists an r-path from a to some b with A(b) ∈ A. Then I is a PEQ-materialization of T and A and so T is PEQ-materializable. (2) Let T∃,r = {A ⊑ ∃r.A} be as in Example 2 and let A be an ABox with at least one assertion of the form A(a). To obtain an ELQ-materialization I of T and A, start with A as an interpretation, add a fresh domain element dr to ∆I and to AI , and extend r I with (a, dr ) and (dr , dr ) for all A(a) ∈ A. Thus T∃,r is ELQ-materializable. Trivially, every PEQ-materialization is a CQ-materialization, every CQ-materialization is an ELIQmaterialization and every ELIQ-materialization is an ELQ-materialization. Conversely, it follows directly from the fact that each PEQ is equivalent to a disjunction of CQs that every CQ-materialization is also a PEQ-materialization. In contrast, the following example demonstrates that ELQ-materializations are different from ELIQ-materializations. A similar argument separates ELIQ-materializations from CQ-materializations. Example 10. Let T∃,r be as in Example 9, A = {B1 (a), B2 (b), A(a), A(b)} and q(x) = (B1 ⊓ ∃r.∃r − .B2 )(x), Then the ELQ-materialization MA from Example 9 is not a Q-materialization for any Q from the set of query languages ELIQ, CQ, PEQ. For example, we have MA |= q(a), but T , A 6|= q(a). An ELIQ/CQ/PEQ-materialization of T and A is obtained by unfolding MA (see below): instead of using only one additional individual dr as a witness for ∃r.A, we attach to both a and b an infinite r-path of elements that satisfy A. Note that every CQ/PEQ-materialization of T∃,r and A must be infinite.

10

DATA COMPLEXITY OF ONTOLOGIES

We will sometimes restrict our attention to materializations I that are countable and generated, i.e, every d ∈ ∆I is reachable from some a ∈ ∆I ∩ NI in the undirected graph [ r I }). GI = (∆I , {{d, d′ } | (d, d′ ) ∈ r∈NR

The following lemma shows that we can make that assumption without loss of generality. Lemma 11. Let T be an ALCFI-TBox, A an ABox, and Q ∈ {CQ, PEQ, ELIQ, ELQ}. If I is a Q-materialization of T and A, then there exists a subinterpretation J of I that is a countable and generated Q-materialization of T and A. Proof. Let I be a Q-materialization of T and A. To construct J we apply a standard selective filtration procedure to I. More precisely, we identify a sequence Ind(A) = S0 ⊆ S1 ⊆ · · · ⊆ ∆I S and then define J to be the restriction of I to i Si . Let C be the set of all concepts of the form ∃r.C that occur in T and of all concepts ∃r.¬C such that ∀r.C occurs in T . Assume Si has already been defined. Then define Si+1 as the union of Si and, for every d ∈ Si and concept ∃r.C ∈ C with d ∈ (∃r.C)I , an arbitrary d′ ∈ ∆I with (d, d′ ) ∈ r I and d′ ∈ C I (unless such a d′ exists already in Si ). It is easy to see that J is a countable and generated Q-materialization of T and A. ❏ 3.1. Model-Theoretic Characterizations of Materializability. We characterize materializations using simulations and homomorphisms. This sheds light on the nature of materializations and establishes a close connection between materializations and initial models as studied in model theory, algebraic specification, and logic programming [Mal71, MG85, Mak87]. A simulation from an interpretation I1 to an interpretation I2 is a relation S ⊆ ∆I1 × ∆I2 such that (1) for all A ∈ NC : if d1 ∈ AI1 and (d1 , d2 ) ∈ S, then d2 ∈ AI2 ; (2) for all r ∈ NR : if (d1 , d2 ) ∈ S and (d1 , d′1 ) ∈ r I1 , then there exists d′2 ∈ ∆I2 such that (d′1 , d′2 ) ∈ S and (d2 , d′2 ) ∈ r I2 ; (3) for all a ∈ ∆I1 ∩ NI : a ∈ ∆I2 and (a, a) ∈ S. Note that, by Condition (3), domain elements that are individual names need to be respected by simulations while other domain elements need not. In database parlance, the latter are thus treated as labeled nulls, that is, while their existence is important, their identity is not. We call a simulation S an i-simulation if Condition (2) is satisfied also for inverse roles. Note that S is a homomorphism preserving ∆I1 ∩ NI if S is a function with domain ∆I . We remind the reader of the following characterizations of ELQs using simulations, ELIQs using i-simulations, and CQs using homomorphisms (see e.g. [LW10]). An interpretation I has finite outdegree if the undirected graph GI has finite outdegree. Lemma 12. Let I and J be interpretations such that ∆I ∩ NI is finite, I is countable and generated, and J has finite outdegree. Then the following conditions are equivalent (where none of the assumed conditions on I and J is required for (2) ⇒ (1)). (1) For all ELIQs C(x) and a ∈ ∆I ∩ NI : if I |= C(a), then J |= C(a); (2) There is an i-simulation from I and J . The same equivalence holds when ELIQs and i-simulations are replaced by ELQs and simulations, respectively. Moreover, the following conditions are equivalent (where none of the assumed conditions on I and J is required for (3) ⇒ (1)). (3) For all PEQs q(~x) and ~a ⊆ ∆I ∩ NI : if I |= q(~a), then J |= q(~a);

DATA COMPLEXITY OF ONTOLOGIES

11

(4) For all CQs q(~x) and ~a ⊆ ∆I ∩ NI : if I |= q(~a), then J |= q(~a); (5) There is a homomorphism from I to J preserving ∆I ∩ NI . Proof. We prove the equivalence of (3)-(5). The equivalence of (1) and (2) is similar (both for ELIQs and ELQs) but simpler and left to the reader. The implication (3) ⇒ (4) is trivial. For the proof of (4) ⇒ (5), assume that I is countable and generated and let J have finite outdegree. We first assume that only a finite set Σ of concept and role names have a non-empty interpretation in I and then generalize the result to arbitrary I. Assume that (4) holds. First observe that for every finite subset X of ∆I there is a homomorphism hX preserving X ∩ NI from the subinterpretation I↾X of I induced by X into J : associate with every d ∈ X an individual variable xd and regard I↾X as the CQ qX (~x) = ∃~y ϕ(~x, ~y ) defined by setting ^ ^ ϕ(~x, ~y ) = ∃~y A(xd ) ∧ r(xd , xd′ ), d∈X∩AI

(d,d′ )∈(X×X)∩r I

where ~x comprises the individual variables in {xa | a ∈ X ∩ NI } and ~y comprises the individual variables xd with d ∈ X \NI (qX is a CQ by our assumption that only finitely many concept and role names have non-empty interpretation). For the assignment π(xd ) = d, we have I |=π ϕ(~x, ~y ). Thus I |=π qX (~x) and so, by (2), J |=π qX (~x). Consequently, there exists an assignment π ′ for qX (~x) in J which coincides with π on {xa | a ∈ X ∩ NI } such that J |=π′ ϕ(~x, ~y ). Let hX (d) = π ′ (d) for d ∈ X. Then hX is a homomorphism from I↾X to J preserving X ∩ NI , as required. We now lift the homomorphisms hX to a homomorphism h from I to J preserving ∆I ∩ NI . Since I is countable and generated, there exists a sequence X0 ⊆ X1 ⊆ · · · of finite subsets of ∆I S I such that X0 = ∆ ∩ NI , i≥0 Xi = ∆I , and for all d ∈ Xi there exists a path in Xi from some a ∈ X0 to d. By the observation above, we find homomorphisms hXi from I↾Xi to J preserving Xi ∩ NI , for i ≥ 0. Let d0 , d1 . . . be an enumeration of ∆I . We define the required homomorphism h as the limit of a sequence h0 ⊆ h1 ⊆ · · · , where each hn has domain {d0 , . . . , dn } and where we ensure for each hn and all d ∈ {d0 , . . . , dn } that there are infinitely many j with hn (d) = h↾Xj (d). Observe that since J has finite outdegree and since for all d ∈ Xi , there exists a path in Xi from some a ∈ X0 to d, for each d ∈ ∆I there exist only finitely many distinct values in {h↾Xi (d) | i ≥ 0}. By the pigeonhole principle, there thus exist infinitely many j with the same value hXj (d). For h0 (d0 ) we take such a value for d0 . Assume hn has been defined and assume that the set I = {j | hn (d) = h↾Xj (d) for all d ∈ {d0 , . . . , dn }} is infinite. Again by the pigeonhole principle, we find a value e ∈ ∆J such that hXj (dn+1 ) = e for infinitely many j ∈ I. We set hn+1 (dn+1 ) = e. The function S h = i≥0 h0 is a homomorphism from I to J preserving ∆I ∩ NI , as required. To lift this result to arbitrary interpretations I, it is sufficient to prove that the homomorphisms hX still exist. This can be shown using again the pigeonhole principle. Let X ⊆ ∆I be finite. We may assume that for each d ∈ X, there exists a path in X from some a ∈ X ∩ NI , to d. We have shown that for each finite set Σ of concept and role names, there exists a homomorphism hΣ X from Σ of I to J (I Σ interprets only the symbols in Σ as non-empty). Since J has finite the Σ-reduct IX X X outdegree, infinitely many hΣ coincide. A straightforward modification of the pigeonhole argument X above can now be used to construct the required homomorphism hX . For the proof of (5) ⇒ (3), assume I |= q(~a) and let h be a homomorphism from I to J preserving ∆I ∩ NI . Let π be an assignment for q(~x) in I witnessing I |= q(~a). Then the composition h ◦ π is an assignment for q(~x) in J witnessing J |= q(~a). ❏

12

DATA COMPLEXITY OF ONTOLOGIES

For the next steps, we need some observations regarding the unfolding of interpretations into forestshaped interpretations. Let us first make precise what we mean by unfolding. The i-unfolding of an interpretation I is an interpretation J defined as follows. The domain ∆J of J consists of all words d0 r1 . . . rn dn with n ≥ 0, each di from ∆I and each ri a (possibly inverse) role such that (a) di ∈ NI iff i = 0; I for 0 ≤ i < n; (b) (di , di+1 ) ∈ ri+1 (c) if ri− = ri+1 , then di−1 6= di+1 for 0 < i < n. For d0 · · · dn ∈ ∆J , we set tail(d0 · · · dn ) = dn . Now set AJ rJ

= {w ∈ ∆J | tail(w) ∈ AI } = (r I ∩ (NI × NI )) ∪ {(σ, σrd) | σ, σrd ∈ ∆J } ∪ {(σr − d, σ) | σ, σr − d ∈ ∆J }

for all A ∈ NC for all r ∈ NR .

We say that an interpretation I is i-unfolded if it is isomorphic to its own i-unfolding. Clearly, every i-unfolding of an interpretation is i-unfolded. For ALCF-TBoxes, it is not required to unfold along inverse roles. This is reflected in the unfolding of an interpretation I, where in contrast to the i-unfolding we use as the domain the set of all words d0 r1 . . . rn dn with n ≥ 0, each di from ∆I , and each ri a role name such that Conditions (a) and (b) above are satisfied. The interpretation of concept and role names remains the same. We call an interpretation I unfolded if it is isomorphic to its own unfolding. The following lemma summarizes the main properties of unfoldings. Its proof is straightforward and left to the reader. Lemma 13. Let I be an interpretation, I i its i-unfolding, and I u its unfolding. Then for every interpretation J , the following conditions are satisfied: i (1) the function f (w) := tail(w), w ∈ ∆I , is a homomorphism from I i to I preserving ∆I ∩ NI ; u (2) the function f (w) := tail(w), w ∈ ∆I , is a homomorphism from I u to I preserving ∆I ∩ NI ; (3) if there is an i-simulation from I to J , then there is a homomorphism from I i to J preserving ∆I ∩ NI ; (4) if there is a simulation from I to J , then there is a homomorphism from I u to J preserving ∆I ∩ NI ; (5) if I is a model of T and A with T an ALCFI-TBox, then I i is a model of T and A; (6) if I is a model of T and A with T an ALCF-TBox, then I u is a model of T and A. An interpretation I is called hom-initial in a class K of interpretations if for every J ∈ K, there exists a homomorphism from I to J preserving ∆I ∩ NI . I is called sim-initial (i-sim-initial) in a class K of interpretations if for every J ∈ K, there exists a simulation (i-simulation) from I to J . The following theorem provides the announced characterization of materializations in terms of simulations and homomorphisms. In the following, the class of all models of T and A is denoted by Mod(T , A). Theorem 14. Let T be an ALCFI-TBox, A an ABox, and let I ∈ Mod(T , A) be countable and generated. Then I is (1) an ELIQ-materialization of T and A iff it is i-sim-initial in Mod(T , A); (2) a CQ-materialization of T and A iff it is a PEQ-materialization of T and A iff it is hominitial in Mod(T , A);

DATA COMPLEXITY OF ONTOLOGIES

13

(3) an ELQ-materialization of T and A iff it is sim-initial in Mod(T , A), provided that T is an ALCF-TBox. The ‘only if’ directions of all three points hold without any of the assumed conditions on I. Proof. We show that (1) follows from Lemma 12 and Lemma 13; (2) and (3) can be proved similarly. We start with the direction from right to left. Assume that I is i-sim-initial in Mod(T , A). Since I is a model of T and A, we have I |= C(a) whenever T , A |= C(a) for any ELIQ C(x) and a ∈ Ind(A). Conversely, if T , A 6|= C(a) then there exists a model J of T and A such that J 6|= C(a). There is an i-simulation from I to J . Thus, by the implication (2) ⇒ (1) from Lemma 12, we have I 6|= C(a) as required. For the direction from left to right, assume that I is a materialization of T and A and take a model J of T and A. We have to construct an i-simulation from I to J . It actually suffices to construct an i-simulation from I to the i-unfolding J i of J : by Point (3) of Lemma 13, there is a homomorphism from J i to J and the composition of an i-simulation with a homomorphism is again an i-simulation. To obtain an i-simulation from I to J i , we first identify a subinterpretation J ′ of J i that has finite outdegree and is still a model of T and A. By the implication (1) ⇒ (2) from Lemma 12 and since I is a materialization, there must then be an i-simulation from I to J ′ . Clearly this is also an i-simulation from I to J i and we are done. It thus remains to construct J ′ , which is done by applying selective filtration to J i in exactly the same way as in the proof of Lemma 11. It can be verified that the outdegree of the resulting subinterpretation J ′ of J i is bounded by |T | + |A| and, therefore, finite. By construction, J ′ ∈ Mod(T , A). ❏ The following example shows that the generatedness condition in Theorem 14 cannot be dropped. We leave it open whether the same is true for countability. Example 15. Let T = {A ⊑ ∃r.A, B ⊑ A} and A = {B(a)} and consider the interpretation I defined by ∆I AI BI rI

= = = =

{a} ∪ {0, 1, 2 . . .} ∪ {. . . , −2′ , −1′ , 0′ , 1′ , 2′ , . . . } ∆I {a} {(a, 0)} ∪ {(n, n + 1) | n ∈ } ∪ {(n′ , n′ + 1) | n ∈ }.

N

Z

Then I is a PEQ-materialization of T and A, but it is not hom-initial (and in fact not even siminitial) since the restriction of I to domain {a} ∪ {0, 1, 2 . . .} is also a model of T and A, but there is no homomorphism (and no simulation) from I to this restriction preserving {a}. As an application of Theorem 14, we now show that materializability coincides for the query languages PEQ, CQ, and ELIQ (and that for ALCF-TBoxes, all these also coincide with ELQmaterializability). Theorem 16. Let T be an ALCFI-TBox. Then the following conditions are equivalent: (1) T is PEQ-materializable; (2) T is CQ-materializable; (3) T is ELIQ-materializable; (4) Mod(T , A) contains an i-sim-initial I, for every ABox A that is consistent w.r.t. T ; (5) Mod(T , A) contains a hom-initial I, for every ABox A that is consistent w.r.t. T .

14

DATA COMPLEXITY OF ONTOLOGIES

If T is an ALCF-TBox, then the above is the case iff T is ELQ-materializable iff Mod(T , A) contains a sim-initial I, for every ABox A that is consistent w.r.t. T . Proof. The implications (1) ⇒ (2) and (2) ⇒ (3) are trivial. For (3) ⇒ (4), let I be an ELIQmaterialization of T and an ABox A. By Lemma 11, we may assume that I is countable and generated. By Lemma 14, Mod(T , A) contains an i-sim-initial interpretation. For (4) ⇒ (5), assume that I ∈ Mod(T , A) is i-sim-initial. By Points (3) and (5) of Lemma 13, the i-unfolding of I is hom-initial in Mod(T , A) and (5) follows. (5) ⇒ (1) follows from Theorem 14. The implications for ALCF-TBoxes are proved similarly. ❏ Because of Theorem 16, we sometimes speak of materializability without reference to a query language and of materializations instead of PEQ-materializations. 3.2. Materializability and CO NP-hardness. We show that non-materializability implies CO NPhardness of query evaluation. To this end, we first establish that materializability is equivalent to the disjunction property, which is sometimes also called convexity and plays a central role in attaining PT IME complexity for subsumption in DLs [BBL05], and for attaining PT IME data complexity for query answering with DL TBoxes [KL07]. A TBox T has the ABox disjunction property for ELIQ (resp. ELQ) if for all ABoxes A, individuals a0 , . . . , ak ∈ Ind(A), and ELIQs (resp. ELQs) C0 (x), . . . , Cn (x), T , A |= C0 (a0 ) ∨ · · · ∨ Ck (ak ) implies T , A |= Ci (ai ) for some i ≤ k. Theorem 17. An ALCFI- (ALCF-) TBox T is materializable iff it has the ABox disjunction property for ELIQs (ELQs). Proof. For the nontrivial “if” direction, let A be an ABox that is consistent w.r.t. T and such that there is no ELIQ-materialization of T and A. Then T ∪ A ∪ Γ is not satisfiable, where Γ = {¬C(a) | T , A 6|= C(a), a ∈ Ind(A), C(x) ELIQ}. In fact, any satisfying interpretation would be an ELIQ-materialization. ByWcompactness, there is a finite subset Γ′ of Γ such that T ∪ A ∪ Γ′ is not satisfiable, i.e. T , A |= ¬C(a)∈Γ′ C(a). Since Γ′ ⊆ Γ, we have T , A 6|= C(a) for all ¬C(a) ∈ Γ′ . Thus, T lacks the ABox disjunction property. ❏ Based on Theorems 16 and 17, we now establish that materializability is a necessary condition for query-evaluation to be it PT IME. Theorem 18. If an ALCFI-TBox T (ALCF-TBox T ) is not materializable, then ELIQ-evaluation (ELQ-evaluation) w.r.t. T is CO NP-hard. Proof. The proof is by reduction of 2+2-SAT, a variant of propositional satisfiability that was first introduced by Schaerf as a tool for establishing lower bounds for the data complexity of query answering in a DL context [Sch93]. A 2+2 clause is of the form (p1 ∨ p2 ∨ ¬n1 ∨ ¬n2 ), where each of p1 , p2 , n1 , n2 is a propositional letter or a truth constant 0, 1. A 2+2 formula is a finite conjunction of 2+2 clauses. Now, 2+2-SAT is the problem of deciding whether a given 2+2 formula is satisfiable. It is shown in [Sch93] that 2+2-SAT is NP-complete. We first show that if an ALCFI-TBox T is not materializable, then UELIQ-evaluation w.r.t. T is CO NP-hard, where a UELIQ is a disjunction C0 (x) ∨ · · · ∨ Ck (x), with each Ci (x) an ELIQ. We then sketch the modifications necessary to lift the result to ELIQ-evaluation w.r.t. T . Since T is not materializable, by Theorem 16 it does not have the disjunction property. Thus, there is an ABox A∨ , individual names a1 , . . . , ak ∈ Ind(A), and ELIQs C0 (x), . . . , Ck (x) such

DATA COMPLEXITY OF ONTOLOGIES

15

that T , A∨ |= C0 (a0 ) ∨ · · · ∨ Ck (ak ), but T , A∨ 6|= Ci (ai ) for all i ≤ k. Assume w.l.o.g. that this sequence is minimal, i.e., T , A∨ 6|= C0 (a0 ) ∨ · · · ∨ Ci−1 (ai−1 ) ∨ Ci+1 (ai+1 ) ∨ · · · ∨ Ck (ak ) for all i ≤ k. This clearly implies that for all i ≤ k, (∗) there is a model Ii of T and A∨ with I |= Ci (ai ) and I 6|= Cj (aj ) for all j 6= i. We will use A∨ , the individuals a1 , . . . , ak , and the ELIQs C0 (x), . . . , Ck (x) to generate truth values for variables in the input 2+2 formula. Let ϕ = c0 ∧ · · · ∧ cn be a 2+2 formula in propositional letters z0 , . . . , zm , and let ci = pi,1 ∨ pi,2 ∨ ¬ni,1 ∨ ¬ni,2 for all i ≤ n. Our aim is to define an ABox Aϕ with a distinguished individual name f and a UELIQ q(x) such that ϕ is unsatisfiable iff T , Aϕ |= q(f ). To start, we represent the formula ϕ in the ABox Aϕ as follows: • the individual name f represents the formula ϕ; • the individual names c0 , . . . , cn represent the clauses of ϕ; • the assertions c(f, c0 ), . . . , c(f, cn ), associate f with its clauses, where c is a role name that does not occur in T ; • the individual names z0 , . . . , zm represent variables, and the individual names 0, 1 represent truth constants; • the assertions [ {p1 (ci , pi,1 ), p2 (ci , pi,2 ), n1 (ci , ni,1 ), n2 (ci , ni,2 )} i≤n

associate each clause with the variables/truth constants that occur in it, where p1 , p2 , n1 , n2 are role names that do not occur in T . We further extend Aϕ to enforce a truth value for each of the variables zi . To this end, add to Aϕ copies A0 , . . . , Am of A∨ obtained by renaming individual names such that Ind(Ai ) ∩ Ind(Aj ) = ∅ whenever i 6= j. As a notational convention, let aij be the name used for the individual name aj ∈ Ind(A∨ ) in Ai for all i ≤ m and j ≤ k. Intuitively, the copy Ai of A is used to generate a truth value for the variable zi . To actually connect each individual name zi to the associated ABox Ai , we use role names r0 , . . . , rk that do not occur in T . More specifically, we extend Aϕ as follows: • link variables zi to the ABoxes Ai by adding assertions rj (zi , aij ) for all i ≤ m and j ≤ k; thus, truth of zi means that the concept ∃r0 .C0 is true at zi and falsity means that one of the concepts ∃rj .Cj , j ≤ k, is true at zi ; • to ensure that 0 and 1 have the expected truth values, add a copy of C0 (x) viewed as an ABox with root 1′ and a copy of C2 (x) viewed as an ABox with root 0′ ; add r0 (1, 1′ ) and r1 (0, 0′ ). Consider the query q0 (x) = C(x) with C = ∃c.(∃p1 .ff ⊓ ∃p2 .ff ⊓ ∃n1 .tt ⊓ ∃n2 .tt) which describes the existence of a clause with only false literals and thus captures falsity of ϕ, where tt is an abbreviation for ∃r0 .C0 and ff an abbreviation for the ELU -concept ∃r1 .C1 ⊔ · · · ⊔ ∃rk .Ck . It is straightforward to show that ϕ is unsatisfiable iff T , A |= q0 (f ). To obtain the desired UELIQ q(x), it remains to take q0 (x) and distribute disjunction to the outside. We now show how to improve the result from UELIQ-evaluation to ELIQ-evaluation. Our aim is to change the encoding of falsity of a variable zi from satisfaction of ∃r1 .C1 ⊔ · · · ⊔ ∃rk .Ck at zi to satisfaction of ∃h.(∃r1 .C1 ⊓ · · · ⊓ ∃rk .Ck ), at zi , where h is an additional role that does not

16

DATA COMPLEXITY OF ONTOLOGIES

occur in T . We can then replace the concept ff in the query q0 with ∃h.(∃r1 .C1 ⊓ · · · ⊓ ∃rk .Ck ), which gives the desired ELIQ q(x). It remains to modify Aϕ to support the new encoding of falsity. The basic idea is that each zi has k successors bi1 , . . . , bik reachable via h such that for 1 ≤ j ≤ k, • ∃rℓ .Cℓ is satisfied at bij for all ℓ = 1, . . . , j − 1, j + 1, . . . , k and • the assertion rj (bij , aij ) is in Aϕ . Thus, ∃r1 .C1 ⊓ · · · ⊓ ∃rk .Ck is satisfied at bij iff Cj is satisfied at aij , for all j with 1 ≤ j ≤ k. In detail, the modification of Aϕ is as follows: • for 1 ≤ j ≤ k, add to Aϕ a copy of Cj viewed as an ABox, where the root individual name is dj ; • for all i ≤ m, replace the assertions rj (zi , aij ), 1 ≤ j ≤ k, with the following: – h(zi , bi1 ), . . . , h(zi , bik ) for all i ≤ m; – rj (bij , aij ), r1 (bij , d1 ), . . . , rj−1 (bij , dj−1 ), rj+1 (bij , dj+1 ), . . . , rk (bij , dk ) for all i ≤ m and 1 ≤ j ≤ k. This finishes the modified construction. Again, it is not hard to prove correctness. It remains to note that, when T is an ALCF-TBox, then the above construction of q yields an ELQ instead of an ELIQ. ❏ The converse of Theorem 18 fails, i.e., there are TBoxes that are materializable, but for which ELIQevaluation is CO NP-hard. In fact, materializations of such a TBox T and ABox A are guaranteed to exist, but cannot always be computed in PT IME (unless PT IME = CO NP). Technically, this follows from Theorem 28 later on which states that for every non-uniform CSP, there is a materializable ALC-TBox for which Boolean CQ-answering has the same complexity, up to complementation of the complexity class. 3.3. Complexity of TBoxes for Different Query Languages. We make use of our results on materializability to show that PT IME query evaluation w.r.t. ALCFI-TBoxes does not depend on whether we consider PEQs, CQs, or ELIQs, and the same is true for Datalog6= -rewritability. For ALCF-TBoxes, we can add ELQs to the list. Theorem 19 below gives a uniform explanation for the fact that, in the traditional approach to data complexity in OBDA, the complexity of evaluating PEQs, CQs, and ELIQs has turned out to be identical for almost all DLs. It allows us to (sometimes) speak of the ‘complexity of query evaluation’ without reference to a concrete query language. Theorem 19. For all ALCFI-TBoxes T , (1) PEQ-evaluation w.r.t. T is in PT IME iff CQ-evaluation w.r.t. T is in PT IME iff ELIQevaluation w.r.t. T is in PT IME; (2) T is Datalog6= -rewritable for PEQ iff it is Datalog6= -rewritable for CQ iff it is Datalog6= rewritable for ELIQ (unless PT IME = CO NP); (3) PEQ-evaluation w.r.t. T is CO NP-hard iff CQ-evaluation w.r.t. T is CO NP-hard iff ELIQevaluation w.r.t. T is CO NP-hard. If T is an ALCF-TBox, then ELIQ can be replaced by ELQ in (1), (2), and (3). If T is an ALCI TBox, then Datalog6= -rewritability can be replaced by Datalog-rewritability in (2).

DATA COMPLEXITY OF ONTOLOGIES

17

Proof. We start with Points (1) and (2), for which the “only if” directions are trivial. For the converse directions, we may assume by Theorem 18 that the TBox T is materializable. The implications from CQ to PEQ in Points (1) and (2) follow immediately from W this assumption: one can first transform a given PEQ q(~x) into an equivalent disjunction of CQs i∈I qi (~x). CQ-materializability of T implies that, for any ABox A and ~a in Ind(A), T , A |= q(~a) iff there exists i ∈ I such that T , A |= qi (~a). Thus if CQ-evaluation w.r.t. T is in PT IME, evaluation of (T , q(~x)) is in PT IME. The same holds for Datalog6= -rewritability because the class of Datalog6= -queries is closed under finite union. We now consider the implications from ELIQ to CQ (and from ELQ to CQ if T is a ALCFTBox) in Points (1) and (2), first concentrating on the PT IME case. The following claim is the main step of the proof. It states that for any CQ q(~x), we can reduce the evaluation of q(~x) w.r.t. T on an ABox A to evaluating quantifier-free CQs and ELIQs C(x) w.r.t. T (ELQs if T is an ALCF-TBox), both on A. Claim 1. For any materializable TBox T and CQ q(~x) with ~x = x1 · · · xn , one can construct a finite set Q of pairs (ϕ(~x, ~y ), C), where • ϕ(~x, ~y ) is a (possibly empty) conjunction of atoms of the form x = y or r(x, y), where r is a role name in q(~x) and • C is a finite set of ELIQs such that the following conditions are equivalent for any ABox A and ~a = a1 · · · an from Ind(A): (i) T , A |= q(~a); (ii) there exists (ϕ(~x, ~y ), C) ∈ Q and an assignment π in Ind(A) with π(xi ) = ai for 1 ≤ i ≤ n, A |=π ϕ(~x, ~y ), and T , A |= C(π(x)) for all C(x) ∈ C. If T is an ALCF-TBox, then one can choose ELQs instead of ELIQs in each C in Q. Before we prove Claim 1, we show how the desired results follow from it. Let a CQ q(~x) be given and let Q be the set of pairs from Claim 1. • Assume that ELIQ-evaluation w.r.t. T is in PT IME. Then T , A |= q(~a) can be decided in polynomial time since there are only polynomially many assignments π and for any such π, A |=π ϕ(~x, ~y ) can be checked in polynomial time (using a naive algorithm) and T , A |= C(π(x)) can be checked in polynomial time for each ELIQ C(x) ∈ C. • Assume that T is Datalog6=-rewritable for ELIQ. Let p = (ϕ(~x, ~y ), C) ∈ Q. For each C(x) ∈ C, choose a Datalog6= -rewriting ΠC (x) of (T , C(x)), assume w.l.o.g that none of the chosen programs share any IDB relations, and that the goal relation of ΠC (x) is goalC . Let Πp be the Datalog6= program that consists of the rules of all the chosen programs, plus the following rule: ^ goal(~x) ← ϕ(~x, ~y ) ∧ goalC (x). C(x)∈C

Datalog6= -rewriting

The desired of (T , q(~x)) is obtained by taking the union of all the con= 6 structed Datalog queries, which can again be expressed in Datalog6=. The implications from ELQs to CQs for ALCF-TBoxes in Points (1) and (2) follow in the same way since, then, each C in Q consists of ELQs only. For the proof of Claim 1, we first require a technical observation that allows us to deal with subqueries that are not connected to an answer variable in the CQ q(~x). To illustrate, consider the query q0 = ∃x B(x). To prove Claim 1 for q0 , we have to find a set Q of pairs (ϕ(~y ), C) satisfying Conditions (i) and (ii). Clearly, in this case the components ϕ(~y ) will be empty and so we have

18

DATA COMPLEXITY OF ONTOLOGIES

to construct a finite set C of ELIQs such that for any ABox A, T , A |= ∃x B(x) iff there exists an ELIQ C(x) ∈ C and an assignment π in Ind(A) such that T , A |= C(π(x)). An infinite set C with this property is given by the set of all ELIQs ∃~r.B(x), where ~r is a sequence r1 · · · rn of roles ri in T and ∃~r.B stands for ∃r1 · · · ∃rn .B—this follows immediately from the assumption that T is materializable and that, by Lemma 11, for any ABox A that is consistent w.r.t. T , there exists a generated CQ-initial model of T and ABox A. The following result states that it is sufficient to include in C the set of all ∃~r.B(x) with ~r of length bounded by n0 := 2(2(|T |+|C|) · 2|T | + 1. Claim 2. Let C be an ELI-concept and assume that T , A |= ∃x C(x). If T is materializable, then there exists a sequence of roles ~r = r1 · · · rn with ri in T and of length n ≤ n0 and an a ∈ Ind(A) such that T , A |= ∃~r.C(a). If C is an EL-concept and T an ALCF-TBox, then the sequence ~r consists of role names in T . Proof of Claim 2. Let I be a CQ-materialization of T and A. By Points (3) and (5) of Lemma 13, we may assume that I is i-unfolded. From T , A |= ∃x C(x), we obtain C I 6= ∅. Let n be minimal such that there are a ∈ Ind(A) and d ∈ C I with n = distI (d, a) where distI (d, a) denotes the length of the shortest path from d to a in the undirected graph GI . If n ≤ n0 , we are done. Otherwise fix an a ∈ Ind(A) and denote by M the set all e ∈ C I with n = distI (e, a). Let I d0 , . . . , dn with a = d0 , dn = d, and (di , di+1 ) ∈ ri+1 for i < n be the shortest path from a to d. Observe that T , A |= ∃~r.C(a) for ~r = r0 · · · rn−1 since I is a materialization of T and A. We now employ a pumping argument to show that this leads to a contradiction. Let cl(T , C) denote the closure under single negation of the set of subconcepts of concepts in T and C. Set tIT ,C (e) = {D ∈ cl(T , C) | e ∈ D I }. As n > n0 , then there exist di and di+j with j > 1 and i + j < n such that tIT ,C (di ) = tIT ,C (di+j ),

tIT ,C (di+1 ) = tIT ,C (di+j+1 ),

ri+1 = ri+j+1

Now replace in I the interpretation induced by the subtree rooted at di+j+1 by the interpretation induced by the subtree rooted at di+1 . We do the same construction for all elements of M and denote the resulting interpretation by J . One can easily show by induction that J is still a model of T and A, but now J 6|= ∃~r.C(a) and so T , A 6|= ∃~r.C(a). This contradiction finishes the proof of Claim 2. For EL-concepts and ALCF-TBoxes, Claim 2 can be proved similarly by using an unfolded (rather than i-unfolded) materialization, which exists by Points (4) and (6) of Lemma 13. Proof of Claim 1. Assume that T and q(~x) = ∃~x ψ(~x, ~y ) are given. We have to construct a set Q such that Conditions (i) and (ii) are satisfied. Let A be an ABox with T , A |= q(~a), I a materialization of T and A that is i-unfolded, and π an assignment in I such that I |=π ψ(~x, ~y ). We define a corresponding pair p = (ϕ(~x, ~z), C) to be included in Q (and these are the only pairs in Q). For identifying ϕ(~x, ~z), set x ∼ y if π(x) = π(y) and denote by [x] the equivalence class of x w.r.t. “∼”. Let ϕ0 be the set of all atoms r([x], [y]) such that π(x), π(y) ∈ Ind(A) and there are x′ ∈ [x] and y ′ ∈ [y] with r(x′ , y ′ ) in ψ. We obtain ϕ(~x, ~y ) by selecting an answer variable y ∈ [x] for every [x] that contains such a variable and then replacing [x] by y in ϕ0 , adding xi = xj to ϕ(~x, ~z) for any two (selected) answer variables xi , xj with xi ∼ xj , and by regarding the remaining equivalences classes [y] that do not contain answer variables as variables in ~z. We now identify C. Assume w.l.o.g. that I uses the naming scheme of i-unravelings. Let a ∈ Ind(A). By Ia , we denote the subinterpretation of I induced by the set of all elements ar1 d1 · · · rn dn ∈ ∆I . Let M be a maximal connected component of ∆Ia ∩ {π(y) | y ∈ var(ψ)}. We associate with M an ELIQ to be included in C (and these are the only ELIQs in C).

DATA COMPLEXITY OF ONTOLOGIES

19

The conjunctive query ϕM consists of all atoms r([x], [y]) such that π(x), π(y) ∈ M and there are x′ ∈ [x], y ′ ∈ [y] with r(x′ , y ′ ) in ψ and all atoms A([x]) such that π(x) ∈ M and there is x′ ∈ [x] with A(x′ ) in ψ. We again assume that equivalence classes [x] that contain an answer variable (there is at most one such class in ϕM ) are replaced with an answer variable from [x] and regard the remaining equivalences classes as variables. Note that ϕM is tree-shaped since Ia is. We can thus pick a variable x0 with π(x0 ) ∈ M such that distI (a, π(x0 )) is minimal. Let x be [x0 ] if [x0 ] contains no answer variable and, otherise, let x be the answer variable that [x0 ] has been replaced with. Let [y1 ], . . . , [ym ] be the variables in ϕM that are distinct from x and consider the ELIQ ∃[y1 ] · · · ∃[ym ]ϕM (x, [y1 ], . . . , [ym ]), which we write as CM (x) where CM is an appropriate ELI-concept. We now distinguish the following cases: • π(x) = a. In this case, we include CM (x) in C; • otherwise, we still know that T , A |= ∃x C(x). Thus, by Claim 2 there is a sequence of roles ~r = r1 · · · rn with ri in T and n ≤ n0 such that T , A |= ∃~r.CM (a) for some a ∈ Ind(A) . In this case, we include ∃~r.CM (y) in C for some fresh individual variable y. This finishes the construction of C and thus of Q. Clearly, Q is finite. The stated properties of Q follow directly from its construction. For ALCF-TBoxes and ELQs, Claim 1 can be proved similarly using an unfolded materialization (instead of an i-unfolded one) and the observation that in this case all CM ([x]) and ∃~r.CM (y) are ELQs (~r uses role names only by Claim 2). We now turn our attention to Point (3). Here, the “if” directions are trivial and we prove the “only if” part. It suffices to show that if PEQ-evaluation w.r.t. a TBox T is CO NP-hard, then so is ELIQ-evaluation. We start with showing the slightly simpler result that CO NP-hardness of CQevaluation w.r.t. T implies CO NP-hardness of UELIQ-evaluation, and then sketch the modifications required to strengthen the proof to attain the original statement. Thus assume that evaluating the CQ q(~x) w.r.t. T is CO NP-hard. We shall exhibit an UELIQ q ′ (x) such that for every ABox A and all ~a ∈ Ind(A), one can produce in polynomial time an ABox A′ with a distinguished individual a0 such that T , A |= q(~a) iff T , A′ |= q ′ (a0 ). Instead of constructing q ′ (~x) right away, we will start with describing the translation of A to A′ . Afterwards, it will be clear how to construct q ′ (~x). Thus, let A be an ABox and ~a from Ind(A). The construction of A′ builds on Claim 1 above. Let Q be the set of pairs from that claim and reserve a fresh individual name a0 . To obtain the desired ABox A′ , we extend A for every pair p = (ϕ(~x, ~y ), C) in Q. Let C = Cp,1 (x1 ), . . . , Cp,kp (xkp ). Then • introduce a fresh individual name ap and fresh role names rp , r, rp,1 , . . . , rp,kp ; • add the assertion rp (a0 , ap ); • for every assignment π in Ind(A) with A |=π ϕ(~x, ~y ) and π(~x) = ~a, introduce – a fresh individual name ap,π and the assertion r(ap , ap,π ); – the assertion rp,i (ap , π(xi )) for 1 ≤ i ≤ kp . From Claim 1, it is immediate that T , A |= q(~a) iff T , A′ |= q ′ (x) where q ′ (x) is the UELIQ ⊔ q′ (x) with Cp = ∃rp.∃r. ⊓ ∃rp,i.Cp,i. Thus, evaluating q′ (x) w.r.t. T is CO NP-hard, as

p∈Q

1≤i≤kp

required. It remains to modify the reduction by replacing CQs with PEQs and UELIQs with ELIQs. The former is straightforward: every PEQ is equivalent to a finite disjunction of CQs, and thus we can construct A′ and q ′ (x) in essentially the same way as before; instead of considering all pairs from Q for a single CQ, we now use the union of all sets Q for the finitely many CQs in question. Finally, we can replace UELIQs with ELIQs by using the same construction as in the proof of Theorem 18: after adding some straightforward auxiliary structure to A′ , one can replace a

20

DATA COMPLEXITY OF ONTOLOGIES

disjunction of ELIQs by (essentially) their conjunction, which is again an ELIQ. Details are left to the reader. ❏ We remark that Theorem 19 can be extended to also cover rewritability into first-order (FO) queries, and that the proof is almost identical to that for Datalog6= -rewritability. 4. U NRAVELING T OLERANCE We develop a condition on TBoxes, called unraveling tolerance, that is sufficient for the TBox to be Datalog6= -rewritable for PEQ, and thus also sufficient for PEQ-evaluation w.r.t. the TBox being in PT IME. Unraveling tolerance strictly generalizes syntactic ‘Horn conditions’ such as the ones used to define the DL Horn-SHIQ, which was designed as a (syntactically) maximal DL with PT IME query evaluation [HMS07, EGOS08]. Unraveling tolerance is based on an unraveling operation on ABoxes, in the same spirit as the unfolding of an interpretation into a tree interpretation we discussed above. Formally, the unraveling Au of an ABox A is the following (possibly infinite) ABox: • Ind(Au ) is the set of sequences b0 r0 b1 · · · rn−1 bn , n ≥ 0, with b0 , . . . , bn ∈ Ind(A) and − r0 , . . . , rn−1 ∈ NR ∪N− R such that for all i < n, we have ri (bi , bi+1 ) ∈ A and (bi−1 , ri−1 ) 6= (bi+1 , ri ) when i > 0; • for each C(b) ∈ A and α = b0 r0 · · · rn−1 bn ∈ Ind(Au ) with bn = b, C(α) ∈ Au ; • for each α = b0 r0 · · · rn−1 bn ∈ Ind(Au ) with n > 0, rn−1 (b0 r0 · · · rn−1 bn−1 , α) ∈ Au . − For all α = b0 · · · bn ∈ Ind(Au ), we write tail(α) to denote bn . Note that the condition (bi−1 , ri−1 ) 6= (bi+1 , ri ) is needed to ensure that functional roles can still be interpreted in a functional way after unraveling. Definition 20 (Unraveling Tolerance). A TBox T is unraveling tolerant if for all ABoxes A and ELIQs q, we have that T , A |= q implies (T , Au ) |= q. It is not hard to prove that the converse direction ‘T , Au |= q implies T , A |= q’ is true for all ALCFI-TBoxes. Note that it is pointless to define unraveling tolerance for queries that are not necessarily tree shaped, such as CQs. Example 21. (1) The ALC-TBox T1 = {A ⊑ ∀r.B} is unraveling tolerant. This can be proved by showing that + that is obtained from A by extending (i) for any (finite or infinite) ABox A, the interpretation IA + I − B A with all a ∈ Ind(A) that satisfy ∃r .A in A (when viewed as an interpretation) is an ELIQ+ + |= C(a) iff IA materialization of T1 and A; and (ii) IA u |= C(a) for all ELIQs C(x) and a ∈ Ind(A). The proof of (ii) is based on a straightforward induction on the structure of the ELIconcept C. As illustrated by the ABox A = {r(a, b), A(a)} and the fact that Au , T |= B(b), the use of inverse roles in the definition of Au is crucial here despite the fact that T1 does not use inverse roles. (2) A simple example for an ALC-TBox that is not unraveling tolerant is T2 = {A ⊓ ∃r.A ⊑ B, ¬A ⊓ ∃r.¬A ⊑ B}. For A = {r(a, a)}, it is easy to see that we have T2 , A |= B(a) (use a case distinction on the truth value of A at a), but T2 , Au 6|= B(a).

DATA COMPLEXITY OF ONTOLOGIES

21

Before we show that unraveling tolerance indeed implies PT IME query evaluation, we first demonstrate the generality of this property by relating it to Horn-ALCFI, the ALCFI-fragment of HornSHIQ. Different versions of Horn-SHIQ have been proposed in the literature, giving rise to different versions of Horn-ALCFI [HMS07, KRH07, EGOS08, Kaz09]. As the original definition from [HMS07] based on polarity is rather technical, we prefer to work with the following equivalent and less cumbersome definition. A Horn-ALCFI-TBox T is a finite set of concept inclusions L ⊑ R and functionality assertions where L and R are built according to the following syntax rules: R, R′ ::= ⊤ | ⊥ | A | ¬A | R ⊓ R′ | L → R | ∃r.R | ∀r.R L, L′ ::= ⊤ | ⊥ | A | L ⊓ L′ | L ⊔ L′ | ∃r.L with r ranging over NR ∪ N− R and L → R abbreviating ¬L ⊔ R. Whenever convenient, we may assume w.l.o.g. that T contains only a single concept inclusion ⊤ ⊑ CT where CT is built according to the topmost rule above. By applying some simple transformations, it is not hard to show that every Horn-ALCFITBox according to the original polarity-based definition is equivalent to a Horn-ALCFI-TBox of the form introduced here. Although not important in our context, we note that even a polynomial time transformation is possible. Theorem 22. Every Horn-ALCFI-TBox is unraveling tolerant. Proof. As a preliminary, we give a characterization of the entailment of ELIQs in the presence of Horn-ALCFI-TBoxes which is in the spirit of the chase procedure as used in database theory [FKMP05, CGK13] and of consequence-driven algorithms as used for reasoning in Horn description logics such as EL++ and Horn-SHIQ [BBL05, Kaz09, Kr¨o10b]. We use extended ABoxes, i.e., finite sets of assertions C(a) and r(a, b) with C a potentially compound concept. An ELIU ⊥ -concept is a concept that is formed according to the second syntax rule in the definition of Horn-ALCFI. For an extended ABox A′ and an assertion C(a), C an ELIU ⊥ -concept, we write A′ ⊢ C(a) if C(a) has a syntactic match in A′ , formally: • A′ ⊢ ⊤(a) is unconditionally true; • A′ ⊢ ⊥(a) if ⊥(b) ∈ A′ for some b ∈ Ind(A); • A′ ⊢ A(a) if A(a) ∈ A′ ; • A′ ⊢ C ⊓ D(a) if A′ ⊢ C(a) and A′ ⊢ D(a); • A′ ⊢ C ⊔ D(a) if A′ ⊢ C(a) or A′ ⊢ D(a); • A′ ⊢ ∃r.C(a) if there is an r(a, b) ∈ A′ such that A′ ⊢ C(b). Now for the announced characterization. Let T = {⊤ ⊑ CT } be a Horn-ALCFI-TBox and A a potentially infinite ABox (so that the characterization also applies to unravelings of ABoxes). We produce a sequence of extended ABoxes A0 , A1 , . . . , starting with A0 = A. In what follows, we use additional individual names of the form ar1 C1 · · · rk Ck with a ∈ Ind(A0 ), r1 , . . . , rk roles that occur in T , and C1 , . . . , Ck subconcept of concept in T . We assume that NI contains such names as needed and use the symbols a, b, . . . also to refer to individual names of this compound form. Each extended ABox Ai+1 is obtained from Ai by applying the following rules in a fair way: R1 if a ∈ Ind(Ai ), then add CT (a). R2 if C ⊓ D(a) ∈ Ai , then add C(a) and D(a); R3 if C → D(a) ∈ Ai and Ai ⊢ C(a), then add D(a); R4 if ∃r.C(a) ∈ Ai and func(r) ∈ / T , then add r(a, arC) and C(arC); R5 if ∃r.C(a) ∈ Ai , func(r) ∈ T , and r(a, b) ∈ Ai , then add C(b);

22

DATA COMPLEXITY OF ONTOLOGIES

R6 if ∃r.C(a) ∈ Ai , func(r) ∈ T , and there is no r(a, b) ∈ Ai , then add r(a, arC) and C(arC); R7 if ∀r.C(a) ∈ Ai and r(a, b) ∈ Ai , then add C(b). S Let Ac = i≥0 Ai be the completion of the original ABox A.2 Note that Ac may be infinite even if A is finite, and that none of the above rules is applicable in Ac . We write ‘Ac ⊢ ⊥’ instead of ‘Ac ⊢ ⊥(a) for some a ∈ NC ’. If A 6⊢ ⊥, then Ac corresponds to an interpretation Ic in the standard way, i.e., ∆ Ic AIc r Ic

= Ind(Ac ) = {a | A(a) ∈ Ac } for all A ∈ NC = {r(a, b) | r(a, b) ∈ Ac } for all r ∈ NR

where in Ic we assume that only the individual names in Ind(A) are elements of NI . Claim 1. If Ac 6⊢ ⊥, then Ic is a PEQ-materialization of T and A. To prove Claim 1 it suffices to show that there is a homomorphism h preserving Ind(A) into any model J of T and A and that Ic is a model of T and A. The homomorphism h can be constructed inductively following the construction of Ac . Similarly, following the construction of Ac it is readily checked that Ic is a model of T and A. Using Claim 1 and the easily proved fact that Ac 6⊢ ⊥ iff A is consistent w.r.t. T one can now prove Claim 2. T , A |= C(a) iff Ac ⊢ C(a) or Ac ⊢ ⊥, for all ELIQs C(x) and a ∈ Ind(A). We now turn to the actual proof of Theorem 22. Consider the application of the above completion construction to both the original ABox A and its unraveling Au . Recall that individuals in Au are of the form a0 r0 a1 · · · rn−1 an . Consequently, individuals in Auc take the form a0 r0 a1 · · · rn−1 an s1 C1 · · · sk Ck . For a ∈ Ind(Ac ) and α ∈ Ind(Auc ), we write a ∼ α if a and α are of the form an s1 C1 · · · sk Ck and a0 r0 a1 · · · rn−1 an s1 C1 · · · sk Ck , respectively, with k ≥ 0. Note that, in particular, a ∼ a for all a ∈ Ind(A). The following claim can be shown by induction on i. Claim 3. For all a ∈ Ind(Ai ) and α ∈ Ind(Aui ) with a ∼ α, we have (1) Ai ⊢ C(a) iff Aui ⊢ C(α) for all ELI-concepts C; (2) C(a) ∈ Ai iff C(α) ∈ Aui for all subconcepts C of concepts in T . Now, unraveling tolerance of T follows from Claims 2 and 3.



Theorem 22 shows that unraveling tolerance and Horn logic are closely related. Yet, the next example demonstrates that there are unraveling tolerant ALCFI-TBoxes that are not equivalent to any Horn sentence of FO. Since any Horn-ALCFI-TBox is equivalent to such a sentence, it follows that unraveling tolerant ALCFI-TBoxes strictly generalize Horn-ALCFI-TBoxes. This increased generality will pay off in Section 5 when we establish a dichotomy result for TBoxes of depth one. Example 23. Take the ALC-TBox T = {∃r.(A ⊓ ¬B1 ⊓ ¬B2 ) ⊑ ∃r.(¬A ⊓ ¬B1 ⊓ ¬B2 )}. One can show as in Example 21 (1) that T is unraveling tolerant; here, the materialization is actually A itself rather than some extension thereof, i.e., as far as ELIQ (and even PEQ) evaluation is concerned, T cannot be distinguished from the empty TBox. 2Order of rule application has an impact on the shape of A , but is irrelevant for the remainder of the proof. c

DATA COMPLEXITY OF ONTOLOGIES

23

It is well-known that FO Horn sentences are preserved under direct products of interpretations [CK90]. To show that T is not equivalent to any such sentence, it thus suffices to show that T is not preserved under direct products. This is simple: let I1 and I2 consist of a single r-edge between elements d and e, and let e ∈ (A⊓B1 ⊓¬B2 )I1 and e ∈ (A⊓¬B1 ⊓B2 )I2 ; then the direct product I of I1 and I2 still has the r-edge between (d, d) and (e, e) and satisfies (e, e) ∈ (A ⊓ ¬B1 ⊓ ¬B2 )I , thus is not a model of T . We next show that unraveling tolerance is indeed a sufficient condition for Datalog6= -rewritability (and thus for PT IME query evaluation). In Section 6, we will establish a connection between query evaluation under DL TBoxes and constraint satisfaction problems (CSPs). The Datalog6= program constructed in the proof of the following result resembles canonical monadic Datalog programs for CSPs [FV93]. Note that it is not clear how to attain a proof of Theorem 24 via the CSP connection: first, as we will also see in Section 6, functional roles break this connection; and second, canonical Datalog programs are available only for Boolean queries while we construct programs for unary queries. Theorem 24. Every unraveling tolerant ALCFI-TBox is Datalog6= -rewritable for PEQ. Proof. Let T be an unraveling tolerant ALCFI-TBox. By Theorem 19, it suffices to show that T is Datalog6= -rewritable for ELIQ. Let A be an ABox and q = C0 (x) an ELIQ. Recall from the proof of Theorem 19 that cl(T , C0 ) denotes the closure under single negation of the set of subconcepts of T and C0 . For an interpretation I and d ∈ ∆I , we use tIT ,q (d) to denote the set of concepts C ∈ cl(T , C0 ) such that d ∈ C I . A T , q-type is a subset t ⊆ cl(T , C0 ) such that for some model I of T , we have t = tIT ,q (d). We use tp(T , q) to denote the set of all T ,q-types. For t, t′ ∈ tp(T , q) and r a role, we write t r t′ if there are a model I of T and d, d′ ∈ ∆I such that tIT ,q (d) = t, tIT ,q (d′ ) = t′ , and (d, d′ ) ∈ r I . Introduce, for every set T ⊆ tp(T , C0 ) a unary IDB relation PT . Define a Datalog6= program Π that consists of the following rules: (1) PT (x) ← A(x) for all concept names A ∈ cl(T , C0 ) and T = {t ∈ tp(T , q) | A ∈ t}; (2) PT (x) ← PT0 (x) ∧ r(x, y) ∧ PT1 (y) for all T0 , T1 ⊆ tp(T , q) and all role names r that occur in cl(T , C0 ) and their inverses, where T = {t ∈ T0 | ∃t′ ∈ T1 : t r t′ }; (3) PT0 ∩T1 (x) ← PT0 (x) ∧ PT1 (x) for all T0 , T1 ⊆ tp(T , q); (4) goal(x) ← PT (x) for all T ⊆ tp(T , q) such that t ∈ T implies C0 ∈ T ; (5) goal(x) ← P∅ (y); (6) goal(x) ← r(y, z1 ) ∧ r(y, z2 ) ∧ z1 6= z2 for all func(r) ∈ T . To show that Π is a rewriting of the OMQ (T , C0 (x)), it suffices to establish the following. Claim. A |= Π(a0 ) iff T , A |= C0 (a0 ) for all ABoxes A and a0 ∈ Ind(A). The “if” direction is straightforward: by induction on the number of rule applications, one can show that whenever Π derives PT (a), then every model of T and A satisfies tIT ,q (a) ∈ T . By definition of the goal rules of Π, A |= Π(a0 ) thus implies that every model of T and A makes C0 (a0 ) true or that A is inconsistent w.r.t. T . Consequently, T , A |= C0 (a0 ). For the “only if” direction, it suffices to show that A 6|= Π(a0 ) implies T , Au 6|= C0 (a0 ) since T is unraveling tolerant. Because of the rules in Π of the form (3), for every a ∈ Ind(A) we can find a unique minimal Ta such that PTa (a) is derived by Π. Observe that, A(α) ∈ Au , tail(α) = a, and t ∈ Ta implies A ∈ t because of the rules of the form (1) in Π and by construction of Au . We first associate with every α ∈ Ind(Au ) a concrete T , q-type tα ∈ Ttail(α) . To start, we choose ta ∈ Ta arbitrarily for all a ∈ Ind(A). Now assume that tα has already been chosen and that

24

DATA COMPLEXITY OF ONTOLOGIES

β = αrb ∈ Ind(Au ). Then r(tail(α), b) ∈ A. Because of the rules in Π of the form (2) and (5), we can thus choose tβ ∈ Tb such that tα r tβ . In this way, all types tα will eventually be chosen. We now construct an interpretation I, starting with ∆I AI rI

= Ind(Au ) = {α | A ∈ tα } for all concept names A = {(α, β) | r(α, β) ∈ Au } for all role names r.

Next, consider every α ∈ Ind(Au ) and every ∃r.C ∈ tα such that Au does not contain an assertion r(α, β) with C ∈ tβ . First assume that func(r) 6∈ T . There must be a T , q-type t such that tα r t and C ∈ t. Choose a model Jα,∃r.C of T and D = ⊓ ta ⊓ ∃r. ⊓ t, a d ∈ D Jα,∃r.C , and an e ∈ (⊓ t)Jα,∃r.C with (d, e) ∈ r Jα,∃r.C . W.l.o.g., we can assume that Jα,∃r.C is tree-shaped with − root d. Let Jα,∃r.C be obtained from Jα,∃r.C by dropping the subtree rooted at e. Now disjointly − add Jα,∃r.C to I, additionally including (a, d) in r I . Now assume that func(r) ∈ T . Then, if there exists r(α, β) ∈ Au , then C ∈ tβ as otherwise we do not have tα r tβ . Thus, assume there is no r(α, β) ∈ Au . There must be a T , q-type t such that tα r t and C ∈ t. We then have D ∈ t for − − all ∃r.D ∈ tα and so construct only a single Jα,∃r.C for the role r and disjointly add Jα,∃r.C to I, I additionally including (a, d) in r . This finishes the construction of I. The following claim can be proved by induction on C, details are omitted. Claim. For all C ∈ cl(T , C0 ) : (a) α ∈ C I iff C ∈ tα for all α ∈ Ind(Au ) and − (b) d ∈ C Jα,∃r.D iff d ∈ C I for all Jα,∃r.D and all d ∈ ∆Jα,∃r.D . By construction of I and since A(α) ∈ Au implies A ∈ tα , I is a model of A. Due to the rules in Π that are of the form (4), Point (a) of the claim yields I 6|= C0 (a0 ). Finally, we observe that I is a model of T . The concept inclusions in T are satisfied by the above claim, since C ⊑ D ∈ T means that C ∈ t implies D ∈ t for every T , q-type t, and since each Jα,∃r.C is a model of T . Due to the rules in Π that are of the form (6) and since each Jα,∃r.C is a model of T , all functionality assertions in T are satisfied as well. Summing up, we have shown that T , Au 6|= C0 (a0 ), as required. ❏ Together with Theorems 19 and 22, Theorem 24 also reproves the known PT IME upper bound for the data complexity of CQ-evaluation in Horn-ALCFI [EGOS08]. By Theorems 18 and 24, unraveling tolerance implies materializability unless PT IME = NP. Based on the disjunction property, this implication can also be proved without the side condition. Theorem 25. Every unraveling tolerant ALCFI-TBox is materializable. Proof. We show the contrapositive using a proof strategy that is very similar to the second step in the proof of Theorem 18. Thus, take an ALCFI-TBox T that is not materializable. By Theorem 16, T does not have the disjunction property. Thus, there are an ABox A∨ , ELIQs C0 (x0 ), . . . , Ck (xk ), and a1 , . . . , ak ∈ Ind(A∨ ) such that T , A∨ |= C0 (a0 ) ∨ · · · ∨ Ck (ak ), but T , A∨ 6|= Ci (ai ) for all i ≤ k. Let Ai be Ci viewed as a tree-shaped ABox with root bi , for all i ≤ k. Assume w.l.o.g. that none of the ABoxes A∨ , A0 , . . . , Ak share any individual names and reserve a fresh individual name b and role names r, r0 , . . . , rk that do not occur in T . Construct an ABox A = A∨ ∪ A0 ∪ · · · ∪ Ak ∪ {r(b, b0 ), . . . , r(b, bk )} ∪ {r0 (bj , b0 ), . . . , rj−1 (bj , bj−1 ), rj+1 (bj , bj+1 ), . . . , rk (bj , bk )} ∪ {r0 (b0 , a0 ), . . . , rk (bk , ak )}

DATA COMPLEXITY OF ONTOLOGIES

25

and an ELIQ q = ∃r.(∃r0 .C0 ⊓ · · · ⊓ ∃rk .Ck )(x). By the following claim, A and q witness that T is not unraveling tolerant. Claim. T , A |= q(b), but T , Au 6|= q(b). Proof. “T , A |= q(b)”. Take a model I of T and A. By construction of A, we have bIi ∈ (∃rj .Cj )I whenever i 6= j. Due to the edges r0 (b0 , a0 ), . . . , rk (bk , ak ) and since T , A∨ |= C0 (a0 ) ∨ · · · ∨ Ck (ak ), we thus find at least one bi such that bIi ∈ (∃ri .Ci )I . Consequently, I |= q(b). “T , Au 6|= q(b)” (sketch). Consider the elements brbi ri ai in Au . Each such element is the root of a copy of the unraveling Au∨ of A∨ , restricted to those individuals in A∨ that are reachable from ai . Since T , A∨ 6|= Ci (ai ), we find a model Ii of T and A∨ with aIi i ∈ / CiIi . By unraveling I, we u u I I obtain a model Iiu of T and Au∨ with ai i ∈ / Ci i . Combining the models I0u , . . . , Iku in a suitable u / CiI for all i ≤ k. Consequently, way, one can craft a model I of T and A∨ such that brbi ri aIi ∈ I 6|= q(b). ❏ 5. D ICHOTOMY

FOR

D EPTH O NE

In practical applications, the concepts used in TBoxes are often of very limited quantifier depth. Motivated by this observation, we consider TBoxes of depth one which are sets of CIs C ⊑ D such that the maximum nesting depth of the constructors ∃r.E and ∀r.E in C and D is one. To confirm that this is indeed a practically relevant case, we have analyzed the 429 ontologies in the BioPortal repository,3 finding that after removing all constructors that are not part of ALCFI, more than 80% of them are of depth one. The main result of this section is a dichotomy between PT IME and CO NP for TBoxes of depth one which is established by proving a converse of Theorem 25, that is, showing that materializability implies unraveling tolerance (and thus PT IME query evaluation and even Datalog6= -rewritability by Theorem 24) for TBoxes of depth one. Together with Theorem 18, which says that non-materializability implies CO NP-hardness, this yields the dichotomy. We remark that the same strategy cannot be used to obtain a dichotomy in the case of unrestricted depth. In particular, the well-known technique of rewriting a TBox into depth one by introducing fresh concept names can change its complexity because it enables querying for concepts such as ¬A or ∀r.A which are otherwise ‘invisible’ to (positive existential) queries. For TBoxes of unrestricted depth (and even in ALC) it is in fact neither the case that PT IME query evaluation implies unraveling tolerance nor that PT IME query evaluation implies Datalog6= rewritability nor that materializability implies PT IME query evaluation. As an example for the former, we show in Section 6 how the TBox T2 from Example 2, which encodes 2-colorability, can be modified to have PT IME query evaluation. However, 2-colorability is not invariant under tree unravelings and, consequently, T2 is not unraveling tolerant. Also the latter two statements follow from results established in Section 6. Theorem 26. Every materializable ALCFI-TBox of depth one is unraveling tolerant. 3The ontologies are available at https://bioportal.bioontology.org/ontologies.

26

DATA COMPLEXITY OF ONTOLOGIES

Proof. Let T be a materializable TBox of depth one, A an ABox, C0 (x) an ELIQ, and a0 ∈ Ind(A) such that T , Au 6|= C0 (a0 ). We have to show that T , A 6|= C0 (a0 ). It follows from T , Au 6|= C0 (a0 ) that Au is consistent w.r.t. T . There must thus be a materialization I u for T and Au , despite the fact that Au is infinite: by Theorem 26, T has the disjunction property and the argument from the proof of Theorem 26 that the disjunction property implies materializability goes through without modification also for infinite ABoxes. Our aim is to turn I u into a model I of A and T such that I 6|= C0 (a0 ). To achieve this, we first uniformize I u in a suitable way. We assume w.l.o.g. that I u has forest-shape, i.e., that I u can be constructed by selecting a tree-shaped interpretation Iα with root α for each α ∈ Ind(Au ), then taking the disjoint union of all u these interpretations, and finally adding role edges (α, β) to r I whenever r(α, β) ∈ Au . In fact, to achieve the desired shape we can take the i-unfolding of I u defined and analysed in Lemmas 13 u and 14, where we start the i-unfolding from the elements of Ind(Au ) ⊆ ∆I . We start with exhibiting a self-similarity inside the unraveled ABox Au and inside I u . Claim 1. For all α, β ∈ Ind(Au ) with tail(α) = tail(β), (1) Au |= C(α) iff Au |= C(β) for all ELIQs C(x); u u (2) α ∈ C I iff β ∈ C I for all concepts C built only from concept names, ¬, and ⊓. To establish Point (1), take α, β ∈ Ind(Au ) such that tail(α) = tail(β) and Au 6|= C(α). Then there is a model I of Au and T such that I 6|= C(α). One can find a model J of Au and T such that J 6|= C(β), as follows. By construction of Au , there is an isomorphism ι : Ind(Au ) → Ind(Au ) with ι(α) = β such that A(γ) ∈ Au iff A(ι(γ)) ∈ Au and r(γ, γ ′ ) ∈ Au iff r(ι(γ), ι(γ ′ )) ∈ Au for all γ ∈ Ind(Au ), all concept names A, and all role names r. We obtain J from I by renaming each γ ∈ Ind(Au ) with ι(γ). Point (2) can be proved by a straightforward induction on C. The base case uses Point (1) and the fact that I u is a materialization of T and A. This finishes the proof of Claim 1. Now for the announced uniformization of I u . What we want to achieve is that for all α, β ∈ Ind(Au ), tail(α) = tail(β) implies Iα = Iβ (recall that Iα is the tree component of I u rooted at α, and likewise for Iβ ). Construct the interpretation J u as follows: • for each α ∈ Ind(Au ) with tail(α) = a, take a copy Jα of Ia with the root a renamed to α; • then J u is the disjoint union of all interpretations Jα , α ∈ Ind(Au ), extended with a role u edge (α, β) ∈ r J whenever r(α, β) ∈ Au . Our next aim is to show that J u is as required, that is, it is a model of T and Au and satisfies J u 6|= C0 (a0 ). It is indeed straightforward to verify that J u is a model of Au : all role assertions are satisfied by construction; moreover, A(α) ∈ Au implies A(a) ∈ Au where a = tail(α) , thus a ∈ AIu and α ∈ AJu . u u Next, we show that J u is a model of T . Let f : ∆J → ∆I be a mapping that assigns to u u each domain element of J the original element in I of which it is a copy. u

u

u

Claim 2. d ∈ C J iff f (d) ∈ C I for all d ∈ ∆J and ALCI-concepts C of depth one. The proof of claim 2 is by induction on the structure of C. We assume w.l.o.g. that C is built only from the constructors ¬, ⊓, and ∃r.C. The base case, where C is a concept name, is an immediate consequence of the definition of J u . The case where C = ¬D and C = D1 ⊓ D2 is routine. It thus remains to consider the case C = ∃r.D, where D is built from ¬ and ⊓ only. u u u First let d ∈ C J . Then there is a (d, e) ∈ r J with e ∈ D J . First assume that the edge u (d, e) was added to r J because d = α and e = β for some α, β ∈ Ind(Au ) with r(α, β) ∈ Au . Let tail(α) = a and tail(β) = b. Then we have f (α) = a and f (β) = b. By construction of

DATA COMPLEXITY OF ONTOLOGIES

27

Au , r(α, β) ∈ Au implies that β = αrb or α = βr − a. In both cases we have r(a, b) ∈ A, u u thus r(a, arb) ∈ Au , thus (a, arb) ∈ r I . Since β = e ∈ D J , induction hypothesis yields that u u b ∈ D I . From Point (2) of Claim 1, we obtain arb ∈ D I and we are done. Now assume that there u is an α ∈ Ind(Au ) such that (d, e) ∈ Jα . By construction of J u , we then have (f (d), f (e)) ∈ r I u and induction hypothesis yields f (e) ∈ D I . u u u Now let f (d) ∈ C I . Then there is an (f (d), e) ∈ r I with e ∈ D I . First assume that f (d) = α and e = β for some α, β ∈ Ind(Au ) with r(α, β) ∈ Au . Since f (d) ∈ Ind(Au ), we must have d = γ ∈ Ind(Au ) and f (d) = a ∈ Ind(A) with tail(γ) = a. By construction of Au , r(a, β) ∈ Au implies that β = arb, thus r(a, b) ∈ A, thus r(γ, δ) ∈ Au with (i) δ = γrb or u (ii) γ = δr − a and tail(δ) = b. Since arb = e ∈ D I , Point (2) of Claim 1 yields b ∈ D Iu . u Since tail(δ) = b implies f (δ) = b, induction hypothesis yields δ ∈ D J and we are done. Now assume that there is an α ∈ Ind(Au ) such that (f (d), e) ∈ Iα . By construction of J u , f (d) being in Iα implies that α = a for some a ∈ Ind(A) and that there is an α′ ∈ Ind(Au ) such that d is in Jα′ and tail(α′ ) = a. Again by construction of J u , we thus find an e′ in Jα′ with f (e′ ) = e and u u (d, e′ ) ∈ r Jα′ ⊆ r J . Induction hypothesis yields e′ ∈ D J . This finishes the proof of Claim 2. It follows from Claim 2 that J u satisfies all CIs in T . To show that J u is a model of T , it u remains to show that J u satisfies all functionality assertions. Thus, let func(r) ∈ T and d ∈ ∆J . If d ∈ / Ind(Au ), then it is straightforward to verify that, by construction of J u , d has at most one r-successor in J u . Now assume d = α ∈ Ind(Au ) and let tail(α) = a. By construction of J u and Au , α has the same number of r-successors in J u as a in I u . Since I u satisfies func(r), α can have at most one r-successor in J u . The final condition that J u should satisfy is J u 6|= C0 (a0 ). Assume to the contrary. We view C0 (x0 ) as a (tree-shaped) CQ. Take a homomorphism h from C0 (x0 ) to J u with h(x0 ) = a0 . (In this proof we consider homomorphisms that do not have to preserve any individual names.) Let the CQ q(x) be obtained from C0 (x0 ) by identifying variables y1 , y2 whenever h(y1 ) = h(y2 ). To achieve a contradiction, it suffices to exhibit a homomorphism h′ from q(x0 ) to I u with h′ (x0 ) = a0 . We start with setting h′ (x) = h(x) whenever h(x) ∈ Ind(Au ). Let q ′ be obtained from q(x0 ) by dropping all role atoms r(x, y) with h′ (x) and h′ (y) already defined (which are satisfied under h′ by construction of J u and since I u is a model of A). Because of the forest shape of J u and by construction, q ′ is a disjoint union of ELIQs such that, in each ELIQ C(x) contained in q ′ , h′ is defined for the root x of C(x), but not for any other variable in it. Consequently, it suffices to show that whenever Jα |= C(α) for some ELIQ C(x) and α ∈ Ind(Au ), then I u |= C(α); the remaining part of h′ can then be constructed in a straightforward way. Now Jα |= C(α) implies Ia |= C(a) where a = tail(α) by choice of Jα , which yields I u |= C(a) and thus I u |= C(α) by Point (1) of Claim 1. This finishes the construction and analysis of the uniform model J u . It remains to convert J u into a model I of T and the original ABox A such that I 6|= C0 (a0 )q: • take the disjoint union of the components Ja of J u , for each a ∈ Ind(A); • add the edge (a, b) to r I whenever r(a, b) ∈ A. It is straightforward to verfiy that I is a model of A: all role assertions are satisfied by construction u of I; moreover, A(a) ∈ A implies A(a) ∈ Au implies a ∈ AJ implies a ∈ AI . To show that I is a model of T and that I 6|= C0 (a0 ), we first observe the following. A bisimulation between interpretations I1 and I2 is a relation S ⊆ ∆I1 × ∆I2 such that (1) for all A ∈ NC and (d1 , d2 ) ∈ S: d1 ∈ AI1 iff d2 ∈ AI2 ; (2) for all r ∈ NR ∪ {s− | s ∈ NR }: if (d1 , d2 ) ∈ S and (d1 , d′1 ) ∈ r I1 , then there exists d′2 ∈ ∆I2 such that (d′1 , d′2 ) ∈ S and (d2 , d′2 ) ∈ r I2 ;

28

DATA COMPLEXITY OF ONTOLOGIES

(3) for all r ∈ NR ∪ {s− | s ∈ NR }: if (d1 , d2 ) ∈ S and (d2 , d′2 ) ∈ r I2 , then there exists d′1 ∈ ∆I1 such that (d′1 , d′2 ) ∈ S and (d1 , d′1 ) ∈ r I2 . Recall that, whenever there is a bisimulation S between I1 and I2 with (d, e) ∈ S, then d ∈ C I1 iff e ∈ C I2 for all ALCI-concepts C [GO07, LPW11]. Claim 3. There is a bisimulation S between J u and I such that (a, a) ∈ S for all a ∈ Ind(A). Since J u is uniform in the sense that Jα is isomorphic to Jβ whenever tail(α) = tail(β), we find a bisimulation between Jα and Ja whenever tail(α) = a. It can be verified that the union of all these bisimulations qualifies as the desired bisimulation S for Claim 3. Thus, Claim 3 is proved. It follows from Claim 3 that I satisfies all concept inclusions in T , and that I 6|= C0 (a0 ). It thus remains to verify that I also satisfies all functionality assertions in T . This can be done in the same way in which we have verified that J u satisfies all those assertions. ❏ The desired dichotomy follows: If an ALCFI-TBox T of depth one is materializable, then PEQ-evaluation w.r.t. T is in PT IME and Datalog6= -rewritable by Theorems 26 and 24. Otherwise, ELIQ-evaluation w.r.t. T is CO NP-complete by Theorem 18. Theorem 27 (Dichotomy). For every ALCFI-TBox T of depth one, one of the following is true: • Q-evaluation w.r.t. T is in PT IME for any Q ∈ {PEQ,CQ,ELIQ} (and Datalog6= -rewritable); • Q-evaluation w.r.t. T is CO NP-complete for any Q ∈ {PEQ,CQ,ELIQ}.

6. Q UERY E VALUATION

IN

ALC/ALCI = CSP

We show that query evaluation w.r.t. ALC- and ALCI-TBoxes has the same computational power as non-uniform CSPs in the following sense: (1) for every CSP, there is an ALC-TBox T such that the CSP can be reduced in polynomial time to the complement of evaluating an OMQ (T , ∃x M (x)) and, conversely, for every OMQ (T , q) query evaluation can be reduced in polynomial time to the CSP’s complement; (2) for every OMQ (T , q) with T an ALCI-TBox and q an ELIQ, there is a CSP such that the complement of the CSP and the query evaluation problem for the (T , q) are reducible to each other in polynomial time. This result has many interesting consequences. In particular, the Feder-Vardi conjecture holds if and only if there is a PT IME/CO NP-dichotomy for query evaluation w.r.t. ALC-TBoxes (equivalently: w.r.t. ALCI-TBoxes). Remarkably, all this is true already for materializable TBoxes. By Theorem 19 and since we carefully choose the appropriate query language in each technical result below, it furthermore holds for any of the query languages ELIQ, CQ, and PEQ (and ELQ for ALC-TBoxes). We begin by introducing CSPs. Since every CSP is equivalent to a CSP with a single predicate that is binary, up to polynomial time reductions [FV93], we consider CSPs over unary and binary predicates (concept names and role names) only. A signature Σ is a finite set of concept and role names. An ABox A is a Σ-ABox if all concept and role names in A are in Σ. For two finite ΣABoxes A and B, we write A → B if there is a homomorphism from A to B that does not have to preserve any individual names. Any Σ-ABox B gives rise to the following (non-uniform) constraint satisfaction problem • CSP(B): given a finite Σ-ABox A, decide whether A → B.

DATA COMPLEXITY OF ONTOLOGIES

29

B is called the template of CSP(B). Many algorithmic problems can be given in the form CSP(B). For example, k-colorability is CSP(Ck ), where Ck is the {r}-ABox containing r(i, j) for all 1 ≤ i 6= j ≤ k. We now formulate and prove Points (1) and (2) from above, starting with (1). Theorem 28. For every template B, one can construct in polynomial time a materializable ALCTBox TB such that, for a distinguished concept name M , the following hold: (1) CSP(B) is polynomial time reducible to the complement of the query evaluation problem for (TB , ∃x M (x)); (2) the query evaluation problem for (TB , q) is polynomial time reducible to the complement of CSP(B), for all PEQs q. Our approach to proving Theorem 28 is to generalize the reduction of k-colorability to query evaluation w.r.t. ALC-TBoxes discussed in Examples 2 and 4, where the main challenge is to overcome the observation from Example 4 that PT IME CSPs such as 2-colorability may be translated into CO NP-hard TBoxes. Note that this is due to the disjunction in the TBox Tk of Example 2, which causes non-materializability. Our solution is to replace the concept names A1 , . . . , Ak in Tk with suitable compound concepts that are ‘invisible to the (positive existential) query’. Unlike the original depth one TBox Tk , the resulting TBox is of depth three. We first define and analyze the replacement of concept names by compound concepts in some detail (as this will be reused later in the paper again) and then return to the proof of Theorem 28. Let Σ be a set of concept names. For any B ∈ Σ, let ZB be a fresh concept name and let rB and sB be fresh role names. The abstraction of B is the ALC-concept HB := ∀rB .∃sB .¬ZB . The Σ-abstraction C ′ of a (potentially compound) concept C is obtained from C by replacing every B ∈ Σ with HB . The Σ-abstraction of a TBox T is obtained from T by replacing all concepts in T with their Σ-abstractions. We associate with Σ an auxiliary TBox T ∃ = {⊤ ⊑ ∃rB .⊤, ⊤ ⊑ ∃sB .ZB | B ∈ Σ} Finally, T ′ ∪ T ∃ is called the enriched Σ-abstraction of T and Σ. In what follows, we are going to replace TBoxes T with their enriched abstractions. The following example shows that the TBox T ∃ is crucial for hiding the concept names in Σ: without T ∃ , disjunctions in T over concept names from Σ can still induce disjunctions in the Σ-abstraction. Example 29. Let T = {A ⊑ ¬B1 ⊔ ¬B2 } and Σ = {B1 , B2 }. Then T ′ = {A ⊑ ¬HB1 ⊔ ¬HB2 } is the Σ-abstraction of T . For A = {A(a)}, we derive T ′ , A |= ∃rB1 .⊤(a) ∨ ∃rB2 .⊤(a) but T ′ , A 6|= ∃rB1 .⊤(a) and T ′ , A 6|= ∃rB2 (a).⊤. Thus T ′ does not have the ABox disjunction property and is not materializable. In contrast, it follows from Lemma 30 below that T ′ ∪T ∃ is materializable and, in fact, T ′ ∪ T ∃ , A |= q(a) iff T ∃ , A |= q(a) holds for all PEQs q. We say that a TBox T admits trivial models if the singleton interpretation I with X I = ∅ for all X ∈ NC ∪ NR is a model of T . Moreover, we write A|Σ to denote the ABox obtained from the ABox A by removing all assertions in A that use a symbol that is not in Σ, and likewise for AΣ and symbols that are in Σ. An ABox A is strongly Σ-consistent w.r.t. a TBox T if there exists a model I of T and A|Σ such that ∆I = Ind(A), AI = {a | A(a) ∈ A} for all A 6∈ Σ, and r I = {(a, b) | r(a, b) ∈ A} for all role names r 6∈ Σ. Thus, strong Σ-consistency formalizes the intuition that we regard the symbols in Σ as existentially quantified second-order variables. The following lemma summarizes the main properties of abstractions. Points (1) and (2) establish a close link between the original TBox and its enriched abstraction. Points (3) and (4) together state that query evaluation is tractable for the enriched abstraction of a TBox T for ABoxes that are strongly Σ-consistent w.r.t. T .

30

DATA COMPLEXITY OF ONTOLOGIES

Lemma 30. Assume that T admits trivial models and let Σ be a finite set of concept names and T ′ ∪ T ∃ the enriched Σ-abstraction of T . Then for every ABox A and all ALCI concepts C not using the fresh symbols from Σ-abstractions: (1) A|Σ is consistent w.r.t. T iff A is consistent w.r.t. T ′ ∪ T ∃ ; (2) for all a ∈ Ind(A) and the Σ-abstraction C ′ of C: T , A|Σ |= C(a)

iff

T ′ ∪ T ∃ , A |= C ′ (a)

iff

T ′ ∪ T ∃ , A |= ∃x C ′ (x);

and if C is a concept name: T , A|Σ |= ∃x C(x)

(3) T ∃ is Datalog6= -rewritable for PEQs; (4) if A is strongly Σ-consistent w.r.t. T , then T ′ ∪ T ∃ , A |= q(~a)

iff

T ∃ , A |= q(~a)

for all PEQs q and all ~a. Proof. Observe that (1) follows from (2) as we can choose C = ⊥. Thus we prove (2). Let C ′ be the Σ-abstraction of C. We first consider (⇒). Assume T ′ ∪ T ∃ , A 6|= C ′ (a). Take a model I of T ′ ∪ T ∃ and A I for that witnesses this. Define an interpretation J in the same way as I except that B J := HB I J ′I all B ∈ Σ. It is straightforward to show for all d ∈ ∆ that d ∈ D iff d ∈ D holds for all ALCI-concepts D not using the fresh symbols from Σ-abstractions and their Σ-abstractions D ′ . Thus J is a model of T and A|Σ and shows that T , A|Σ 6|= C(a) if T ′ ∪ T ∃ , A 6|= C ′ (a). The same proof shows that (⇒) holds for queries of the form ∃x C(x) and ∃x C ′ (x) as well (even if C is not a concept name). Now consider (⇐). Assume T , A|Σ 6|= C(a) or T , A|Σ 6|= ∃x A(x) (where A is a concept name). Let I be a model of T and A|Σ that witnesses this. Construct a model Ican of T ′ ∪ T ∃ and A as follows: ∆Ican is the set of words w = dv1 · · · vn such that d ∈ ∆I and vi ∈ {rB , sB , s¯B | I or v 6= r ). Now let B ∈ Σ} where vi 6= s¯B if (i) i > 2 or (ii) i = 2 and (d 6∈ HB 1 B AIcan = AI for all concept names A 6∈ Σ B Ican = {d ∈ Ind(A) | B(d) ∈ A} for all B ∈ Σ Ican I = ZB ∪ {w | tail(w) = sB } for all B ∈ Σ ZB

r Ican = r I for all r 6∈ {rB , sB | r ∈ Σ} Ican I = rB ∪ {(w, wrB ) | wrB ∈ ∆Ican } for all r ∈ Σ rB

sIBcan = sIB ∪ {(w, wsB ) | wrB ∈ ∆Ican } ∪ {(w, w¯ sB ) | w¯ sB ∈ ∆Ican } for all r ∈ Σ Ican = B I for all B ∈ Σ. Thus for all concepts D (not using By construction of Ican , we have HB symbols from Σ-abstractions) and their Σ-abstractions D ′ and all d ∈ ∆I , we have d ∈ D ′Ican iff d ∈ D I . Thus, the CIs of T ′ hold in all d ∈ ∆I since the CIs of T hold in all d ∈ ∆I . The CIs of T ′ also hold in all d ∈ ∆Ican \ ∆I since T admits trivial models. Thus Ican is a model of T ′ . Since Ican is a model of T ∃ by construction, it follows that Ican is a model of T ′ ∪ T ∃ . It also follows that Ican shows T ′ ∪ T ∃ , A 6|= C ′ (a) if I shows that T , A|Σ 6|= C(a) and that Ican shows that T ′ ∪ T ∃ , A 6|= ∃x A′ (x) if I shows that T , A|Σ 6|= ∃x A(x). (3) is a consequence of the fact that T ∃ can be viewed as a TBox formulated in the description logic DL-LiteR and that any OMQ (T , q) with T a DL-LiteR -TBox and q a PEQ is known to be rewritable into a union of CQs [CDGL+ 07, ACKZ09].

DATA COMPLEXITY OF ONTOLOGIES

31

(4) Assume that A is strongly Σ-consistent w.r.t. T and that T ∃ , A 6|= q(~a). We show T ′ ∪ ∃ of T ∃ and A in the same T ∃ , A 6|= q(~a). Note first that one can construct a hom-initial model IA way as Ican was constructed from I above (by replacing I with the interpretation IA corresponding ∃ to A and not using the symbols s¯B in the construction). Thus, ∆IA is the set of words w = ∃ 6|= q(~ av1 · · · vn such that a ∈ Ind(A) and vi ∈ {rB , sB , | B ∈ Σ}. We have IA a). Now, as A is strongly Σ-consistent w.r.t. T , there is a model I of T and A|Σ with ∆I = Ind(A) and AI = {a | A(a) ∈ A} for all A 6∈ Σ, and r I = {(a, b) | r(a, b) ∈ A} for all role names r. Construct the model Ican of T ′ ∪ T ∃ and A in the same way as in the proof of (2). Define a ∃ by setting h(w) = w ′ , where w ′ is obtained from w by replacing every s mapping h : Ican → IA ¯B ′ ∃ by sB . One can show that h is a homomorphism. Thus Ican 6|= q(~a) and so T ∪ T , A 6|= q(~a), as required. The converse direction is trivial. ❏ We are now ready to prove Theorem 28. Proof of Theorem 28. Assume a Σ0 -template B is given. We construct the TBox TB in two steps. First take for any d ∈ Ind(B) a concept name Ad and define a TBox HB with the following CIs: dom ⊑



d∈Ind(B)

Ad ⊓ Ae ⊑ ⊥ Ad ⊓ ∃r.Ae ⊑ ⊥ Ad ⊓ A ⊑ ⊥ Here dom ⊑



d∈Ind(B)

Ad for all d, e ∈ Ind(B), d 6= e for all d, e ∈ Ind(B), r ∈ Σ0 , r(d, e) 6∈ B for all d ∈ Ind(B), A ∈ Σ0 , A(d) 6∈ B.

Ad stands for the set of CIs

∃r.⊤ ⊑



d∈Ind(B)

Ad ,

A⊑



d∈Ind(B)

Ad ,

⊤ ⊑ ∀r.(



d∈Ind(B)

Ad )

where r and A range over all role and concept names in Σ0 , respectively. We use a CI of the form dom ⊑ C rather than ⊤ ⊑ C to ensure that the TBox HB admits trivial models. Let M be a fresh concept name and set Σ = {Ad | d ∈ Ind(B)}. Then the following can be proved in a straightforward way. Claim 1. For any ABox A the following conditions are equivalent: (1) HB , A|Σ∪{M } 6|= ∃x M (x); (2) A|Σ is consistent w.r.t. HB ; (3) A|Σ0 → B. Thus, CSP(B) and the complement of the query evaluation problem for (HB , ∃x M (x)) are reducible to each other in polynomial time. Because of the disjunctions, however, the query evaluation problem w.r.t HB is typically CO NP-hard even if CSP(B) is in PT IME. We thus ‘hide’ the concept names Ad by replacing them with their abstractions HAd . Let HB′ ∪ T ∃ be the enriched Σabstraction of HB . From Claim 1 and Lemma 30 (1) according to which A|Σ is consistent w.r.t. HB ′ ∪ T ∃ , we obtain iff A is consistent w.r.t. HB Claim 2. For any ABox A, the following conditions are equivalent: ′ ∪ T ∃ , A| (1) HB {M } 6|= ∃x M (x); ′ ∪ T ∃; (2) A is consistent w.r.t. HB (3) A|Σ0 → B. ′ ∪ T ∃ be the enriched Σ-abstraction of H . We show that T is as required to prove Let TB = HB B B Theorem 28.

32

DATA COMPLEXITY OF ONTOLOGIES

(1) We have to show that CSP(B) is reducible in polynomial time to the complement of the query evaluation problem for (TB , ∃x M (x)). But given a Σ0 -ABox A, we have by Claim 2 that A → B iff TB , A |= ∃x M (x). (2) For the converse reduction, let q be a PEQ. We have to show that the query evaluation problem for (TB , q) is reducible in polynomial time to the complement of CSP(B). Let A be an ABox and ~a from Ind(A). We show that the following are equivalent: (a) TB , A |= q(~a); (b) A|Σ0 6→ B or T ∃ , A |= q(~a). Regarding (b), we remark that by Lemma 30 (3) T ∃ , A |= q(~a) can be checked in polynomial time and thus can be checked as part of the reduction. First assume that (a) holds. If A|Σ0 → B, then by Claim 1 the ABox A|Σ is consistent w.r.t. HB . Thus there is a model I of HB and A|Σ satisfying ∆I = Ind(A) and AI = {a | A(a) ∈ A} for all concept names A 6∈ Σ and r I = {(a, b) | r(a, b) ∈ A} for all role names r. Thus, A is strongly Σ-consistent w.r.t. HB . By Lemma 30 (4) we have TB , A |= q(~a) iff T ∃ , A |= q(~a) for all PEQs q and all ~a, as required. Conversely, assume (b) holds. If A|Σ0 6→ B, then by Claim 2 A is not consistent w.r.t. TB and so TB , A |= q(~a). If T ∃ , A |= q(~a), then TB , A |= q(~a) since T ∃ ⊆ TB . ❏ The following converse of Theorem 28 is proved in [BtCLW14]. Theorem 31. For every ALCI-TBox T and ELIQ C(x), one can compute a template B in exponential time such that the query evaluation problem for (T , C(x)) and the complement of CSP(B) are polynomial time reducible to each other. The proof of Theorem 31 given in [BtCLW14] proceeds in two steps. To deal with answer variables, it uses generalized CSPs with constants, defined by a finite set of templates (instead of a single one) and admitting the inclusion of constant symbols in the signature of the CSP (instead of only relation symbols). One shows that (i) for every OMQ (T , C(x)), one can construct a generalized CSP with a single constant whose complement is mutually reducible in polynomial time with the query evaluation problem for (T , C(x)) and (ii) every generalized CSP with constants is mutually reducible in polynomial time with some standard CSP. For the reader’s convenience, we illustrate the construction of the template from a given OMQ, concentrating on Boolean ELIQs which are of the form ∃x C(x) with C(x) an ELIQ. In this special case, one can avoid the use of generalized CSPs with constants. Theorem 32. Let T be an ALCI-TBox, q = ∃x C(x) with C an ELIQ, and Σ the signature of T and q. Then one can construct (in time single exponential in |T | + |C|) a Σ-template BT ,q such that for all ABoxes A: (HomDual) T , A |= q iff A|Σ 6→ BT ,q Proof. Assume T and q = ∃x C(x) are given. We use the notation from the proof of Theorem 24. Thus, cl(T , C) denotes the closure under single negation of the set of subconcepts of T and C, tp(T , q) denotes the set of T , q-types and for t, t′ ∈ tp(T , q) we write t r t′ if t and t′ can be satisfied in domain elements of a model of T that are related by r. Now, a T , q-type t omits q if it is satisfiable in a model I of T with C I = ∅. Let BT ,q be the set of assertions A(t) such t omits q and A ∈ t and r(t, t′ ) such that t and t′ omit q and t r t′ . It is not difficult to show that condition (HomDual) holds for all ABoxes A. Observe that BT ,q can be constructed in exponential time since the set of T , q-types omitting q can be constructed in exponential time. ❏

DATA COMPLEXITY OF ONTOLOGIES

33

Example 33. Let T = {A ⊑ ∀r.B} and define q = ∃x B(x). Then BT ,q is defined, up to isomorphism, as {r(a, a), r(a, b), A(b), r(a, c)}. As a consequence of Theorems 28 and 31, we obtain the following. Theorem 34. There is a dichotomy between PT IME and CO NP for CQ-evaluation w.r.t. ALCTBoxes if and only if the Feder-Vardi conjecture is true. The same is true for ALCI-TBoxes, for ELIQs, and for PEQs. For ALC-TBoxes, it additionally holds for ELQs. Proof. Let CSP(B) be an NP-intermediate CSP, i.e., a CSP that is neither in PT IME nor NP-hard. Take the TBox TB from Theorem 28. By Point 1 of that theorem, CQ-evaluation w.r.t. T is not in PT IME. By Point 2, CQ-evaluation w.r.t. TB is not CO NP-hard. Conversely, let T be an ALC-TBox for which CQ-evaluation w.r.t. T is neither in PT IME nor CO NP-hard. Then by Theorem 19, the same holds for ELIQ-evaluation w.r.t. T . It follows that there is a concrete ELIQ q such that query evaluation for (T , q) is CO NP-intermediate. By Theorem 31, there is a template B such that evaluating (T , q) is mutually reducible in polynomial time with the complement of CSP(B). Thus CSP(B) is NP-intermediate, as required. ❏ Observe that the TBox constructed in the proof of Theorem 28 has depth three. Thus, a dichotomy between PT IME and CO NP for CQ-evaluation w.r.t. ALC-TBoxes of depth three would imply that the Feder-Vardi conjecture is true. On the other hand, we have proved a dichotomy between PT IME and CO NP for CQ-evaluation w.r.t. ALCIF-TBoxes of depth one. The behavior of TBoxes of depth two remains open. 7. N ON -D ICHOTOMY

AND

U NDECIDABILITY

IN

ALCF

We show that the complexity landscape of query evaluation w.r.t. ALCF-TBoxes is much richer than for ALCI, and in fact too rich to be fully manageable. In particular, we prove that for CQevaluation, there is no dichotomy between PT IME and CO NP (unless PT IME = NP). We also establish that materializability, Datalog6= -rewritability, PT IME query evaluation, and CO NP-hardness of query evaluation are undecidable. We start with the undecidability proofs, which are by reduction of an undecidable rectangle tiling problem and reuse the ‘hidden concepts’ introduced in the previous section. Next, the TBox from that reduction is adapted to prove the non-dichotomy result by an encoding of the computations of nondeterministic polynomial time Turing machines (and again using hidden concepts). The basis for the technical development in this section is a TBox constructed in [BBLW16] to prove the undecidability of query emptiness in ALCF. An instance of the finite rectangle tiling problem is given by a triple P = (T, H, V ) with T a finite set of tile types including an initial tile Tinit to be placed on the lower left corner and a final tile Tfinal to be placed on the upper right corner, H ⊆ T × T a horizontal matching relation, and V ⊆ T×T a vertical matching relation. A tiling for (T, H, V ) is a map f : {0, . . . , n}×{0, . . . , m} → T such that n, m ≥ 0, f (0, 0) = Tinit , f (n, m) = Tfinal , (f (i, j), f (i + 1, j)) ∈ H for all i < n, and (f (i, j), f (i, j + 1)) ∈ V for all i < m. We say that P admits a tiling if there exists a map f that is a tiling for P. It is undecidable whether an instance of the finite rectangle tiling problem admits a tiling. Now let P = (T, H, V ) be a finite rectangle tiling problem with T = {T1 , . . . , Tp }. We regard the tile types in T as concept names and set Σg = {T1 , . . . , Tp , x, y, x ˆ, yˆ}, where x, y, x ˆ, and yˆ are functional role names. The TBox TP is defined as the following set of CIs, where (Ti , Tj , Tℓ ) range over all triples from T such that (Ti , Tj ) ∈ H and (Ti , Tℓ ) ∈ V and where for e ∈ {c, x, y}

34

DATA COMPLEXITY OF ONTOLOGIES

the concept Be ranges over all conjunctions L1 ⊓ L2 with Li ∈ {Ze,i , ¬Ze,i }, for concept names Ze,i (i = 1, 2): Tfinal ⊑ Y ⊓ U ⊓ R ∃x.(U ⊓ Y ⊓ Tj ) ⊓ Ix ⊓ Ti ⊑ U ⊓ Y ∃y.(R ⊓ Y ⊓ Tℓ ) ⊓ Iy ⊓ Ti ⊑ R ⊓ Y ∃x.(Tj ⊓ Y ⊓ ∃y.Y ) ⊓ ∃y.(Tℓ ⊓ Y ⊓ ∃x.Y ) ⊓ Ix ⊓ Iy ⊓ C ⊓ Ti ⊑ Y Y ⊓ Tinit ⊑ A Bx ⊓ ∃x.∃ˆ x.Bx ⊑ Ix By ⊓ ∃y.∃ˆ y.By ⊑ Iy ∃x.∃y.Bc ⊓ ∃y.∃x.Bc ⊑ C



1≤s