Rule-based reasoning in the Semantic Web

30
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
  • date post

    18-Oct-2014
  • Category

    Education

  • view

    7.637
  • download

    1

description

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/).

Transcript of Rule-based reasoning in the Semantic Web

PowerPoint Presentation

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

Outline

Motivation

SWRL

RIF

F. Corno, L. Farinetti - Politecnico di Torino 2

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?

3F. Corno, L. Farinetti - Politecnico di Torino

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

4F. Corno, L. Farinetti - Politecnico di Torino

Rule-based reasoning

Forward chaining

Backward chaining

RETE Algorithm

Goal-directed reasoning

5F. Corno, L. Farinetti - Politecnico di Torino

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

6F. Corno, L. Farinetti - Politecnico di Torino

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).

7F. Corno, L. Farinetti - Politecnico di Torino

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

8F. Corno, L. Farinetti - Politecnico di Torino

Outline

Motivation

SWRL

RIF

F. Corno, L. Farinetti - Politecnico di Torino 9

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-theoreticsemantics

10F. Corno, L. Farinetti - Politecnico di Torino

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.

11F. Corno, L. Farinetti - Politecnico di Torino

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

12F. Corno, L. Farinetti - Politecnico di Torino

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

13F. Corno, L. Farinetti - Politecnico di Torino

Syntax issues

SWRL rules are defined according to different syntaxforms

Abstract syntax (in functional form)

XML concrete syntax

RDF concrete syntax

Human-readable form (using logic predicates)

14F. Corno, L. Farinetti - Politecnico di Torino

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

15F. Corno, L. Farinetti - Politecnico di Torino

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)

16F. Corno, L. Farinetti - Politecnico di Torino

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 17F. Corno, L. Farinetti - Politecnico di Torino

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 materializesuch relationships

OWL Inference only supports forall or exists in propagating properties

In OWL you may not express that specific instancethat has such properties!

18F. Corno, L. Farinetti - Politecnico di Torino

OWL versus SWRL

OWL has a declarative nature, while SWRL is more operational

Even if the semantics extends that of OWL, practicalreasoners just apply the rules

The consistency of the rules application relies on the rule designers infinite wisdom

Example: If a property is declared as symmetric, thenwe must be careful to create all property instances tosatisfy that

19F. Corno, L. Farinetti - Politecnico di Torino

Concrete syntaxes: XML

x1x2

x2x3

x1x3

20F. Corno, L. Farinetti - Politecnico di Torino

Concrete syntaxes: RDF (I)

21F. Corno, L. Farinetti - Politecnico di Torino

Concrete syntaxes: RDF (II)

22F. Corno, L. Farinetti - Politecnico di Torino

Outline

Motivation

SWRL

RIF

F. Corno, L. Farinetti - Politecnico di Torino 23

Source: Chris Welty (W3C), RIF

Presentation to NY Semweb Meetup,

http://www.w3.org/2005/rules/wiki/images

/b/b0/W3C_RIF-CW-9-09.pdf24F. Corno, L. Farinetti - Politecnico di Torino

25F. Corno, L. Farinetti - Politecnico di Torino

26F. Corno, L. Farinetti - Politecnico di Torino

27F. Corno, L. Farinetti - Politecnico di Torino

F. Corno, L. Farinetti - Politecnico di Torino 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 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 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.