Datalog-Based Data Access over Ontology Knowledge Bases Unit 4 - - PowerPoint PPT Presentation

datalog based data access over ontology knowledge bases
SMART_READER_LITE
LIVE PREVIEW

Datalog-Based Data Access over Ontology Knowledge Bases Unit 4 - - PowerPoint PPT Presentation

Datalog-Based Data Access over Ontology Knowledge Bases Unit 4 Systems Thomas Eiter Institut fr Informationsysteme, TU Wien ICCL Summer School 2013, August 29-30, 2013 Austrian Science Fund (FWF) grants P20841, P24090 1/36 Datalog over


slide-1
SLIDE 1

Datalog-Based Data Access over Ontology Knowledge Bases

Unit 4 – Systems Thomas Eiter

Institut für Informationsysteme, TU Wien

ICCL Summer School 2013, August 29-30, 2013

Austrian Science Fund (FWF) grants P20841, P24090 1/36

slide-2
SLIDE 2

Datalog over Ontologies / Unit 4

  • 1. Introduction

Unit Outline

  • 1. Introduction
  • 2. Clipper
  • 3. DReW – Datalog Rewriting System
  • 4. Conclusion
  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 2/36

slide-3
SLIDE 3

Datalog over Ontologies / Unit 4

  • 1. Introduction

Some Systems / Tools

General queries can be reduced to Boolean queries: Q(

X) ❀ Q( c)

This is not much practical Systems handling non-ground queries, as in databases, are needed Predominant: rewriting to relational DBMS FO-Rewriting Systems QUONTO / PRESTO OWLGRES REQUIEM/DL-Lite MOR (dl-progs/DL-Lite) Datalog-Rewriting Systems REQUIEM/EL CLIPPER ASPIDE/OWL-2-DLVex, ASPIDE/REQUIEM DReW (dl-programs)

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 3/36

slide-4
SLIDE 4

Datalog over Ontologies / Unit 4

  • 2. Clipper

CLIPPER Reasoner

CLIPPER is a reasoner for CQ answering over Horn-SHIQ

  • ntologies

Homepage: http://www.kr.tuwien.ac.at/research/systems/clipper at GitHub: https://github.com/ghxiao/clipper Based on Datalog rewriting (unit 3) Implemented in Java Ontology parser: OWL-API Datalog backend: DLV (inside CLIPPER); Clingo may be used as well (compute rewriting, via command line)

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 4/36

slide-5
SLIDE 5

Datalog over Ontologies / Unit 4

  • 2. Clipper

Query Answering Algorithm

Recall: three steps to construct Datalog program

Algorithm Horn-SHIQ-CQ Input: normal Horn-SHIQ KB K = (T , A), conjunctive query Q Output: query answers Ξ(T ) ← Saturate(T ); rewT (Q) ← Rewrite(Q, Ξ(T )); cr(T ) ← CompletionRules(T ); P ← A ∪ cr(T ) ∪ rewT (q); ans ← { u | q( u) ∈ Datalog-eval(P)}; ✄ call Datalog reasoner

Note: recursive rules might occur in CR(T ) predicate arities in P are bounded by 2. hence rewriting P is necessarily exponential in the worst case (unless EXPTIME = NP)

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 5/36

slide-6
SLIDE 6

Datalog over Ontologies / Unit 4

  • 2. Clipper

System Architecture

Saturation Ontology Prepro- cessing O Query Prepro- cessing (1) Q Query Rewriting P ← A ∪ cr(T ) ∪ rewT (q) Datalog Engine (DLV, Clingo) ans ABox A (2) T r e wT (Q) (4) (3) Q P (1) Conjunctive Query (2) Normalized TBox (3) Existential axioms in Ξ(T ) (4) Axioms crT for ABox completion rules

Version 0.1: CQs with simple roles only (no transitive roles) Use SPARQL syntax

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 6/36

slide-7
SLIDE 7

Datalog over Ontologies / Unit 4

  • 2. Clipper

Usage

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 7/36

slide-8
SLIDE 8

Datalog over Ontologies / Unit 4

  • 2. Clipper

Usage, cont’d

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 8/36

slide-9
SLIDE 9

Datalog over Ontologies / Unit 4

  • 2. Clipper

Properties

