swt lecture session 8 - rules
Post on 18-Oct-2014
229 views
DESCRIPTION
TRANSCRIPT
![Page 1: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/1.jpg)
+
Rules
Mariano Rodriguez-Muro, Free University of Bozen-Bolzano
![Page 2: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/2.jpg)
+Disclaimer
License This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 License (http://creativecommons.org/licenses/by-sa/3.0/)
![Page 3: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/3.jpg)
+Reading material
Chapter 7. Semantic Web Programming Chapter 6. Foundations of Semantic Web.
![Page 4: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/4.jpg)
+What are rules
Means of representing knowledge An ontology language Can be seen as conditions statements:
if []then []
if x is a Man and x hasChild y Father(x)
![Page 5: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/5.jpg)
+Why rules
Easy to understand RDFS (and sometimes OWL) is not enough:
If a person x is the brother of somebody y, and there is z such that z is the uncle of x, then z is the uncle of y too.
for all x,y,z, if hasBrother(x,y) & hasUncle(x,z) then hasUncle(y,z)
![Page 6: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/6.jpg)
+SWRL
![Page 7: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/7.jpg)
+SWRL
How can datalog and OWL be combined? SWRL – Semantic Web Rule Language [swirl]
• Proposal for a rule based Semantic Web Language (W3C member submission)http://www.w3.org/Submission/SWRL/
• Idea: datalog rules referring to RDF classes/propertiesSymbols in rules can be OWL identifiers or new symbols
• Various further features and syntactic forms
• Support in inference engines (very wide spread support)
7
![Page 8: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/8.jpg)
+SWRL Syntaxes
Two syntaxes:
1. Abstract syntax based on “Extended Backus-Naur Form notation1. Directly translatable to a Human readable syntax
(SPARQL lie)
2. XML Concrete Syntax1. Parsable by existing OWL/RDF/XML parsers2. Suitable as a exchange language for the semantic
web
![Page 9: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/9.jpg)
+Abstract Syntax
![Page 10: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/10.jpg)
+Abstract Syntax ExampleFor the rule:
The corresponding abstract syntax:
![Page 11: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/11.jpg)
+Example 1A very common use for rules is to move property values from one individual to a related individual
Express the fact that the style of an art object is the same as the style of the creator.
Artist(?x) & artistStyle(?x,?y) & Style(?y) & creator(?z,?x) ⇒ style/period(?z,?y)
Implies(Antecedent(Artist(I-variable(x)) artistStyle(I-variable(x) I-variable(y)) Style(I-variable(y)) creator(I-variable(z) I-variable(x)))
Consequent(style/period(I-variable(z) I-variable(y))))
![Page 12: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/12.jpg)
+RDFS as rules
Provide a translation of all RDFS axiom as rules subClassOf subPropertyOf domain range
![Page 13: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/13.jpg)
+Beyond RDFS
Transitivity of a property P Reflexivity of a property P Inverse of a property P Equivalence of properties/classes Sufficient conditions for class membership
![Page 14: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/14.jpg)
+Built ins
One of the main motivations for SWRL rules Provide means to manipulate data
Comparisons Mathematical transformations List operators Modifiers for strings, dates and times Boolean and URI checks URI construction
![Page 15: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/15.jpg)
+Built-ins exampleshasAddress(?creditCardMachine, ?ccAddress) ^hasAddress(?customer, ?custAddress) ^hasState(?ccAddress, ?ccState) ^hasState(?custAddress, ?custState) ^swrlb:equal(?custState, ?ccState) ^hasBirthday(?customer, ?bDate) ^swrlb:subtractYearMonthDurations(?diff, ?today, ?bDate) ^swrlb:greaterThanOrEqual(?diff, "P18Y0M")→ LegalCigaretteBuyer(?customer)
![Page 16: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/16.jpg)
+Built-ins examples
foaf:Person(?person) ^foaf:gender(?person, "female") ^foaf:name(?person, ?name)→ swrlb:stringConcat(?s, "Dear Ms. ", ?name, ":") ^ hasFormalGreeting(?person, ?s)
![Page 17: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/17.jpg)
+Empty antecedents/consequent
Empty antecedent indicate the consequent is ALWAYS true
Empty consequents indicate the antecedent is a contradiction
Allow to define FACTs and CONSTRAINTS
State class/property disjointness
State a FK-like constraint State number-restriction
constraints
![Page 18: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/18.jpg)
+XML Concrete Syntax
• Based on OWL XML Presentation Syntax and RuleML• The SWRL XML syntax uses the OWL XML Ontology root
element and some of its subelements:• VersionInfo• PriorVersion• BackwardCompatibleWith• IncompatibleWith• Imports• Annotation• Class• EnumeratedClass
• SubClassOf• EquivalentClasses• DisjointClasses• DatatypeProperty• ObjectProperty• SubPropertyOf• EquivalentProperties• Individual• SameIndividual• DifferentIndividuals
![Page 19: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/19.jpg)
+XML Elements (1)
• VAR
• IMP
![Page 20: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/20.jpg)
+XML Element (2)
• Rlab• Body
• Head
![Page 21: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/21.jpg)
+XML Elements (cont)
• classAtom
![Page 22: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/22.jpg)
+XML Elements (cont)
• datarangeAtom
![Page 23: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/23.jpg)
+XML Elements (cont)
• individualPropertyAxiom
![Page 24: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/24.jpg)
+XML Elements (cont)
• datavaluedPropertyAxiom
![Page 25: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/25.jpg)
+XML Elements (cont)
• sameIndividualAtom
![Page 26: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/26.jpg)
+XML Elements (cont)
• differentIndividualsAtom
![Page 27: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/27.jpg)
+XML Elements (cont)
• builtInAtom
Built in atoms include: Comparison, Mathematical transformations, List operators, Modifiers for strings, dates and times, Boolean and URI checks, URI constructions
![Page 28: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/28.jpg)
+When RDFS/Rules
Expressivity for RDFS/OWL is enough
Use is knowledge sharing Application requires high
performance/uses specialized reasoner
Application requires standard behavior
Expressivity only captures by rules
Use is application behavior Application requires
complex reasoning Application relies on a
particular inference engine only
RDFS/OWL Rules
![Page 29: SWT Lecture Session 8 - Rules](https://reader034.vdocuments.us/reader034/viewer/2022051311/544230ebafaf9fe7098b4594/html5/thumbnails/29.jpg)
+Conclusion
Rules are a VERY expressive (powerful) ontology language Rules can capture most inferences provided by RDFS (part
of OWL too) Rules shouldn’t be abused. Performance of rule based
reasoning is suboptimal w.r.t. RDFS/OWL specialized reasoning.
Rules can be a powerful mean to capture application behiavor.
Note, although SWRL is the defacto rule language for the semantic web, there are new standards, i.e. RIF, that might take over in the future (further information in FSW Chapter 6)