FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES RDFS Rule-based Reasoning - - PowerPoint PPT Presentation

foundations of semantic web technologies
SMART_READER_LITE
LIVE PREVIEW

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES RDFS Rule-based Reasoning - - PowerPoint PPT Presentation

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES RDFS Rule-based Reasoning Sebastian Rudolph Dresden, 16 April 2013 Content Overview & XML 9 APR DS2 Hypertableau II 7 JUN DS5 Introduction into RDF 9 APR DS3 Tutorial 5 11 JUN DS2 RDFS


slide-1
SLIDE 1

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

RDFS Rule-based Reasoning

Sebastian Rudolph

Dresden, 16 April 2013

slide-2
SLIDE 2

Content

Overview & XML 9 APR DS2 Hypertableau II 7 JUN DS5 Introduction into RDF 9 APR DS3 Tutorial 5 11 JUN DS2 RDFS – Syntax & Intuition 12 APR DS5 SPARQL Syntax & Intuition 11 JUN DS3 RDFS – Semantics 16 APR DS2 SPARQL – Semantics 14 JUN DS2 RDFS Rule-based Reasoning 16 APR DS3 SPARQL 1.1 14 JUN DS3 Tutorial 1 19 APR DS5 SPARQL Entailment 14 JUN DS5 OWL – Syntax & Intuition 26 APR DS5 Tutorial 6 18 JUN DS2 Tutorial 2 3 MAY DS5 SPARQL Implementation 18 JUN DS3 OWL & Description Logics 7 MAY DS2 Ontology Editing 2 JUL DS2 OWL 2 7 MAY DS3 Ontology Engineering 2 JUL DS3 Tutorial 3 10 MAY DS5 Tutorial 7 9 JUL DS2 Tableau I 14 MAY DS2 Linked Data 9 JUL DS3 Tableau II 14 MAY DS3 Applications 12 JUL DS5 Tutorial 4 17 MAY DS5 Test Exam 16 JUL DS2 Tableau – Optimizations 7 JUN DS2 Test Exam Evaluation 16 JUL DS3 Hypertableau I 7 JUN DS3 Q&A Session 19 JUL DS5

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-3
SLIDE 3

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-4
SLIDE 4

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-5
SLIDE 5

Constituents of Rules

  • basic elements of rules are atoms

– ground atoms without free variables – non-ground atoms with free variables

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-6
SLIDE 6

What are Rules?

1

logic rules (fragments of predicate logic): – F → G equivalent to ¬F ∨ G – logical extension of knowledge base static – open world – declarative (describing)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-7
SLIDE 7

What are Rules?

1

logic rules (fragments of predicate logic): – F → G equivalent to ¬F ∨ G – logical extension of knowledge base static – open world – declarative (describing)

2

procedural rules (e.g. production rules): – “If X then Y else Z ” – executable commands dynamic – operational (meaning = effect caused when executed)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-8
SLIDE 8

What are Rules?

1

logic rules (fragments of predicate logic): – F → G equivalent to ¬F ∨ G – logical extension of knowledge base static – open world – declarative (describing)

2

procedural rules (e.g. production rules): – “If X then Y else Z ” – executable commands dynamic – operational (meaning = effect caused when executed)

3

logic programming et al. (e.g. PROLOG, F-Logic): – man(X) <- person(X) AND NOT woman(X) – approximation of logical semantics with operational aspects, built-ins are possible – often closed-world – semi-declarative

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-9
SLIDE 9

Predicate Logic as a Rule Language

  • rules as implication formulae in predicate logic:

H

  • head

← A1 ∧ A2 ∧ . . . ∧ An

  • body

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-10
SLIDE 10

Predicate Logic as a Rule Language

  • rules as implication formulae in predicate logic:

H

  • head

← A1 ∧ A2 ∧ . . . ∧ An

  • body

