SWRL
Section 6. RDF Concrete Syntax


Contents


6. RDF Concrete Syntax

In this section we present an RDF concrete syntax for the rules. It is straightforward to provide such an RDF concrete syntax for rules, but the presence of variables in rules goes beyond the RDF Semantics. We do not yet know if the intended semantics of the resultant RDF graphs can be described as a semantic extension of RDF.

An RDF Schema for SWRL is swrl.rdf. An OWL ontology for SWRL is swrl.owl. Each of these provides only a partial description of the syntax for SWRL; the OWL ontology is more complete than the RDF Schema.

Translation from the XML Concrete Syntax to RDF/XML could be easily accomplished by extending the XSLT transformation for the OWL XML Presentation syntax [OWL XML].

6.1. Rule Examples in RDF Concrete Syntax

These examples illustrate a suitable rules extension of the OWL RDF/XML syntax. The first example is a repetition of Example 5.1-2 using RDF/XML syntax:

Example 6.1-1
<swrl:Variable rdf:ID="x1"/>
<swrl:Variable rdf:ID="x2"/>
<swrl:Variable rdf:ID="x3"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasParent"/> 
      <swrl:argument1 rdf:resource="#x1" />
      <swrl:argument2 rdf:resource="#x2" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasSibling"/> 
      <swrl:argument1 rdf:resource="#x2" />
      <swrl:argument2 rdf:resource="#x3" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasSex"/> 
      <swrl:argument1 rdf:resource="#x3" />
      <swrl:argument2 rdf:resource="#male" />
    </swrl:IndividualPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasUncle"/> 
      <swrl:argument1 rdf:resource="#x1" />
      <swrl:argument2 rdf:resource="#x3" />
    </swrl:IndividualPropertyAtom>
  </ruleml:head> 
</ruleml:Imp> 

This example is a repetition of Example 5.1-3 using RDF/XML syntax:

Example 6.1-2
<swrl:Variable rdf:ID="x"/>
<swrl:Variable rdf:ID="y"/>
<swrl:Variable rdf:ID="z"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&ulan;Artist"/> 
      <swrl:argument1 rdf:resource="#x" />
    </swrl:ClassAtom>
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&aat;Style"/> 
      <swrl:argument1 rdf:resource="#y" />
    </swrl:ClassAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&aatulan;artistStyle"/> 
      <swrl:argument1 rdf:resource="#x" />
      <swrl:argument2 rdf:resource="#y" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&vra;creator"/> 
      <swrl:argument1 rdf:resource="#x" />
      <swrl:argument2 rdf:resource="#z" />
    </swrl:IndividualPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&vra;style/period"/> 
      <swrl:argument1 rdf:resource="#z" />
      <swrl:argument2 rdf:resource="#y" />
    </swrl:IndividualPropertyAtom>
  </ruleml:head> 
</ruleml:Imp> 

This example is a repetition of the complex rule from Example 5.1-4 using RDF/XML syntax:

Example 6.1-3
<swrl:Variable rdf:ID="airport"/>
<swrl:Variable rdf:ID="loc"/>
<swrl:Variable rdf:ID="name"/>
<swrl:Variable rdf:ID="lat"/>
<swrl:Variable rdf:ID="lon"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&airport-ont;Airport"/> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#location"/> 
      <swrl:argument1 rdf:resource="#airport" />
      <swrl:argument2 rdf:resource="#loc" />
    </swrl:IndividualPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#latitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lat" />
    </swrl:DatavaluedPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#longitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lon" />
    </swrl:DatavaluedPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:ClassAtom> 
      <swrl:classPredicate>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#sameLocation"/>
          <owl:someValuesFrom>
            <owl:Class>
              <owl:intersectionOf rdf:parseType="Collection">
                <owl:Class rdf:about="&map;Location"/>
                <owl:Restriction>
                  <owl:onProperty rdf:resource="&map;isLocationOf"/>
                  <owl:someValuesFrom>
                    <owl:Class>
                      <owl:intersectionOf rdf:parseType="Collection">
                        <owl:Class rdf:about="&map;Point"/>
                        <owl:Restriction>
                          <owl:onProperty rdf:resource="&map;isObjectOf"/>
                          <owl:someValuesFrom>
                            <owl:Class>
                              <owl:oneOf rdf:parseType="Collection">
                                <owl:Item rdf:resource="#layer"/>
                              </owl:oneOf>
                            </owl:Class>
                          </owl:someValuesFrom>
                        </owl:Restriction>
                      </owl:intersectionOf>
                    </owl:Class>
                  </owl:someValuesFrom>
                </owl:Restriction>
              </owl:intersectionOf>
            </owl:Class>
          </owl:someValuesFrom>
        </owl:Restriction>
      </swrl:classPredicate> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
  </ruleml:head> 
</ruleml:Imp> 

These examples are also provided as example6.1-1.owl, example6.1-2.owl, and example6.1-3.owl.