# Query Answering for OWL-DL with Rules Boris Motik Ulrike Sattler Rudi Studer.

## Presentation on theme: "Query Answering for OWL-DL with Rules Boris Motik Ulrike Sattler Rudi Studer."— Presentation transcript:

Query Answering for OWL-DL with Rules Boris Motik Ulrike Sattler Rudi Studer

2 Contents Introduction Preliminaries Decidability Problems DL-safe Rules Decidability of Query Answering Query Answering by Disjunctive Datalog Conclusion & Future Work

3 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; easily lead to undecidability)  usually support non-monotonic reasoning

4 Goals Extending OWL-DL with rules is needed  query answering should be decidable  SWRL approach is undecidable In this talk I…  …explain why adding rules to DL leads to undecidability  …present DL-safe rules  …discuss the expressivity of the approach  …show that query answering is decidable  …give an algorithm for query answering

5 Contents Introduction Preliminaries Decidability Problems DL-safe Rules Decidability of Query Answering Query Answering by Disjunctive Datalog Conclusion & Future Work

6 Preliminaries Atomic concepts : C C u D C t D 9 R.C 8 R.C · n R.C (R is simple) ¸ n R.C (R is simple) { i 1, …, i n } Concept Expressions C v D C ´ D TBox Axioms C(a) R(a,b) a ¼ b ABox Axioms R v S Trans(R) RBox Axioms Atomic roles R – (inverse roles) Roles OWL-DL is SHOIN (D) My algorithms support SHIQ (D) Main difference: nominals Semantics is  (KB) by translating KB into FOL

7 Contents Introduction Preliminaries Decidability Problems DL-safe Rules Decidability of Query Answering Query Answering by Disjunctive Datalog Conclusion & Future Work

8 Example for Termination Problems Question: does KB ² Grandchild(Jane)?  this is the case iff KB [ { : Grandchild(Jane) } is unsatisfiable  show by trying to build a model peter x1x1 x2x2 Person 9 father.Person father Person 9 father.Person father Person father 9 father.Person KB implies an infinite sequence of fathers  enumerating all of them leads to non-termination  advanced techniques needed to ensure termination Grandchild

9 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) Peter x1x1 x2x2 Person 9 father.Person father Person 9 father.Person father Person father 9 father.Person Peter x1x1 Person 9 father.Person father Person 9 father.Person father x 1 is blocked by Peter, so reuse successors of Peter. Grandchild

10 Why is Blocking Possible? 9 S.( 9 R.C u 9 R.D) v Q, 8 x:{[ 9 y: S(x,y) Æ ( 9 x: R(y,x) Æ C(x)) Æ ( 9 x: R(y,x) Æ D(x))] ! Q(x)}, 8 x,x 1,x 2,x 3 :{ S(x,x 1 ) Æ R(x 1,x 2 ) Æ C(x 2 ) Æ R(x 1,x 3 ) Æ D(x 3 ) ! Q(x) } In OWL-DL only tree-like axioms are allowed  (modulo technicalities concerning transitivity or nominals) x x1x1 S x2x2 x3x3 RR 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

11 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) Ã hasParent(x,z), hasSibling(y,z), Female(y) hasAunt(Jane,Mary) Ã hasParent(Jane,Ann), hasSibling(Mary,Ann), Female(Mary) hasAunt(Ann,Jane) Ã hasParent(Ann,Mary), hasSibling(Jane,Mary), Female(Jane) … Jane Mary Ann propositional clauses

12 Combining OWL-DL with Rules OWL-DL + Rules = Decidability due to tree-like axioms + Decidability due to finite number of individuals = Trouble! OWL-DL + Rules = Decidability due to tree-like axioms + Decidability due to finite number of individuals = Trouble!

13 Contents Introduction Preliminaries Decidability Problems DL-safe Rules Decidability of Query Answering Query Answering by Disjunctive Datalog Conclusion & Future Work

14 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) Ã Person(x), livesAt(x,y), worksAt(x,y) Not DL-safe, since x and y occur only in DL-atoms. Homeworker(x) Ã 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).

15 (KB, P) ² BadChild(Cain) With normal (DL-unsafe) rules: Cain is a grandchild (as before) Cain has a father (Adam) and a sibling that he hates (Abel) (KB, P) ² BadChild(Romulus) Romulus hates Remus We do not know who the father of Romulus and Remus is, but we know that he exists Expressivity (I)

16 With DL-safe rules: (KB, P) ² BadChild’(Cain) We know the identity of Cain’s father (Adam) We do not know the identity of Cain’s father, so O (y) cannot be matched to an individual (KB, P) ² BadChild’(Romulus) Expressivity (II) Intuitive semantics: BadChild’ is a known child with a known father who hates some of his known siblings.

17 Reasoning with DL-safe rules does not mean “derive DL consequences first, and then apply the rules.” common misconception; significantly changes semantics Oedipus may be a good or a bad child. KB ² GoodChild(Oedipus) Expressivity (III) KB ² BadChild’(Oedipus) KB ² Child(Oedipus) Either way, Oedipus is a child. This is not derived by applying the rules to consequences of the DL part.

18 Expressivity (IV) DL-safety does not reduce component languages DL-safety allows exchanging consequences between components about explicit individuals only DL-safety does increase expressivity  rules alone cannot derive KB ² BadChild’(Cain)  no existential quantifiers  DL alone cannot derive KB ² BadChild’(Cain)  non-tree-like rules needed

19 Contents Introduction Preliminaries Decidability Problems DL-safe Rules Decidability of Query Answering Query Answering by Disjunctive Datalog Conclusion & Future Work

20 Decidability of Query Answering Theorem: Query answering in (KB, P) is decidable. Proof: By grounding P and reduction to DL satisfiability. KB [ { BC’(x) Ã 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) Ç : GC(Cain) Ç : par(Cain, Adam) Ç : par – (Adam, Abel) Ç : hates(Cain, Abel), BC’(Abel) Ç : GC(Abel) Ç : par(Abel, Adam) Ç : par – (Adam, Cain) Ç : 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. (KB, P) ²  iff  (KB) [ P [ { :  } is unsatisfiable

21 Contents Introduction Preliminaries Decidability Problems DL-safe Rules Decidability of Query Answering Query Answering by Disjunctive Datalog Conclusion & Future Work

22 Query Answering by Disjunctive Datalog Theorem: (KB, P) ²  iff DD(KB) [ P ² . Proof: By adapting slightly the original correctness proof for the reduction. Expected to be practicable, since it allows reusing deductive database techniques 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)

23 Contents Introduction Preliminaries Decidability Problems DL-safe Rules Decidability of Query Answering Query Answering by Disjunctive Datalog Conclusion & Future Work

24 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