semantically equivalent to disjunction: H ∨ ¬A1 ∨ ¬A2 ∨ . . . ∨ ¬An

  • implications often written from right to left(← or :-)
  • constants, variables and function symbols allowed
  • quantifiers for variables are often omitted:

free variables are often understood as universally quantified (i.e. rule is valid for all variable assignments)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-11
SLIDE 11

Rules – Example

Example: hasUncle(x✱ z) ← hasParent(x✱ y) ∧ hasBrother(y✱ z)

  • we use short names (hasUncle) instead of IRIs like

http://example.org/Example#hasUncle

  • we use x,y,z for variables

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-12
SLIDE 12

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-13
SLIDE 13

Lloyd-Topor Transformation

  • multiple heads in atoms are usually understood as conjunction

H1✱ H2✱ . . . ✱ Hm ← A1✱ A2✱ . . . ✱ An equivalent to H1 ← A1✱ A2✱ . . . ✱ An H2 ← A1✱ A2✱ . . . ✱ An . . . Hm ← A1✱ A2✱ . . . ✱ An

  • such a rewriting is also referred to as Lloyd-Topor transformation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-14
SLIDE 14

Disjunctive Rules

  • some rule formalisms allow for disjunction

several atoms in the head are conceived as alternatives: H1✱ H2✱ . . . ✱ Hm ← A1✱ A2✱ . . . ✱ An equivalent to H1 ∨ H2 ∨ . . . ∨ Hm ← A1 ∧ A2 ∧ . . . ∧ An equivalent to H1 ∨ H2 ∨ . . . ∨ Hm ∨ ¬A1 ∨ ¬A2 ∨ . . . ∨ ¬An (not considered here)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-15
SLIDE 15

Kinds of Rules

names for “rules” in predicate logic:

  • clause: disjunction of atomic and negated atomic propositions

– Woman(x) ∨ Man(x) ← Person(x) ✱

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-16
SLIDE 16

Kinds of Rules

names for “rules” in predicate logic:

  • clause: disjunction of atomic and negated atomic propositions

– Woman(x) ∨ Man(x) ← Person(x)

  • Horn clause: clause with at most one non-negated atom

– ← Man(x) ∧ Woman(x) “integrity constraints” ✱

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-17
SLIDE 17

Kinds of Rules

names for “rules” in predicate logic:

  • clause: disjunction of atomic and negated atomic propositions

– Woman(x) ∨ Man(x) ← Person(x)

  • Horn clause: clause with at most one non-negated atom

– ← Man(x) ∧ Woman(x) “integrity constraints”

  • definite clause: Horn clause with exactly one non-negated atom

