(11) Semantic Web Technologies  - Rules
Upcoming SlideShare
Loading in...5
×
 

(11) Semantic Web Technologies - Rules

on

  • 886 views

 

Statistics

Views

Total Views
886
Views on SlideShare
886
Embed Views
0

Actions

Likes
1
Downloads
37
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    (11) Semantic Web Technologies  - Rules (11) Semantic Web Technologies - Rules Presentation Transcript

    • Semantic Web Technologies Lecture Dr. Harald Sack Hasso-Plattner-Institut für IT Systems Engineering University of Potsdam Winter Semester 2012/13 Lecture Blog: http://semweb2013.blogspot.com/ This file is licensed under the Creative Commons Attribution-NonCommercial 3.0 (CC BY-NC 3.0)Dienstag, 8. Januar 13
    • Semantic Web Technologies Content2 1. Introduction 2. Semantic Web - Basic Architecture Languages of the Semantic Web - Part 1 3. Knowledge Representation and Logics Languages of the Semantic Web - Part 2 4. Applications in the ,Web of Data‘ Semantic Web Technologies , Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • last lect ure OWL23 OWL SHROIQ(D) SHOIN(D) Extension Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • SHROIQ(D) Overview OWL 24 Class OWL Expressions Tbox (Class axioms) • Class names A,B • Inclusion C ⊑ D SHROIQ(D) • Conjunction C ⊓ D • Equivalence C ≣ D • Disjunction SHOIN(D) C ⊔ D • Negation ¬C Rbox (Property Axioms) • Exist. property restriction ∃R.C • Inclusion R1 ⊑ R2 • Univ property restriction ∀R.C • General Inclusion R(-)1 º R (-) 2 º ..... º R (-) n ⊑ R • Self ∃S.Self • Transitivity • Greater-than ≥n S.C • Symmetry • Less-than ≤ S • Reflexivity • Enumerated classes {a} • Irreflexivity • Disjunctiveness Properties • Property names R,S,T Abox (Facts) • Simple properties S,T • Class membership C(a) • Inverse properties R- • Property relation R(a,b) Erweiterung • Negated property relation ¬S(a,b) • Universal property U • Equality a=b • Inequality a≠b Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • OWL2 – Web Ontology Language5 • OWL2 is a semantic fragment of FOL OWL • OWL2 exists in different flavors SHROIQ(D) OWL2 OWL 2 • OWL2 EL, OWL2 RL, OWL QL2 ⊆ OWL2 DL ⊆ OWL2 Full SHOIN(D) OWL2 Full undecidable OWL2 DL SHROIQ(D) 2NExpTimeComplete OWL1 DL SHOIN(D) NExpTimeComplete OWL2 RL OWL2 EL EL++ PTimeComplete Erweiterung OWL2 QL DL-Lite AC0 Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam Turmbau zu Babel, Pieter Brueghel, 1563Dienstag, 8. Januar 13
    • 6 Can we do SPARQL with OWL? Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • Using SPARQL with OWL Knowledge Bases •Consider the following OWL KB7 foaf:Person rdfs:subClassOf foaf:Agent . foaf:Person rdfs:subclassOf [ a owl:Restriction ; owl:onProperty :hasFather ; owl:someValuesFrom foaf:Person. ] foaf:knows rdfs:range foaf:Person. :Magnus a Person . :Magnus foaf:knows :Nadine . SELECT ?X { ?X a foaf:Person } •SPARQL 1.0 returns only :Magnus but it should also return :Nadine Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Using SPARQL with OWL Knowledge Bases8 •SPARQL 1.0 is a Query Language for RDF Graphs •does not support RDFS/OWL entailment •Complex (OWL) ontologies cannot be represented with an explicit graph, there exist numerous possible interpretations •In difference to RDF, there is no most specific interpretation as foundation for a graph •OWL DL Interpretations might contain an (possibly) infinite number of elements Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Using SPARQL with OWL Knowledge Bases •Consider the following OWL KB9 foaf:Person rdfs:subClassOf foaf:Agent . foaf:Person rdfs:subclassOf [ a owl:Restriction ; owl:onProperty :hasFather ; owl:someValuesFrom foaf:Person. ] foaf:knows rdfs:range foaf:Person. :Magnus a Person . :Magnus foaf:knows :Nadine . SELECT ?X { ?X a foaf:Person } •SPARQL 1.1 enables OWL entailment and returns :Magnus :Nadine Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SPARQL 1.1 with RDFS/OWL Entailment •Challenges and Pittfalls10 •possibly infinite answers •non-distinguished variables •other SPARQL 1.1 features, e.g. aggregates •SPARQL 1.1 follows a simple pragmatic approach: •Restrict results to terms occurring in the graph •Answers must result from BGP matching •Aggregates are evaluated as post-processing after BGP matching Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Alternative Variant for Querying OWL DL11 •Conjunctive Queries •no official specification •Goal: more expressive queries about individuals •Formatting or post-processing of results is not considered •practical relevance for applications •various implementations available Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Syntax and Intuition of Conjunctive Queries12 •conjunctive queries are simple •Example: •„Which books are published by Springer and who is the author?“ Book(x) ∧ publishedBy(x, Springer) ∧ hasAuthor(x, y) •Syntax similar to FOL •Main elements: Properties/Classes/Individuals, Variables, Conjunction ∧ Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Syntax and Intuition of Conjunctive Queries •Main elements (Atoms):13 •C(e) or ¬C(e) , C is class name, e is variable or name of an individual •R(e,f), R is property name, e and f are variables or names of individuals •Example: Book(x) ∧ publishedBy(x, Springer) ∧ hasAuthor(x, y) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Semantics of Conjunctive Queries •Conjunctive Queries are similar to logical formulas14 •Queries without variables might be entailed directly from the ontology •Variables are used as placeholders for individuals •Function μ is result of a conjunctiven query q for an OWL DL Ontology O, iff: (1) Domain of μ is the set of free variables in q (2) Range of μ is the set of all individuals in O (3) O ⊨ μ(q), i.e. conjunctive query q with given variable assignment is entailed by O •no partial function – all Variables must be assigned •Literals (Datatypes) are not considered for simplicity Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Elements Without Names •Variables are placeholders for (named) individuals15 •OWL Ontologies can entail the existence of not named individuals •Example: Book(a) (a is a book) Book ⊑ ∃hasAuthor.⊤ (every book has an author) Anfrage: Book(x) ∧ hasAuthor(x,y) → no possible solution Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Non-distinguished Variables •How to consider not named elements for the query?16 •Output of not named elements as part of the result is problematic •But a statement of existence is possible via non-distinguished variables (=variables bound via existential quantification) Book(a) (a is a book) Book ⊑ ∃hasAuthor.⊤ (every book has an author) Anfrage: ∃y.(Book(x) ∧ hasAuthor(x,y)) Solution {x ↦ a}, but y is NOT PART of the result Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SPARQL vs. Conjunctive Queries17 SPARQL Conjunctive Queries graph patterns logical conjunctions canonical model many possible models options, alternatives, filters - only query for individuals query for arbitrary elements (strict typing) distinguished and non-distinguished variables for arbitrary elements variables Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Implementations of Conjunctive Queries •KAON2: conjunctive queries without non-distinguished18 variables, restricted negation possible •Pellet: conjunctive queries with non-distinguished variables and negation, not complete for OWL DL •further implementations with special query languages (RacerPro) or restrictions to simpler DLs (QuOnto for OWL2 QL) • see also http://www.cs.man.ac.uk/~sattler/reasoners.html Restrict the problem and the implementation gets simpler Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Semantic Web Technologies Content19 3. Knowledge Representation and Logics The Languages of the Semantic Web - Part 2 • Excursion: Ontologies in Philosophy and Computer Science • Recapitulation: Propositional Logic and First Order Logic • Description Logics • RDF(S) Semantics • OWL and OWL-Semantics • OWL 2 • Rules & The Semantic Web Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 20 Can we model everything with OWL? Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 21 & c s ti l e u R ema n e S b th W e Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 22 3.7 Rules & The Semantic Web 3.7.1 Rules from a Semantic Web Perspective 3.7.2 Rules for OWL with SWRL 3.7.3 Rules expressible in OWL 3.7.4 Exchanging Rules with RIF Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • The Role of Rules • The Semantic Web concentrates on declarative forms23 of knowledge representation • OWL, RDFS • Rules are a common form of procedural knowledge representation in Knowledge Engineering • Expert Systems • Prolog, CLIPS, JESS, OPS, … • Knowledge representation formalisms of the Semantic Web have expressive limitations which can be overcome by rule-based knowledge • e.g. composition of complex classes from classes and properties Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • What are Rules? IF A .... THEN B ....24 A ! B •Interpretation of a rule depends on context • General Inference: Premise → Conclusion • Hypothesis: Cause → Effect • Production: Condition → Action Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • What are Rules? •Logical Rules (FOL implication):25 •F ! G is equivalent with ¬F ∨ G •Logical extension of the KB (static) •Open World, declarative •Procedural Rules (e.g. Production Rules): •If X then Y else Z •executable machine instructions (dynamic) •operational (semantics = effect at application) •Logic Programming Rules (e.g. Prolog, F-Logic): •„woman(X) <- person(X) AND NOT man(X)“ •Approximation of logical semantics with operational aspects •Closed World (mostly), semi-declarative Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • FOL as Rule Language •Rules as FOL implications (Horn Clause)26 A 1 ∧ A2 ∧ . . . ∧ An ! H Body → Head •semantically equivalent with ¬A1 ∨ ¬A2 ∨ . . . ∨ ¬An ∨ H •where Ai, H are atomic formulas •Quantification most times ommitted, free variables are considered to be universally quantified •i.e. the rule holds for all possible assignments Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • FOL as Rule Language •Rules as FOL implications (Horn Clause)27 H ← A1 ∧ A2 ∧ . . . ∧ An Head ← Body often written from right to left ( ← or :- ) •semantically equivalent with ¬A1 ∨ ¬A2 ∨ . . . ∨ ¬An ∨ H •where Ai, H are atomic formulas •Quantification most times ommitted, free variables are considered to be universally quantified •i.e. the rule holds for all possible assignments Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Variants of FOL Rules •Lloyd-Topor Transformation28 •Several atoms in the head are usually considered as conjunction A1 A2...An ! H1 H2...Hm •is equal to A1 A2...An ! H1 A1 A2...An ! H2 ... A1 A2...An ! Hm •this transformation is called Lloyd-Topor Transformation Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Variants of FOL Rules •Disjunctive Rules29 •Disjunction of several non-negated Atoms A1 ∧ A2 ∧ . . . ∧ An → H1 ∨ H2 ∨ . . . ∨ Hm Body Head •reverse implication, as e.g. „if I see someting, then the light is on or the sun is shining“ Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Variants of FOL Rules •FOL Rules30 •Clause: Disjunction of atomic formulas or negated atomaric formulas •Horn Clause: Claus with at most one not negated atom ¬p ∨ ¬q ∨ . . . ∨ ¬t ∨ u can be written as p ∧ q ∧ . . . ∧ t ! u •Definite Clause: Clause with exactly one not negated atom •Fact: Clause of a single not negated atom Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Variants of FOL Rules •Examples31 Person(x) ! Woman(x) ∨ Man(x) (clause) Man(x) ∧ hasChild(x,y) ! Father(x)(definite clause) hasBrother(mother(x),y) ! isUncle(x,y) (with function symbol) Man(x) ∧ Woman(x) ! (horn clause) Woman(Nadine) (fact) •Semantic of rules complies to FOL semantics Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Description Logics vs. Rules •Rules are usually considered to apply only to known32 constants. •No possibility to „create“ new things „on the flight“ by using existential quantification ∃ Human ⊑ ∃hasParent.Human •If rules are considered FOL formulas, then combining rules with ALC leads to undecidability. Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • DATALOG • is a logical rule language that consists of33 • horn clauses without function symbols • conjunction, constants, universally quantified variables, predicate symbols • no disjunction, no negation, no existential quantification, no function symbols • originally developed as foundation of deductive databases • Knowledge Bases (Datalog Programs) are sets of horn clauses (without function symbols) • DATALOG is decidable • DATALOG is computationally efficient, complexity corresponds to OWL Lite, i.e. ExpTime Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • DATALOG34 •Datalog Term: constant c or variable v •Datalog Atom: p(t1,...,tn) with predicate p, terms t1,...,tn •Datalog Rule: ∀x1,...,∀xn (B1 ⋀ ... ⋀ Bn → H) with B1,...,Bn,H atoms and x1,...,xn variables of the atoms •Datalog Program: set of Datalog rules Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • DATALOG Examples35 (1) Vegetarian(x) ⋀ FishProduct(y) → dislikes(x,y) (2) orderedDish(x,y) ⋀ dislikes(x,y) → Unhappy(x) (3) orderedDish(x,y) → Dish(y) (4) dislikes(x,z) ⋀ Dish(y) ⋀ contains(y,z) → dislikes(x,y) (5) → Vegetarian(Matthias) (6) Happy(x) ⋀ Unhappy(x) → Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • DATALOG Semantics • Interpretation I with Domain ΔI36 • Interpretation of variables: variable assignment Z (mapping of variables to ΔI) • Interpretation of rules and terms wrt. I (and Z): • Interpretation of a constant: aI,Z = aI∈ΔI • Interpretation of a variable: xI,Z = Z(x)∈ΔI • Interpretation of an n-ary predicate: pI ∈ ΔI n • I,Z ⊨ p(t1,...,tn) iff (tI,Z1,...,tI,Zn)∈pI, • I ⊨ B!H iff for all variable assignments Z it holds: either I,Z ⊨ H or I,Z ⊭ B. • I is a Model for a rule set (program), iff: I ⊨ B!H for all rules B!H of the rule set Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • 37 How to c ombi OWL ne and Data log? Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • 38 Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • 39 3.7 Rules & The Semantic Web 3.7.1 Rules from a Semantic Web Perspective 3.7.2 Rules for OWL with SWRL 3.7.3 Rules expressible in OWL 3.7.4 Exchanging Rules with RIF Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • SWRL SemanticWeb Rule Language •W3C Submission (bereits im Mai 2004) (developed by the Joint US/EU ad hoc40 Agent Markup Language Committee (JC), in collaboration with RuleML Initiative) •based on combination of parts of OWL and RuleML/Datalog •here OWL DL and Unary/Binary Datalog RuleML •Idea: Datalog Rules that apply on OWL ontologies •Symbols in rules can be OWL identifiers (or new Datalog identifiers) •Syntax: XML Concrete Syntax (extends OWL XML Presentation Language), RDF Concrete Syntax and abstract Syntax •Rules are represented as Implication of an Antecedent (Body) and a Consequent (Head) •SWRL is undecidable Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL SemanticWeb Rule Language41 Antecedent → Consequent • Antecedent and Consequent are Conjunctions of assertions (atoms) of the form • C(x) or P(x,y) • sameAs(x,y), differentFrom(x,y) • where x,y are variables, OWL individuals or elements of an OWL concrete domain, • C(x) is an OWL class description P(x,y) is an OWL property description Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL - Abstract Language Definition •SWRL Rule42 a ← b1,...,bn where a: head, b1,...,bn: body •SWRL Knowledge Base k=(Σ,P) where Σ is an OWL knowledge base P is a finite rule set •Atoms are defined as Atom ← C(i) | D(v) | R(i, j) | U(i,v) | builtIn(p, v1, ..., vn) | i = j | i ≠ j • C ... Class, D ... Datatype • v,v1,...vn ... Datatype Variable / Value Identifier • R ... Object Property • p ... name of a BuiltIn function • U ... Datatype Property • i,j ... Variable / Individual identifier Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL - Semantics •OWL DL (Description Logics) and Datalog are applying the43 same interpretations •OWL individuals are Datalog constants •OWL classes are unary Datalog predicates •OWL properties are binary Datalog predicates •Interpretation can be model for OWL ontology as well as for a set of Datalog rules Entailment for OWL/Datalog combination is possible Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL - Semantics •Let I=(ΔI, ΔD,.I ,.D) an interpretation with44 •ΔI = Object Interpretation domain •ΔD = Datatype Interpretation domain •.I = Object Interpretation function •.D = Datatype Interpretation function •with ΔI ∩ ΔD =⊥ •VIX are object variables with VIX ! 2ΔI •VDX are datatype variables with VDX ! 2ΔD Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL - Semantics •Interpretation of SWRL atoms:45 SWRL atom Interpretation C(i) iI∈CI R(i,j) (iI,jI)∈RI U(i,v) (iI,vD)∈UI D(v) vD∈DD builtIn(p,v1,...,vn) v1D,...,vnD∈pD i=j iI=jI i≠j iI≠jI Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL - Semantics •SWRL Antecedent is satisfied, iff46 •antecedent is empty (trivial) •all atoms of the antecedent are satisfied •SWRL Consequent is satisfied, iff •it is not empty and •the atom of the consequent is satisfied •A rule is satisfied for an Interpretation I, iff •the Interpretation I, which satisfies the antecedent also satisfies the consequent. Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL - Example hatOnkel(?x,?z) ← hatVater(?x,?y) Λ hatBruder(?y,?z)47 <ruleml:imp> <ruleml:_rlab ruleml:href="#onkel"/> <owlx:Annotation> <owlx:Documentation>Bruder des Vaters</owlx:Documentation> </owlx:Annotation> <ruleml:_body> <swrlx:individualPropertyAtom swrlx:property=“&family;hatVater"> <ruleml:var>x</ruleml:var> <ruleml:var>y</ruleml:var> </swrlx:individualPropertyAtom> <swrlx:individualPropertyAtom swrlx:property=“&family;hatBruder"> <ruleml:var>y</ruleml:var> <ruleml:var>z</ruleml:var> </swrlx:individualPropertyAtom> </ruleml:_body> <ruleml:_head> <swrlx:individualPropertyAtom swrlx:property=“&family;hatOnkel"> <ruleml:var>x</ruleml:var> <ruleml:var>z</ruleml:var> </swrlx:individualPropertyAtom> </ruleml:_head> </ruleml:imp> Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • SWRL is undecidable • Logical Inference for OWL+SWRL is undecidable48 • There is no known algorithm that is able to entail all possible inferences for all SWRL knowledge bases, even with unlimited resources and time • But, from a practical perspective, there are • Algorithms that are able to entail all possible inferences for some SWRL knowledge bases • Algorithms that are able to entail some inferences for all SWRL knowledge bases Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Tool Support for SWRL •Bossam, R2ML, Hoolet, Pellet, KAON2, RacerPro, •Jess, SWRLTab, SWRLQueryTab49 Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 50 3.7 Rules & The Semantic Web 3.7.1 Rules from a Semantic Web Perspective 3.7.2 Rules for OWL with SWRL 3.7.3 Rules expressible in OWL 3.7.4 Exchanging Rules with RIF Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • Decidable Fragments of SWRL •Which SWRL knowledge bases enable complete51 inference algorithms? •All SWRL knowledge bases that exist only of OWL / OWL2 axioms •All SWRL knowledge bases that exist only of sets of Datalog programs •Every static finite class of SWRL knowledge bases •Are there more SWRL fragments that are decidable? (1) Description Logics Rules SWRL Rules that can already be expressed with OWL2 (2) DL-safe Rules Restriction of SWRL Rules via variable assignment constraints Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Description Logics Rules52 •General Idea: Find out, which rules can be expressed via OWL2 •Simple Rules in OWL2 Class1 ⊑ Class2 Property1 ⊑ Property2 •become Class1(x) ! Class2(x) Property1(x,y) ! Property2(x,y) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Description Logics Rules53 •Some classes can be fragmented into rules A ⊓ B ⊑ ⊥ becomes A(x) ∧ B(x) ! A ⊑ ∀R.B becomes A(x) ∧ R(x,y) ! B(y) A ⊑ ¬B ⊔ C becomes A(x) ∧ B(x) ! C(x) ⊤ ⊑ ≤1R.⊤ becomes R(x,y) ∧ R(x,z) ! y=z A ⊓ ∃R.∃S.B ⊑ C becomes A(x) ∧ R(x,y) ∧ S(y,z) ∧ B(z) ! C(x) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules54 •Some classes can be fragmented into rules A ⊓ ∃R.{b} ⊑ C becomes A(x) ∧ R(x,b) ! C(x) {a} ≣ {b} becomes ! a=b A ⊑ B ⊓ C becomes A(x) ! B(x) and A(x) ! C(x) A ⊔ B ⊑ C becomes A(x) ! C(x) and B(x)! C(x) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules •In general:55 •A DL axiom α can be translated into rules, if after translating α into a FOL expression α‘, and after normalizing this expression into a set of clauses M, each formula in M is a Horn clause (i.e. a rule) •What about complex properties (property chains)? Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules •Property chains can be expressed as rules:56 hasParent ∘ hasBrother ⊑ hasUncle •becomes hasParent(x,y) ∧ hasBrother(y,z) ! hasUncle(x,z) •in general R ∘ S ⊑ T becomes R(x,y) ∧ S(y,z) ! T(x,z) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules •Problems:57 •What if on both sides of the rule are not only properties or not only classes ? Example.: Man(x) ∧ hasChild(x,y) ! fatherOf(x,y) •How to express this in OWL2? Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules Example.: Man(x) ∧ hasChild(x,y) ! fatherOf(x,y)58 •How to express this in OWL2? •Idea: •substitute Man(x) with a property to make a property chain •Apply „Self“ to transform classes into properties •Auxiliary property PMan •Auxiliary axiom Man ≣ ∃PMan.Self •Thus: PMan ∘ hasChild ⊑ fatherOf Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules •Rolification of concept/class59 A(x) ∧ R(x,y) ! S(x,y) becomes PA ∘ R ⊑ S A(y) ∧ R(x,y) ! S(x,y) becomes R ∘ PA ⊑ S A(x) ∧ B(y) ∧ R(x,y) ! S(x,y) becomes PB ∘ R ∘ PB ⊑ S Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules •More problems:60 Example.: Vegetarian(x) ∧ Fishproduct(y) ! dislikes(x,y) •How to express this in OWL2? •Idea: •Apply universal property U to connect classes •Auxiliary properties: PVegetarian und PFishproduct Vegetarian ≣ ∃PVegetarian.Self Fishproduct ≣ ∃PFishproduct.Self PVegetarian ∘ U ∘ PFishproduct ⊑ dislikes Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (1) Description Logics Rules •More Problems:61 Example.: orderedDish(x,y) ∧ dislikes(x,y) ! Unhappy(x) •How to express this in OWL 2? • Is it possible to eliminate variable y to form a class inclusion in OWL2? ∃orderedDish.⊤ ⊓ ∃dislikes.⊤ ⊑ Unhappy ? ∃orderedDish.∃dislikes–.⊤ ⊑ Unhappy ? Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Decidable Fragments of SWRL •Which SWRL knowledge bases enable complete62 inference algorithms? •All SWRL knowledge bases that exist only of OWL / OWL2 axioms •All SWRL knowledge bases that exist only of sets of Datalog programs •Every static finite class of SWRL knowledge bases •Are there more SWRL fragments that are decidable? (1) Description Logics Rules SWRL Rules that can already be expressed with OWL2 (2) DL-safe Rules Restriction of SWRL Rules via variable assignment constraints Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • (2) DL-Safe Rules •Idea:63 •Restrict SWRL to guarantee decidability via restricting the number of possible variable assignments •Arbitrary Datalog rules are allowed with names of OWL classes and OWL properties •Rules must be DL-safe: each variable must also be represented within an expression of the rule body that doesn‘t use an OWL class or OWL property (= Datalog Atom) •Semantics can be adopted from OWL+SWRL (FOL). DL-safety restricts the application of rules to known individuals Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Forcing DL-Safety •Example:64 brother(x, z) ⋀ father(z, y) ! uncle(x, y) •NOT DL-safe, if „bruder“ and „father“ are OWL properties •Force DL-Safeness by Restricting the rules to known individuals O(x) ⋀ O(y) ⋀ O(z) ⋀ bruder(x, z) ⋀ vater(z, y) ! onkel(x, y) •whereby the fact O(a) has to be asserted for all OWL individuals •Rule is only applicable to known OWL individuals (Named Individuals) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13 Turmbau zu Babel, Pieter Brueghel, 1563
    • Forcing DL-Safety •Example: „He, who hates his brother, is evil.“65 Knowledge Base: father(Kain, Adam) " father(Abel, Adam) "hates(Kain, Abel) ∃father.father—{Remus}(Romulus) " hates(Romulus, Remus) father(x,z) ⋀ father(y,z) ⋀ hates(x,y) ! evil(x) O(x)⋀O(y)⋀O(z)⋀father(x,z)⋀father(y,z)⋀hates(x,y) ! evilsafe(x) O(Kain), O(Abel), O(Adam), O(Romulus), O(Remus) •this implies: evil(Kain), evil(Romulus) •this implies (safe): evilsafe(Kain), BUT NOT: evilsafe(Romulus) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • Summary •SWRL („OWL + Datalog“) is not decidable66 •Description Logic Rules •SWRL fragment that can be expressed with OWL2 •indirectly supported by OWL 2 reasoners •DL-safe Rules •SWRL fragment where variables only can be assigned to concrete values (constants) •supported by OWL reasoner •DL-safety can be forced •Standard and Best-Practice for rules still does not exist Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 67 3.7 Rules & The Semantic Web 3.7.1 Rules from a Semantic Web Perspective 3.7.2 Rules for OWL with SWRL 3.7.3 Rules expressible in OWL 3.7.4 Exchanging Rules with RIF Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF - Rule Interchange Format •W3C Standard (June 2010)68 •Goal: Definition of a standard to exchange rules  (esp. for web-based rule engines) Rule Engine A semantic preservice mapping RIF dialect X semantic preserving mapping Rule Engine B Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF - Rule Interchange Format •Components:69 •RIF BLD (Basic Logic Dialect) - language standard •RIF-RDF / RIF-OWL - interoperable Semantic with existing knowledge representation languages of the semantic web •RIF-PRD (Production Rules Dialect) - standard for production rules •RIF-DTB (Data Types and Builtins) •RIF-FLD (Framework of Logic Dialects) RIF Core •W3C RIF Working Group http://www.w3.org/2001/sw/wiki/RIF Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF - CORE •RIF-Core is70 •restricted variant of RIF BLD (definite Horn rules without function symbols, i.e. similar to Datalog) •part of RIF PRD (Production Rule Dialect) •W3C recommendation since 2010 •Syntax variants: •(readable) BLD presentation syntax •XML-based serialization Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE Dialect •Example.: uncle(x,y) ← brother(x,z) ⋀ father(z,y)71 brother(Martin, Johannes) father(Johannes, Max) Document ( Prefix(ex <http://example.com/>) Group( Forall ?x ?y ?z( ex:uncle(?x,?y) :- And(ex:brother(?x,?z) ex:father(?z,?y)) ) ex:brother(ex:Martin ex:Johannes) ex:father(ex:Johannes ex:Max) ) ) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE Dialect •Property values can be assigned comfortably via ‘Frames‘72 •Example.: subject [ property -> object ] ex:book[ex:authoredBy -> ex:Harald ex:title -> “Internetworking“^^xsd:string ex:publishedBy -> ex:Springer] Forall ?person ?book ( ?person[ex:authorOf -> ?book :- ?book [ex:hasAuthor -> ?person]] ) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE Dialect •Another RIF Example:73 Document( Prefix(dbp <http://dbpedia.org/property/>) Prefix(my <http://mydata.org/resource#>) Prefix(rdfs <http://www.w3.org/2000/01/rdf-schema#>) Group ( Forall ?mname ?aname ?movie ?actor my:actorIn(?aname ?mname) :- And( ?movie[dbp:starring -> ?actor rdfs:label -> ?mname] ?actor[rdfs:label ?aname] ) ) ) Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE XML Syntax <Document>74 <payload> <Group> <sentence>𝜒(regel1)</sentence> ... <sentence>𝜒(regeln)</sentence> </Group> </payload> </Document> 𝜒 = mapping function to map presentation syntax to XML syntax Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE XML Syntax RIF presentation Syntax RIF XML Syntax75 <Forall> <declare>𝜒(?x1)</declare) ... <declare>𝜒(?xn)</declare) Forall ?x1...?xn (content) <formula> 𝜒(content) </formula> </Forall> 𝜒 = mapping function to map presentation syntax to XML syntax Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE XML Syntax RIF presentation Syntax RIF XML Syntax76 <Implies> <if>𝜒(body)</if) head :- body <then>𝜒(head)</then> </Implies> <And> <formula> 𝜒(content1) </formula> And(content1...contentn) ... <formula> 𝜒(contentn) </formula> </And> Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE XML Syntax77 RIF presentation Syntax RIF XML Syntax <Atom> <op>𝜒(predicate)</op) <args ordered=“yes“> 𝜒(t1) predicate(t1...tn) ... 𝜒(tn) </args> </Atom> Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE XML Syntax RIF presentation Syntax RIF XML Syntax78 <Frame> <object>𝜒(subject)</object) <slot ordered=“yes“> 𝜒(o1) 𝜒(p1) subject(p1-> o1 ... pn-> on) </slot> ... <slot ordered=“yes“> 𝜒(on) 𝜒(pn) </slot> </Frame> Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • RIF-CORE XML Syntax RIF presentation Syntax RIF XML Syntax79 <Const type=“datatype“> “literal“^^datatype literal </Const> <Var> variablenname ?variablenname </Var> Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 80 3.7 Rules & The Semantic Web 3.7.1 Rules from a Semantic Web Perspective 3.7.2 Rules for OWL with SWRL 3.7.3 Rules expressible in OWL 3.7.4 Exchanging Rules with RIF Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • Semantic Web Technologies Content81 3. Knowledge Representation and Logics The Languages of the Semantic Web - Part 2 • Excursion: Ontologies in Philosophy and Computer Science • Recapitulation: Propositional Logic and First Order Logic • Description Logics • RDF(S) Semantics • OWL and OWL-Semantics • OWL 2 • Rules & The Semantic Web Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • Next Lecture:82 a l i c o g n g t o l r i O n e e i n n g E Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 3. Knowledge Representation & Logic 3.7 Rules & the Semantic Web83 Bibliography • P. Hitzler, S. Roschke, Y. Sure: Semantic Web Grundlagen, Springer, 2007. • P. Hitzler, M. Krötzsch, S. Rudolph: Foundations of Semantic Web Technologies, CRC Press, 2009. Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13
    • 3. Knowledge Representation & Logic 3.7 Rules & The Semantic Web84 □Blog http://semweb2013.blogspot.com/ □Webseite http://www.hpi.uni-potsdam.de/studium/ lehrangebot/itse/veranstaltung/ semantic_web_technologien-3.html □bibsonomy - Bookmarks http://www.bibsonomy.org/user/lysander07/ swt1213_11 Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität PotsdamDienstag, 8. Januar 13