OWL Rules
Section 5. XML Concrete Syntax

Authors:
Harold Boley
Said Tabet

Contents


5. XML Concrete Syntax

Many possible XML encodings could be imagined (e.g., a RuleML based syntax as proposed in http://www.daml.org/listarchive/joint-committee/1460.html), but the most obvious solution is to extend the existing OWL Web Ontology Language XML Presentation Syntax [OWL XML], which can be straightforwardly modified to deal with OWL Rules. This has several advantages:

In the first place, the ontology root element is extended to include "imp" and "var" axioms as found under the rulebase root of RuleML.

element Ontology
<Ontology
  name = xsd:anyURI 
>
  Content: (VersionInfo | PriorVersion | BackwardCompatibleWith | 
            IncompatibleWith | Imports | Annotation | 
            Class[axiom] | EnumeratedClass(D,F) | 
            SubClassOf(D,F) | EquivalentClasses | DisjointClasses(D,F) | 
            DatatypeProperty | ObjectProperty | 
            SubPropertyOf | EquivalentProperties | 
            Individual[axiom] | SameIndividual | DifferentIndividuals |
            imp[axiom] | var[axiom])* 
</Ontology>
Attribute: name - refers to a name of this ontology, which is the base URI of this element.
Note: This is the root element of OWL documents in the XML presentation syntax, while rdf:RDF is used as the document root for OWL in RDF/XML.

We then simply need to add the relevant syntax for variables and rules.


Variable (var) axioms are statements about variables, indicating that the given string is to be used as a variable.

element var[axiom]
<ruleml:var>xsd:string</ruleml:var>
Parents: Ontology

A var axiom simply defines the existence of a variable. This is taken from the RuleML namespace. For example:

Example 5-1
<ruleml:var>x1</ruleml:var> 

Rule (imp) axioms are similar to SubClassOf axioms. They are taken from the RuleML namespace and can be read as a logical implication between the antecedent (_body) and consequent (_head). Like SubClassOf axioms, rules may include annotations.

element imp[axiom]
<imp>
  Content: ( Annotation*, _body, _head )
</imp>
Parents: Ontology
Note: This element allows one to say that every binding that satisfies the _body of the rule must also satisfy the _head of the rule.

Both _body and _head are lists of atoms and are read as the conjunction of the component atoms.

element _body
<_body>
  Content: ( atom* )
</_body>
Parents: imp
element _head
<_head>
  Content: ( atom* )
</_head>
Parents: imp

Atoms can be formed from unary predicates (classes), binary predicates (properties), equalities or inequalities.

Model group atom
  Content: (classAtom | individualPropertyAtom | datavaluedPropertyAtom | 
            sameIndividualAtom | differentIndividualsAtom)
Parents: _body, _head

Class atoms consist of a description and either an individual name or a variable name.

element classAtom
<classAtom>
  Content: ( description, iObject )
</classAtom>
Parents: atom

The description in a class atom may be a class name, or may be a complex description using boolean combinations, restrictions, etc. For example:

Example 5-2
<owlx:classAtom> 
  <owlx:Class owlx:name="Person" />
  <ruleml:var>x1</ruleml:var>
</owlx:classAtom> 

<owlx:classAtom> 
  <owlx:IntersectionOf>
    <owlx:Class owlx:name="Person" />
    <owlx:ObjectRestriction owlx:property="hasParent"> 
      <owlx:someValuesFrom owlx:class="Physician" />
    </owlx:ObjectRestriction> 
  </owlx:IntersectionOf>
  <ruleml:var>x2</ruleml:var>
</owlx:classAtom> 

Property atoms consist of a property name and two elements that can be individual names, variable names or data values.

element individualPropertyAtom
<individualPropertyAtom
  property = xsd:anyURI {required} 
>
  Content: ( iObject, iObject )
</individualPropertyAtom>
Attribute: property - a reference to an individual property name
Parents: atom
element datavaluedPropertyAtom
<datavaluedPropertyAtom
  property = xsd:anyURI {required} 
>
  Content: ( iObject, dObject )
</datavaluedPropertyAtom>
Attribute: property - a reference to an datavalued property name
Parents: atom

As OWL does not support complex property descriptions, a property atom takes only a property name. For example:

Example 5-3
<owlx:individualPropertyAtom  owlx:property="hasParent"> 
  <ruleml:var>x1</ruleml:var>
  <owlx:Individual owlx:name="John" />
</owlx:individualPropertyAtom> 

<owlx:datavaluedPropertyAtom  owlx:property="grade"> 
  <ruleml:var>x1</ruleml:var>
  <owlx:DataValue owlx:datatype="&xsd;integer">4</owlx:DataValue>
</owlx:datavaluedPropertyAtom> 

Same (different) individual atoms assert equality (inequality) between sets individual and variable names.

element sameIndividualAtom
<sameIndividualAtom>
  Content: ( iObject* )
</sameIndividualAtom>
Parents: atom
element differentIndividualsAtom
<differentIndividualsAtom>
  Content: ( iObject* )
</differentIndividualsAtom>
Parents: atom

Note that (in)equalities can be asserted between arbitrary combinations of variable names and individual names. For example:

Example 5-4
<owlx:sameIndividualAtom> 
  <ruleml:var>x1</ruleml:var>
  <ruleml:var>x2</ruleml:var>
  <owlx:Individual owlx:name="Clinton" />
  <owlx:Individual owlx:name="Bill_Clinton" />
</owlx:sameIndividualAtom> 

Model group iObject
  Content: ( Individual[ID] | var[ID] )
Parents: classAtom, individualPropertyAtom, sameIndividualAtom, differentIndividualsAtom
Model group dObject
  Content: ( DataValue | var[ID] )
Parents: datavaluedPropertyAtom
element var[ID]
<ruleml:var>xsd:string</ruleml:var>
Parents: iObject, dObject
Note: This element is used for solely referring to a variable ID, and does not actually define any variable, unlike a var axiom.

5.1. Rule Examples

We can use OWL rules to assert that the combination of the hasParent and hasBrother properties implies the hasUncle property:

Example 5.1-1
<ruleml:imp> 
  <ruleml:_body> 
    <owlx:individualPropertyAtom  owlx:property="hasParent"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x2</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:individualPropertyAtom  owlx:property="hasBrother"> 
      <ruleml:var>x2</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    </owlx:individualPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <owlx:individualPropertyAtom  owlx:property="hasUncle"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    </owlx:individualPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

An alternative formulation for the hasUncle rule given in Example 5.1-1 would be to assert that if x1 hasParent x2, x2 hasSibling x3, and x3 hasSex male, then x1 hasUncle x3:

Example 5.1-2
<ruleml:imp> 
  <ruleml:_body> 
    <owlx:individualPropertyAtom  owlx:property="hasParent"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x2</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:individualPropertyAtom  owlx:property="hasSibling"> 
      <ruleml:var>x2</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    <owlx:individualPropertyAtom  owlx:property="hasSex"> 
      <ruleml:var>x3</ruleml:var>
      <owlx:Individual owlx:name="#male" />
    </owlx:individualPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <owlx:individualPropertyAtom  owlx:property="hasUncle"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    </owlx:individualPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

The following example is due to Guus Schreiber, and is based on ontologies used in an image annotation demo.

The rule expresses the fact that, given knowledge about the AAT style of certain ULAN artists (e.g., van Gogh is an Impressionist painter), we can derive the style of an art object (represented with the VRA element "style/period") from the value of the creator of the art object (represented by the VRA element "creator", a subproperty of dc:creator):

Example 5.1-3
<ruleml:imp> 
  <ruleml:_body> 
    <owlx:classAtom> 
      <owlx:class="&ulan;Artist" />
      <ruleml:var>_x</ruleml:var>
    </owlx:classAtom> 
    <owlx:classAtom> 
      <owlx:class="&aat;Style" />
      <ruleml:var>_y</ruleml:var>
    </owlx:classAtom> 
    <owlx:individualPropertyAtom  owlx:property="&aatulan;artistStyle"> 
      <ruleml:var>_x</ruleml:var>
      <ruleml:var>_y</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:individualPropertyAtom  owlx:property="&vra;creator"> 
      <ruleml:var>_x</ruleml:var>
      <ruleml:var>_z</ruleml:var>
    </owlx:individualPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <owlx:individualPropertyAtom  owlx:property="&vra;style/period"> 
      <ruleml:var>_z</ruleml:var>
      <ruleml:var>_y</ruleml:var>
    </owlx:individualPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

The following is taken from an extended example due to Mike Dean. It expresses the fact that for every Airport there is a map Point that has the same location (latitude and longitude) as the Airport and that is an object of "layer" (a map DrawingLayer). Moreover, this map point has the Airport as an underlyingObject and has the Airport name as its Label

Note how the expressive power of OWL Rules allows "existentials" to be expressed in the head of a rule—it is asserted that, for every airport, there must exist such a map point.


Example 5.1-4
<!--
Background knowledge about airports and maps:
-->

<owlx:DatatypeProperty owlx:name="latitude"/>
<owlx:DatatypeProperty owlx:name="longitude"/>

<owlx:SubClassOf> 
  <owlx:sub> 
    <owlx:class="Location" />
  </owlx:sub> 
  <owlx:super> 
    <owlx:IntersectionOf>
      <owlx:ObjectRestriction owlx:property="latitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:ObjectRestriction> 
      <owlx:ObjectRestriction owlx:property="longitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:ObjectRestriction> 
    </owlx:IntersectionOf>
  </owlx:super> 
</owlx:SubClassOf> 

<owlx:Individual owlx:name="&airport;GEC">
  <owlx:type owlx:name="&airport-ont;Airport" /> 
  <owlx:DataPropertyValue owlx:property="airport-ont:name">
    <owlx:DataValue owlx:datatype="&xsd;string">Spokane Intl</owlx:DataValue> 
  </owlx:DataPropertyValue>
  <owlx:ObjectPropertyValue owlx:property="location">
    <owlx:Individual>
      <owlx:DataPropertyValue owlx:property="latitude">
        <owlx:DataValue>47.6197</owlx:DataValue> 
      </owlx:DataPropertyValue>
      <owlx:DataPropertyValue owlx:property="longitude">
        <owlx:DataValue>-117.5336</owlx:DataValue> 
      </owlx:DataPropertyValue>
    </owlx:Individual>
  </owlx:ObjectPropertyValue>
</owlx:Individual>
 
<owlx:Individual owlx:name="layer">
  <owlx:type owlx:name="&map;DrawingLayer" /> 
</owlx:Individual>
 
<owlx:Individual owlx:name="map">
  <owlx:type owlx:name="&map;Map" /> 
  <owlx:DataPropertyValue owlx:property="&map;name">
    <owlx:DataValue owlx:datatype="&xsd;string">Airports</owlx:DataValue> 
  </owlx:DataPropertyValue>
  <owlx:ObjectPropertyValue owlx:property="map:layer">
    <owlx:Individual owlx:name="layer"/>
  </owlx:ObjectPropertyValue>
</owlx:Individual>

<!--
A map:Location has latitude and longitude, both of which are doubles:
-->

<owlx:SubClassOf> 
  <owlx:sub> 
    <owlx:class="&map;Location" />
  </owlx:sub> 
  <owlx:super> 
    <owlx:IntersectionOf>
      <owlx:ObjectRestriction owlx:property="&map;latitude"> 
        <owlx:someValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:ObjectRestriction> 
      <owlx:ObjectRestriction owlx:property="&map;latitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:ObjectRestriction> 
      <owlx:ObjectRestriction owlx:property="&map;longitude"> 
        <owlx:someValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:ObjectRestriction> 
      <owlx:ObjectRestriction owlx:property="&map;longitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:ObjectRestriction> 
    </owlx:IntersectionOf>
  </owlx:super> 
</owlx:SubClassOf> 

<!--
If a map:Location is the sameLocation as another location, 
then it has the same values for latitude and longitude.
-->

<ruleml:imp> 
  <ruleml:_body> 
    <owlx:classAtom> 
      <owlx:class="&map;Location" />
      <ruleml:var>_maploc</ruleml:var>
    </owlx:classAtom> 
    <owlx:individualPropertyAtom  owlx:property="sameLocation"> 
      <ruleml:var>_loc</ruleml:var>
      <ruleml:var>_maploc</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:datavaluedPropertyAtom  owlx:property="latitude"> 
      <ruleml:var>_loc</ruleml:var>
      <ruleml:var>_lat</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
    <owlx:datavaluedPropertyAtom  owlx:property="longitude"> 
      <ruleml:var>_loc</ruleml:var>
      <ruleml:var>_lon</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <owlx:datavaluedPropertyAtom  owlx:property="&map;latitude"> 
      <ruleml:var>_maploc</ruleml:var>
      <ruleml:var>_lat</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
    <owlx:datavaluedPropertyAtom  owlx:property="&map;longitude"> 
      <ruleml:var>_maploc</ruleml:var>
      <ruleml:var>_lon</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

<!--
Wherever an Airport is located, there is some map:Location
that is the sameLocation as the Airport's location, and that
is the location of a map Point that is an object of the
map:DrawingLayer "layer":
-->

<owlx:ObjectProperty owlx:name="&map;location" owlx:inverseOf="&map;isLocationOf" />
<owlx:ObjectProperty owlx:name="&map;object" owlx:inverseOf="&map;isObjectOf" />

<ruleml:imp> 
  <ruleml:_body> 
    <owlx:classAtom> 
      <owlx:class="&airport-ont;Airport" />
      <ruleml:var>_airport</ruleml:var>
    </owlx:classAtom> 
    <owlx:individualPropertyAtom  owlx:property="location"> 
      <ruleml:var>_airport</ruleml:var>
      <ruleml:var>_loc</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:datavaluedPropertyAtom  owlx:property="latitude"> 
      <ruleml:var>_loc</ruleml:var>
      <ruleml:var>_lat</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
    <owlx:datavaluedPropertyAtom  owlx:property="longitude"> 
      <ruleml:var>_loc</ruleml:var>
      <ruleml:var>_lon</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <owlx:classAtom> 
      <owlx:ObjectRestriction owlx:property="sameLocation"> 
        <owlx:someValuesFrom>
          <owlx:IntersectionOf>
            <owlx:class="&map;Location" />
            <owlx:ObjectRestriction owlx:property="&map;isLocationOf"> 
              <owlx:someValuesFrom>
                <owlx:IntersectionOf>
                  <owlx:class="&map;Point" />
                  <owlx:ObjectRestriction owlx:property="&map;isObjectOf"> 
                    <owlx:someValuesFrom>
                      <owlx:OneOf>
                        <owlx:Individual owlx:name="#layer" /> 
                      </owlx:OneOf>
                    </owlx:someValuesFrom>
                  </owlx:ObjectRestriction owlx:property="&map;isObjectOf"> 
                </owlx:IntersectionOf>
              </owlx:someValuesFrom>
            </owlx:ObjectRestriction owlx:property="&map;isLocationOf"> 
          </owlx:IntersectionOf>
        </owlx:someValuesFrom>
      </owlx:ObjectRestriction> 
      <ruleml:var>_loc</ruleml:var>
    </owlx:classAtom> 
  </ruleml:_head> 
</ruleml:imp> 

<!--
The map:Point whose map:location is the map:Location of an Airport 
has the airport as a map:underlyingObject and has a map:label 
which is the name of the Airport.
-->

<ruleml:imp> 
  <ruleml:_body> 
    <owlx:classAtom> 
      <owlx:class="&airport-ont;Airport" />
      <ruleml:var>_airport</ruleml:var>
    </owlx:classAtom> 
    <owlx:individualPropertyAtom  owlx:property="location"> 
      <ruleml:var>_airport</ruleml:var>
      <ruleml:var>_loc</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:individualPropertyAtom  owlx:property="sameLocation"> 
      <ruleml:var>_loc</ruleml:var>
      <ruleml:var>_maploc</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:individualPropertyAtom  owlx:property="&map;location"> 
      <ruleml:var>_point</ruleml:var>
      <ruleml:var>_maploc</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:datavaluedPropertyAtom  owlx:property="&airport-ont;name"> 
      <ruleml:var>_airport</ruleml:var>
      <ruleml:var>_name</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <owlx:individualPropertyAtom  owlx:property="&map;underlyingObject"> 
      <ruleml:var>_point</ruleml:var>
      <ruleml:var>_airport</ruleml:var>
    </owlx:individualPropertyAtom> 
    <owlx:datavaluedPropertyAtom  owlx:property="&map;label"> 
      <ruleml:var>_point</ruleml:var>
      <ruleml:var>_name</ruleml:var>
    </owlx:datavaluedPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp>