Query Answering for OWL-DL with Rules Boris Motik Ulrike Sattler Rudi Studer Contents •Introduction •Preliminaries •Decidability Problems •DL-safe Rules •Decidability of Query Answering •Query Answering by Disjunctive Datalog •Conclusion & 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; easily lead to undecidability) 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… …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 4 Contents •Introduction •Preliminaries •Decidability Problems •DL-safe Rules •Decidability of Query Answering •Query Answering by Disjunctive Datalog •Conclusion & 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 · n R.C (R is simple) ¸ n R.C (R is simple) CvD C´D ABox Axioms C(a) R(a,b) a¼b a¼b { i1, …, in } RBox Axioms Roles RvS Atomic roles R– (inverse roles) Trans(R) 6 Contents •Introduction •Preliminaries •Decidability Problems •DL-safe Rules •Decidability of Query Answering •Query Answering by Disjunctive Datalog •Conclusion & Future Work 7 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 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) Æ (9 x: R(y,x) Æ C(x)) Æ (9 x: R(y,x) Æ D(x))] ! Q(x)} , 8 x,x1,x2,x3:{ S(x,x1) Æ R(x1,x2) Æ C(x2) Æ R(x1,x3) Æ 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) Ã hasParent(x,z), hasSibling(y,z), Female(y) Jane Mary Ann propositional clauses hasAunt(Jane,Mary) Ã hasParent(Jane,Ann), hasSibling(Mary,Ann), Female(Mary) hasAunt(Ann,Jane) Ã 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 •Decidability of Query Answering •Query Answering by Disjunctive Datalog •Conclusion & 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) Ã 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). 14 Expressivity (I) With normal (DL-unsafe) rules: (KB, P) ² BadChild(Cain) • 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 15 Expressivity (II) With DL-safe rules: (KB, P) ² BadChild’(Cain) • We know the identity of Cain’s father (Adam) (KB, P) ² BadChild’(Romulus) • 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 ² GoodChild(Oedipus) KB ² BadChild’(Oedipus) KB ² 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 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 18 Contents •Introduction •Preliminaries •Decidability Problems •DL-safe Rules •Decidability of Query Answering •Query Answering by Disjunctive Datalog •Conclusion & Future Work 19 Decidability of Query Answering • Theorem: Query answering in (KB, P) is decidable. • Proof: By grounding P and reduction to DL satisfiability. (KB, P) ² iff (KB) [ P [ {: } is unsatisfiable 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. 20 Contents •Introduction •Preliminaries •Decidability Problems •DL-safe Rules •Decidability of Query Answering •Query Answering by Disjunctive Datalog •Conclusion & Future Work 21 Query Answering by Disjunctive Datalog • 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) ² 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 22 Contents •Introduction •Preliminaries •Decidability Problems •DL-safe Rules •Decidability of Query Answering •Query Answering by Disjunctive Datalog •Conclusion & 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