This is an archive of an inactive wiki and cannot be modified.

RIF example UC7: Interchanging Rule Extensions to OWL

Background

Use case Interchanging Rule Extensions to OWL is about interchanging different rule extensions to the Web Ontology Language OWL.

Source rules

The current example in the use case is more on how to use ontologies and rules together, rather than how to interchange different rule languages which are extensions to OWL. In the following example, MAE (Material Anatomical Entities) is a class defined in an OWL ontology on brain cortex anatomical structures, while bounded and connected are properties introduced either by the ontology or by a rule base. The EBNF syntax of RIF Core WD1 is used, however without a Forall wrapper around the rule, as follows:

connectedTo(?X ?Y) :- And( MAE(?X) MAE(?Y) boundedBy(?X ?Z) boundedBy(?Y ?Z) )

The XML syntax of RIF Core WD1 is used, however without a Forall wrapper around the rule, as follows:

  <Implies>
    <then>
      <Uniterm>
        <Const>connectedTo</Const>
        <Var>X</Var>
        <Var>Y</Var>
      </Uniterm>
    </then>
    <if>
      <And>
        <Uniterm>
          <Const>MAE</Const>
          <Var>X</Var>
        </Uniterm>
        <Uniterm>
          <Const>MAE</Const>
          <Var>Y</Var>
        </Uniterm>
        <Uniterm>
          <Const>boundedBy</Const>
          <Var>X</Var>
          <Var>Z</Var>
        </Uniterm>
        <Uniterm>
          <Const>boundedBy</Const>
          <Var>Y</Var>
          <Var>Z</Var>
        </Uniterm>
      </And>
    </if>
  </Implies>

Analysis and issues

Naming

Like in OWL, RIF constants, predicates can be identified by URIrefs, data values can be represented by (simple or typed) literals. Similarly, functions can be identified by URIrefs. We use the iri attribute for these. As variables should only be unique within a rule, they can be simply strings enclosed in elements.

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE rdf:RDF [ 
    <!ENTITY rdf  "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
    <!ENTITY xsd  "http://www.w3.org/2001/XMLSchema#">
    <!ENTITY owl  "http://www.w3.org/2002/07/owl#" >
    <!ENTITY uc7  "http://www.w3.org/2005/rules/wg/wiki/UC7#" >
]>

 <Implies>
    <then>
      <Uniterm>
        <Const rif:iri="uc7:connectedTo" />
        <Var>X</Var>
        <Var>Y</Var>
      </Uniterm>
    </then>
    <if>
      <And>
        <Uniterm>
          <Const rif:iri="uc7:MAE" />
          <Var>X</Var>
        </Uniterm>
        <Uniterm>
          <Const rif:iri="uc7:MAE" />
          <Var>Y</Var>
        </Uniterm>
        <Uniterm>
          <Const rif:iri="uc7:boundedBy" />
          <Var>X</Var>
          <Var>Z</Var>
        </Uniterm>
        <Uniterm>
          <Const rif:iri="uc7:boundedBy" />
          <Var>Y</Var>
          <Var>Z</Var>
        </Uniterm>
      </And>
    </if>
  </Implies>