Comparison with state-of-the-art systems PRESTO and REQUIEM [E_ et al. 2012a,2012b] CLIPPER shows promising results Nice downscaling behavior, on less expressive ontologies (falling into DL-Lite) Prototype with transitive roles may be available soon! Possible extensions (projected)

  • weakly DL-safe rules (algorithm developed, implementation pending)
  • other DLs, like regular EL++ and Horn-SRIQ, datatypes
  • more expressive queries, like regular path queries

Big issue: lack of realistic test cases!

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 9/36

slide-10
SLIDE 10

Datalog over Ontologies / Unit 4

  • 3. DReW

3.1 Uniform Evaluation

DReW System

Loose Coupling - revisited Advantage:

  • clean semantics, can use legacy systems
  • fairly easy to incorporate further knowledge formats

(e.g. RDF)

  • supportive to privacy, information hiding

Rules Ontology dl-atom 1 dl-atom 2 Rule Reasoner Ontology Reasoner Hybrid Reasoner

Drawback: impedance mismatch, performance

  • dl-program evaluation needs multiple calls of a

dl-reasoner

  • Calls are expensive

∗ optimizations (caching, pruning ...)

  • exponentially many calls may be unavoidable
  • Even polynomially many calls might be too costly
  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 10/36

slide-11
SLIDE 11

Datalog over Ontologies / Unit 4

  • 3. DReW

3.1 Uniform Evaluation

Uniform Evaluation

Method

Convert the evaluation problem into one for a single reasoning engine

L-formulas Logic L Reasoner

Transform dl-program Π into an (equivalent) knowledge base in formalism L for evaluation (uniform evaluation)

  • L = FO Logic (SQL): MOR; acyclic Π over DL-Lite, using an RDBMS
  • L = Datalog¬: DReW; Π over Datalog-rewritable ontologies

Note: uniform evaluation is different from tight integration in a unifying logic

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 11/36

slide-12
SLIDE 12

Datalog over Ontologies / Unit 4

  • 3. DReW

3.1 Uniform Evaluation

Issues

“Uniform Evaluation” raises some issues: 1) Cost of a transformation. E.g.,

  • Reduction of CQs over DL-Lite ontologies to

first-order (FO) Logic [Calvanese et al., 2007] non-recursive Datalog [Gottlob and Schwentick, 2011], [Kontchakov et al., 2010]

  • Reduction of SHIQ to DATALOG∨ [Hustadt et al., 2007].

2) Existence of a transformation (possibly under constraints)

  • Embedding of a formalism into another
  • Properties (e.g. modularity [Janhunen, 1999])
  • Embedding of dl-programs e.g. into MKNF [Motik and Rosati, 2010],

Equilibrium Logic [Fink and Pearce, 2010]

3) Complexity of the target formalism 4) Feasibility of transformations for practical concerns

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 12/36

slide-13
SLIDE 13

Datalog over Ontologies / Unit 4

  • 3. DReW

3.2 Reasoning via Datalog Rewriting

Uniform Datalog Evaluation of dl-Programs

Idea: for Datalog-rewritable ontologies, we may replace dl-atoms

DL[λ; Q]( c) with Datalog programs evaluating the atoms

the result is computed in an atom Qλ(

c)

rewrite the dl-rules to ordinary rules, by replacing dl-atoms evaluate the resulting logic program using a Datalog engine / ASP solver Important: uniform query rewriting, must work for all λ Demonstrate the method on the Network example

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 13/36

slide-14
SLIDE 14

Datalog over Ontologies / Unit 4

  • 3. DReW

3.2 Reasoning via Datalog Rewriting

Network Example

Π = (O, P)

Ontology O : n1 n2 n3 n4 n5 x1? x2?

X ≥ 1.wired ⊑ Node ⊤ ⊑ ∀wired.Node wired = wired−; n1 = n2 = n3 = n4 = n5 wired(n1, n2) wired(n2, n3) wired(n2, n4) wired(n2, n5) wired(n3, n4) wired(n3, n5). ≥ 4.wired ⊑ HighTrafficNode

Rules P

newnode(x1). newnode(x2).

  • verloaded(X) ← DL[wired ⊎ connect; HighTrafficNode](X).

connect(X, Y) ← newnode(X), DL[Node](Y), not overloaded(Y), not excl(X, Y). excl(X, Y) ← connect(X, Z), DL[Node](Y), Y = Z. excl(X, Y) ← connect(Z, Y), newnode(Z), newnode(X), Z = X. excl(x1, n4).

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 14/36