– Father(x) ← Man(x) ∧ hasChild(x✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-18
SLIDE 18

Kinds of Rules

names for “rules” in predicate logic:

  • clause: disjunction of atomic and negated atomic propositions

– Woman(x) ∨ Man(x) ← Person(x)

  • Horn clause: clause with at most one non-negated atom

– ← Man(x) ∧ Woman(x) “integrity constraints”

  • definite clause: Horn clause with exactly one non-negated atom

– Father(x) ← Man(x) ∧ hasChild(x✱ y)

  • fact: clause containing just one non-negated atom

– Woman(gisela)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-19
SLIDE 19

Kinds of Rules

Rules may also contain function symbols: hasUncle(x✱ y) ←hasBrother(mother(x)✱ y) hasFather(x✱ father(x)) ←Person(x) new elements are dynamically generated not considered here see logic programming

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-20
SLIDE 20

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-21
SLIDE 21

Datalog

Horn rules without function symbols Datalog rules

  • logical rule language, originally basis of deductive databases
  • knowledge bases (“programs”) consisting of Horn clauses without

function symbols

  • decidable
  • efficient for big datasets, combined complexity ExpTime
  • a lot of research done in the 1980s

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-22
SLIDE 22

Datalog as Extension of the Relation Calculus

Datalog can be conceived as Extension of the relation calculus by recursion T(x✱ y) ← E(x✱ y) T(x✱ y) ← E(x✱ z) ∧ T(z✱ y) computes the transitive closure (T) of the binary relation E, (e.g. if E contains the edges of a graph)

  • a set of (ground) facts is also called an instance

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-23
SLIDE 23

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-24
SLIDE 24

Semantics of Datalog

three different but equivalent ways to define the semantics:

  • model-theoretically
  • proof-theoretically
  • via fixpoints

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-25
SLIDE 25

Model-theoretic Semantics of Datalog

rules are seen as logical sentences: ∀x✱ y✳(T(x✱ y) ← E(x✱ y)) ∀x✱ y✳(T(x✱ y) ← E(x✱ z) ∧ T(z✱ y))

  • not sufficient to uniquely determine a solution

interpretation of T has to be minimal

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-26
SLIDE 26

Model-theoretic Semantics of Datalog

in principle, a Datalog rule ρ: R1(u1) ← R2(u2)✱ . . . ✱ Rn(un) represents the FOL sentence ∀x1✱ . . . ✱ xn✳(R1(u1) ← R2(u2) ∧ . . . ∧ Rn(un))

  • x1✱ . . . ✱ xn are the rule’s variables and ← is logical implication
  • an instance I satisfies ρ, written I |

= ρ, if and only if for every instantiation R1(ν(u1)) ← R2(ν(u2))✱ . . . ✱ Rn(ν(un)) we find R1(ν(u1)) satisfied whenever R2(ν(u2))✱ . . . ✱ Rn(ν(un)) are satisfied

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-27
SLIDE 27

Model-theoretic Semantics of Datalog

  • an instance I is a model of a Datalog program P

, if I satisfies every rule in P (seen as a FOL formula)

  • the semantics of P for the input I is the minimal model that contains I (if it

exists)

  • Question: does such a model always exist?
  • If so, how can we construct it?

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-28
SLIDE 28

Proof-theoretic Semantics of Datalog

based on proofs for facts: given : E(a✱ b)✱ E(b✱ c)✱ E(c✱ d) T(x✱ y) ← E(x✱ y) (1) T(x✱ y) ← E(x✱ z) ∧ T(z✱ y) (2) (a) E(c, d) is a given fact (b) T(c, d) follows from (1) and (a) (c) E(b, c) is a given fact (d) T(b, d) follows from (c), (b) and (2) (e) . . .

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-29
SLIDE 29

Proof-theoretic Semantics of Datalog

  • programs can be seen as “factories” that produce all provable facts

(deriving new facts from known ones in a bottom-up way by applying rules)

  • alternative: top-down evaluation; starting from a to-be-proven fact, one

looks for lemmata needed for the proof ( Resolution)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-30
SLIDE 30

Proof-theoretic Semantics of Datalog

a fact is provable, if it has a proof, represented by a proof-tree:

Definition

A proof tree for a fact A for an instance I and a Datalog program P is a labeled tree in which

1

every node is labeled with a fact

2

every leaf is labeled with a fact from I

3

the root is labeled with A

4

for each internal leaf there exists an instantiation A1 ← A2✱ . . . ✱ An of a rule in P , such that the node is labeled with A1 and its children with A2✱ . . . ✱ An

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-31
SLIDE 31

Proof-theoretic Semantics of Datalog

based on proofs for facts: given : E(a✱ b)✱ E(b✱ c)✱ E(c✱ d) T(x✱ y) ← E(x✱ y) (1) T(x✱ y) ← E(x✱ z) ∧ T(z✱ y) (2) (a) E(c, d) is a given fact (b) T(c, d) follows from (1) and (a) (c) E(b, c) is a given fact (d) T(b, d) follows from (c), (b) and (2) (e) . . . T(b, d) E(b, c) T(c, d) E(c, d)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-32
SLIDE 32

Fixpoint Semantics

defines the semantics of a Datalog program as the solution of a fixpoint equation

  • procedural definition (iteration until fixpoint reached)
  • given an instance I and a Datalog program P

, we call a fact A a direct consequence for P and I, if

1

A is contained in I or

2

A ← A1✱ . . . ✱ An is the instance of a rule from P , such that A1✱ . . . ✱ An ∈ I

  • then we can define a “direct consequence”-operator that computes,

starting from an instance, all direct consequences

  • similar to the bottom-up proof-theoretic semantics, but shorter proofs are

always generated earlier than longer ones

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-33
SLIDE 33

Semantics of Rules

  • compatible with other approaches that are based on FOL (e.g. description

logics)

  • conjunctions in rule heads and disjunction in bodies unnecessary
  • other (non-monotonic) semantics definitions possible

– well-founded semantics – stable model semantics – answer set semantics

  • for Horn rules, these definitions do not differ
  • production rules/procedural rules conceive the consequence of a rule as

an action “If-then do” not considered here

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-34
SLIDE 34

Extensional and Intensional Predicates

  • from the database perspective (and opposed to logic programming) one

distinguishes facts and rules

  • within rules, we distinguish extensional and intensional predicates
  • extensional predicates (also: extensional database – edb) are those not
  • ccurring in rule heads (in our example: relation E)
  • intensional predicates (also: intensional database – idb) are those
  • ccurring in at least one head of a rule (in our example: relation T)
  • semantics of a datalog program can be understood as a mapping of given

instances over edb predicates to instances of idb predicates

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-35
SLIDE 35

Datalog in Practice

Datalog in Practice:

  • several implementations available
  • some adaptations for Semantic Web: XSD types, URIs (e.g. → IRIS)

Extensions of Datalog:

  • disjunctive Datalog allows for disjunctions in rule heads
  • non-monotonic negation (no FOL semantics)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-36
SLIDE 36

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-37
SLIDE 37

Evaluating Datalog Programs

  • top-down or bottom-up evaluation
  • direct evaluation versus compilation into an efficient program
  • here:

1

Na¨ ıve bottom-up Evaluierung

2

Semi-na¨ ıve bottom-up Evaluierung

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-38
SLIDE 38

Reverse-Same-Generation

given Datalog programm: rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y) given data: up flat down a e g f l f a f m n m f f m m

  • g

