Web Ontology Language (OWL) Abstract Syntax and Semantics
Section 4. Mapping to RDF N-Triples

Editors:
Peter F. Patel-Schneider, Bell Labs Research
Ian Horrocks, Department of Computer Science, University of Manchester
Frank van Harmelen, Department of Artificial Intelligence, Vrije Universiteit Amsterdam

Contents


4. Mapping to RDF N-Triples

The exchange syntax for OWL is RDF/XML, as specified in the OWL Reference Description [OWL Reference]. Further, the meaning of an OWL document base in RDF/XML is determined only from the n-triples [RDF Tests] that result from the RDF parsing of the RDF/XML document. Thus one way of translating an OWL ontology in abstract syntax form into the exchange syntax is by giving a transformation of each directive into a collection of n-triples.

The n-triples syntax used here is the one used in the RDF Model Theory [RDF MT]. In this variant, QNames are allowed. To turn this syntax into the standard one, just turn the QName into the obvious URI reference. The only prefixes used in the transformation are rdf, rdfs, xsd, and owl, which should be expanded into http://www.w3.org/1999/02/22-rdf-syntax-ns#, http://www.w3.org/2000/01/rdf-schema#, http://www.w3.org/2001/XMLSchema#, and http://www.w3.org/2002/07/owl#, respectively.

As all OWL Lite constructs are special cases of constructs in the full abstract syntax, transformations are only provided for the full versions.

Each type of directive is translated via one of the transformation rules below. In the transformation rules nonterminals are enclosed in angle brackets. Repeating nonterminals are listed using ellipses, as in <description1> … <descriptionn>, this form allows easy specification of the transformation for all values of n, including 0. Optional portions of the abstract syntax (enclosed in square brackets) are optional portions of the transformation (signified by square brackets).

The table below gives the transformation rules that transform the abstract syntax to the OWL exchange syntax. The left column gives a piece of syntax (S), the center column gives its transformation (T(S)), and the right column gives a node identifier that is the main node of the transformation (M(T(S))), but only for syntactic constructs that can occur as pieces of directives. Some transformations in the table are for directives. Other transformations are for parts of directives. The last transformation is for sequences, which are not part of the abstract syntax per se. This last transformation is used to make some of the other transformations more compact and easier to read.

For many directives these transformation rules call for the transformation of components of the directive using other transformation rules. When the transformation of a component is used in a node position of a triple, the transformation of the construct is part of the production (but only once per production) and the main node of that transformation should be used for that node of the triple.

Bnode identifiers here must be taken as local to each transformation, i.e., different identifiers should be used for each invocation of a transformation rule.

Abstract Syntax (and sequences) - S Transformation - T(S) Main Node - M(T(S))
<datatypeID> <datatypeID> rdf:type owl:Datatype .
<datatypeID> rdf:subClassOf rdfs:Literal .
<datatypeID>
<classID> <classID> rdf:type owl:Class .
<classID> rdf:subClassOf owl:Thing .
<classID>
<individualID> <individualID> rdf:type owl:Thing . <individualID>
<datavaluedPropertyID> <datavaluedPropertyID> rdf:type owl:DatatypeProperty .
<datavaluedPropertyID> rdfs:domain owl:Thing .
<datavaluedPropertyID> rdfs:range rdfs:Literal .
<datavaluedPropertyID>
<individualvaluedPropertyID> <individualvaluedPropertyID> rdf:type owl:ObjectProperty .
<individualvaluedPropertyID> rdfs:domain owl:Thing .
<individualvaluedPropertyID> rdfs:range owl:Thing .
<individualvalued-
PropertyID>
<datatypeID> <literal> <datatypeID>:<literal> [[To be fixed.]] <datatypeID>:<literal>
Annotation( <URI reference> <URI reference> ) # <URI reference> <URI reference> .
Annotation( <URI reference> <lexical-form> ) # <URI reference> <lexical-form> .
Imports(<URI>) # owl:imports <URI> .
Individual(<iID>
      <annotation1> … <annotationn>
      type(<type1>)…type(<typen>)
      (<pID1> <value1>) … (<pIDn> <valuen>))
<iID> rdf:type T(owl:Thing) .
<iID> T(<annotation1>) . … <iID> T(<annotationn>) .
<iID> rdf:type T(<type1>) . … <iID> rdf:type T(<typen>) .
<iID> <pID1> T(<value1>) . … <iID> <pIDn> T(<valuen>) .
<iID>
Individual(
      <annotation1> … <annotationn>
      type(<type1>)…type(<typen>)
      (<pID1> <value1>) … (<pIDn> <valuen>))