slide-15
SLIDE 15

Datalog over Ontologies / Unit 4

  • 3. DReW

3.2 Reasoning via Datalog Rewriting

Network Example, cont’d

  • 1. Rewriting the ontology

The DL component O is in OWL 2 RL resp. LDL+, which is Datalog-rewritable (so are the dl-atoms). We transform O to the Datalog program ΦLDL+(O):

wired−(Y, X) ← wired(X, Y) wired(Y, X) ← wired−(X, Y) ⊤(X) ← wired(X, Y) ⊤(Y) ← wired(X, Y) ⊤(X) ← wired−(X, Y) ⊤(Y) ← wired−(X, Y) %axiom ≥ 1.wired ⊑ Node Node(Y) ← wired(X, Y) %axiom ⊤ ⊑ ∀wired.Node Node(Y) ← wired(X, Y), ⊤(X) %axiom ≥ 4.wired ⊑ HighTrafficNode HighTrafficNode(X) ← wired(X, Y1), wired(X, Y2), wired(X, Y3), wired(X, Y4), Y1 = Y2, Y1 = Y3, . . . , Y3 = Y4. wired(n1, n2) wired(n2, n3) wired(n2, n4), wired(n2, n5). wired(n3, n4). wired(n3, n5).

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 15/36

slide-16
SLIDE 16

Datalog over Ontologies / Unit 4

  • 3. DReW

3.2 Reasoning via Datalog Rewriting

Network Example, cont’d

  • 2. Duplicating for dl-inputs

dl-atoms in Π:

DL[Node](Y), DL[wired ⊎ connect; HighTrafficNode](X) the dl-queries in are just instance queries, so given by Node(Y)

  • resp. HighTrafficNode(X)

Each DL-atom sends up a different input λ to O and so entailments for the λ’s might be different. To this purpose, we copy ΦLDL+(O) to new disjoint equivalent versions for each DL-input λ For the set ΛP = {λ1 = ǫ, λ2 = wired ⊎ connect}, we have

  • ΦLDL+,λ1(O) = {Nodeλ1(X) ← wiredλ1(X, Y), . . .} and
  • ΦLDL+,λ2(O) = {Nodeλ2(X) ← wiredλ2(X, Y), . . .}
  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 16/36

slide-17
SLIDE 17

Datalog over Ontologies / Unit 4

  • 3. DReW

3.2 Reasoning via Datalog Rewriting

Network Example, cont’d

  • 3. Rewriting dl-rules to ordinary rules

To rewrite DL-rules P into ordinary rules Pord, we simply replace each DL-atom DL[λ; Q](

  • t) by a new atom Qλ(
  • t).

Pord

newnode(x1). newnode(x2).

  • verloaded(X) ← HighTrafficNodeλ2(X).

connect(X, Y) ← newnode(X), Nodeλ1(Y), not overloaded(Y), not excl(X, Y). excl(X, Y) ← connect(X, Z), Nodeλ1(Y), Y = Z. excl(X, Y) ← connect(Z, Y), newnode(Z), newnode(X), Z = X. excl(x1, n4).

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 17/36

slide-18
SLIDE 18

Datalog over Ontologies / Unit 4

  • 3. DReW

3.2 Reasoning via Datalog Rewriting

Network Example, cont’d

  • 4. Rewriting dl-atom Input to Datalog rules

The inputs λ for the copies ΦLDL+,λ can be transferred by rules:

  • λ1 = ǫ (no input); no rule needed
  • λ2 = wired ⊎ connect:

wiredλ2(X, Y) ← connect(X, Y).

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 18/36

slide-19
SLIDE 19

Datalog over Ontologies / Unit 4

  • 3. DReW

3.2 Reasoning via Datalog Rewriting

Network Example, cont’d

  • 5. Calling the Datalog reasoner

Now we have transformed all the components into a Datalog¬ program

ΨLDL+(Π) = ΦLDL+,λ1(Σ) ∪ ΦLDL+,λ2(Σ) ∪ Pord ∪ P(ΛP).

We can send it to a datalog engine, e.g. DLV, and compute its answer set or the well-founded model The answer sets of ΨLDL+(Π), filtered to connect, overloaded,

