Semantic Web Reasoning With N3

Substantiating knowledge

Predicates express relationships between entities.
Not surprisingly, some of those relationships have similar properties, which we can exploit.

New relationships

There's something we haven't told you about. Cindy and John are more than just friends.

ppl:Cindy ppl:dates ppl:John.

Obviously, this also works the other way round. Time for some reasoning.

Example: "knows" and "dates" rules

Execute this command if you have downloaded the example files:

eye cindy-dates.n3 knows-rule.n3 dates-rule.n3 --query query-all.n3 --nope

Alternatively, execute this command to use the online example files:

eye http://n3.restdesc.org/n3/cindy-dates.n3 http://n3.restdesc.org/n3/knows-rule.n3 http://n3.restdesc.org/n3/dates-rule.n3 --query http://n3.restdesc.org/n3/query-all.n3 --nope

If we look at the "knows" and "dates" rules, we notice a resemblance. This is not a coincidence, because both predicates share the fact that they are symmetric.

A well-known vocabulary for expressing common ontological properties is OWL, the Web Ontology Language. It contains a mechanism to express that a property is symmetric:

@prefix owl: <http://www.w3.org/2002/07/owl#>.

foaf:knows a owl:SymmetricProperty.
ppl:dates a owl:SymmetricProperty.

The a is the short Notation3 way of saying "… belongs to the class …".

Unfortunately, these statements alone are insufficient to actually create the relationship from John to Cindy.

Defining predicates by rules

We need a rule that conveys the meaning of the owl:SymmetricProperty predicate.
Luckily, this has been done for us, as well as for a lot of other OWL properties.
Let's give it a try:

Example: "knows" and "dates" rules

Execute this command if you have downloaded the example files:

eye cindy-dates.n3 reflexives.n3 owl-SymmetricProperty.n3 --query query-all.n3 --nope

Alternatively, execute this command to use the online example files:

eye http://n3.restdesc.org/n3/cindy-dates.n3 http://n3.restdesc.org/n3/reflexives.n3 http://n3.restdesc.org/n3/owl-SymmetricProperty.n3 --query http://n3.restdesc.org/n3/query-all.n3 --nope

What happens here, is that the rule substantiates the meaning of the predicate.
It is very important here to get the exact picture of what the reasoner performs:

Input

Reasoning

  1. Since "knows" and "dates" are symmetric, the symmetric property applies.
  2. This means that every statement with them, can be reversed.

Output

You might not have expected to see owl:SymmetricProperty in the output, since this seems part of the internal process, just like the rule. However, the query specifically asks EYE to return all statements it can find. You will learn later how to tailor this behavior.

Reasoning at the meta level

The last three chapters, we've made enormous steps along the abstraction route:

  1. We started out with a rule specific to Cindy and John.
  2. We continued with a rule for all people, specific to "knows".
  3. We ended up with a rule for all symmetric predicates.

This characterizes a big movement from software engineering to knowledge engineering.
Rules no longer serve as a primary medium to reach a goal, but rather, they support the predicates that express this goal. Reasoning now happens at the meta level.

Next

References