b g n p m h c h n i d i

  • p

k j

  • TU Dresden, 16 April 2013

Foundations of Semantic Web Technologies

slide-39
SLIDE 39

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-40
SLIDE 40

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-41
SLIDE 41

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-42
SLIDE 42

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-43
SLIDE 43

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-44
SLIDE 44

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-45
SLIDE 45

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-46
SLIDE 46

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-47
SLIDE 47

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-48
SLIDE 48

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-49
SLIDE 49

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-50
SLIDE 50

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-51
SLIDE 51

Reverse-Same-Generation – Visualization

a b c d e f g h i j k l m n

  • p

u u d d d f d d u u u u u d f f f rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-52
SLIDE 52

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-53
SLIDE 53

Na¨ ıve Algorithm for Computing rsg

rsg(x✱ y) ← flat(x✱ y) rsg(x✱ y) ← up(x✱ x1)✱ rsg(y1✱ x1)✱ down(y1✱ y)

Algorithm 1 RSG

rsg := ∅ repeat rsg := rsg ∪ flat ∪ π16(σ2=4(σ3=5(up × rsg × down))) until fixpoint reached

rsgi+1 := rsgi ∪ flat ∪ π16(σ2=4(σ3=5(up × rsg × down))) Level 0: ∅ Level 1: {(g✱ f)✱ (m✱ n)✱ (m✱ o)✱ (p✱ m)} Level 2: {Level 1} ∪ {(a✱ b)✱ (h✱ f)✱ (i✱ f)✱ (j✱ f)✱ (f✱ k)} Level 3: {Level 2} ∪ {(a✱ c)✱ (a✱ d)} Level 4: {Level 3}

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-54
SLIDE 54