newnode, excl, are the (strong) answer sets of Π ΨLDL+(Π) | =wf p(a) iff Π | =wf p(a) for ground atom

Example: ΨLDL+(Π) |

=wf overloaded(n2)

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 19/36

slide-20
SLIDE 20

Datalog over Ontologies / Unit 4

  • 3. DReW

3.3 dl-program Transformation

dl-program Transformation (General Case)

DL: Datalog-rewritable Description Logic Π = (O, P): a dl-program with dl-atoms DL[λi; Qi](

  • ti), 1 ≤ i ≤ n, where

λi = Si,1 ⊎ pi,1, . . . , Si,mi ⊎ pi,mi, and Qi is an instance query.

Let ΛP = {λ1, . . . , λn} and define

ΨDL(Π) :=

λi∈ΛP ΦDL,λi(O) ∪ Pord ∪ ρ(ΛP) ∪ TP

where

ΦDL,λi(O) is a copy of ΦDL(O) with all predicates subscripted with λi ρ(ΛP) consists of rules Si,j,λ( Xi,j) ← pi,j( Xi,j), for all λi ∈ ΛP Pord is P with each DL[λi; Qi](

  • ti) replaced by a new atom Qλi(

ti) TP = {⊤(a), ⊤2(a, b) | a, b occur in P }

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 20/36

slide-21
SLIDE 21

Datalog over Ontologies / Unit 4

  • 3. DReW

3.3 dl-program Transformation

dl-program Transformation (General Case)

Remark: ΦDL(

λi∈ΛP Oλi) in place of λi∈ΛP ΦDL,λi(O) may be

possible, where Oλi is a copy of O with all predicates subscripted with λi

Theorem

Let Π = (O, P) be a dl-program over Datalog-rewritable DL. Then (1) for every a ∈ HBP, Π |

=wf a iff ΨDL(Π) | =wf a;

(2) the answer sets of Π correspond 1-1 to the answer sets of Ψ(Π), s.t.

(i) every strong answer set of Π is expendable to an answer set of Ψ(Π); and (ii) for every answer set J of Ψ(Π), its restriction I = J |HBP to HBP is an answer set of Π.

Note: updates S−

∪p can be effected via ¬S ⊎ p (if permissible, or emulated)

  • ther queries Q depending on rewritability
  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 21/36

slide-22
SLIDE 22

Datalog over Ontologies / Unit 4

  • 3. DReW

3.4 DReW

DReW Reasoner

DReW prototype: uniform dl-program evaluation in Datalog¬

http://www.kr.tuwien.ac.at/research/systems/drew/

at GitHub: https://github.com/ghxiao/drew written in Java

  • ntology parser: OWL-API

Datalog reasoner: DLV (inside DReW); Clingo may be used as well (compute rewriting, via command line) Features in DReW v0.3

  • ntology component
  • OWL 2 RL (LDL+)
  • OWL 2 EL (SROEL(⊓, ×))

rule formalism

  • dl-Programs (answer sets, well founded semantics)
  • CQs under DL-safeness
  • Terminological Default Reasoning (frontend)
  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 22/36

slide-23
SLIDE 23

Datalog over Ontologies / Unit 4

  • 3. DReW

3.4 DReW

System Architecture (Core)

OWL Ontology L DL-Rules P Ontology Parser DL-Rules Parser DL Rewriter DL Profile DL-Atom Extractor DL-Rules Rewriter Duplicator DL-Atom Rewriter Datalog Generator DL-Program Rewriter Model Builder Results Datalog¬ Engine data flow conrol flow

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 23/36

slide-24
SLIDE 24

Datalog over Ontologies / Unit 4

  • 3. DReW

3.4 DReW

Usage

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 24/36

slide-25
SLIDE 25

Datalog over Ontologies / Unit 4

  • 3. DReW

3.4 DReW

Example Usage

Example with Network dl-Program under ASP semantics:

$ ./drew -rl -ontology sample_data/network.owl \

  • dlp sample_data/network.dlp \
  • filter connect -dlv $HOME/bin/dlv

{ connect(x1, n1) connect(x2, n5) } { connect(x1, n5) connect(x2, n1) } { connect(x1, n5) connect(x2, n4) } { connect(x1, n1) connect(x2, n4) }

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 25/36

slide-26
SLIDE 26

