This project has retired. For details please refer to its Attic page.
Apache Stanbol - Stanbol Rule Language

Stanbol Rule Language

Example

The following is a rule, called uncleRule, for inferring the relation hasUncle between individuals x and y if z is a parent of x and z is brother of y.

In Stanbol Rule syntax it is:

uncleRule[has(<http://www.foo.org/myont.owl#hasParent>, ?x, ?z) .
          has(<http://www.foo.org/myont.owl#hasSibling>, ?z, ?y)
             ->
          has(<http://www.foo.org/myont.owl#hasUncle>, ?x, ?y)
]

The rule above becomes the following SWRL rule:

<swrl:Variable rdf:ID="x"/>
<swrl:Variable rdf:ID="z"/>
<swrl:Variable rdf:ID="y"/>
<ruleml:Imp> 
   <ruleml:body rdf:parseType="Collection">
      <swrl:IndividualPropertyAtom> 
          <swrl:propertyPredicate rdf:resource="&eg;hasParent"/> 
          <swrl:argument1 rdf:resource="#x" />
          <swrl:argument2 rdf:resource="#z" />
      </swrl:IndividualPropertyAtom>
      <swrl:IndividualPropertyAtom> 
          <swrl:propertyPredicate rdf:resource="&eg;hasSibling"/> 
          <swrl:argument1 rdf:resource="#z" />
          <swrl:argument2 rdf:resource="#y" />
      </swrl:IndividualPropertyAtom>
   </ruleml:body>
   <ruleml:head rdf:parseType="Collection"> 
      <swrl:IndividualPropertyAtom> 
          <swrl:propertyPredicate rdf:resource="&eg;hasUncle"/> 
          <swrl:argument1 rdf:resource="#x" />
          <swrl:argument2 rdf:resource="#y" />
      </swrl:IndividualPropertyAtom>
   </ruleml:head> 
</ruleml:Imp>

or the following SPARQL CONSTRUCT statement:

PREFIX myont: <http://www.foo.org/myont.owl#>

CONSTRUCT { ?x myont:hasUncle ?y }
WHERE { ?x myont:hasParent ?z . 
        ?z myont:hasSibling ?y}

Back to Rules