Na¨ ıve Algorithm for Evaluating Datalog Programs

  • redundant computations (all elements of the preceding level are taken

into account)

  • on each level, all elements of the preceding level are re-computed
  • monotone (rsg is extended more and more)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-55
SLIDE 55

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-56
SLIDE 56

Semi-Na¨ ıve Algorithm for Computing rsg

focus on facts that have been newly computed on the preceding level

Algorithm 2 RSG′

∆1

rsg(x✱ y) := flat(x✱ y)

∆i+1

rsg (x✱ y) := up(x✱ x1)✱ ∆i rsg(y1✱ x1)✱ down(y1✱ y)

  • not recursive
  • no Datalog program (set of rules is infinite)
  • for each input I and ∆i

rsg (the newly computed instances on level i),

rsgi+1 − rsgi ⊆ ∆i+1

rsg ⊆ rsgi+1

  • RSG(I)(rsg) = ∪1≤i(∆i

rsg)

  • less redundancy

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-57
SLIDE 57

An Improvement

But: ∆i+1

rsg = rsgi+1 − rsgi

e.g.: (g✱ f) ∈ ∆2

rsg✱ (g✱ f) ✴

∈ rsg2 − rsg1 rsg(g✱ f) ∈ rsg1, because flat(g✱ f), rsg(g✱ f) ∈ ∆2

rsg, because up(g✱ n)✱ rsg(m✱ f)✱ down(m✱ f)

  • idea: use rsgi − rsgi−1 instead of ∆i

rsg in the second “rule” of RSG′

Algorithm 3 RSG′′ ∆1

rsg(x✱ y) := flat(x✱ y)

rsg1 := ∆1

rsg

tmpi+1

rsg (x✱ y) := up(x✱ x1)✱ ∆i rsg(y1✱ x1)✱ down(y1✱ y)

∆i+1

rsg (x✱ y) := tmpi+1 rsg − rsgi

rsgi+1 := rsgi ∪ ∆i+1

rsg

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-58
SLIDE 58

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-59
SLIDE 59

Datalog Rules for RDFS (no Datatypes & Literals)

problem: no strict separation between data and schema (predicates) a rdfs:domain x . u a y . rdfs2 u rdf:type x . rdf : type(u✱ x) ← rdfs : domain(a✱ x) ∧ a(u✱ y)

  • solution: use a triple predicate

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-60
SLIDE 60

Datalog Rules for RDFS (no Datatypes & Literals)

problem: no strict separation between data and schema (predicates) a rdfs:domain x . u a y . rdfs2 u rdf:type x . rdf : type(u✱ x) ← rdfs : domain(a✱ x) ∧ a(u✱ y)

  • solution: use a triple predicate

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-61
SLIDE 61

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-62
SLIDE 62

Datalog Rules for RDFS (no Datatypes & Literals)

a rdfs:domain x . u a y . rdfs2 u rdf:type x .

Triple(u✱ rdf : type✱ x) ← Triple(a✱ rdfs : domain✱ x) ∧ Triple(u✱ a✱ y)

  • usage of just one predicate reduces optimization potential
  • all (newly derived) triples are potential candidates for any rule
  • rules change when the data changes, no separation between schema

and data

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-63
SLIDE 63

Datalog Rules for RDFS (no Datatypes & Literals)

  • solution 2: introduce specific predicates

a rdfs:domain x . u a y . rdfs2 u rdf:type x .

type(u✱ x) ← domain(a✱ x) ∧ rel(u✱ a✱ y)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-64
SLIDE 64

Axiomatic Triples as Facts

type(rdf:type, rdf:Property) type(rdf:subject, rdf:Property) type(rdf:predicate, rdf:Property) type(rdf:object, rdf:Property) type(rdf:first, rdf:Property) type(rdf:rest, rdf:Property) type(rdf:value, rdf:Property) type(rdf: 1, rdf:Property) type(rdf: 2, rdf:Property) type(. . . , rdf:Property) type(rdf:nil, rdf:List) . . . (plus RDFS axiomatic triples)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-65
SLIDE 65