Datalog over Ontologies / Unit 4

  • 3. DReW

3.4 DReW

Example Usage, cont’d

Example with network dl-Programs under well-founded semantics

$ ./drew -rl -ontology sample_data/network.owl \

  • dlp sample_data/network.dlp \
  • filter overloaded -wf -dlv ./dlv-wf

{ overloaded(n2) }

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 26/36

slide-27
SLIDE 27

Datalog over Ontologies / Unit 4

  • 3. DReW

3.4 DReW

Frontend: Terminological Default Reasoning

Support for ontologies L = (T , A) extended with default rules D in the style of terminological default logic [Baader and Hollunder, 1995] Example: access control policy, akin to [Bonatti et al., 2011]

T =        Staff ⊑ User, Blacklisted ⊑ Staff, Deny ⊓ Grant ⊑ ⊥, UserRequest ≡ ∃hasAction.Action ⊓ ∃hasSubject.User ⊓ ∃hasTarget.Project, StaffRequest ≡ ∃hasAction.Action ⊓ ∃hasSubject.Staff ⊓ ∃hasTarget.Project, BlacklistedStaffRequest ≡ StaffRequest ⊓ ∃hasSubject.Blacklisted        A = {StaffRequest(r1), Blacklisted(jim), . . . } D =    UserRequest(X) : Deny(X)/Deny(X), StaffRequest(X) : ¬BlacklistedStaffRequest(X)/Grant(X), BlacklistedStaffRequest(X) : ⊤/Deny(X)   

  • users normally are denied access to files, staff is granted access
  • blacklisted staff are denied any access

Implements transformation of extended O+ = (T , A, D) to

dl-programs (over EL) [Dao-Tran et al., 2009]

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 27/36

slide-28
SLIDE 28

Datalog over Ontologies / Unit 4

  • 3. DReW

3.4 DReW

Ongoing / Future Work

More evaluation, use cases

  • Rule-based reasoning over Business ontologies (EDIMine project)
  • Geodata reasoning: semantically enriched spatial queries

More expressive DL ontology reasoning, e.g. Horn-SHIQ More reasoning paradigm support, e.g. Closed World Assumption Further update operators (−

∩) and semantics

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 28/36

slide-29
SLIDE 29

Datalog over Ontologies / Unit 4

  • 4. Conclusion

4.1 Conclusion

Conclusion

Systems using Datalog rewriting are emerging DB technology can be fruifully exploited Much to do . . . E.g., issue: Datalog¬-rewritability Relaxed notions of Datalog-rewritability (allow for auxiliary relations) Datalog¬-rewritability of dl-atoms:

  • program ΦDL(O) could have multiple answer sets (or none)
  • Plugging in ΦDL(Oλ) for some dl-atom DL[λ, Q](
  • t) may lead to

unwanted effects (e.g., additional answer sets) ⇒ use syntactic restrictions (e.g., acyclicity, dl-atoms are not involved in cycles)

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 29/36

slide-30
SLIDE 30

References I

Franz Baader and Bernhard Hollunder. Embedding defaults into terminological knowledge representation formalisms.

  • J. Autom. Reasoning, 14(1):149–180, 1995.

Piero A. Bonatti, Marco Faella, and Luigi Sauro. Adding default attributes to EL++. In Wolfram Burgard and Dan Roth, editors, AAAI. AAAI Press, 2011.

  • D. Calvanese, G. de Giacomo, D. Lembo, M. Lenzerini, and Riccardo Rosati.

Tractable reasoning and efficient query answering in description logics: The DL-Lite family. JAR, 39(3):385–429, 2007. Minh Dao-Tran, Thomas Eiter, and Thomas Krennwallner. Realizing default logic over description logic knowledge bases. In C. Sossai and G. Chemello, editors, Proc. 10th European Conference on Symbolic and Quantitative Approaches to Reasoning with Uncertainty, (ECSQARU 2009), volume 5590 of Lecture Notes in Computer Science, pages 602–613. Springer, 2009.

  • T. Eiter, G. Ianni, T. Lukasiewicz, and R. Schindlauer.

Well-founded semantics for description logic programs in the Semantic Web. ACM Trans. Comput. Log., 12(2):11, 2011.

slide-31
SLIDE 31

References II

