Semantic Web Reasoning With EYE

A simple rule

Notation3 is more than a convenient way to write RDF.
Specifically, it allows us to express rules.

The need for rules

We're already aware that Cindy knows John. In the FOAF sense, knowing someone is assumed reciprocal. So John also knows Cindy.

We could just add that fact to our knowledge base. But that would violate the DRY principle: why add knowledge that's already there?

Instead, we are going to generate this kind of facts automatically.

A first rule

So far, we've only added facts to our knowledge base. We will now add another kind of knowledge: a rule. Maybe you're familiar with these (no worries if you're not):

P implies Q

The above reads “P implies Q”, or in an instructive manner: “if we have P, we also have Q”. Let's express that in N3 with Cindy and John:

@prefix ppl: <>.
@prefix foaf: <>.

    ppl:Cindy foaf:knows ppl:John.
    ppl:John foaf:knows ppl:Cindy.

Obviously, we're saying here that if Cindy knows John, then John also knows Cindy.
N3 uses braces {} to group triples and a textual arrow => for the implication symbol.
Also, don't forget to end the rule with a period ., just like regular triples.


We execute the rule we just created… online!