_:x rdf:type T(owl:Thing) .
_:x T(<annotation1>) . … _:x T(<annotationn>) .
_:x rdf:type T(<type1>) . … _:x rdf:type T(<typen>) .
_:x <pID1> T(<value1>) . … _:x <pIDn> T(<valuen>) .
_:x
SameIndividual( <individualID1> … <individualIDn>) <individualIDi> owl:sameAs <individualIDj> . 1≤i<j≤n
DifferentIndividuals(<individualID1> … <individualIDn>) <individualIDi> owl:differentFrom <individualIDj> . 1≤i<j≤n
Class(<classID>
      [partial | complete]
      <annotation1> … <annotationn>)
      <description1> … <descriptionn>)
<classID> rdf:type owl:Class .
<classID> [ rdfs:subClassOf | owl:sameClassAs ] _:x .
_:x T(<annotation1>) . … _:x T(<annotationn>) .
_:x owl:intersectionOf T(SEQ <description1>…<descriptionn>) .
EnumeratedClass(<classID>
      <annotation1> … <annotationn>)
      <individualID1> … <individualIDn>)
<classID> rdf:type owl:Class .
<classID> owl:sameClassAs _:x .
_:x T(<annotation1>) . … _:x T(<annotationn>) .
_:x owl:oneOf T(SEQ <individualID1>…<individualIDn>) .
DisjointClasses( <description1> … <descriptionn> ) T(<descriptioni>) owl:disjointWith T(<descriptionj>) . 1≤i<j≤n
EquivalentClasses( <description1> … <descriptionn>) T(<descriptioni>) owl:sameClassAs T(<descriptionj>) . 1≤i<j≤n
SubClassOf( <description1> <description2>) T(<description1>) rdfs:subClassOf T(<description2>) .
unionOf( <description1> … <descriptionn>) _:x owl:unionOf T(SEQ <description1>…<descriptionn>) . _:x
intersectionOf( <description1> … <descriptionn>) _:x owl:intersectionOf T(SEQ <description1>…<descriptionn>) . _:x
complementOf(<description>) _:x owl:complementOf T(<description>) . _:x
oneOf( <individualID1> … <individualIDn>) _:x rdf:type owl:Class .
_:x owl:oneOf T(SEQ <individualID1>…<individualIDn>) .
_:x
oneOf( <datatypeID1> <value1> … <datatypeIDn> <valuen>) _:x rdf:type owl:Datatype .
_:x owl:oneOf
T(SEQ <datatypeID1> <value1>… <datatypeIDn> <valuen>) .
_:x
restriction( <ID> <component1> … <componentn>) _:x owl:intersectionOf
  T(SEQ(restriction(<ID> <component1>)…
   restriction(<ID> <componentn>))) .
_:x
restriction( <ID> allValuesFrom(<range>)) _:x rdf:type owl:Restriction .
_:x owl:onProperty T(<ID>) .
_:x owl:allValuesFrom T(<range>) .
_:x
restriction( <ID> someValuesFrom(<required>)) _:x rdf:type owl:Restriction .
_:x owl:onProperty T(<ID>) .
_:x owl:someValuesFrom T(<required>) .
_:x
restriction( <ID> value(<value>)) _:x rdf:type owl:Restriction .
_:x owl:onProperty T(<ID>) .
_:x owl:hasValue T(<value>) .
_:x
restriction( <ID> minCardinality(<min>)) _:x rdf:type owl:Restriction .
_:x owl:onProperty T(<ID>) .
_:x owl:minCardinality xsd:decimal"<min>" .
_:x
restriction( <ID> maxCardinality(<max>)) _:x rdf:type owl:Restriction .
_:x owl:onProperty T(<ID>) .
_:x owl:maxCardinality xsd:decimal"<max>" .
_:x
restriction( <ID> cardinality(<card>)) _:x rdf:type owl:Restriction .
_:x owl:onProperty T(<ID>) .
_:x owl:cardinality xsd:decimal"<card>" .
_:x
DatatypeProperty( <name>


      <annotation1> … <annotationn>)       super(<super1>)…
      super(<supern>)
      domain(<domain1>)…
      domain(<domainn>)
      range(<range1>)…
      range(<rangen>)
      [Functional])