Axiomatic Triples as Facts

type(rdf:type, rdf:Property) type(rdf:subject, rdf:Property) type(rdf:predicate, rdf:Property) type(rdf:object, rdf:Property) type(rdf:first, rdf:Property) type(rdf:rest, rdf:Property) type(rdf:value, rdf:Property) type(rdf: 1, rdf:Property) type(rdf: 2, rdf:Property) type(. . . , rdf:Property) type(rdf:nil, rdf:List) . . . (plus RDFS axiomatic triples)

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-66
SLIDE 66

Axiomatic Triples as Facts

type(rdf:type, rdf:Property) type(rdf:subject, rdf:Property) type(rdf:predicate, rdf:Property) type(rdf:object, rdf:Property) type(rdf:first, rdf:Property) type(rdf:rest, rdf:Property) type(rdf:value, rdf:Property) type(rdf: 1, rdf:Property) type(rdf: 2, rdf:Property) type(. . . , rdf:Property) type(rdf:nil, rdf:List) . . . (plus RDFS axiomatic triples)

  • nly needed for those rdf: i that occur in the graphs G1 and G2, if

G1 | =? G2 is to be decided

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-67
SLIDE 67

RDF Entailment Rules (no Datatypes & Literals)

u a y rdf1 a rdf:type rdf:Property type(a, rdf:Property) ← rel(u, a, y) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-68
SLIDE 68

RDF Entailment Rules (no Datatypes & Literals)

u a y rdf1 a rdf:type rdf:Property type(a, rdf:Property) ← rel(u, a, y) a rdfs:domain x . u a y . rdfs2 u rdf:type x . type(u, x) ← domain(a, x) ∧ rel(u, a, y) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-69
SLIDE 69

RDF Entailment Rules (no Datatypes & Literals)

u a y rdf1 a rdf:type rdf:Property type(a, rdf:Property) ← rel(u, a, y) a rdfs:domain x . u a y . rdfs2 u rdf:type x . type(u, x) ← domain(a, x) ∧ rel(u, a, y) a rdfs:range x . u a v . rdfs3 v rdf:type x . type(v, x) ← range(a, x) ∧ rel(u, a, v) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-70
SLIDE 70

RDF Entailment Rules (no Datatypes & Literals)

u a y rdf1 a rdf:type rdf:Property type(a, rdf:Property) ← rel(u, a, y) a rdfs:domain x . u a y . rdfs2 u rdf:type x . type(u, x) ← domain(a, x) ∧ rel(u, a, y) a rdfs:range x . u a v . rdfs3 v rdf:type x . type(v, x) ← range(a, x) ∧ rel(u, a, v) u a x . rdfs4a u rdf:type rdfs:Resource . type(u, rdfs:Resource) ← rel(u, a, x) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-71
SLIDE 71

RDF Entailment Rules (no Datatypes & Literals)

u a v . rdfs4b v rdf:type rdfs:Resource . type(v, rdfs:Resource) ← rel(u, a, v) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-72
SLIDE 72

RDF Entailment Rules (no Datatypes & Literals)

u a v . rdfs4b v rdf:type rdfs:Resource . type(v, rdfs:Resource) ← rel(u, a, v) u rdfs:subPropertyOf v . v rdfs:subPropertyOf x . rdfs5 u rdfs:subPropertyOf x . subPropertyOf(u, x) ← subPropertyOf(u, v) ∧ subPropertyOf(v, x) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-73
SLIDE 73

RDF Entailment Rules (no Datatypes & Literals)