Thomas Eiter, Magdalena Ortiz, Mantas Šimkus, Kien Trung-Tran, and Guohui Xiao. Query rewriting for Horn-SHIQ plus rules. In Proceedings 26th Conference on Artificial Intelligence (AAAI ’12), July 22-26, 2012,

  • Toronto. AAAI Press, 2012.

Thomas Eiter, Magdalena Ortiz, Mantas Šimkus, Kien Trung-Tran, and Guohui Xiao. Towards practical query answering for Horn-SHIQ. In Yevgeny Kazakov, Domenico Lembo, and Frank Wolter, editors, Proceedings of the 25th International Workshop on Description Logics (DL2012), June -9, Rome, Italy, volume 846 of CEUR Workshop Proceedings. CEUR-WS.org, 2012. 11 pp. http://ceur-ws.org/Vol-846. Michael Fink and David Pearce. A logical semantics for description logic programs. In Tomi Janhunen and Ilkka Niemelä, editors, JELIA, volume 6341 of Lecture Notes in Computer Science, pages 156–168. Springer, 2010. Georg Gottlob and Thomas Schwentick. Rewriting ontological queries into small nonrecursive datalog programs. In Riccardo Rosati, Sebastian Rudolph, and Michael Zakharyaschev, editors, Description Logics, volume 745 of CEUR Workshop Proceedings. CEUR-WS.org, 2011.

slide-32
SLIDE 32

References III

Ullrich Hustadt, Boris Motik, and Ulrike Sattler. Reasoning in description logics by a reduction to disjunctive datalog.

  • J. Autom. Reasoning, 39(3):351–384, 2007.

Tomi Janhunen. On the intertranslatability of non-monotonic logics.

  • Ann. Math. Artif. Intell., 27(1-4):79–128, 1999.

Roman Kontchakov, Carsten Lutz, David Toman, Frank Wolter, and Michael Zakharyaschev. The combined approach to query answering in dl-lite. In Fangzhen Lin, Ulrike Sattler, and Miroslaw Truszczynski, editors, KR. AAAI Press, 2010.

  • B. Motik and R. Rosati.

Reconciling Description Logics and Rules. Journal of the ACM, 57(5):1–62, 2010. P . Schneider. Evaluation of description logic programs using an RDBMS. Master’s thesis, Vienna University of Technology, December 2010.

slide-33
SLIDE 33

Datalog over Ontologies / Unit 4

  • 6. Appendix: FO-Rewritable dl-Programs / MOR 6.1 FO-Rewritable dl-Programs

FO-Rewritable dl-Programs

Basic Idea:

  • Transform a dl-program Π = (O, P) into an SQL expression S(Π)
  • ver the vocabulary of O
  • Desired property: S(Π) is independent of the concrete ABox of O

management systems (DBMS)

  • To evaluate S(Π), we can use efficient relational database

The family of DL-Lite DLs satisfies the (analog) property (called FO-reducibility) for CQs. For dl-programs, we need restrictions on the rules and the ontology

Definition

A dl-program Π = (O, P), O = (T , A), is FO-rewritable, if Π |

= p( c) for

atom p(

c), is expressible by a FO formula φ( x) over the relational

schema induced by the vocabulary of O, such that Π |

= p( c) iff A | = φ( c), where φ only depends on p, P and T , but not on A.

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 30/36

slide-34
SLIDE 34

Datalog over Ontologies / Unit 4

  • 6. Appendix: FO-Rewritable dl-Programs / MOR 6.2 Acyclic dl-programs

Acyclic dl-programs

To ensure FO-rewritability, ban intrinsic recursion from Π = (O, P) This is ensured by acyclicity:

P is acyclic, if some mapping K: Preds(P) → {0, . . . , n} exists such

that for every rule

a ← b1, . . . , bk, not bk+1, . . . , not bm,

in P, and every p, q ∈ Preds(P) where p occurs in a and q occurs in some bi, it holds K(p) > K(q).

Example Π = (O, P) where O = {C ⊑ D} and P = p(a); p(b); q(c); s(X) ← DL[C ⊎ p; D](X), not DL[C ⊎ q, C − ∪p; D](X)

  • .

Note: every acyclic Π has WFS(Π) as its unique answer set.

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 31/36

slide-35
SLIDE 35

Datalog over Ontologies / Unit 4

  • 6. Appendix: FO-Rewritable dl-Programs / MOR 6.3 FO-Rewritable dl-atoms