<name> rdf:type owl:DatatypeProperty .
<name> rdfs:domain owl:Thing .
<name> rdfs:range rdfs:Literal .
<name> T(<annotation1>) . … <name> T(<annotationn>) .
<name> rdfs:subPropertyOf T(<super1>) . …
<name> rdfs:subPropertyOf T(<supern>) .
<name> rdfs:domain T(<domain1>) . …
<name> rdfs:domain T(<domainn>) .
<name> rdfs:range T(<range1>) . …
<name> rdfs:range T(<rangen>) .
[<name> rdf:type owl:FunctionalProperty . ]
ObjectProperty( <name>


      <annotation1> … <annotationn>)
      super(<super1>)…
      super(<supern>)
      domain(<domain1>)…
      domain(<domainn>)
      range(<range1>)…
      range(<rangen>)
      [inverseOf(<inverse>)]
      [Symmetric]
      [Functional |
       InverseFunctional |
       Transitive])
<name> rdf:type owl:ObjectProperty .
<name> rdfs:domain owl:Thing .
<name> rdfs:range owl:Thing .
<name> T(<annotation1>) . … <name> T(<annotationn>) .
<name> rdfs:subPropertyOf T(<super1>) . …
<name> rdfs:subPropertyOf T(<supern>) .
<name> rdfs:domain T(<domain1>) . …
<name> rdfs:domain T(<domainn>) .
<name> rdfs:range T(<range1>) . …
<name> rdfs:range T(<rangen>) .
[<name> owl:inverseOf T(<inverse>) .]
[<name> rdf:type owl:SymmetricProperty . ]
[<name> rdf:type owl:FunctionalProperty . ]
[<name> rdf:type owl:InverseFunctionalProperty . ]
[<name> rdf:type owl:TransitiveProperty . ]
EquivalentProperties( <datavaluedPropertyID1> … <datavaluedPropertyIDn>) T(<datavaluedPropertyIDi>) owl:samePropertyAs T(<datavaluedPropertyIDj>) . 1≤i<j≤n
SubPropertyOf( <datavaluedPropertyID1> <datavaluedPropertyID2>) T(<datavaluedPropertyID1>) rdfs:subPropertyOf T(<datavaluedPropertyID2>) .
EquivalentProperties( <individualvaluedPropertyID1> … <individualvaluedPropertyIDn>) T(<individualvaluedPropertyIDi>) owl:samePropertyAs T(<individualvaluedPropertyIDj>) . 1≤i<j≤n
SubPropertyOf( <individualvaluedPropertyID1> <individualvaluedPropertyID2>) T(<individualvaluedPropertyID1>) rdfs:subPropertyOf T(<individualvaluedPropertyID2>) .
annotation ( <URI reference> <URI reference> ) <URI reference> <URI reference>
annotation ( <URI reference> <lexical-form> ) <URI reference> "<lexical-form>"
SEQ <item1>…<itemn> _:l1 rdf:type rdf:List .
_:l1 rdf:first T(<item1>) . _:l1 rdf:rest _:l2 .

_:ln rdf:type rdf:List .
_:ln rdf:first T(<itemn>) . _:ln rdf:rest rdf:nil .
_:l1

4.1. Definition of OWL/DL Ontologies in N-Triple Form

A collection of n-triples is an OWL/DL ontology in n-triple form if it is the result of the above transformation of an OWL ontology in abstract syntax form and, moreover,

  1. the abstract syntax form does not use any URI reference as more than one of a classID, a datatypeID, an individualID, a datavaluedPropertyID, or an individualvaluedPropertyID;
  2. the abstract syntax form does not use the URI of the document itself as a URI reference;
  3. the abstract syntax form does not use any URI reference that is the first or second argument of an Annotation directive or an annotation portion of a directive as a classID, a datatypeID, an individualID, or a datavaluedPropertyID, nor does it use any URI reference that is the first argument of an Annotation directive or an annotation portion of a directive as an individualvaluedPropertyID; and
  4. the abstract syntax form does not mention any of the URI references from the RDF, RDFS, or OWL namespaces except rdf:Literal, owl:Thing, and owl:Nothing.

This transformation is not injective, as several OWL abstract ontologies that do not use the above reserved vocabulary can map into the same collection of triples. However, the only cases where this can happen is with constructs that have the same meaning, such as several DisjointClasses axioms having the same effect as one larger one. It would be possible to define a canonical inverse transformation, if desired.