29
EL-ifying Ontologies David Carral 1 , Cristina Feier 2 , Bernardo Cuenca Grau 2 , Pascal Hitzler 1 , and Ian Horrocks 2 1 Department of Computer Science, Wright State University, Dayton US 2 Department of Computer Science, University of Oxford, Oxford UK Abstract. The OWL 2 profiles are fragments of the ontology language OWL 2 for which standard reasoning tasks are feasible in polynomial time. Many OWL ontologies, however, contain a typically small number of out-of-profile axioms, which may have little or no influence on reason- ing outcomes. We investigate techniques for rewriting axioms into the EL and RL profiles of OWL 2. We have tested our techniques on both classification and data reasoning tasks with encouraging results. 1 Introduction Description Logics (DLs) are a family of knowledge representation formalisms underpinning the W3C standard ontology languages OWL and OWL 2. State- of-the-art DL reasoners such as Pellet [18], JFact, FaCT ++ [21], RacerPro [9], and HermiT [15] are highly-optimised for classification (i.e., the problem of com- puting all subsumption relationships between atomic concepts in an ontology) and have been exploited successfully in many applications. In a recent large- scale evaluation campaign, these reasoners exhibited excellent performance on a corpus of more than 1, 000 ontologies, as they were able to classify 75%-85% of the corpus in less than 10 seconds when running on stock hardware [8,3]. However, notwithstanding extensive research into optimisation techniques, DL reasoning remains a challenge in practice. Indeed, the aforementioned eval- uation also revealed that many ontologies are still hard for reasoners to classify. Furthermore, due to the high worst-case complexity of reasoning, systems are inherently not robust, and even minor changes to ontologies can have a signifi- cant effect on performance. Finally, the limitations of DL reasoners become even more apparent when reasoning with ontologies and large datasets. These issues have motivated a growing interest in lightweight DLs: weaker logics that enjoy more favourable computational properties. OWL 2 specifies several profiles (language fragments) based on lightweight DLs [14]: OWL 2 EL (or just EL) is based on the EL family of DLs; OWL 2 RL (or just RL) is based on Datalog; and OWL 2 QL (or just QL) is based on DL-Lite. Standard reasoning tasks, including classification and fact entailment (checking whether an ontology and a dataset entail a given ground atom), are feasible in polynomial time for all profiles, and many highly scalable reasoners have been developed [22,11,2,4]. Unfortunately, many ontologies fall outside the OWL 2 profiles, and we are forced to resort to a fully-fledged reasoner if a completeness guarantee is required.