u a v . rdfs4b v rdf:type rdfs:Resource . type(v, rdfs:Resource) ← rel(u, a, v) u rdfs:subPropertyOf v . v rdfs:subPropertyOf x . rdfs5 u rdfs:subPropertyOf x . subPropertyOf(u, x) ← subPropertyOf(u, v) ∧ subPropertyOf(v, x) u rdf:type rdf:Property . rdfs6 u rdfs:subPropertyOf u . subPropertyOf(u, u) ← type(u, rdf:Property) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-74
SLIDE 74

RDF Entailment Rules (no Datatypes & Literals)

u a v . rdfs4b v rdf:type rdfs:Resource . type(v, rdfs:Resource) ← rel(u, a, v) u rdfs:subPropertyOf v . v rdfs:subPropertyOf x . rdfs5 u rdfs:subPropertyOf x . subPropertyOf(u, x) ← subPropertyOf(u, v) ∧ subPropertyOf(v, x) u rdf:type rdf:Property . rdfs6 u rdfs:subPropertyOf u . subPropertyOf(u, u) ← type(u, rdf:Property) a rdfs:subPropertyOf b . u a y . rdfs7 u b y . rel(u, b, y) ← subPropertyOf(a, b) ∧ rel(u, a, y) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-75
SLIDE 75

RDF Entailment Rules (no Datatypes & Literals)

u rdf:type rdfs:Class . rdfs8 u rdf:subClassOf rdfs:Resource . subClassOf(u, rdfs:Resource) ← type(u, rdfs:Class) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-76
SLIDE 76

RDF Entailment Rules (no Datatypes & Literals)

u rdf:type rdfs:Class . rdfs8 u rdf:subClassOf rdfs:Resource . subClassOf(u, rdfs:Resource) ← type(u, rdfs:Class) u rdfs:subClassOf x . v rdf:type u . rdfs9 v rdf:type x . type(v, x) ← subClassOf(u, x) ∧ type(v, x) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-77
SLIDE 77

RDF Entailment Rules (no Datatypes & Literals)

u rdf:type rdfs:Class . rdfs8 u rdf:subClassOf rdfs:Resource . subClassOf(u, rdfs:Resource) ← type(u, rdfs:Class) u rdfs:subClassOf x . v rdf:type u . rdfs9 v rdf:type x . type(v, x) ← subClassOf(u, x) ∧ type(v, x) u rdf:type rdfs:Class . rdfs10 u rdfs:subClassOf u . subClassOf(u, u) ← type(u, rdfs:Class) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-78
SLIDE 78

RDF Entailment Rules (no Datatypes & Literals)

u rdf:type rdfs:Class . rdfs8 u rdf:subClassOf rdfs:Resource . subClassOf(u, rdfs:Resource) ← type(u, rdfs:Class) u rdfs:subClassOf x . v rdf:type u . rdfs9 v rdf:type x . type(v, x) ← subClassOf(u, x) ∧ type(v, x) u rdf:type rdfs:Class . rdfs10 u rdfs:subClassOf u . subClassOf(u, u) ← type(u, rdfs:Class) u rdfs:subClassOf v . v rdfs:subClassOf x . rdfs11 u rdfs:subClassOf x . subClassOf(u, x) ← subClassOf(u, v) ∧ subClassOf(v, x) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-79
SLIDE 79

RDF Entailment Rules (no Datatypes & Literals)

u rdf:type rdfs:ContainerMembershipProperty . rdfs12 u rdfs:subPropertyOf rdfs:member . subPropertyOf(u, rdfs:member) ← type(u, rdfs:ContainerMembershipProperty) a, b IRIs x, y IRI, blank node or literal u, v IRI or blank node l literal :n blank nodes TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies

slide-80
SLIDE 80

Agenda

  • Rules

– Llyod-Topor Transformation

  • Datalog

– Characterizations of Datalog Program Semantics

  • Evaluating Datalog Programs

– Na¨ ıve Evaluation – Semi-na¨ ıve Evaluation

  • Rules for RDFS via a Triple Predicate
  • Rules for RDFS via Direct Translation

TU Dresden, 16 April 2013 Foundations of Semantic Web Technologies