Rule-based reasoning in the Semantic Web

  • 6,002 views
Uploaded on

An introduction to SWRL and to rule-based reasoning languagest for the Semantic Web. The material is mostly taken from the Semantic Web Recommendations. Slides for the PhD Course on Semantic Web …

An introduction to SWRL and to rule-based reasoning languagest for the Semantic Web. The material is mostly taken from the Semantic Web Recommendations. Slides for the PhD Course on Semantic Web (http://elite.polito.it/).

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
6,002
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
200
Comments
0
Likes
8

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Rule-based reasoning in the Semantic Web Fulvio Corno, Laura Farinetti Politecnico di Torino Dipartimento di Automatica e Informatica e-Lite Research Group – http://elite.polito.it
  • 2. Outline  Motivation  SWRL  RIF F. Corno, L. Farinetti - Politecnico di Torino 2
  • 3. Motivation  Classical reasoning operations in OWL only allow very limited use cases  Consistency  Class properties and relationships  Instance classification  How to to more complex reasoning tasks?  E.g., inferring properties of instances depending on other instance properties? F. Corno, L. Farinetti - Politecnico di Torino 3
  • 4. Types of rules  Production Rules (or Inference Rules)  IF condition THEN action  Logical predicates  Executed upon explicit request, starting from a stateless initial condition  Event-Condition-Action rules  “Reactive” execution to detect and react to incoming events and process event patterns  Usually running in parallel to the application, reacting when events occur, usually in a stateful manner F. Corno, L. Farinetti - Politecnico di Torino 4
  • 5. Rule-based reasoning  Forward chaining  Backward chaining  RETE Algorithm  Goal-directed reasoning F. Corno, L. Farinetti - Politecnico di Torino 5
  • 6. Forward chaining  Forward chaining starts with the available data and uses inference rules to extract more data until a goal is reached.  An inference engine using forward chaining searches the inference rules until it finds one where the antecedent (If clause) is known to be true.  When found it can conclude, or infer, the consequent (Then clause), resulting in the addition of new information to its data F. Corno, L. Farinetti - Politecnico di Torino 6
  • 7. Backward chaining  Backward chaining starts with a list of goals (or a hypothesis) and works backwards from the consequent to the antecedent to see if there is data available that will support any of these consequents.  An inference engine using backward chaining would search the inference rules until it finds one which has a consequent (Then clause) that matches a desired goal.  If the antecedent (If clause) of that rule is not known to be true, then it is added to the list of goals (in order for one's goal to be confirmed one must also provide data that confirms this new rule). F. Corno, L. Farinetti - Politecnico di Torino 7
  • 8. Rule engines  Drools (now Jboss Rules, own rule format)  http://www.jboss.org/drools  SweetRules (RuleML, SWRL, others)  http://sweetrules.semwebcentral.org/  Jena 2 (own rule format)  http://jena.sourceforge.net/inference/  Jess (own rule format)  http://www.jessrules.com/  Pellet  Bossam … F. Corno, L. Farinetti - Politecnico di Torino 8
  • 9. Outline  Motivation  SWRL  RIF F. Corno, L. Farinetti - Politecnico di Torino 9
  • 10. Semantic Web Rule Language (SWRL)  Not an official W3C Recommedation  Application to OWL of the RuleML (http://ruleml.org/) languages  Extends OWL language by providing Horn clauses  Defines an extension of the OWL model-theoretic semantics F. Corno, L. Farinetti - Politecnico di Torino 10
  • 11. SWRL structure  The rules are of the form of an implication between an antecedent (body) and consequent (head).  The intended meaning can be read as:  whenever the conditions specified in the antecedent hold,  then the conditions specified in the consequent must also hold. F. Corno, L. Farinetti - Politecnico di Torino 11
  • 12. General structure  Both the antecedent (body) and consequent (head) consist of zero or more atoms.  An empty antecedent is treated as trivially true (i.e. satisfied by every interpretation), so the consequent must also be satisfied by every interpretation;  an empty consequent is treated as trivially false (i.e., not satisfied by any interpretation), so the antecedent must also not be satisfied by any interpretation.  Multiple atoms are treated as a conjunction F. Corno, L. Farinetti - Politecnico di Torino 12
  • 13. Atoms  Atoms in these rules can be of the form  C(x), where C is an OWL description  P(x,y), where P is an OWL property  sameAs(x,y)  differentFrom(x,y)  where x, y are either variables, OWL individuals or OWL data values F. Corno, L. Farinetti - Politecnico di Torino 13
  • 14. Syntax issues  SWRL rules are defined according to different syntax forms  Abstract syntax (in functional form)  XML concrete syntax  RDF concrete syntax  Human-readable form (using logic predicates) F. Corno, L. Farinetti - Politecnico di Torino 14
  • 15. Example: uncle  Human-readable syntax  hasParent(?x1,?x2) ∧ hasBrother(?x2,?x3) ⇒ hasUncle(?x1,?x3)  Abstract syntax  Implies(Antecedent( hasParent(I-variable(x1) I-variable(x2)) hasBrother(I-variable(x2) I-variable(x3))) Consequent( hasUncle(I-variable(x1) I-variable(x3))))  Example: if John has Mary as a parent and Mary has Bill as a brother then John has Bill as an uncle F. Corno, L. Farinetti - Politecnico di Torino 15
  • 16. Example: inheritance  Human-readable syntax  Student(?x1) ⇒ Person(?x1)  Abstract syntax  Implies(Antecedent(Student(I-variable(x1))) Consequent(Person(I-variable(x1))))  This is an improper usage of rules: it should be expressed directly in OWL, to make the information also available to an OWL reasoner  SubClassOf(Student Person) F. Corno, L. Farinetti - Politecnico di Torino 16
  • 17. Example: propagating properties  Human-readable syntax  Artist(?x) & artistStyle(?x,?y) & Style(?y) & creator(?z,?x) ⇒ style/period(?z,?y)  Abstract syntax  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))))  Meaning: the style of an art object is the same as the style of the creator F. Corno, L. Farinetti - Politecnico di Torino 17
  • 18. SWRL versus OWL  The last example may not be described in OWL  In OWL, you declare relationships between Classes  Such relationships are intended to apply on instances  You may add properties to instances to materialize such relationships  OWL Inference only supports “forall” or “exists” in propagating properties  In OWL you may not express “that specific instance that has such properties”! F. Corno, L. Farinetti - Politecnico di Torino 18
  • 19. OWL versus SWRL  OWL has a declarative nature, while SWRL is more operational  Even if the semantics extends that of OWL, practical reasoners just “apply the rules”  The consistency of the rules application relies on the rule designer’s infinite wisdom  Example: If a property is declared as symmetric, then we must be careful to create all property instances to satisfy that F. Corno, L. Farinetti - Politecnico di Torino 19
  • 20. Concrete syntaxes: XML <ruleml:imp> <ruleml:_rlab ruleml:href="#example1"/> <ruleml:_body> <swrlx:individualPropertyAtom swrlx:property="hasParent"> <ruleml:var>x1</ruleml:var> <ruleml:var>x2</ruleml:var> </swrlx:individualPropertyAtom> <swrlx:individualPropertyAtom swrlx:property="hasBrother"> <ruleml:var>x2</ruleml:var> <ruleml:var>x3</ruleml:var> </swrlx:individualPropertyAtom> </ruleml:_body> <ruleml:_head> <swrlx:individualPropertyAtom swrlx:property="hasUncle"> <ruleml:var>x1</ruleml:var> <ruleml:var>x3</ruleml:var> </swrlx:individualPropertyAtom> </ruleml:_head> </ruleml:imp> Politecnico di Torino F. Corno, L. Farinetti - 20
  • 21. Concrete syntaxes: RDF (I) <swrl:Variable rdf:ID="x1"/> <swrl:Variable rdf:ID="x2"/> <swrl:Variable rdf:ID="x3"/> <ruleml:Imp> <ruleml:body rdf:parseType="Collection"> <swrl:IndividualPropertyAtom> <swrl:propertyPredicate rdf:resource="&eg;hasParent"/> <swrl:argument1 rdf:resource="#x1" /> <swrl:argument2 rdf:resource="#x2" /> </swrl:IndividualPropertyAtom> <swrl:IndividualPropertyAtom> <swrl:propertyPredicate rdf:resource="&eg;hasSibling"/> <swrl:argument1 rdf:resource="#x2" /> <swrl:argument2 rdf:resource="#x3" /> </swrl:IndividualPropertyAtom> F. Corno, L. Farinetti - Politecnico di Torino 21
  • 22. Concrete syntaxes: RDF (II) <swrl:IndividualPropertyAtom> <swrl:propertyPredicate rdf:resource="&eg;hasSex"/> <swrl:argument1 rdf:resource="#x3" /> <swrl:argument2 rdf:resource="#male" /> </swrl:IndividualPropertyAtom> </ruleml:body> <ruleml:head rdf:parseType="Collection"> <swrl:IndividualPropertyAtom> <swrl:propertyPredicate rdf:resource="&eg;hasUncle"/> <swrl:argument1 rdf:resource="#x1" /> <swrl:argument2 rdf:resource="#x3" /> </swrl:IndividualPropertyAtom> </ruleml:head> </ruleml:Imp> F. Corno, L. Farinetti - Politecnico di Torino 22
  • 23. Outline  Motivation  SWRL  RIF F. Corno, L. Farinetti - Politecnico di Torino 23
  • 24. Source: Chris Welty (W3C), RIF Presentation to NY Semweb Meetup, F. Corno, L. Farinetti - Politecnico di Torino http://www.w3.org/2005/rules/wiki/images 24 /b/b0/W3C_RIF-CW-9-09.pdf
  • 25. F. Corno, L. Farinetti - Politecnico di Torino 25
  • 26. F. Corno, L. Farinetti - Politecnico di Torino 26
  • 27. F. Corno, L. Farinetti - Politecnico di Torino 27
  • 28. References  SWRL: A Semantic Web Rule Language Combining OWL and RuleML, W3C Member Submission 21 May 2004  http://www.w3.org/Submission/SWRL/  RIF Use Cases and Requirements, W3C Working Draft 18 December 2008  http://www.w3.org/TR/rif-ucr/ F. Corno, L. Farinetti - Politecnico di Torino 28
  • 29. References  http://en.wikipedia.org/wiki/Business_rules_engine  http://en.wikipedia.org/wiki/Forward_chaining  http://en.wikipedia.org/wiki/Backward_chaining  RIF Working Group  http://www.w3.org/2005/rules/wiki/RIF_Working_Group F. Corno, L. Farinetti - Politecnico di Torino 29
  • 30. License  This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.  To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. F. Corno, L. Farinetti - Politecnico di Torino 30