EL-ifying Ontologies...EL-ifying Ontologies David Carral 1, Cristina Feier 2, Bernardo Cuenca Grau , Pascal Hitzler , and Ian Horrocks2 1 Department of Computer Science, Wright State

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

  • EL-ifying Ontologies

    David Carral1, Cristina Feier2, Bernardo Cuenca Grau2, Pascal Hitzler1, andIan Horrocks2

    1 Department of Computer Science, Wright State University, Dayton US2 Department of Computer Science, University of Oxford, Oxford UK

    Abstract. The OWL 2 profiles are fragments of the ontology languageOWL 2 for which standard reasoning tasks are feasible in polynomialtime. Many OWL ontologies, however, contain a typically small numberof out-of-profile axioms, which may have little or no influence on reason-ing outcomes. We investigate techniques for rewriting axioms into theEL and RL profiles of OWL 2. We have tested our techniques on bothclassification and data reasoning tasks with encouraging results.

    1 Introduction

    Description Logics (DLs) are a family of knowledge representation formalismsunderpinning the W3C standard ontology languages OWL and OWL 2. State-of-the-art DL reasoners such as Pellet [18], JFact, FaCT++ [21], RacerPro [9],and HermiT [15] are highly-optimised for classification (i.e., the problem of com-puting all subsumption relationships between atomic concepts in an ontology)and have been exploited successfully in many applications. In a recent large-scale evaluation campaign, these reasoners exhibited excellent performance on acorpus of more than 1, 000 ontologies, as they were able to classify 75%-85% ofthe corpus in less than 10 seconds when running on stock hardware [8,3].

    However, notwithstanding extensive research into optimisation techniques,DL reasoning remains a challenge in practice. Indeed, the aforementioned eval-uation also revealed that many ontologies are still hard for reasoners to classify.Furthermore, due to the high worst-case complexity of reasoning, systems areinherently not robust, and even minor changes to ontologies can have a signifi-cant effect on performance. Finally, the limitations of DL reasoners become evenmore apparent when reasoning with ontologies and large datasets.

    These issues have motivated a growing interest in lightweight DLs: weakerlogics that enjoy more favourable computational properties. OWL 2 specifiesseveral profiles (language fragments) based on lightweight DLs [14]: OWL 2 EL(or just EL) is based on the EL family of DLs; OWL 2 RL (or just RL) is based onDatalog; and OWL 2 QL (or just QL) is based on DL-Lite. Standard reasoningtasks, including classification and fact entailment (checking whether an ontologyand a dataset entail a given ground atom), are feasible in polynomial time forall profiles, and many highly scalable reasoners have been developed [22,11,2,4].

    Unfortunately, many ontologies fall outside the OWL 2 profiles, and we areforced to resort to a fully-fledged reasoner if a completeness guarantee is required.

  • Even in such cases, the majority of axioms typically still fall within one of theprofiles, and the out-of-profile axioms may have little or no influence on theresults of classification or query answering. Effectively detecting cases where theadditional expressivity is used in a “harmless” way is, however, challenging, sinceeven a single axiom can have a dramatic effect on reasoning outcomes.

    In this paper we investigate techniques for rewriting out-of-profile axioms soas to improve reasoner performance. All rewritings are polynomial and preserveclassification and fact entailment reasoning outcomes. In Section 3, we considerrewritings that are applicable to SHOIQ—a DL that covers OWL DL and mostof OWL 2 [10]—and that can transform non-EL axioms into EL by eliminationof inverse roles and universal restrictions. If all non-EL axioms can be rewritten,then we can provide completeness guarantees using only an EL reasoner. Other-wise, the rewritings can still improve the performance of fully-fledged reasoners(e.g., by enabling the use of optimisation techniques that are applicable only inthe absence of certain constructs) and/or the effectiveness of modular reasonersthat combine profile-specific with OWL 2 reasoners, such as MORe [1].

    In Section 4, we focus on Horn ontologies and consider rewritings into OWL2 RL. The RL profile is tightly connected to Datalog, and hence existentialrestrictions ∃R.C occurring positively in axioms are disallowed, unless C is asingleton nominal {o}. We show that when R fulfills certain conditions, suchconcepts ∃R.C can be rewritten into existential restrictions over nominals asaccepted in OWL 2 RL; we call such roles R reuse-safe. In the limit case whereall roles are reuse-safe, the ontology can be polynomially rewritten into RL;if, additionally, the ontology contains no cardinality constraints, it can also berewritten into EL. Furthermore, if only some roles are reuse-safe, they can betreated by (hyper-)tableau reasoners in an optimised way, potentially reducingthe size of the constructed pre-models and improving reasoning times.

    We have implemented our rewriting techniques and evaluated their effect onreasoning times over a large repository of ontologies. Our experiments reveal thatour EL-ification techniques can lead to substantial improvements in classificationtimes for both standard and modular reasoners. Furthermore, we show that manyontologies contain only reuse-safe roles and hence can be rewritten into RL; thus,highly scalable RL triple stores can be exploited for large-scale data reasoning.

    2 Preliminaries

    A signature consists of disjoint countably infinite sets of individuals NI, atomicconcepts NC and atomic roles NR. A role is an element of NR ∪ {R−|R ∈ NR}.The function Inv(·) is defined over the set of roles as follows, where R ∈ NR:Inv(R) = R− and Inv(R−) = R. An RBox R is a finite set of RIAs R v R′ andtransitivity axioms Tra(R), with R and R′ roles. We denote with vR the minimalrelation over roles in R s.t. R vR S and Inv(R) vR Inv(S) hold if R v S ∈ R.We define v∗R as the reflexive-transitive closure of vR. A role R is transitive inR if there is a role S such that S v∗R R, R v∗R S and either Tra(S) ∈ R orTra(Inv(S)) ∈ R. A role R is simple inR if no transitive role S exists s.t. S v∗R R.

  • The set of SHOIQ concepts is the smallest set containing A (atomic concept),> (top), ⊥ (bottom), {o} (nominal), ¬C (negation), C uD (conjunction), C tD (disjunction), ∃R.C (existential restriction), ∀R.C (universal restriction), 6nS.C (at-most restriction), and > nR.C (at-least restriction), for A ∈ NC, C andD SHOIQ concepts, o ∈ NI, R a role and S a simple role, and n a nonnegativeinteger. A literal concept is either atomic or the negation of an atomic concept.A TBox T is a finite set of GCIs C v D with C,D concepts. An ABox A is afinite set of assertions C(a) (concept assertion), R(a, b) (role assertion), a ≈ b(equality assertion), and a 6≈ b (inequality assertion), with C a concept, R a roleand a, b individuals. A fact is either a concept assertion A(a) with A atomic,a role assertion, an equality assertion, or an inequality assertion. A knowledgebase is a triple K = (R, T ,A). The semantics is standard [10].

    We assume familiarity with standard conventions for naming DLs, and wejust provide here a definition of the OWL 2 profiles. A SHOIQ KB is:

    – EL if (i) it does not contain inverse roles, negation, disjunction, at-mostrestrictions and at-least restrictions; and (ii) every universal restriction ap-pears in a GCI of the form > v ∀R.C.

    – RL if each GCI C v D satisfies (i) C does not contain negation as well asuniversal, at-least, and at-most restrictions; (ii) D does not contain nega-tion (other than ⊥), union, existential restrictions (other than of the form∃R.{o}), at-least restrictions, and at-most restrictions with n > 1.

    – QL if it does not contain transitivity and for each GCI C v D (i) C is eitheratomic or ∃R.>; (ii) D is of the form

    dni=1Bi with each Bi either a literal

    concept, or ⊥, or of the form ∃R.A with R a role and A either atomic or >.

    Classification of K is the task of computing all subsumptions K |= A v B withA ∈ NC ∪ {>}, and B ∈ NC ∪ {⊥}. Fact entailment is to check whether K |= α,for α a fact. Both problems are reducible to knowledge base unsatisfiability.

    3 EL-ification of SHOIQ ontologies

    In this section, we propose techniques for transforming non-EL axioms into EL.Whenever possible, inverse roles are replaced with fresh symbols and the knowl-edge base is extended with axioms simulating their possible effects. At the sametime, we attempt to transform positive occurrences of universal restrictions intonegative occurrences of existential restrictions while inverting the relevant role.Note that our techniques do not rewrite disjunctions and cardinality restrictions;thus, ontologies containing such constructs will not be fully rewritten into EL.

    3.1 Preprocessing

    Before attempting to rewrite a SHOIQ knowledge base K into EL, we firstbring K into a suitable normal form. Normalisation facilitates further rewritingsteps, and it allows us to identify axioms with a direct correspondence in EL.For example, A t B v ¬∀R.¬C is equivalent to the EL axioms A v ∃R.C and

  • Θ(T ) =⋃α∈T

    Θ(α)

    Θ(C v D t ∀R.B) = Θ(C v D t αB) ∪ {αB v ∀R.B}Θ(C v D t ∀R.¬B) = Θ(C u αB v D) ∪ {∃R.B v αB}Θ(C v Dt ./ nR.B) = Θ(C v D t αB) ∪ {αB v./ nR.B}Θ(C v Dt > nR.¬B) = Θ(C v Dt > nR.αB) ∪ {αB uB v >}Θ(C v Dt 6 nR.¬B) = Θ(C v Dt 6 nR.αB) ∪ {> v αB tB}

    Θ(C v D t ¬B) = Θ(C uB v D)Θ(α) = α for any other axiom α.

    Fig. 1. C is a conjunction of atomic concepts or >, D is a disjunction of concepts C,∀R.C, ./ nR.C (./∈ {6,>}) or ⊥, with C literal, B atomic, and αB is fresh.

    B v ∃R.C. Furthermore, although A v ∃R.¬B is not equivalent to an EL axiom,it can be trivially transformed into the EL axioms A v ∃R.X and XuB v ⊥ byintroducing a fresh symbol X. We therefore introduce a normal form that makesexplicit those axioms that are neither logically equivalent to EL axioms, nor canbe transformed into EL by means of the trivial introduction of fresh symbols.

    Definition 1. A GCI is normalised if it is of either of the following forms, whereeach A(i) is atomic or >, B is atomic, each C(j) is atomic, ⊥, or a nominal, Ris a role, n > 2, and m > 1:

    (N1)

    nl

    i=1

    Ai vm⊔j=1

    Cj ; (N2) A v ∃R.Ai; (N3) ∃R.A v Ai

    (N4) A v >nR.Ai; (N5) A v ∀R.B; (N6) A v 6mR.Ai

    A knowledge base K = (R, T ,A) is normalised if A has only facts and each GCIin T is normalised. Finally, K is Horn if m = 1 in each axiom N1 or N6.

    Note that axioms of type N2 and N3, as well as Horn axioms of type N1,are EL. To normalise a knowledge base K, we proceed in two steps. First, wetranslate K into the following disjunctive normal form [15].

    Definition 2. A GCI is in disjunctive normal form (DNF) if it is of the form> v

    ⊔ni=1 Ci, where each Ci is of the form B, {o}, ∃R.B, ∀R.B, >nR.B,

    or 6nR.B, for B a literal concept, R a role, and n a nonnegative integer. Aknowledge base K = (R, T ,A) is in DNF if all roles in A are atomic, all conceptassertions in A contain only a literal concept, and each GCI in T is in DNF.

    DNF normalisation can be seen as a variant of the structural transformation,in which all complex concepts are “flattened” and negations are made explicit(see [15] for details). Once K is in DNF, we can further normalise by replac-ing concepts ¬B in restrictions ∀R.¬B, ∃R.¬B, >nR.¬B and 6nR.¬B with

  • a

    A,C

    x

    B

    R−

    R

    a

    A C

    x y

    B

    RNR−

    a) b)

    Fig. 2. A situation where rewriting away inverse roles leads to missing entailments

    fresh symbols, bringing the remaining negated concepts to the left in GCIs, andintroducing fresh symbols for all restrictions occurring in disjunctions.

    Definition 3. Let K be a KB. Then, Υ (K) is computed from K as follows: (i)apply the transformation in [15] to obtain K′ = (R′, T ′,A′) in DNF; (ii) replaceeach assertion α = ¬A(a) in A′ with a fact Xα(a), with Xα fresh, and extendT ′ with Xα uA v ⊥; and (iii) apply to T ′ the transformation Θ in Figure 1.

    The following proposition establishes the properties of normalisation.

    Proposition 1. Let K be a KB, then Υ (K) is normalised and can be computedin polynomial time in the size of K. Furthermore, if K is EL, then so is Υ (K).Finally, K is satisfiable iff Υ (K) is satisfiable.

    3.2 Rewritable Inverse Roles

    Satisfiability of SHOIQ KBs is NExpTime-complete, whereas for SHOQ it isExpTime-complete; thus, in general, inverse roles cannot be faithfully eliminatedfrom SHOIQ KBs by means of a polynomial transformation. The followingexample illustrates that an obstacle to rewritability is the interaction betweeninverses and at-most restrictions.

    Example 1. Consider K = (R, T ,A), with R = ∅, A = {A(a)}, and T as follows:

    T = {A v ∃R−.B; B v ∃R.C; B v 6 1R.>}

    Note thatK |= C(a). In every model (∆I , ·I), object aI must beR−-connected tosome x ∈ BI (due to the first axiom in T ); also, x must be R-connected to somey ∈ CI (due to the second axiom). Then, for the last axiom to be satisfied, aI andy must be identical; thus, aI ∈ CI . Figure 2 a) depicts such a model. Considernow K′ obtained from K by replacing R− with a fresh atomic role NR− . Then,K′ 6|= C(a), and Figure 2 b) depicts a model of K′ not satisfying C(a). ExtendingK′ with EL axioms to simulate the interaction between inverses and cardinalityrestrictions (and thus recover the missing entailment) seems infeasible. ♦

  • We next propose sufficient conditions for inverse roles to be rewritable in thepresence of cardinality constraints. Our conditions ensure existence of a one-to-one correspondence between the canonical forest-shaped models of the originaland rewritten KBs, and hence disallow cases such as Example 2.3

    Definition 4. Let K = (R, T ,A) be a normalised SHOIQ knowledge base. A(possibly inverse) role R is generating in K if there exists a role R′ occurring inT in an axiom of type N2 or N4 such that R′ v∗R R.

    An inverse role S− is rewritable if for each X ∈ {S, S−} occurring in anaxiom of type N6 we have that Inv(X) is not generating in K.

    Intuitively, roles R′ in axioms N2 or N4 are those “inducing” the edges betweenindividuals and their successors in a canonical model; then, a role R is generatingif it is a super-role of one such R′. Our condition ensures that “backwards” edgesin a canonical model of K (i.e., those induced by an inverse role) cannot invalidatean at-most cardinality restriction. In the limit case where all inverse roles in aSHOIQ KB are rewritable, we can faithfully eliminate inverses and rewrite theKB into SHOQ by means of a polynomial transformation.

    Theorem 1. Let C be the class of all normalised SHOIQ ontologies containingonly rewritable inverse roles. Then, there exists a polynomial transformationmapping each K ∈ C to an equisatisfiable SHOQ knowledge base.4

    Theorem 1 identifies a class of SHOIQ ontologies for which standard reasoningis feasible in ExpTime (in contrast to NExpTime). This result can also be ex-ploited for optimisation: tableaux reasoners employ pairwise blocking techniquesover SHOIQ ontologies, while they rely on more aggressive single blocking tech-niques for SHOQ inputs, which can reduce the size of pre-models.

    3.3 The EL-ification Transformation

    Before presenting our transformation formally, we provide two motivating ex-amples. First, we show how a rewritable inverse role can be eliminated in thepresence of cardinality constraints.

    Example 2. Let K = (R, T ,A) be the following knowledge base:

    R = {R v T−; S v T−}T = {A v ∃R.B; A v ∃S.C; A v 6 1T−.>; B u C v D; ∃R.D v B}A = {A(a); T (b, a)}

    3 Roughly speaking, a forest-shaped model of a (normalised) knowledge base is canon-ical if every fact that holds in the model is “justified” by an axiom or assertion inthe knowledge base. In particular, the result of unravelling a pre-model constructedby a (hyper-)tableau algorithm is a canonical forest-shaped model.

    4 Theorem 1 is given here for presentation purposes: it follows as a corollary of Theo-rem 3, which we state only after presenting our transformations.

  • aA

    Bb

    B

    C

    D

    T

    R, S

    aA

    Bb

    B

    C

    D

    T

    NT−

    R,S

    a) b)

    Fig. 3. Rewriting away inverse roles in a KB with cardinality constraints

    Figure 3(a) depicts a canonical model for K. The facts entailed by K areprecisely those that hold in the canonical model. By Definition 4, T− is rewritablesince T is not generating; however, it does not suffice to replace T− with a freshNT− since the resulting KB will no longer entail the facts R(a, b), S(a, b), B(b),C(b), and D(b). Instead, we can extend A with T−(a, b), and only then replaceT− with NT− . The canonical model of the resulting KB is given in Figure 3(b).♦

    Next, we show how axioms of type N5, which involve a universal restriction, canbe replaced with EL axioms of type N3 if the relevant roles are not generating.

    Example 3. Consider K = (R, T ,A) where R = {R v S−}, A = {A(a);S(a, b)},and T is defined as follows:

    T = {A v ∀S.B; B v ∃R.C; ∃S.B v D; C uD v ⊥}

    Clearly, K is unsatisfiable. Furthermore, it does not contain axioms N6, andhence S− is rewritable. In a first step, we extend K with logically redundant ax-ioms, which make explicit information that may be lost when replacing inverseswith fresh symbols. Thus, we extend T with ∃S−.A v B, and B v ∀S−.D; fur-thermore, we extend R with R− v S; and finally, A with the assertion S−(b, a).

    An important observation is that S is not generating. As a result, we candispense with axiom A v ∀S.B. Then we replace S− with a fresh symbol NS−and R− with NR− . The resulting K′ = (R′, T ′,A′) is as follows:

    R′ = {R v NS− ; NR− v S}T ′ = {∃NS− .A v B; B v ∃R.C; ∃S.B v D; B v ∀NS− .D; C uD v ⊥}A′ = {A(a); S(a, b); NS−(b, a)}

    K′ is unsatisfiable; furthermore it is in EL except for axiom B v ∀NS− .D. Thisaxiom cannot be dispensed with since S− is generating, and hence it is neededto propagate information along NS− -edges in a canonical model. ♦

    We next present our transformation. For simplicity, we first restrict ourselvesto ALCHOIQ KBs; later on, we discuss issues associated with transitivity ax-ioms and show how our techniques extend to SHOIQ.

    Definition 5. Let K = (R, T ,A) be a normalised ALCHOIQ knowledge base.The knowledge base Ξ(K) = (R′, T ′,A′) is obtained as follows:

  • 1. Extension: the knowledge base Ke = (Re, Te,Ae) is defined as follows:– Re extends R with an axiom Inv(R) v Inv(S) for each R v S in R;– Te extends T with the following axioms:• an axiom ∃Inv(R).A v B for each axiom A v ∀R.B in T where

    either Inv(R) is generating, or R is not generating; and• an axiom A v ∀Inv(R).B for each axiom ∃R.A v B in T whereInv(R) is generating;

    – Ae extends A with an assertion R−(b, a) for each R(a, b) ∈ A.2. EL-ification: Ξ(K) = (R′, T ′,A′) is obtained from Ke by first removing all

    axioms A v ∀R.B in Te where R is not generating in T and then replacingeach occurrence of an inverse role that is rewritable in Ke with a fresh role.

    The extension step only adds redundant information, and hence K and Ke areequivalent. Making such information explicit is crucial for the subsequent EL-ification step, where ineffectual axioms involving universal restrictions are re-moved, and rewritable inverse roles are replaced with fresh atomic roles. Thefollowing theorem extablishes the properties of the transformation.

    Theorem 2. Let K′ = Ξ(K). The following conditions hold:

    1. K′ is satisfiable iff K is satisfiable;2. K′ is of size polynomial in the size of K;3. If K satisfies all of the following properties, then K′ is EL:

    – K is Horn and does not contain axioms of type N4 or N6;– each axiom N5 satisfies either A = >, or R is not generating.– each axiom N3 satisfies either A = >, or Inv(R) is not generating.

    Note that the third condition in the theorem establishes sufficient conditions onK for the transformed knowledge base K′ to be in EL. A simple case is when Kis in the QL profile of OWL 2, in which case the transformed KB is guaranteedto be in EL. An interesting consequence of this result is that highly optimisedEL reasoners, such as ELK, can be exploited for classifying QL ontologies.

    Corollary 1. If K is a normalised QL knowledge base, then Ξ(K) is in EL.

    In many cases our transformation may only succeed in partially rewriting aknowledge base into EL (c.f. Example 3). Even in these cases, our techniquescan have substantial practical benefits (see Evaluation section). As discussed inSection 3.2, in the absence of inverse roles (hyper-)tableau reasoners may exploitmore aggressive blocking techniques. Furthermore, modular reasoning systemssuch as MORe, which are designed to behave better for ontologies with a largeEL subset, are substantially enhanced by our transformations.

    3.4 Dealing with Transitivity Axioms

    As shown by the following example, the transformation in Definition 5 is notapplicable to knowledge bases containing transitivity axioms in the RBox.

  • Example 4. Consider K = (R, T ,A) with R = {R v R−;Tra(R)}, A = {A(a)},and T = {A v ∃R.B;A v C;∃R−.C v D}. Let K′ = Ξ(K), where we assumethat the transitivity axiom Tra(R) stays unmodified in K′. More precisely, A′ =A, and R′ = {R v NR− ;NR− v R;Tra(R)}, and T ′ = {A v ∃R.B;A vC;∃NR− .C v D;C v ∀R.D}. It can be checked that K |= D(a), but K′ 6|= D(a);thus, a relevant entailment is lost. An attempt to recover this entailment bymaking NR− transitive does not solve the problem. ♦

    To address this issue, we eliminate transitivity before applying our transforma-tion in Definition 5. Standard techniques for eliminating transitivity axioms inDLs (e.g., [15]) have the effect of introducing non-Horn axioms. As a result, aHorn knowledge base may not remain Horn after eliminating transitivity. There-fore, we propose a modification of the standard technique that preserves Hornaxioms and which is compatible with our transformation in Definition 5.

    Definition 6. Let K = (R, T ,A) be a normalised SHOIQ knowledge base. Foreach axiom of the form A v ∀R.B in T and each transitive sub-role S of R inR, let XSR,B be an atomic concept uniquely associated to R,B, S. Furthermore,for each axiom ∃R.A v B in T and each transitive sub-role S of R in R, letY SR,B be a fresh atomic concept uniquely associated to R,B, S.

    The knowledge base Ω(K) = (R′, T ′,A′) is defined as follows: (i) R′ is ob-tained from R by removing all transitivity axioms; (ii) T ′ is obtained from Tby adding axioms A v ∀S.XSR,B, XSR,B v ∀S.XSR,B, and XSR,B v ∀S.B for eachconcept XSR,B, and axioms ∃S.A v Y SR,B, ∃S.Y SR,B v Y SR,B, and ∃S.Y SR,B v Bfor each concept Y SR,B; finally, (iii) A′ = A.

    Lemma 1 establishes the properties of transitivity elimination, and Theorem3 shows that our techniques extend to a SHOIQ knowledge base K by firstapplying Ω to K and then Ξ to the resulting KB.

    Lemma 1. Let K be a normalised SHOIQ KB. The following holds:

    1. Ω(K) is satisfiable iff K is .2. Ω(K) is a normalised ALCHOIQ; furthermore, Ω(K) is Horn iff K is Horn.3. Ω(K) can be computed in time polynomial in the size of K.4. if K is EL, then so is Ω(K).5. If an inverse role R− is rewritable in K, then it is also rewritable in Ω(K).

    Theorem 3. Let K = (R, T ,A) be a normalised SHOIQ knowledge base, andlet K′ = Ξ(Ω(K)). Then, K′ satisfies all properties 1− 3 in Theorem 2.

    4 Reuse-safe Roles

    We next focus on Horn ontologies, and show how to further optimise reasoning byidentifying roles that are “reuse-safe”, and which can thus be treated by (hyper-)tableau reasoners in a more optimised way. Each application of an axiom N2or N4 triggers the generation of fresh individuals in a (hyper-)tableau. If these

  • s11F1 s12 F2 . . . s17F1 s18 F2

    s7F s10 Fs8F s9 F

    s3D1, E s6 D2, Es4D2, E s5 D1, E

    s1 s2B1, C B2, C

    a A

    R R

    R R R R

    S S S S

    R R R R

    s8F1 s9 F2

    s7F

    s3D1, E s6 D2, Es4D2, E s5 D1, E

    s1 s2B1, C B2, C

    a A

    R R

    R R R R

    S S S S

    R R

    a) b)

    Fig. 4. Decreasing model size by reusing individuals

    axioms involve a reuse-safe role, however, we show that reasoners can associatewith each such axiom a single fresh nominal, which can be deterministically“reused” whenever the axiom is applied during construction of a pre-model. Thismay reduce the size of pre-models, and improve reasoning times. Our techniqueextends the results in [16], which show that for EL ontologies all roles admitreuse, and pre-model size can be bounded polynomially.

    Example 5. Consider the following knowledge base K = (R, T ,A) where R = ∅,A = {A(a)}, and T consists of the following axioms:

    A v ∃R.B1 C v ∃R.D1 A v ∀R.C E v ∃S.F F v ∃R.F2 B1 uB2 v ⊥A v ∃R.B2 C v ∃R.D2 C v ∀R.E F v ∃R.F1 F1 u F2 v ⊥ D1 uD2 v ⊥

    Since R is generating and K has no inverses, we have Ξ(K) = K. Figure 4a) depicts a canonical model of K. Role S is reuse-safe since it is not “affected”by non-EL axioms involving universal restrictions. We can exploit this fact to“fold” the model by identifying all nodes with an S-predecessor to a single freshnominal, as in Figure 4 b). In this way, we can reduce model size. ♦

    Definition 7. Let K = (R, T ,A) be a normalised Horn KB. A role R in K isreuse-safe if either R is not generating or the following conditions hold:

    – Each axiom A v 6 1S.B in K satisfies R 6v∗R S and R 6v∗R Inv(S);– Each axiom A v ∀S.B in K with A 6= > satisfies R 6v∗R S; and– Each axiom ∃S.A v B in K with A 6= > satisfies R 6v∗R Inv(S).

    If a generating role R is reuse-safe, we can ensure that R-edges in a canonicalmodel of K are irrelevant to the satisfaction of non-EL axioms in K. To ensurethat (hyper-)tableau algorithms will exploit reuse-safety, and construct succinct“folded” canonical models such as the one in Example 5, we provide the followingtransformation, which makes the relevant nominals explicit.

  • Definition 8. Let K = (R, T ,A) be a normalised Horn knowledge base.For each each positive occurrence of a concept ∃R.B (resp. > nR.B) in K

    with R reuse-safe, let cR,B (resp. ci,R,B for 1 6 i 6 n) be fresh individual(s).Then, Ψ(K) is KB obtained from K by:– replacing each axiom in T of the form A v ∃R.B, where R is safe, byA v ∃R.{cR,B} and adding the fact B(cR,B) to A, and by

    – replacing each axiom of the form A v >nR.B, where R is safe, by all α ∈{A v ∃R.{ci,R,B}, {cj,R,B} u {ck,R,B} v ⊥ | 1 6 i 6 n and 1 6 j < k 6 n}and adding the facts B(ci,R,B), for 1 6 i 6 n, to A.

    The following theorem establishes the correctness of our transformation.

    Theorem 4. K is satisfiable iff Ψ(K) is satisfiable.In practice, system developers can achieve the same goal as our transformationby making their implementations sensitive to reuse-safe roles: to satisfy an axiominvolving existential or an at-least restrictions over such role, a system shouldreuse a suitable distinguished individual instead of generating a fresh one.

    We next analyse the case where all roles in a Horn KB K = (R, T ,A) arereuse-safe. In this case, we can show that Ψ(K) is in RL. Furthermore, we canidentify a new efficiently-recognisable class of DL knowledge bases that con-tains both EL and RL, and for which both classification and fact entailment arefeasible in polynomial time.

    Theorem 5. Let C be the class of Horn knowledge bases K such that all rolesin K are reuse-safe. Then, the following conditions hold:1. Checking whether a SHOIQ KB K is in C is feasible in polynomial time;2. Every EL and RL knowledge base is contained in C;3. Ψ(K) is an RL knowledge base for each K ∈ C; and4. Classification and fact entailment in C are feasible in polynomial time.

    Finally, it is worth emphasising that, although the transformations Ψ in Defini-tion 8 and Ξ in Section 3 are very different and serve rather orthogonal purposes,they are connected in the limit case where all roles are reuse-safe and the ontol-ogy does not contain cardinality restrictions.

    Proposition 2. Let K be a normalised Horn KB that does not contain axiomsN4 or N6. Then, Ξ(Ω(K)) is EL iff all roles in K are reuse-safe.

    5 Evaluation

    We have implemented the transformations described in Sections 3 and 4, andwe have performed a range of classification and data reasoning experiments overboth realistic ontologies and standard benchmarks.

    5.1 Classification Experiments

    For our input data, we used the OWL 2 ontologies in the Oxford OntologyRepository,5 which contains 793 realistic ontologies, as well as a “hard” version

    5 http://www.cs.ox.ac.uk/isg/ontologies/

  • Ontology ID 00018 00352 00448 00461 00463 00470 00660 Fly

    Original (HermiT) 76.787 18.679 68.545 2.260 t-out 286.89 102.80 840.014Normalised (HermiT) 30.730 7.235 41.529 11.768 t-out 318.60 123.71 807.167EL-ified (HermiT) 9.006 7.953 21.395 1.801 651.884 54.40 17.62 17.361

    Original (MORe) 42.292 15.095 5.949 2.515 t-out 258.53 99.93 844.639Normalised (MORe) 10.521 3.195 5.061 11.442 t-out 293.55 85.42 819.640EL-ified (MORe) 3.0792 2.650 5.019 1.310 694.046 3.48 17.58 17.409

    Table 1. Classification times for representative ontologies (in seconds).

    of the FlyAnatomy ontology, which is not yet in the repository. Several of thetest ontologies contain a small number of axioms exploiting constructs (suchas complex RIAs) not available in SHOIQ; in these cases we tested filteredversions of the ontologies where such axioms have been removed.

    We tested classification times for the latest versions of HermiT (v.1.3.8) andMORe (v.0.1.5) using their standard settings. All experiments were performedon a laptop with 16 GB RAM and Intel Core 2.9 GHz processor running Javav.1.7.0 21, with a timeout set to 3,000s.

    EL-ification Experiments. Out of the 793 ontologies in the corpus, we se-lected those 70 that contain inverse roles, and which HermiT takes at least 1s toclassify. For each test ontology K we have computed a normalised version Υ (K)and an EL-ified version K′ (see Section 3), and have compared classificationtimes for HermiT and MORe on each version.

    We found that 50 out of the 70 test ontologies contained only rewritableinverse roles, which could be successfully eliminated using our transformations,and 4 of these ontologies could be fully rewritten into EL. Of these 50 ontologies,6 could not be classified by HermiT even after EL-ification; however, HermiTsucceeded on 2 EL-ified ontologies that could not be classified in their originalform. For the remaining 42 ontologies, normalisation alone leads to a slight de-terioration in average performance due to the introduction of new class names(which HermiT must classify); however, EL-ification improves HermiT’s perfor-mance by an average factor of approximately 3. We believe that this improvementis due to HermiT being able to use single blocking instead of pairwise blocking.

    Like HermiT, MORe failed on 8 of the original ontologies, but succeededon two of these after EL-ification. With the remaining 42, as for HermiT, nor-malisation alone leads to a slight deterioration in performance, but EL-ificationimproves performance by an average factor of approximately 6. The larger im-provement can be explained by the fact that many axioms are rewritten intoEL, and hence MORe can delegate a greater part of the computational work toELK. Table 1 presents results for some representative cases.

    Finally, as already mentioned, our test corpus contains 20 ontologies withnon-rewritable inverse roles. As expected, in these cases we obtained no consis-tent improvement since the presence of inverses forces HermiT to use pairwiseblocking; furthermore, in some cases the transformation negatively impacts per-formance, as it adds a substantial number of axioms to simulate the effect of

  • inverse roles. Hence, it seems that our techniques are clearly beneficial onlywhen all inverse roles are rewritable.

    Reuse Safety. From the 793 ontologies in the corpus, we identified 174 Hornontologies that do not fall within any of the OWL 2 profiles. We have appliedour transformation in Definition 8 to these ontologies and found that 53 do notcontain unsafe roles and hence are rewritten into RL. Furthermore, we foundthat in the remaining ontologies 89% of the roles were reuse-safe, on average.We have tested classification times with HermiT over the transformed ontologies,but found that the transformation had a negative impact on performance. Thisis explained by the fact that our transformation introduces nominals. In thepresence of nominals, HermiT disables anywhere blocking—a powerful techniquethat makes nodes blockable by any other node in the tableau (and not just by itsancestors). As mentioned in Section 4, it would be more effective to implementsafe reuse as a modification of HermiT’s calculus; this, however, implies non-trivial modifications to the core of the reasoner, which is left for future work.

    5.2 Data Reasoning Experiments

    We have used the standard LUBM benchmark, which comes with an ontologyabout academic departments and a dataset generator parameterised by the num-ber of universities for which data is generated (LUBM(n) denotes the datasetfor n universities). The LUBM ontology is not in RL, as it contains axioms oftype N2; however, all roles in LUBM are reuse-safe and hence we rewrote itinto RL using the transformation in Definition 8. For each dataset, we recordedthe times needed to compute the instances of all atomic concepts in the ontol-ogy. We compared HermiT over the original ontology and the RL reasoner RD-Fox6 over the transformed ontology. HermiT took 3.7s for LUBM(1), and timedout for LUBM(5). In contrast RDFox only required 0.2s for LUBM(1), 1.5s forLUBM(10), and 7.4s for LUBM(20). These results suggest the clear benefits oftransforming an ontology to RL and exploiting highly scalable reasoners such asRDFox.

    6 Related Work

    The observation that many ontologies consist of a large EL “backbone” and arelatively small number of non-EL axioms is exploited by the modular reasonerMORe [1] to delegate the bulk of the classification work to EL reasoner ELK[11]. Modular reasoning techniques, however, are sensitive to syntax and allnon-EL axioms (as well as those “depending” on them) must be processed by afully-fledged OWL reasoner. Ren et al. propose a technique for approximatingan OWL ontology into EL [17]; this approximation, however, is incomplete forclassification and hence valid subsumptions might be lost.

    Several techniques for inverse role elimination in DL ontologies have beendeveloped. Ding et al. [7] propose a polynomial reduction from ALCI into ALC,6 http://www.cs.ox.ac.uk/isg/tools/RDFox/

  • which is then extended in [6] to SHOI. Similarly, Song et al. [19] propose apolynomial reduction from ALCHI to ALCH KBs to optimise classification. Inall of these approaches inverse roles are replaced with fresh symbols and newaxioms are introduced to compensate for the loss of implicit inferences. Theseapproaches, however, are not applicable to KBs with cardinality restrictions; fur-thermore, inverse role elimination heavily relies on the introduction of universalrestrictions, and hence they are not well-suited for EL-ification. Calvanese etal. [5] propose a transformation from ALCFI knowledge bases to ALC which issound and complete for classification; this technique exhaustively introduces uni-versal restrictions to simulate at-most cardinality restrictions and inverse roles,and hence it is also not well-suited for EL-ification; furthermore, this techniqueis not applicable to knowledge bases with transitive roles or nominals. Finally,Lutz et al. study rewritability of first-order formulas into EL as a decision prob-lem [13]; the rewritings studied in [13], however, require preservation of logicalequivalence, whereas ours preserve satisfiability.

    The techniques described in Section 4 extend the so-called combined ap-proach to query answering in EL [12,20]. They are also related to are stronglyrelated to individual reuse optimisations [16], where to satisfy existential re-strictions a (hyper-)tableau reasoner tries to reuse an individual from the modelconstructed thus far. Individual reuse, however, may introduce non-determinismin exchange for a smaller model: if the reuse fails (i.e., a contradiction is derived),the reasoner must backtrack and introduce a fresh individual. In contrast, in thecase of reuse-safe roles reuse can be done deterministically and hence model sizeis reduced without the need of backtracking.

    Finally, Zhou et. al use a very similar transformation as ours to strengthenontologies and overestimate query answers [23]. It follows from Theorem 5 thatthe technique in [23] leads to exact answers to atomic queries for Horn ontologieswhere all roles are reuse-safe.

    7 Conclusions and Future Work

    In this paper, we have proposed novel techniques for rewriting ontologies intothe OWL 2 profiles. Our techniques are easily implementable as preprocessingsteps in DL reasoners, and can lead to substantial improvements in reasoningtimes. Furthermore, we have established sufficient conditions for ontologies tobe polynomially rewritable into the EL and RL profiles. Thus, for the class ofontologies satisfying our conditions reasoning becomes feasible in polynomialtime. There are many avenues to explore for future work. For example, we willinvestigate extensions of our EL-ification techniques that are capable of rewritingaway disjunctive axioms. Furthermore, we are planning to implement safe reusein HermiT and evaluate the impact of this optimisation on classification.

    References

    1. Armas Romero, A., Cuenca Grau, B., Horrocks, I.: MORe: modular combinationof OWL reasoners for ontology classification. In: ISWC. pp. 1–16 (2012)

  • 2. Baader, F., Lutz, C., Suntisrivaraporn, B.: CEL - A polynomial-time reasoner forlife science ontologies. In: IJCAR. pp. 287–291 (2006)

    3. Bail, S., Glimm, B., Gonçalves, R.S., Jiménez-Ruiz, E., Kazakov, Y., Matentzoglu,N., Parsia, B. (eds.): ORE, CEUR, vol. 1015 (2013)

    4. Bishop, B., Kiryakov, A., Ognyanoff, D., Peikov, I., Tashev, Z., Velkov, R.: OWLim:A family of scalable semantic repositories. Semantic Web J. 2(1), 33–42 (2011)

    5. Calvanese, D., De Giacomo, G., Rosati, R.: A note on encoding inverse roles andfunctional restrictions in ALC knowledge bases. In: Proceedings of the 1998 De-scription Logic Workshop (DL’98). pp. 69–71. CEUR (1998)

    6. Ding, Y.: Tableau-based Reasoning for Description Logics with Inverse Roles andNumber Restrictions. Ph.D. thesis, Concordia University, Canada (2008)

    7. Ding, Y., Haarslev, V., Wu, J.: A new mapping from ALCI to ALC. In: Calvanese,D., Franconi, E., Haarslev, V., Lembo, D., Motik, B., Turhan, A., Tessaris, S. (eds.)DL-07. CEUR Workshop Proceedings, vol. 250 (2007)

    8. Gonçalves, R.S., Matentzoglu, N., Parsia, B., Sattler, U.: The empirical robustnessof Description Logic classification. In: DL. pp. 197–208 (2013)

    9. Haarslev, V., Hidde, K., Möller, R., Wessel, M.: The racerpro knowledge represen-tation and reasoning system. Semantic Web J. 3(3), 267–277 (2012)

    10. Horrocks, I., Sattler, U.: A tableau decision procedure for SHOIQ. J. of Auto-mated Reasoning 39(3), 249–276 (2007)

    11. Kazakov, Y., Krötzsch, M., Simancik, F.: Concurrent classification of EL ontolo-gies. In: ISWC. pp. 305–320 (2011)

    12. Kontchakov, R., Lutz, C., Toman, D., Wolter, F., Zakharyaschev, M.: The Com-bined Approach to Ontology-Based Data Access. In: IJCAI. pp. 2656–2661 (2011)

    13. Lutz, C., Piro, R., Wolter, F.: Description logic tboxes: Model-theoretic character-izations and rewritability. In: IJCAI. pp. 983–988 (2011)

    14. Motik, B., Cuenca Grau, B., Horrocks, I., Wu, Z., Fokoue, A., Lutz, C. (eds.):OWL 2 Web Ontology Language: Profiles. W3C Recommendation (27 October2009), available at http://www.w3.org/TR/owl2-profiles/

    15. Motik, B., Shearer, R., Horrocks, I.: Hypertableau reasoning for description logics.J. Artificial Intelligence Research (JAIR) 36(1), 165–228 (2009)

    16. Motik, B., Horrocks, I.: Individual reuse in description logic reasoning. In: IJCAR.pp. 242–258 (2008)

    17. Ren, Y., Pan, J.Z., Zhao, Y.: Soundness preserving approximation for TBox rea-soning. In: AAAI (2010)

    18. Sirin, E., Parsia, B., Cuenca Grau, B., Kalyanpur, A., Katz, Y.: Pellet: A practicalOWL-DL reasoner. J. Web Semantics (JWS) 5(2), 51–53 (2007)

    19. Song, W., Spencer, B., Du, W.: A transformation approach for classifyingALCHI(D) ontologies with a consequence-based ALCH reasoner”. In: ORE.CEUR, vol. 1015, pp. 39–45 (2013)

    20. Stefanoni, G., Motik, B., Horrocks, I.: Introducing Nominals to the CombinedQuery Answering Approaches for EL. In: AAAI (2013)

    21. Tsarkov, D., Horrocks, I.: FaCT++ description logic reasoner: System description.In: IJCAR. pp. 292–297 (2006)

    22. Wu, Z., Eadon, G., Das, S., Chong, E.I., Kolovski, V., Annamalai, M., Srinivasan,J.: Implementing an inference engine for RDFS/OWL constructs and user-definedrules in Oracle. In: ICDE. pp. 1239–1248 (2008)

    23. Zhou, Y., Cuenca Grau, B., Horrocks, I., Wu, Z., Banerjee, J.: Making the mostof your triple store: query answering in OWL 2 using an RL reasoner. In: WWW(2013)

    http://www.w3.org/TR/owl2-profiles/

  • A Appendix

    Theorem 2. 1.: K′ = Ξ(K) is satisfiable iff K is satisfiable:Proof. We show a one-to-one correspondence between (canonical forest) mod-els of K = (R, T ,A) and K′ = (R′, T ′,A′).Let f be a function which maps roles in K′ to roles in K as follows:

    f(R) =

    {Q−, when R = NQ

    R, otherwise .

    Also, let g be the inverse of f (f is bijective): g maps roles in K to roles in K′as follows:

    g(R) =

    {NQ, when R = Q− and Q− is rewritable

    R, otherwise .

    ⇒: Let I1 = (∆I1 , ·I1) be a model for K (not necessarily forest-shaped). Weshow how to construct from I1 a model I2 = (∆I2 , ·I2) for K′.Let ∆I2 = ∆I1 and ·I2 be defined as follows:

    – sI2 = sI1 , for every s ∈ NI– AI2 = AI1 , for every A ∈ NC– RI2 = RI1 , for every R ∈ NR– NRI2 = (R−)I1 , for every NR in the signature of K′.

    Then, the following hold:

    1. (x, y) ∈ RI2 implies (x, y) ∈ (f(R))I1 , for every R in the signature of K′,and

    2. (x, y) ∈ RI1 implies (x, y) ∈ (g(R))I2 , for every R in the signature of K .

    We show that I2 = (∆I2 , ·I2) satisfies every axiom from K′:

    – Assume R v S ∈ R′, and (x, y) ∈ RI2 . Then, f(R) v∗R f(S) ∈ R and(x, y) ∈ (f(R))I1 . Thus, (x, y) ∈ (f(S))I1 , which implies (x, y) ∈ g(f(S))I2 =SI2 .

    – Assume ∃R.A v B ∈ T ′, (x, y) ∈ RI2 , and y ∈ AI2 . Then, either:• ∃f(R).A v B ∈ T . As (x, y) ∈ (f(R))I1 and y ∈ AI1 , it follows that:x ∈ BI1 ⇒ x ∈ BI2 , or

    • A v ∀Inv(f(R)).B ∈ T . As (y, x) ∈ (Inv((f(R)))I1 and y ∈ AI1 , itfollows that: x ∈ BI1 ⇒ x ∈ BI2 .

    – Assume A v ∀R.B ∈ T ′, x ∈ AI2 , and (x, y) ∈ RI2 . Then, either:• ∃Inv(f(R)).A v B ∈ T . As (y, x) ∈ (Inv((f(R)))I1 and y ∈ AI1 , it

    follows that: x ∈ BI1 ⇒ x ∈ BI2 , or• A v ∀f(R).B ∈ T . As (y, x) ∈ (f(R))I1 and y ∈ AI1 , it follows that:x ∈ BI1 ⇒ x ∈ BI2 .

  • – Assume A v> nR.B ∈ T ′ and x ∈ AI2 . Then, A v> n(f(R)).B ∈ T andx ∈ AI1 . As (x, y) ∈ (f(R))I1 implies (x, y) ∈ RI2 and y ∈ BI1 impliesy ∈ BI2 , it follows that x ∈ (> nR.B)I2 .

    – Assume A v6 nR.B ∈ T ′ and x ∈ AI2 . Then, A v6 n(f(R)).B ∈ T , x ∈AI1 , and consequently x ∈ (6 n(f(R)))I1 . We have that (x, y) ∈ RI2 implies(x, y) ∈ (f(R))I1 and y ∈ BI2 implies y ∈ BI1 . Then, x 6∈ (> nR.B)I2implies x 6∈ (> n(f(R)).B)I1 – contradiction. Thus, x ∈ (> nR.B)I2 .

    – AssumedAi v

    ⊔Bj ∈ T ′ and x ∈ (

    dAi)I2 . Then,

    dAi v

    ⊔Bj ∈ T ,

    x ∈ (dAi)I1 , and thus x ∈ (

    ⊔Bj)I1 , which implies x ∈ (

    ⊔Bj)I2 .

    ⇐: Let I2 = (∆I2 , ·I2) be a canonical forest model for K′. We show how toconstruct from I1 a model I1 = (∆I1 , ·I1) for K.Let ∆I1 = ∆I2 and ·I1 be defined as follows:

    – sI1 = sI2 , for every s ∈ NI– AI1 = AI2 , for every A ∈ NC

    – RI1 =

    RI2 , for every R ∈ NR s.t. R− is not rewritable

    or does not occur in KRI2 ∪ (NR−)I2 , otherwise.

    Before moving to show that I1 = (∆I1 , ·I1) is a model of K, we introduce a fewhelping lemmas:

    Lemma 2. Let R be a role which occurs in K′. Then (x, y) ∈ RI2 iff there existsa role S in K such that one of the following holds:

    1. g(S) v∗R′ R, g(S)(a, b) ∈ A′, aI2 = x, and bI2 = y,2. g(S) v∗R′ Inv(R), g(S)(b, a) ∈ A′, aI2 = x, and bI2 = y,3. g(S) v∗R′ R, g(S) occurs in an axiom of type N2 or N4 in K’, x ∈ AI2 and

    (x, y) ∈ g(S)I2 ,4. g(S) v∗R′ Inv(R), g(S) occurs in an axiom of type N2 or N4 in K’, y ∈ AI2

    and (y, x) ∈ g(S)I2 .

    Proof. It follows from the fact that: I2 = (∆I2 , ·I2) is a canonical forestmodel. Intuitively, in each of the cases the S-role is the reason for the existenceof R(xI2 , yI2) in the interpretation. �

    Lemma 3. Let R and S be two roles in K. Then, the following hold:

    i) g(R) v∗R′ g(S) implies R v∗R S, andii) g(R) v∗R′ Inv(g(S)) implies R v∗R Inv(S).

    Proof. First, from Definition 5 we observe that: g(R) v g(S) ∈ R′ impliesR v S ∈ R or Inv(R) v Inv(S) ∈ R: R v∗R S.

    Also, g(R) v Inv(g(S)) ∈ R′ implies that: f(g(R)) v f(Inv(g(S))) ∈ Ror f(Inv(g(R))) v f(g(S)) ∈ R. From the definition of f it can be seen thatf(Inv(R)) = Inv(R) = Inv(f(R)) (note that R cannot be of the form NQ as f is

  • not defined on inputs of type NQ−), thus: g(R) v Inv(g(S)) ∈ R′ implies that:R v Inv(S) ∈ R or Inv(R) v S ∈ R: R v∗R Inv(S).

    From the two base cases above it is easy to see how one can construct aninduction argument over the role hierarchy to prove the original claims. �

    Lemma 4. Let R be a role in K. Then, the following hold:

    – (x, y) ∈ (g(R))I2 and R is not generating in K implies (x, y) ∈ Inv(g(Inv(R)))I2 ,– (x, y) ∈ Inv(g(Inv(R)))I2 and Inv(R) is not generating in K implies (x, y) ∈

    (g(R))I2 .

    Proof.We first show that the claims of the current lemma hold in the cases wherethe reason for (x, y) ∈ (g(R))I2 and (x, y) ∈ Inv(g(Inv(R)))I2 is one of thoseenunciated at points 1. and 2. in Lemma 2. We distinguish between:

    – (x, y) ∈ (g(R))I2 and case 1. in Lemma 2 holds for g(R). Then: g(S) v∗R′g(R) implies g(Inv(S)) v∗R′ g(Inv(R)) and g(S)(a, b) ∈ A′ implies g(Inv(S))(b, a) ∈A′. Together with aI2 = x, and bI2 = y, it follows that (y, x) ∈ g(Inv(R))I2 ,thus (x, y) ∈ Inv(g(Inv(R)))I2 .

    – (x, y) ∈ (g(R))I2 and case 2. in Lemma 2 holds for g(R) – similar to above.– (x, y) ∈ Inv(g(Inv(R)))I2 and case 1. holds for Inv(g(Inv(R))). Then: (y, x) ∈

    (g(Inv(R)))I2 , g(S) v∗R′ g(Inv(R)), and g(S)(a, b) ∈ A′ with aI2 = y andbI2 = x. But then: g(Inv(S)) v∗R′ g(R) and g(Inv(S))(b, a) ∈ A′). It followsthat (x, y) ∈ (g(R))I2 .

    – (x, y) ∈ Inv(g(Inv(R)))I2 and case 2. holds for Inv(g(Inv(R))) – similar toabove.

    We next show that the claims of the current lemma hold even when the conditionsat point 1. and 2. of Lemma 2 do not hold. We distinguish between:

    – (x, y) ∈ (g(R))I2 , R is not generating in K, and neither the conditions atpoint 1. nor the conditions at point 2. of Lemma 2 do not hold. Then the con-ditions at point 4. of Lemma 2 must be fulfilled w.r.t. g(R): there exists a roleS s.t. g(S) v∗R′ Inv(R) and (y, x) ∈ g(S)I2 . From Lemma 3 it follows that:S v∗R Inv(R) and thus g(S) v∗R′ g(Inv(R)). But then, (y, x) ∈ g(Inv(R)I2 or(x, y) ∈ Inv(g(Inv(R)))I2 .

    – (x, y) ∈ Inv(g(Inv(R)))I2 , Inv(R) is not generating in K and neither theconditions at point 1. nor the conditions at point 2. of Lemma 2 do nothold. Then, the conditions at point 3. of Lemma 2 must be fulfilled w.r.t.Inv(g(Inv(R))): there exists a role S s.t. g(S) v∗R′ Inv(g(Inv(R)) and (x, y) ∈g(S)I2 . But then, from Lemma 3 it follows that S v∗R Inv(Inv(R)) = R.Thus, g(S) v∗R′ g(R) and (x, y) ∈ (g(R))I2 .

    We finally proceed to show that I1 = (∆I1 , ·I1) is a model of K. As for the proofin the other direction it holds that:

  • – (x, y) ∈ RI2 implies (x, y) ∈ (f(R))I1 , for every R in the signature of K′,and

    – (x, y) ∈ RI1 implies (x, y) ∈ (g(R))I2 ∪(Inv(g(Inv(R))))I2 , for every R in thesignature of K .

    As we will see I1 satisfies every axiom from K:

    – Assume R v S ∈ R, and (x, y) ∈ RI1 . Then g(R) v g(S) ∈ R′, g(Inv(R)) vg(Inv(S)) ∈ R′ and (x, y) ∈ (g(R))I2 ∪ (Inv(g(Inv(R))))I2 . Thus, (x, y) ∈ SI2and (x, y) ∈ SI1 .

    – Assume ∃R.A v B ∈ T and x ∈ ∃R.AI1 : there exists y ∈ ∆I1 s.t. (x, y) ∈RI1 and y ∈ AI1 . Then, ∃g(R).A v B ∈ T ′ and if Inv(R) is generating:A v ∀g(Inv(R)).B ∈ T ′. Also (x, y) ∈ (g(R))I2 ∪ (Inv(g(Inv(R))))I2 andy ∈ AI2 .When (x, y) ∈ (g(R))I2 , from ∃g(R).A v B ∈ T ′ it follows that x ∈ BI2 ,and thus x ∈ BI1 .When (x, y) ∈ (Inv(g(Inv(R))))I2 and Inv(R) is generating: (y, x) ∈ (g(Inv(R)))I2and from A v ∀g(Inv(R)).B ∈ T ′ it follows that x ∈ BI2 , and thus x ∈ BI1 .When (x, y) ∈ (Inv(g(Inv(R))))I2 and Inv(R) is not generating from Lemma4 it follows that (x, y) ∈ g(R)I2 and together with ∃g(R).A v B ∈ T ′ itleads to x ∈ BI2 , and x ∈ BI1 .

    – Assume A v ∀R.B ∈ T , x ∈ AI1 , and (x, y) ∈ RI1 : x ∈ AI2 , and (x, y) ∈(g(R))I2 ∪ (Inv(g(Inv(R))))I2 . Then: ∃g(Inv(R)).A v B ∈ T ′ and if R is notgenerating or Inv(R) is generating, and A v ∀g(R).B ∈ T ′ if R is generating.When (x, y) ∈ (g(R))I2 and R is generating from A v ∀g(R).B ∈ T ′ itfollows that x ∈ BI2 , and thus x ∈ BI1 .When (x, y) ∈ (g(R))I2 and R is not generating, from Lemma 4 it followsthat (x, y) ∈ (Inv(g(Inv(R))))I2 : (y, x) ∈ (g(Inv(R)))I2 and together with∃g(Inv(R)).A v B ∈ T ′ it follows that x ∈ BI2 , and thus x ∈ BI1 .When (x, y) ∈ (Inv(g(Inv(R))))I2 and Inv(R) is not generating from Lemma4 it follows that (x, y) ∈ g(R)I2 and together with A v ∀g(R).B ∈ T ′ itleads to x ∈ BI2 , and x ∈ BI1 .When (x, y) ∈ (Inv(g(Inv(R))))I2 and Inv(R) is generating from Lemma 4,from ∃g(Inv(R)).A v B ∈ T ′ it follows that x ∈ BI2 , and thus x ∈ BI1 .

    – Assume A v> nR.B ∈ T and x ∈ AI1 . Then, A v> n(g(R)).B ∈ T ′ andx ∈ AI2 . As (x, y) ∈ (g(R))I2 implies (x, y) ∈ RI1 and y ∈ BI2 impliesy ∈ BI1 , it follows that x ∈ (> nR.B)I1 .

    – Assume A v6 nR.B ∈ T and x ∈ AI1 . Then, A v6 n(g(R)).B ∈ T ′,x ∈ AI2 , and consequently x ∈ (6 n(g(R)))I2 . We have that (x, y) ∈ RI1implies (x, y) ∈ (g(R))I2 ∪ (Inv(g(Inv(R))))I2 and y ∈ BI1 implies y ∈ BI2 .Assume (x, y) ∈ (Inv(g(Inv(R))))I2 , but (x, y) /∈ (g(R))I2 . Then R is notgenerating and Inv(R) is generating (otherwise there is a contradiction withLemma 4). Also, it is either the case that R = Q or R = Q− with Q− beingrewritable. But this is in contradiction with the notion of rewritable roles.Thus, in this case (x, y) ∈ RI1 implies (x, y) ∈ (g(R))I2 and x 6∈ (> nR.B)I1implies x 6∈ (> n(g(R)).B)I2 – contradiction. Thus, x ∈ (> nR.B)I1 .

  • – AssumedAi v

    ⊔Bj ∈ T and x ∈ (

    dAi)I1 . Then,

    dAi v

    ⊔Bj ∈ T ′,

    x ∈ (dAi)I2 , and thus x ∈ (

    ⊔Bj)I2 , which implies x ∈ (

    ⊔Bj)I1 .

    A.1 Reuse-safe Roles

    In this section we verify the correctness of the rewriting presented in Definition8 as stated in Theorem 5. To do so, we first proof correctness of a modifiedversion of the hypertableau algorithm introduced in [15]. From this result it isstraightforward to verify correctness of the aforementioned transformation.

    We proceed with some preliminary notions necessary for the definition of thehypertableau algorithm and the reuse safe strategy. Note that some of these areslightly modified as compared to the ones appearing [15]. To improve readability,we have simplified the algorithm to only cover the cases for Horn-SHOIQ on-tologies. Also, the >-rule is modified to automatically reuse auxiliary individualsto satisfy at least restrictions that feature existential roles.

    The algorithm requires that the DL axioms are preprocessed into DL-clauses– universally quantified implications containing DL concepts and roles as predi-cates. More specifically, DL axioms are preprocessed into HT-clauses – syntac-tically restricted DL-clauses on which the hypertableau calculus is guaranteedto terminate. HT-clauses are formally defined in Definition 5 of [15].

    Instead of reusing the lengthy preprocessing procedure introduced in Section4.1 of [15] we directly map the set of Horn-SHOIQ axioms into DL-clauses asdefined in Figure 5.7 Since we are only considering axioms in a very succinct nor-mal form this mapping is a much more straightforward procedure. By definitionall clauses produced by the mappings described in Figure 5 are HT-clauses.

    Note that, mapping (8) of Figure 5 contains a special type of atom, namelyy ≈ [email protected]. The annotation @x61R.D does not affect the meaning and y ≈[email protected] is semantically equivalent to y ≈ z. These annotations appear as partof the premise of the NI -rule (described in Figure 6).As in [15], the following lemma holds:

    Lemma 5. Let K be a Horn-SHOIQ knowledge base. Then K is equisatisfiablewith Ω(K) = (ΩT R(K), ΩA(K)), where ΩT R(K) is a set of HT-clauses andΩA(K) is an ABox, both obtained as shown in Figure 5, where Ω(K) is to beinterpreted with standard first order logic standard semantics.

    Lemma 5 follows from Lemma 3 in [15]. This result is completely straightfor-ward since, given a normalized Horn-SHOIQ ontology K, the transformationdefined in Figure 5 outputs the same set of HT-clauses as the more involvedpreprocessing process defined in Section 4.1 of the previously cited paper.We proceed now with a simplified definition of the hypertableau algorithm.

    Definition 9. (Hypertableau with Individual Reuse.)

    7

  • ΩTR(K) = {ΩT (α)|α ∈ T } ∪ {ΩR(β)|β ∈ R} (1)ΩA(K) = A (2)

    ΩT (C1 u . . . u Cn v D) 7→ C1(x) ∧ . . . ∧ Cn(x)→ D(x) (3)ΩT (∃R.C v D) 7→ R(x, y) ∧ C(y)→ D(x) (4)ΩT (C v ∀R.D) 7→ C(x) ∧ R(x, y)→ D(y) (5)ΩT (C v ∃R.D) 7→ C(x)→> 1R.D(x) (6)

    ΩT (C v> nR.D) 7→ C(x)→> nR.D(x) (7)

    ΩT (C v6 1R.D) 7→ C(x) ∧ R(x, y) ∧ D(y) ∧ R(x, z) ∧D(z)→ y ≈ [email protected] (8)

    ΩT (C v {a}) 7→ C(x) ∧Oa(z)→ x ≈ z (9)

    ΩR(R v S) 7→ R(x, y)→ S(x, y) (10)

    ΩR(R v S−) 7→ R(x, y)→ S(y, x) (11)

    where K = 〈T ,R,A〉 and every predicate of the form C(x) appearing in the body of a resulting DLclause such that C = > or in the head such that C = ⊥ is erased

    Fig. 5. Horn-SHOIQ Clauses

    Let K = 〈T ,R,A〉 be a Horn-SHOIQ ontology defined over the signatureNI, NC and NR. Let C be a set of HT-clauses such that C = ΩT R(K).

    Individuals. The set of auxiliary individuals NX is the smallest set suchthat αiRD ∈ NX for every role R, atomic concept D, and positive integer i. Theset of root individuals NO is the smallest set such that NI ∪ NX ⊆ NO, and ifx ∈ NO then x.〈R,D〉 ∈ NO, for each role R and named concept D. The set ofall individuals NA is the smallest set such that NO ⊆ NA and if x ∈ NA thenx.(i, R,D) ∈ NA for every role R, atomic concept D, and positive integer i. Theindividuals in NA \NO are blockable individuals. An individual x.(i, R,D) is asuccessor of x, and x is a predecessor of x.(i, R,D). Descendant and ancestorare the respective transitive closures of successor and predecessor.

    ABoxes. An ABox that contains only named individuals and no at-mostequalities is called an input ABox. The hypertableau algorithm works with gen-eralized ABoxes, which can contain assertions using the individuals from NA, aspecial assertion ⊥ that is false in all interpretations, and an acyclic confluentrelation 7→ on root individuals called renaming. The canonical name of a rootindividual a ∈ NO with respect to A, written ||a||A, is the normal form of awith respect to 7→ in A. If a occurs in A, then the relation 7→ must be such that||a||A = a.

    Pairwise Anywhere Blocking. The label of an individual is defined asLA(s) = {C | C(s) ∈ A and C is of the form A or > nR.A} and of an individualpair as LA(s, t) = {R | R(s, t) ∈ A}. Let ≺ be a transitive and irreflexive relationon NA such that, if s

    ′ is an ancestor of s, then s′ ≺ s. By induction on ≺, weassign to each individual in A a status as follows: a blockable individual s witha predecessor s′ is directly blocked by a blockable individual t with a predecessort′ if and only if t is not blocked, t ≺ s, LA(s) = LA(t), LA(s′) = LA(t′),

  • LA(s, s′) = LA(t, t′) and LA(s′, s) = LA(t, t′); s is indirectly blocked if and onlyif it has a predecessor that is blocked; and s is blocked if and only if it is directlyor indirectly blocked.

    Pruning. The Abox pruneA(s) is obtained from A by removing all assertionscontaining a descendent of s.

    Merging. The ABox mergeA(s 7→ t) is obtained from pruneA(s) by replacingthe individual s with the individual t in all assertions (but not in the renamingrelation 7→) and, if both t and s are root individuals, adding the renaming s 7→ t.

    Derivation Rules. Figure 6 specifies rules that, for A an ABox and C a setof HT-clauses, derive the ABoxes A1, . . . ,Al.

    Rule Precedence. The ≈-rule can be applied to a (possibly annotated) equal-ity s ≈ t in an ABox A only if A does not contain an equality of the forms ≈ [email protected] to which the NI-rule is applicable.

    Clash. An ABox A contains a clash if and only if ⊥ ∈ A; otherwise, A isclash free.

    Derivation. A derivation D = (T, λ) for a set of HT-clauses C and anABox A consists of a finitely branching tree T where every node has at mostone child and a function λ labeling the nodes of T with ABoxes such that (i)λ(�) = A for � the root of T , (ii) t ∈ T is a leaf of T if ⊥ ∈ λ(t) or no derivationrule is applicable to λ(t) and C, and (iii) otherwise, t ∈ T has child s suchthat λ(s) is exactly the result of applying on (arbitrarily chosen, but respectingthe precedence) applicable derivation rule to λ(t) and C. The derivation D issuccessful if it contains a leaf node labeled with a clash-free ABox.

    The main result of this section is conveyed in the following theorem:

    Theorem 6. Let C be a set of HT-clauses and A an input ABox. Then, (1) eachderivation produced by the hypertableau algorithm for C and A is finite, (2) if aderivation is successful then (C,A) is satisfiable and (3) if (C,A) is satisfiablethere exists a successful derivation.

    Proof. [Theorem 6] Statement (1) is immediate from the proof of Lemma 7in [15]. It is also trivial to see that (2) also holds: if there exist a successfulderivation then a model can be constructed for for (C,A) as shown in the proofof Lemma 6 in [15]. Showing claim (3) requires a more elaborate argument.

    We start this argument introducing function ar which maps a role R and twoindividuals or variables s, t to a binary predicate. Function ar will be used acrossthe rest of the argument to formally define further claims and is formally definedas follows:

    ar(R, s, t) =

    {R(s, t) R ∈ NRInv(R)(t, s) R /∈ NR

    We proceed with the definition of the precedence relation over individuals RAn and function [·] which maps an individual to a concept expression. Thesetwo will be used to properly formalize further claims.

    Let R be a role and An an HT-ABox produced by the hypertableau algorithmduring the reasoning process. Then RAn⊆ NA×NA is the minimal relation such

  • Fig. 6. Derivation Rules of the Hypertableau Calculus

    Hyp-rule

    if 1. r ∈ C, where r = U1 ∧ . . . ∧ Un → V ∈ C, and2. a mapping σ from variables in r to the individuals of A exists such that2.1 there is no x ∈ NV such that σ(x) is indirectly blocked,2.2 σ(Ui) ∈ A for each 1 6 i 6 m, and2.3 σ(V ) /∈ A,

    then A1 = A ∪ {⊥} if V is empty;A1 = A ∪ {σ(V )} otherwise.

    >-rule

    if 1. > nR.D(s) ∈ A,2. s is not blocked, and3. A does not contain individuals u1, . . . , un such that3.1 {R(s, ui), D(ui) | 1 6 i 6 n} ∪ {ui 6≈ uj | 1 6 i < j 6 n} ⊆ A, and3.2 for each 1 6 i 6 n, either ui is a successor of s or ui is not blocked,

    then A1 := A ∪ {R(s, ui), C(ui) | 1 6 i 6 n} ∪ {ui 6≈ uj | 1 < i < j 6 n} where eachui = αiRD if R is a safe role; otherwise every ui is a freshly introduced successors of s

    ≈-rule

    if 1. s ≈ t ∈ An,2. s 6= t, and3. neither s nor t is indirectly blocked

    then A1 := mergeA(s→ t) if t ∈ NI, t ∈ NO and s /∈ NI, or s is a descendant of t;A1 := mergeA(t→ s) otherwise

    ⊥-ruleif s 6≈ s ∈ Athe A1 := A ∪ {⊥}

    NI -rule

    if 1. s ≈ [email protected] ∈ A (the symmetry of ≈ applies as usual),2. u is a root individual,3. s is a blockable individual and it is not a successor of u, and4. t is a blockable individual

    then A1 := mergeA(s→ ||u.〈R,D〉||A)

    that RA0= {(s, t) | ar(R, s, t) ∈ A0} and depending on the expansion ruleapplied to derive An the relation RAn is defined from the relation

    n−1An as

    follows:

    – (Hyp-rule)• ar(S, x, y)→ ar(R, x, y), ar(S, s, t) ∈ An−1 and s SAn−1 t:

    RAn=

    RAn−1

    ∪{(s, t)}.• All other cases: RAn=

    RAn−1 .

    – (>-rule)• > nR.D(s) ∈ An−1 where R is safe: RAn=

    RAn−1 ∪{(s, αiRD)}.

    • > nR.D(s) ∈ An−1 where R is unsafe: RAn= RAn−1 ∪{(s, s.(i, R,D))}.

    • > nInv(R).D(s) ∈ Am−1 whereR is unsafe: RAn= RAn−1 ∪{(s.(i, R,D), s)}.

    – ((≈-rule) or (NI-rule)) An = mergeAn−1(s 7→ t): RAn= merge RAn−1

    (s 7→ t).

    Let [·] a function on NA defined as follows:

    [s] =

    {s} s ∈ NI∃Inv(R).> uD uXi s = αiRD∃Inv(R).[t] uD uXti s = t.(i, R,D)∃Inv(R).[t] uD s = t.〈R,D〉

  • where Xi are freshly introduced classes that allow us to differentiate the class ofall ith successors created due to some application of the >-rule.

    We show inductively that, if (C,A) is satisfiable, then the following properties(1− 9) hold for each HT-ABox in the derivation and each model I of (C,A):1. s ≈ [email protected] ∈ An implies [s]I = [u.〈R,B〉]I .2. ar(S, s, t) ∈ An and A(x)∧V (x, y)∧B(y)∧V (x, z)∧B(z)→ y ≈ [email protected] ∈ C

    such that S ≺∗R V imply [s]I ⊆ (∃S.[t])I .3. s ≈ t ∈ An, where s ≈ t may be annotated, implies [s]I = [t]I .4. s SAn t implies [s]

    I ⊆ (∃S.[t])I .5. ar(S, s, t) ∈ An and s 6 An t implies V v∗R Inv(S) for some safe role V .6. ar(S, s, t) ∈ An implies [s]I ⊆ (∃S.>)I .7. D(s) ∈ An implies [s]I ⊆ DI .8. s 6≈ t ∈ An implies [s]I 6= [t]I .9. s occurs syntactically in An implies [s]I 6= ∅.

    10. ⊥ 6= An.Note that, to verify statement (3), it suffices to show IH (A.1) and (A.1).

    The other claims are explicitly stated to properly structure the proof. The basecase of the induction, namely the ABox A0, trivially satisfies (1) - (A.1). For theinductive step, the IH states that (1 - A.1) hold for every assertion α ∈ An−1when a rule from Figure 6 is applied to produce a new derivation An.

    IH (1): s ≈ [email protected] ∈ An only if

    1. (Hyp-rule) C(x) ∧ R(x, y) ∧ D(y) ∧ R(x, z) ∧ D(z) → z ≈ y ∈ C and{C(u), R(u, s), D(s), R(u, t), B(t)} ⊆ An−1.We apply (2) to R(u, s) to obtain [u]I = ∃R.[s]I . We apply (7) and D(s) toobtain [u]I ⊆ CI and sI ⊆ DI . Since C(x)∧R(x, y)∧D(y)∧R(x, z)∧D(z)→z ≈ y ∈ C we can conclude [s]I = [u.〈R,D〉]I . Note that [u.〈i, R,D〉] =∃Inv(R).[u] uD.

    2. (≈-rule) Two possible cases arise:(a) {s ≈ [email protected], v ≈ t} ⊆ An−1 such that t ∈ NI, v is a descendant of

    t, or t ∈ NO and v /∈ NI. We apply IH (1) to s ≈ [email protected] and obtain[s]I = [u.〈i, R,D〉]I .

    (b) {s ≈ v, v ≈ [email protected]} ⊆ An−1 such that s ∈ NI, u is a descendant ofs, or s ∈ NO and u /∈ NI. We apply IH (1) to v ≈ [email protected] to obtain[v]I = [u.〈i, R,D〉]I . We apply IH (3) to s ≈ v to obtain [s]I ≈ [v]I .Hence [s]I = [u.〈i, R,D〉]I .

    3. (NI-rule) Two cases arise:(a) v ≈ [email protected] ∈ An−1 such that s = u.〈R,D〉, u is a root individual, v is a

    blockable individual that is not a successor of u, t is a blockable individualand neither v nor t is indirectly blocked. Then [s]I = [u.(R,D)]I sinces = u.(R,D).

    (b) v ≈ [email protected] ∈ An−1 such that t = u.〈R,D〉, u is a root individual, vis a blockable individual that is not a successor of u, s is a blockableindividual and neither v nor s is indirectly blocked. We can apply IH (1)to v ≈ [email protected] ∈ An−1 to derive [s]I = [u.(R,D)]I since s = u.(R,D).

  • IH (2): ar(S, s, t) ∈ An only if

    1. (Hyp-rule) ar(R, x, y) → ar(S, x, y) ∈ C and ar(R, s, t) ∈ An−1. Note thatsince S ≺∗R V we also have that R ≺∗R V . We apply IH (2) to ar(R, s, t) toobtain [s]I ⊆ (∃R.[t])I . The claim holds since RI ⊆ SI Inv(R)I ⊆ Inv(S)I .

    2. (∃-rule) Two possible cases arise:(a) ∃S.D(s) ∈ An−1. We apply IH (7) to ∃S.D(s) to obtain [s]I ⊆ (∃S.D)I .

    The claim holds since t = s.(S,D) and [t] = ∃Inv(S).[s] uD.(b) ∃Inv(S).D(t) ∈ An−1. The claim holds since s = t.(S,D) and [s] =∃S.[t] uD.

    3. (≈-rule) Two possible cases arise:(a) {ar(S, s, u), u ≈ t} ⊆ An−1 such that t ∈ NI, u is a descendant of t, or t ∈

    NO and u /∈ NI. We apply IH (2) to ar(S, s, u) to obtain [s]I ⊆ (∃S.[u])I .We apply IH (3) to u ≈ t to obtain [u]I = [t]I . Hence [s]I ⊆ (∃S.[t])I .

    (b) {s ≈ u, ar(S, u, t)} ⊆ An−1 such that s ∈ NI, u is a descendant of s, ors ∈ NO and u /∈ NI. Analogous to the previous case.

    4. (NI-rule) Two cases arise:(a) {ar(S, v, t), v ≈ [email protected]} ⊆ An−1 such that s = u.〈R,D〉, u is a root

    individual, v is a blockable individual that is not a successor of u, t is ablockable individual and neither v nor t is indirectly blocked. We applyIH (1) to v ≈ [email protected] to obtain [v]I = [u.〈R,D〉]I . We apply IH (2) toar(S, v, t) to conclude [v]I ⊆ (∃S.[t])I . Consequently [s]I ⊆ (∃S.[t])I .

    (b) {ar(S, s, v), v ≈ [email protected]} ⊆ An−1 such that t = u.〈R,D〉, u is a rootindividual, v is a blockable individual that is not a successor of u, s is ablockable individual and neither v nor s is indiredctly blocked. Analogousto the previous case.

    Remark: both S and Inv(S) are necessarily unsafe roles in case 2.

    IH (3): s ≈ t ∈ An only if

    1. (Hyp-rule) C(x) ∧ ar(R, x, y) ∧ D(y) ∧ ar(R, x, z) ∧ D(z) → z ≈ y ∈ Cand {C(u), ar(R, u, s), D(s), ar(R, u, t), D(t)} ⊆ An−1. We apply IH (2) toar(Inv(R), s, u) and ar(R, u, t) and obtain [s]I ⊆ (∃Inv(R).[u])I and [u]I ⊆(∃R.[t])I . Applying IH (7) to C(u), D(s) and D(t) we obtain [u]I ⊆ CI ,[s]I ⊆ DI and [t]I ⊆ DI . We can conclude that [s]I 6= ∅ by IH (A.1). Con-sequently [s]I ⊆ (D u ∃Inv(R).(C u ∃R.(D u [t])))I . Thus [s]I ⊆ [t]I sinceC(x) ∧ ar(R, x, y) ∧ D(y) ∧ ar(R, x, z) ∧ D(z) → z ≈ y ∈ C. An analogousargument can be made to show that [t]I ⊆ [s]I . Hence [s]I = [t]I .

    2. (≈-rule) Two possible cases arise:(a) {s ≈ u, u ≈ t} ⊆ An−1 such that t ∈ NI, u is a descendant of t, or

    t ∈ NO and u /∈ NI. We apply IH (3) to both s ≈ u and u ≈ t to obtain[s]I = [u]I and [u]I = [t]I . Hence [s]I = [t]I .

    (b) {s ≈ u, u ≈ t} ⊆ An−1 such that s ∈ NI, u is a descendant of s, ors ∈ NO and u /∈ NI. Analogous to the previous case.

    3. (NI-rule) Two possible cases arise:

  • (a) {v ≈ t, v ≈ [email protected]} ⊆ An−1 such that s = u.〈R,D〉, u is a rootindividual, v is a blockable individual that is not a successor of u, t is ablockable individual and neither v nor t is indirectly blocked. We apply(1) to v ≈ [email protected] to conclude [v]I = [u.〈R,D〉]I . We apply (3) tov ≈ t to obtain [v]I = [t]I . Consequently, [s]I = [t]I .

    (b) {s ≈ v, v ≈ [email protected]} ⊆ An−1 such that t = u.〈R,D〉, u is a rootindividual, v is a blockable individual that is not a successor of u, s is ablockable individual and neither v nor s is indirectly blocked. Analogousto the previous one.

    Remark: IH (2) can be applied in case 1 sinceR ≺∗O R. Also, note that ar(R, u, s) =ar(Inv(R), s, u).

    IH (4) : s SAn t only if

    1. (Hyp-rule) ar(R, x, y) → ar(S, x, y) ∈ C, ar(R, s, t) ∈ An−1 and s RAn−1 t.We apply IH (4) to s RAn−1 t to obtain [s]

    I ⊆ (∃R.[t])I . This implies[s]I ⊆ (∃S.[t])I since RI ⊆ SI .

    2. (∃-rule) Two possible cases arise:(a) ∃S.D(s) ∈ An−1. We can apply IH (7) to ∃S.D(s) to infer [s]I ⊆ ∃S.DI .

    Note that t = s.(S,D) or t = αSD and consequently [t] = ∃Inv(S).[s]uDor [t] = ∃Inv(S).> uD. Either way [s]I ⊆ (∃S.[t])I .

    (b) ∃Inv(S).D(t) ∈ An−1. Then s = t.Inv(S)D, [s] = ∃S.[t] u D and hence[s]I ⊆ (∃S.[t])I .

    3. (≈-rule) Two possible cases arise:(a) t ≈ u ∈ An−1 and s SAn−1 u such that t ∈ NI, u is a descendant of

    t, or t ∈ NO and u /∈ NI. We apply IH (4) to s SAn−1 u to obtain[s]I ⊆ (∃S.[u])I and IH (3) to u ≈ t to obtain [u]I = [t]I . Hence [s]I ⊆(∃S.[t])I .

    (b) s ≈ u ∈ An−1 and u SAn−1 t such that s ∈ NI, u is a descendant of s,or s ∈ NO and u /∈ NI. Analogous to the previous case.

    4. (NI-rule) Two possible cases arise:

    (a) v SAn−1 t and v ≈ [email protected] ∈ An−1 such that s = u.〈R,D〉, u is a

    root individual, v is a blockable individual that is not a successor of u,t is a blockable individual and neither v nor t is indirectly blocked. Weapply (1) to v ≈ [email protected] to conclude [v]I = [u.〈R,D〉]I . We apply (3)to v SAn−1 t to obtain [v]

    I ⊆ (∃S.[t])I . Consequently, [s]I ⊆ (∃S.[t])I .(b) s SAn−1 v and v ≈ w@

    u61R.D ∈ An−1 such that t = u.〈R,D〉, u is a root

    individual, v is a blockable individual that is not a successor of u, s is ablockable individual and neither v nor s is indirectly blocked. Analogousto the previous case.

  • IH (5) ar(S, s, t) ∈ An and s 6 SAn t only if

    1. (Hyp-rule) ar(R, x, y) → ar(S, x, y) ∈ C and ar(R, s, t) ∈ An−1. Note thatnecessarily s 6 RAn−1 t as otherwise s

    SAn t. We apply IH (5) to ar(R, s, t)

    to obtain V v∗R Inv(R) which implies V v∗R Inv(S).2. (∃-rule) ∃Inv(S).D(t) ∈ An−1. Then s = αInv(S)D and V v∗R Inv(S) for a safe

    role V = Inv(S).

    3. (≈-rule) Two possible cases arise:(a) {s ≈ u, ar(S, u, t)} ⊆ An−1 such that s ∈ NI or s ∈ NO and u /∈ NI. Note

    that necessarily u 6 SAn−1 t as otherwise s SAn t. We apply IH (5) to

    ar(S, u, t) to obtain V v∗R Inv(S) for some safe role V .(b) {ar(S, s, u), u ≈ t} ⊆ An−1 and s A u such that t ∈ NI, or t ∈ NO and

    u /∈ NI. Analogous to the previous case.4. (NI-rule) Analogous to case 2.a.

    IH (6): ar(R, s, t) ∈ An only if

    1. (Hyp-rule) ar(S, x, y) → ar(R, x, y) ∈ C and ar(S, s, t) ∈ An−1. We apply IH(6) to ar(S, s, t) ∈ An−1 to obtain [s]I ⊆ ∃S.>I . We conclude [s]I ⊆ ∃R.>Isince SI ⊆ RI .

    2. (∃-rule) Two possible cases arise:(a) ∃R.D(s) ∈ An−1. We apply IH (7) to ∃R.D(s) to obtain [s]I ⊆ ∃R.DI .

    Hence, [s]I ⊆ ∃R.>.(b) ∃Inv(R).D(t) ∈ An−1. Then s = t.Inv(R)D or s = αInv(R)D and conse-

    quently [s] = ∃R.[t] uD or [s] = ∃R.> uD. Either way [s]I ⊆ ∃R.>.3. (≈-rule) Two possible cases arise:

    (a) {ar(R, s, u), u ≈ t} ⊆ An−1 such that t is named or u is a descendantof t. We apply IH (6) to ar(R, s, u) ∈ An−1 to obtain [s]I ⊆ (∃R.[u])I .Hence sI ⊆ (∃R.>)I

    (b) {s ≈ u, ar(R, u, t)} ∈ An−1 such that s is named or u is a descendant ofs. We apply IH (6) to ar(R, u, t) ∈ An−1 to obtain [u]I ⊆ (∃R.>)I andIH (3) to s ≈ u to obtain [s]I = [u]I . Hence sI ⊆ (∃R.>)I .

    4. (NI-rule) Two possible cases arise:

    (a) ar(R, v, t), v ≈ [email protected] ∈ An−1 such that s = u.〈R,D〉, u is a rootindividual, v is a blockable individual that is not a successor of u, t is ablockable individual and neither v nor t is indirectly blocked. We apply(1) to v ≈ [email protected] to conclude [v]I = [u.〈R,D〉]I . We apply (6) toar(R, v, t) to obtain [v]I ⊆ (∃S.>)I . Consequently, [s]I ⊆ (∃S.[t])I .

    (b) {ar(R, s, v), v ≈ [email protected]} ⊆ An−1 such that t = u.〈R,D〉, u is a rootindividual, v is a blockable individual that is not a successor of u, s is ablockable individual and neither v nor s is indirectly blocked. We apply(6) to ar(R, s, v) to obtain [s]I ⊆ (∃S.>)I .

  • IH (7) D(s) ∈ An only if

    1. (Hyp-rule) Five possible cases arise:

    (a)∧Ci(x) → D(x) ∈ C and Ci(s) ∈ An−1. We apply (7) to all Ci(s) ∈An−1 to obtain [s]I ⊆ CIi . Hence [s]I ⊆ DI .

    (b) R(x, y)∧C(y)→ D(x) ∈ C and {C(s), ar(R, s, t)} ⊆ An−1. We apply (7)to C(s) ∈ An−1 to obtain [s]I ⊆ C. Two cases arise:

    i. s RAn−1 t. We apply (4) to ar(R, s, t) to obtain [s]I ⊆ (∃R.[t]I).

    Hence, [s]I ⊆ Dii. s 6 RAn−1 t. We apply (5 to ar(R, s, t) to obtain V v

    ∗R Inv(R) for

    some safe role V . Note that ar(R, x, y) ∧ C(y) → D(x) ∈ C implies∃R.C v D ∈ O. Since V v∗R Inv(R) for V a safe role we can concludethat C = > by contradiction. We apply IH (6) to ar(R, s, t) to obtain[s]I ⊆ (∃R.[t])I and conclude [s]I ⊆ D.

    (c) C(x) ∧ R(x, y) → D(y) ∈ C and {C(t), R(t, s)} ⊆ An−1. Analogous tothe previous case. Note that C v ∀R.D ≡ ∃R−.C v D.

    (d) C(x)→> nR.D(x) ∈ C and C(s) ∈ An. Analogous to case 1.a.(e) → D(x) and s occurs in An. Trivial.

    2. (>-rule) > nR.D(t) ∈ An−1. Then s = t.iRD or s = αiRD. Either way[s]I ⊆ DI .

    3. (≈-rule) {D(u), u ≈ s} ⊆ An−1 such that such that u ∈ NI, s is a descendantof u, or u ∈ NO and s /∈ NI. We apply IH (3) to u ≈ s to obtain [u]I = [s]Iand IH (7) to D(u) to conclude uI ⊆ DI . Hence [s]I ⊆ DI

    4. (NI-rule) {D(v), v ≈ [email protected]} ⊆ An−1 such that s = u.〈R,D〉, u is a rootindividual, v is a blockable individual that is not a successor of u, t is ablockable individual and neither v nor t is indirectly blocked. We apply (1)to v ≈ [email protected] to conclude [v]I = [u.〈R,D〉]I . We also apply IH (7) toD(v) to conclude vI ⊆ DI . Hence [s]I ⊆ DI .

    IH (8) s 6≈ t ∈ An only if:

    1. (>-rule) > nR.D(u) ∈ An such that n > 2. Then s = u.(i, R,D) andt = u.(j, R,D), or s = αiRD and t = αjRD. Either way [s]

    I 6= [t]I .2. (≈-rule) Two possible cases arise:

    (a) {s 6≈ v, v ≈ t} ⊆ An−1 such that t ∈ NI, v is a descendant of t, or t ∈ NOand v /∈ NI. We apply IH (8) to s 6≈ v to obtain [s]I 6= [v]I and IH (3)to v ≈ t and obtain [v]I = [t]I . Consequently, [s]I 6= tv]I

    (b) {s ≈ v, v 6≈ t} ⊆ An−1 such that s ∈ NI, u is a descendant of s, ors ∈ NO and u /∈ NI. Analogous to the previous case.

    3. (NI-rule) Analogous to the previous case, just make use of IH 1 instead of 3.

    IH (9) claim:s occurs syntactically in An implies [s]I 6= ∅. We only need toverify this when s appears for the first time in An, as for all other cases we canjust use this IH to verify the claim. Individual s appears for the first time in Anonly if:

  • 1. (>-rule): > nR.D(t) ∈ An−1. Then s = αiRD or s = t.(i, R,D). We applyIH 9 over t to conclude non-emptiness of [t]I . Hence, [s]I must be non-emptyas well.

    2. (NI-rule): v ≈ [email protected]} ⊆ An−1 such that s = u.〈R,D〉, u is a root indi-vidual, v is a blockable individual that is not a successor of u, t is a blockableindividual and neither v nor t is indirectly blocked. We apply IH 9 over vto conclude non-emptiness of [v]I . By IH 1 we have that [v]I = [s]I . Hence,[s]I must be non-empty as well.

    IH (A.1) claim: ⊥ /∈ An. ⊥ /∈ An only if D(x) →∈ C and D(s) ∈ An−1 ors 6≈ s for some s. Note that by IH (9) we have that [s]I must be non-empty.Hence, s 6≈ s /∈ An−1 by contradiction, as we have that by IH (8) this wouldimply that sI 6= sI . Again, by contradiction D(s) /∈ An−1. This would implythat [s]I ⊆ DI by IH (8) from which we would conclude unsatisfiability of K.Since we know that K is satisfiable (statement (3)) the is must not be the case.��

    It is straightforward to see the previously modified algorithm produces thesame kind of ABoxes for K than the regular algorithm would for Ψ(K) whereauxiliary individuals αiRD are substituted by the newly introduced nominals{ciRD} (after some extra rule applications). Hence, the previous argument canbe used to show equisatisfiability of K and Ψ(K). Since classification is reducedto equisatisfiability, we can always do this reduction to compute the class hier-archy of an ontology. Reusing the previous argument we also proof the followingtheorem:

    Lemma 6. K |= C(a) if and only if Ψ(K) |= C(a).

    Proof. The previously (lengthy) argument can be rewritten reformulating IH8 into

    D(s) ∈ An implies K |= [s] ⊆ DHence, for all s ∈ NI, C(s) ∈ An implies K |= C(s). For the completeness part ofthe argument we can always proof the contrapositive. Namely, that if D(t) /∈ Anthen there exist a model for which tI /∈ CI . This model can be constructed fromAn as shown in the proof of Lemma 6 in [15]. �

    Hence, when all roles are safe and the ontology can be translated into OWLRL, we can perform instance retrieval in “one pass” transforming the DL clausesinto datalog rules and materializing all consequences. Equality is transformed inthe usual way, adding the following set of predicates to the program:

    → x ≈ xx ≈ y → y ≈ x

    x ≈ y ∧ y ≈ z → x ≈ zP (x1, . . . , xi, . . . xn) ∧ xi ≈ y → P (x1, . . . , y, . . . xn)

    for every predicate P and every variable xi.

    EL-ifying Ontologies