16
Datalog+, RuleML and OWL 2: Formats and Translations for Existential Rules Jean-François Baget ([email protected]) Alain Gutierrez Michel Leclère Marie-Laure Mugnier Swan Rocher Clément Sipieter PROJECT TEAM GraphIK INRIA Sophia-Antiplis LIRMM The 9th International Web Rule Symposium (RuleML) 2015

Challenge@RuleML2015 Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

  • Upload
    ruleml

  • View
    27

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

Datalog+, RuleML and OWL 2: Formats and Translations for Existential Rules

Jean-François Baget ([email protected])

Alain Gutierrez

Michel Leclère

Marie-Laure Mugnier

Swan Rocher

Clément Sipieter

PROJECT TEAM

GraphIK INRIA Sophia-Antiplis

LIRMM

The 9th International Web Rule

Symposium (RuleML) 2015

Page 2: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

An overview of GRAAL

• GRAAL: a platform for reasoning with Existential Rules/Datalog+

(see yesterday’s talk by C. Sipieter « Graal: A Toolkit for Query

Answering with Existential Rules»)

Facts

Ontology

Conjunctive

query

Know

ledge

Base

Page 3: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

GRAAL: Architecture

- 3

Yeste

rday’s

talk

This talk

Page 4: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

DLGP (DataLoG Plus) at a glance

• father(bob, tom).

• father(tom, X), parents(X, sam, alice).

• [A1] mother(bob, liz).

• father(X,Y), mother(X,Z) :- parents(X,Y,Z).

• parents(Y,U,V), parents (Z,R,S) :- parents(X,Y,Z).

• ! :- father(X,Y), mother(X,Y). % Constraint

• Y = Z :- mother(X,Y), mother(X,Z). % Equality Rule

- 4

Facts

R

ule

s

Page 5: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

A Natural Transformation in RuleML

- 5

[A2] parents(Y,U,V), parents (Z,R,S) :- parents(X,Y,Z). <Assert><!-- A2 --> <Forall><Var>X</Var><Var>Y</Var><Var>Z</Var> <Implies> <if> <Atom><Rel>parents</Rel> <Var>X</Var><Var>Y</Var><Var>Z</Var> </Atom> </if> <then><Exists> <Var>U</Var><Var>V</Var><Var>R</Var><Var>S</Var> <And> <Atom><Rel>parents</Rel> <Var>Y</Var><Var>U</Var><Var>V</Var> </Atom> <Atom><Rel>parents</Rel> <Var>Z</Var><Var>R</Var><Var>S</Var> </Atom> </And></Exists></then></Implies></Forall></Assert>

Page 6: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

A (quick) overview of OWL 2

• Primitive Classes (unary predicates): Man, Woman, …

• Primitive Properties (binary predicates): father, mother, …

• Class expressions: ( parent. Human) ⊓ ( parent . God)

• Property Expressions: parent . mother

• Assertions:

– (( parent. Human) ⊓ ( parent . God))(hercules)

– grand-mother ≡ parent . mother

- 6

Page 7: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

OWL2 and Existential Rules

- 7

OWL 2 Existential Rules

A ⊑ B ⊔ C

P(Y, T), r(Z, T) :- r(X, Y), p(X, Z)

q(a, b, c)

ER

RL QL EL

¬ A ⊑ B

Page 8: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

Adding IRIs in DLGP

• constants and predicate names are now IRIs (turtle-

like syntax)

– absolute IRI: <http://example.org/pred>

– prefixed IRI:

• @prefix ex: <http://example.org>

• ex:pred

– relative IRI:

• @base <http://example.org>

• <pred>

• And we can still write (datalog compatibility): pred

- 8

Page 9: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

From OWL 2 to DLGP

• Assertions without class expressions can always be translated

– parent . mother ⊑ grandmother

– grandmother(X,Z) :- parent (X,Y), mother(Y,Z).

• Translation of assertions with class expressions in inclusions

– (( parent. Human) ⊓ ( parent . God))(hercules)

– {hercules} ⊑ ( parent. Human) ⊓ ( parent . God)

- 9

Page 10: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

Transformation into Class Inclusions

- 10

Page 11: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

Analysis of Inclusions: principle

• A ⊑ B

– Can be translated as a single rule when A and B are EquivClass

expressions.

– When A is a SubClass expression and B is a SuperClass

expression, can be rewritten as a set of inclusions of form A’ ⊑ B’

where A’ and B’ are EquivClass expressions.

• The ER profile limits OWL 2 assertions to those whose

associated class inclusions are of form SubClass ⊑ SuperClass

- 11

Page 12: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

EquivClass Expressions

- 12

Page 13: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

SubClass Expressions

- 13

• Rationale: when A is a SubClass expression, A is the existential

closure of conjunctions and disjunctions. Its disjunctive normal

form is A1 ⊔ … ⊔ Ak where the Ai are EquivClass expressions.

So A ⊑ B is equivalent to the set of inclusions Ai ⊑ B.

Page 14: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

SuperClass Expressions

• Example: A ⊑ ¬ B is equivalent to A ⊓ B ⊑ Nothing. When A

and B are SubClass expressions, A ⊓ B is also a SubClass

expression. Thus ¬ B is a SuperClass expression when B is

a SubClass expression.

- 14

Page 15: Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations for Existential Rules

Our algorithm: partial translation of

non ER assertions

- 15

A ⊔ ¬ B ⊑ ∀ r . (C ⊓ ¬ B) ⊓ r . (B ⊔ C)

A ⊔ ¬ B ⊑ ∀ r . (C ⊓ ¬ B) A ⊔ ¬ B ⊑ r . (B ⊔ C)

r- . (A ⊔ ¬ B) ⊑ C ⊓ ¬ B

r- . (A ⊔ ¬ B) ⊑ C r- . (A ⊔ ¬ B) ⊑ ¬ B

r- . (A ⊔ ¬ B) ⊓ B ⊑ ( r- . A) ⊔ ( r- . ¬ B) ⊑ C

( r- . A) ⊑ C r- . ¬ B ⊑ C

C(X) :- r(Y,X), A(Y).

(( r- . A) ⊓ B) ⊔ (( r- . ¬ B) ⊓ B) ⊑

( r- . A) ⊓ B ⊑ ( r- . ¬ B) ⊓ B ⊑

! :- r(Y,X), A(Y), B(X).