# Query Answering for OWL-DL with Rules

```Query Answering for
OWL-DL with Rules
Boris Motik
Ulrike Sattler
Rudi Studer
Contents
•Introduction
•Preliminaries
•Decidability Problems
•DL-safe Rules
•Conclusion &amp; Future Work
2
Introduction
• OWL-DL – a decidable fragment of FOL
 allows existential and universal quantifiers
 quantifier usage restricted to make reasoning decidable
 only tree-like axioms allowed
 expressivity not sufficient for certain practical problems
• Rule systems – a different set of choices
 decidability achieved by allowing universal quantifiers only
 existential quantifiers possible (function symbols required;
 usually support non-monotonic reasoning
3
Goals
• Extending OWL-DL with rules is needed
 query answering should be decidable
 SWRL approach is undecidable
• In this talk I…
 …present DL-safe rules
 …discuss the expressivity of the approach
 …show that query answering is decidable
 …give an algorithm for query answering
4
Contents
•Introduction
•Preliminaries
•Decidability Problems
•DL-safe Rules
•Conclusion &amp; Future Work
5
Preliminaries
• OWL-DL is
SHOIN(D)
• My algorithms
support SHIQ(D)
• Main difference:
nominals
• Semantics is (KB)
by translating KB
into FOL
Concept Expressions
TBox Axioms
Atomic concepts
:C
CuD
CtD
9 R.C
8 R.C
&middot; n R.C (R is simple)
&cedil; n R.C (R is simple)
CvD
C&acute;D
ABox Axioms
C(a)
R(a,b)
a&frac14;b
a&frac14;b
{ i1, …, in }
RBox Axioms
Roles
RvS
Atomic roles
R– (inverse roles)
Trans(R)
6
Contents
•Introduction
•Preliminaries
•Decidability Problems
•DL-safe Rules
•Conclusion &amp; Future Work
7
Example for Termination Problems
• Question: does KB &sup2; Grandchild(Jane)?
 this is the case iff KB [ { :Grandchild(Jane) } is unsatisfiable
 show by trying to build a model
Grandchild
Person
9 father.Person
peter
Person
9 father.Person
father
x1
father
Person
9 father.Person
x2
father
• KB implies an infinite sequence of fathers
 enumerating all of them leads to non-termination
 advanced techniques needed to ensure termination
8
Termination in DL Algorithms
• Each father does not need to be distinct, so an infinite model can
be wound up to a finite model (using blocking)
Grandchild
Person
9 father.Person
Peter
father
Grandchild
Person
9 father.Person
Peter
Person
9 father.Person
x1
father
Person
9 father.Person
x2
father
Person
9 father.Person
father
x1
father
x1 is blocked by Peter,
so reuse successors of Peter.
9
Why is Blocking Possible?
• In OWL-DL only tree-like axioms are allowed
 (modulo technicalities concerning transitivity or nominals)
9 S.(9 R.C u 9 R.D) v Q
,
8 x:{[ 9 y: S(x,y) &AElig; (9 x: R(y,x) &AElig; C(x)) &AElig; (9 x: R(y,x) &AElig; D(x))] ! Q(x)} ,
8 x,x1,x2,x3:{ S(x,x1) &AElig; R(x1,x2) &AElig; C(x2) &AElig; R(x1,x3) &AElig; D(x3) ! Q(x) }
x
S
x1
R
R
x2
x3
• This restriction ensures the tree-model property
 if there is a model, a tree-like model always exists as well
• Tree-like models can always be wound up into finite
(representations of) models
 SHIQ models can be infinite trees, but can be finitely represented
 SHOIN models need not be trees, but can be finitely represented
10
Reasoning with (function-free) Rules
• No existential quantifiers
 limited to only explicitly introduced individuals
 = a finite number for finite knowledge bases
• Can enforce arbitrary-shaped models
 for reasoning, examine all possible assignments of individuals to
variables (grounding)
 reasoning is reduced to propositional logic
hasAunt(x,y) &Atilde; hasParent(x,z), hasSibling(y,z), Female(y)
Jane
Mary
Ann
propositional clauses
hasAunt(Jane,Mary) &Atilde; hasParent(Jane,Ann), hasSibling(Mary,Ann), Female(Mary)
hasAunt(Ann,Jane) &Atilde; hasParent(Ann,Mary), hasSibling(Jane,Mary), Female(Jane)
…
11
Combining OWL-DL with Rules
OWL-DL + Rules
=
Decidability due to tree-like axioms
+
Decidability due to finite number of individuals
=
Trouble!
12
Contents
•Introduction
•Preliminaries
•Decidability Problems
•DL-safe Rules
•Conclusion &amp; Future Work
13
Definition: DL-safe Rules
• DL-safe program P contains rules with concepts and roles from
KB as unary resp. binary predicates in head or body (DL-atoms)
• Each variable occurs in a non-DL-atom in the body (DL-safety)
 makes rules applicable only to explicitly introduced individuals
• Semantics: (KB, P) is semantically equivalent to (KB) [ P
 rules interpreted as clauses (no non-monotonic reasoning)
Homeworker(x) &Atilde; Person(x), livesAt(x,y), worksAt(x,y)
Not DL-safe, since x and y
occur only in DL-atoms.
Homeworker(x) &Atilde; Person(x), livesAt(x,y), worksAt(x,y), O(x), O(y)
We assume that there is a fact O()
for each individual  in the ABox.
(KB contains Homeworker, livesAt, Person, worksAt).
14
Expressivity (I)
With normal
(DL-unsafe)
rules:
• Cain is a grandchild (as before)
• Cain has a father (Adam) and a
sibling that he hates (Abel)
• Romulus hates Remus
• We do not know who the father of
Romulus and Remus is, but we
know that he exists
15
Expressivity (II)
With DL-safe
rules:
• We know the identity of Cain’s
• We do not know the identity of
Cain’s father, so O(y) cannot be
matched to an individual
Intuitive semantics: BadChild’ is a known child with a known father
who hates some of his known siblings.
16
Expressivity (III)
• Reasoning with DL-safe rules does not mean “derive
DL consequences first, and then apply the rules.”
• common misconception; significantly changes semantics
KB &sup2; GoodChild(Oedipus)
KB &sup2; Child(Oedipus)
Oedipus may be a good or a bad child.
Either way, Oedipus is a child.
This is not derived by applying the rules
to consequences of the DL part.
17
Expressivity (IV)
• DL-safety does not reduce component languages
• DL-safety allows exchanging consequences between
• DL-safety does increase expressivity
 rules alone cannot derive KB &sup2; BadChild’(Cain)
 no existential quantifiers
 DL alone cannot derive KB &sup2; BadChild’(Cain)
 non-tree-like rules needed
18
Contents
•Introduction
•Preliminaries
•Decidability Problems
•DL-safe Rules
•Conclusion &amp; Future Work
19
• Theorem: Query answering in (KB, P) is decidable.
• Proof: By grounding P and reduction to DL satisfiability.
(KB, P) &sup2;  iff (KB) [ P [ {: } is unsatisfiable
KB [ { BC’(x) &Atilde; GC(x), par(x,y), par–(y,z), hates(x,z), O(x), O(y), O(z),… } is unsatisfiable
• grounding by explicit individuals { Cain, Abel and Adam }
• possible since O contains only explicit individuals
KB [ { BC’(Cain) &Ccedil; :GC(Cain) &Ccedil; :par(Cain, Adam) &Ccedil; :par–(Adam, Abel) &Ccedil; :hates(Cain, Abel),
BC’(Abel) &Ccedil; :GC(Abel) &Ccedil; :par(Abel, Adam) &Ccedil; :par–(Adam, Cain) &Ccedil; :hates(Abel, Cain)…}
• select from each clause don’t-know non-deterministically
a literal and assume it is true
KB [ { BC’(Cain), :GC(Abel) …} = KB’ is unsatisfiable
KB’ is an OWL-DL knowledge base, so satisfiability can be decided by standard algorithms.
20
Contents
•Introduction
•Preliminaries
•Decidability Problems
•DL-safe Rules
•Conclusion &amp; Future Work
21
• The algorithm is inefficient due to non-determinism
• For SHIQ, query answering can be done by reduction to
disjunctive datalog
SHIQ
KB
Elimination of
Transitivity
Axioms
Translation
Into
Clauses
Saturation
by BS
Elimination
of Function
Symbols
Conversion
to DD
Disjunctive
Program
DD(KB)
• Theorem: (KB, P) &sup2;  iff DD(KB) [ P &sup2; .
• Proof: By adapting slightly the original correctness proof
for the reduction.
• Expected to be practicable, since it allows reusing
deductive database techniques
22
Contents
•Introduction
•Preliminaries
•Decidability Problems
•DL-safe Rules
•Conclusion &amp; Future Work
23
Conclusion
• DL-safe rules:
 restrict application of rules to individuals explicitly
introduced in the ABox to achieve decidability
 do not restrict component languages
 increase expressivity of component languages
 …can be simply appended to the result of the reduction of
SHIQ to disjunctive datalog
• Future work:




extend reduction to support nominals (to support OWL-DL)
implement KAON2 – a new hybrid reasoner
conduct a thorough performance evaluation
support some kind of non-monotonic reasoning
24
```