FO-Rewritable dl-atoms

For FO-rewritability of Π = (O, P), O = (T , A) each dl-query Q(x) in P must be FO-rewritable, i.e., some FO-formula φQ(x) on O’s vocabulary exists, such that O |

= Q(c) iff A | = φQ(c), for each c φQ(x) must depend only on T , but not on A Example (cont’d) dl-query Q = D(X) over O = {C ⊑ D} is translated to φQ(x) = C(x) ∨ D(x)

For dl-atom DL[λ, Q](x), also updates Si opi pi must be respected

Example (cont’d)

The dl-atom DL[C ⊎ p; D](X) is translated into

δ1(x) = (C(x) ∨ p(x)) ∨ D(x).

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 32/36

slide-36
SLIDE 36

Datalog over Ontologies / Unit 4

  • 6. Appendix: FO-Rewritable dl-Programs / MOR 6.3 FO-Rewritable dl-atoms

FO-rewritable dl-atoms (cont’d)

if opi = −

∪ occurs in P, avoid translating Si − ∪pi to Si(x) ∨ ¬pi(x)

Assume O is over a DL that is

(i) CWA-satisfiable (i.e., for every DL KB O′, the DL KB CWA(O′) = O′ ∪ {¬α | α ∈ AΣ, O′ | = α} is satisfiable, where AΣ is the set of all membership assertions in the underlying vocabulary Σ, and (ii) allows for FO-rewritable concept and role memberships.

Example (cont’d)

The dl-atom DL[C ⊎ q; C −

∪p; D](X) is translated into δ2(x) = (C(x) ∨ q(x)) ∨ D(x) ∨ ∃y((C(y) ∨ q(y)) ∧ p(y))

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 33/36

slide-37
SLIDE 37

Datalog over Ontologies / Unit 4

  • 6. Appendix: FO-Rewritable dl-Programs / MOR 6.4 FO-Rewritability Result

FO-Rewritability Result

Theorem ([E_ et al., 2011])

Let Π = (O, P) be acyclic, and p(

c) an atom, such that

(1) every dl-query in P is FO-rewritable, and (2) if −

∪ occurs in P, then O is defined over a DL that (2a) is

CWA-satisfiable, and (2b) allows for FO-rewritable concept and role memberships. Then, Π |

=wf p( c) is FO-rewritable.

Constructive proof: (a) every dl-atom δ is expressible as FO formula over the ABox of O; (b) every predicate of rank 0 is easily FO-expressible over the facts of P; (c) every other predicate pI is expressible by rule merging (cf. Clark Completion)

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 34/36

slide-38
SLIDE 38

Datalog over Ontologies / Unit 4

  • 6. Appendix: FO-Rewritable dl-Programs / MOR 6.4 FO-Rewritability Result

Example (cont’d)

The rule for predicate s is translated into

φs(x) = (δ1(x) ∧ ¬δ2(x))

Then Π |

=wf s(o) iff F | = φs(o), for any constant o.

Remark: The DL-Lite family is CWA-satisfiable There, dl-queries C(X), R(X, Y) are immediately FO-rewritable Other dl-queries can be reduced to such queries (introducing fresh indviuals).

  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 35/36

slide-39
SLIDE 39

Datalog over Ontologies / Unit 4

  • 6. Appendix: FO-Rewritable dl-Programs / MOR 6.5 MOR System

MOR System

MOR (MergeRuleOntology) [Schneider, 2010]: experimental prototype Evaluates conjunctive queries CQ over an acyclic dl-program

Π = (O, P) using an RDBMS (PostgreSQL 8.4)

Main modules:

  • Datalog-to-SQL rewriter:

puts the facts of P and the ABox of O in the DB and rewrites the rules

  • f P into cascading VIEWS (not materialized)
  • DL-Lite plugin:

transforms dl-atoms, using the perfect rewriting of a query and a TBox T from the algorithm PerfectRef [Calvanese et al., 2007]

  • OWLGRES (adapted):

construct the perfect rewriting (no execution)

Realize hypothetical updates Si ⊎ pi in dl-atoms by views Other plugins than DL-lite are possible (access other DLs, even

  • ther formalisms)
  • T. Eiter / TU Wien

ICCL 2013 29/08/2013 36/36