Rule-based reasoning on the Semantic Web

Ruben Verborgh

Rule-based reasoning on the Semantic Web

Ruben Verborgh, IDLab, Ghent Universityimec

View, discuss, and edit these slides on GitHub at
RubenVerborgh / Semantic-Web-Reasoning

All men are mortal.
Socrates is a man.

Therefore,
Socrates is mortal.

∀x P(x) ⇒ Q(x)
P(y)

_____________
Q(y)

modus ponens

Rule-based reasoning on the Semantic Web

Rule-based reasoning on the Semantic Web

The basic information unit in the Semantic Web
is a link from one resource to another.

Those two resources each
are identified by a URL.

To simplify their display,
we abbreviate URLs using prefixes.

In contrast to typical Web links, these links
are typed with a URL we can dereference.

This Linked Data fact can be
represented as a triple.

We define the triple by its components:

Since a link type is a URL,
it is also a resource we can describe.

In addition to resources,
link targets can also be literal values.

By linking resources together this way,
we create a Semantic Web of Linked Data.

Linked Data triples can be serialized
using the Notation3 syntax.


PREFIX dbr:  <http://dbpedia.org/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

dbr:Tim_Berners-Lee foaf:knows dbr:Ted_Nelson.
dbr:Tim_Berners-Lee foaf:givenName "Tim".

foaf:knows rdf:type rdf:Property.

Rule-based reasoning on the Semantic Web

Semantic Web reasoning is an agent’s
ability to verify and discover facts.

Some reasoners are tailored to a task,
others can/need to be extended.

Rules in Notation3 are also expressed as triples
through if–then implications.


{ … }  log:implies  { … }.
{ … }      =>       { … }.

{ ppl:Tim foaf:knows ppl:Ted. }
=>
{ ppl:Ted foaf:knows ppl:Tim. }.

The EYE reasoner can produce inferences
by executing Notation3 rules.

Through the use of variables,
we can make rules more generic.


{ ppl:Tim foaf:knows ppl:Ted. }
=>
{ ppl:Ted foaf:knows ppl:Tim. }.

{ ?personA foaf:knows ?personB. }
=>
{ ?personB foaf:knows ?personA. }.

EYE will instantiate variables at runtime
in order to execute the rules.

Rule-based reasoning on the Semantic Web

Recall that a link type
is also a resource we can describe.

An ontology is a collection of descriptions
of related properties and classes.

rdf:type is a property stating that
a resource is an instance of a class.

ppl:Tim rdf:type foaf:Person.
ppl:Tim rdf:type ex:ComputerScientist.

rdf:type rdf:type rdf:Property.

rdfs:subPropertyOf is a property stating
a property is more specific than another.

ex:hasFriend rdfs:subPropertyOf foaf:knows.

rdfs:range   rdfs:subPropertyOf rdfs:seeAlso.
rdfs:domain  rdfs:subPropertyOf rdfs:seeAlso.

OWL contains similar properties for
symmetry, reflexivity, and transitivity.

ex:isMarriedTo a owl:SymmetricProperty.
ex:hasSameAge a owl:ReflexiveProperty.
owl:isFamilyMemberOf a owl:TransitiveProperty.

Ontologies use these properties and classes
to define their own concepts.


foaf:knows a rdf:Property.
foaf:knows rdfs:domain foaf:Person.
foaf:knows rdfs:range  foaf:Person.
foaf:knows rdf:type owl:SymmetricProperty.

Instead of capturing behavior with rules,
we describe the concepts it uses.


{ ?personA foaf:knows ?personB. }
=>
{ ?personB foaf:knows ?personA. }.

{ ?property rdf:type owl:SymmetricProperty.
  ?thingA ?property ?thingB. }
=>
{ ?thingB ?property ?thingA. }.

Defining rules at the ontological level
makes a vocabulary declarative.

Rules for many common properties already exist
and can therefore be reused.

Available from the EYE website:

Therefore, avoid writing rules
when using rule-based reasoning.

If you define a new property, describe it using other properties instead:

ex:hasFriend rdfs:subPropertyOf foaf:knows.
    

Only if this is insufficient, define custom rules.

Based on 1 data triple and 1 ontology triple,
a reasoner can derive a lot of knowledge.

Why is our hasFriend relation not symmetric
even though foaf:knows is?

Perhaps a rule is missing?

{ ?propertyA rdfs:subPropertyOf ?propertyB.
  ?propertyB rdf:type owl:SymmetricProperty. }
=>
{ ?propertyA rdf:type owl:SymmetricProperty. }.
  

This would have unintended consequences!

Another reason to reuse existing rules:
they have been tested or even proven correct.

Rule-based reasoning on the Semantic Web

To remember from this class