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

Editors:
Peter F. Patel-Schneider, Bell Labs Research, Lucent Technologies
Ian Horrocks, Department of Computer Science, University of Manchester

Contents


4. Mapping to RDF Graphs

The exchange syntax for OWL is RDF/XML [RDF Syntax], as specified in the OWL Reference Description [OWL Reference]. Further, the meaning of an OWL ontology in RDF/XML is determined only from the RDF graph [RDF Concepts] that results 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 triples. As all OWL Lite constructs are special cases of constructs in the full abstract syntax, transformations are only provided for the OWL DL versions.

The syntax for triples used here is the one used in the RDF Model Theory [RDF MT]. In this variant, qualified names are allowed. As detailed in the RDF Model Theory, to turn this syntax into the standard one just expand the qualified names into URI references in the standard RDF manner by concatenating the namespace name with the local name. The only namespace prefixes used in the transformation are rdf, rdfs, xsd, and owl, which correspond to the namespaces 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.

4.1. Translation to RDF Graphs

The Transformation Table gives transformation rules that transform the abstract syntax to the OWL exchange syntax. In a few cases, notably for the DifferentIndividuals construct, there are different transformation rules. In such cases either rule can be chosen, resulting in a non-deterministic translation. In a few other cases, notably for class and property axioms, there are triples that may or may not be generated. These triples are indicated by flagging them with [opt]. These non-determinisms allow the generation of more RDF Graphs.

The left column of the table gives a piece of syntax (S), the center column gives its transformation (T(S)), and the right column gives an identifier for the main node of the transformation (M(T(S))), but only for syntactic constructs that can occur as pieces of directives. Repeating components are listed using ellipses, as in description1; … descriptionn, this form allows easy specification of the transformation for all values of n greater than or equal to zero. Optional portions of the abstract syntax (enclosed in square brackets) are optional portions of the transformation (signified by square brackets).

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 as the subject or object 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. Also, some of the transformations require a URI for the current ontology. It is assumed that ontologies that are subject to this sort of transformation will be placed into a web-accessible document; the URI of this document is given as U.

Transformation to Triples
Abstract Syntax (and sequences) - S Transformation - T(S) Main Node - M(T(S))
Ontology(directive1 … directiven) U rdf:type owl:Ontology . [opt]
T(directive1) … T(directiven)
datatypeID datatypeID rdf:type rdfs:Datatype . datatypeID
classID classID rdf:type owl:Class .
classID rdf:type rdfs:Class . [opt]
classID
individualID individualID
datavaluedPropertyID datavaluedPropertyID rdf:type owl:DatatypeProperty .
datavaluedPropertyID rdf:type rdf:Property . [opt]
datavalued-
PropertyID
individualvaluedPropertyID individualvaluedPropertyID rdf:type owl:ObjectProperty .
individualvaluedPropertyID rdf:type rdf:Property . [opt]
individualvalued-
PropertyID
datatypeID literal literal^^<datatypeID> literal^^
<datatypeID>
literal literal literal
Annotation(URIreference URIreference) U <URIreference> <URIreference> .
Annotation(URIreference dataLiteral) U <URIreference> T(dataLiteral) .
Imports(URI) U owl:imports URI .
Individual(iID annotation1 … annotationn
      type(type1)…type(typen)
      value(pID1 value1) … value(pIDn valuen))
iID T(annotation1) . … iID T(annotationn) .
iID rdf:type T(type1) . … iID rdf:type T(typen) .
iID T(pID1) T(value1) . … iID T(pIDn) T(valuen) .
iID
Individual(annotation1 … annotationn
      type(type1)…type(typen)
      value(pID1 value1) … value(pIDn valuen))
_:x T(annotation1) . … _:x T(annotationn) .
_:x rdf:type T(type1) . … _:x rdf:type T(typen) .
_:x T(pID1) T(value1) . … _:x T(pIDn) T(valuen) .
_:x
SameIndividual(iID1 … iIDn) iIDi owl:sameIndividualAs iIDj . 1≤ij≤n
DifferentIndividuals(iID1 … iIDn) iIDi owl:differentFrom iIDj . 1≤ij≤n
DifferentIndividuals(iID1 … iIDn) _:x rdf:type owl:AllDifferent .
_:x owl:distinctMembers T(SEQ iIDi … iIDj)
Class(classID partial
      annotation1 … annotationn
      description1 … descriptionn)
classID rdf:type owl:Class .
classID rdf:type rdfs:Class . [opt]
classID T(annotation1) . … classID T(annotationn) .
classID rdfs:subClassOf T(description1) . …
classID rdfs:subClassOf T(descriptionn) .
Class(classID complete
      annotation1 … annotationn
      description1 … descriptionn)
classID rdf:type owl:Class .
classID rdf:type rdfs:Class . [opt]
classID T(annotation1) . … classID T(annotationn) .
classID owl:intersectionOf T(SEQ description1…descriptionn) .
Class(classID complete
      annotation1 … annotationn
      description)
classID rdf:type owl:Class .
classID rdf:type rdfs:Class . [opt]
classID T(annotation1) . … classID T(annotationn) .
classID owl:sameClassAs T(description) .
Class(classID complete
      annotation1 … annotationn
      unionOf(description1 … descriptionn))
classID rdf:type owl:Class .
classID rdf:type rdfs:Class . [opt]
classID T(annotation1) . … classID T(annotationn) .
classID owl:unionOf T(SEQ description1…descriptionn) .
Class(classID complete
      annotation1 … annotationn
      complementOf(description))
classID rdf:type owl:Class .
classID rdf:type rdfs:Class . [opt]
classID T(annotation1) . … classID T(annotationn) .
classID owl:complementOf T(description) .
EnumeratedClass(classID
      annotation1 … annotationn
      iID1 … iIDn)
classID rdf:type owl:Class .
classID T(annotation1) . … classID T(annotationn) .
classID owl:oneOf T(SEQ iID1…iIDn) .
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 rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:unionOf T(SEQ description1…descriptionn) .
_:x
intersectionOf(description1 … descriptionn) _:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:intersectionOf T(SEQ description1…descriptionn) .
_:x
complementOf(description) _:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:complementOf T(description) .
_:x
oneOf(iID1 … iIDn) _:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:oneOf T(SEQ iID1…iIDn) .
_:x
oneOf(v1 … vn) _:x rdf:type rdfs:Class . [opt]
_:x owl:oneOf T(SEQ v1 … vn) .
_: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 rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:onProperty T(ID) .
_:x owl:allValuesFrom T(range) .
_:x
restriction(ID someValuesFrom(required)) _:x rdf:type owl:Restriction .
_:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:onProperty T(ID) .
_:x owl:someValuesFrom T(required) .
_:x
restriction(ID value(value)) _:x rdf:type owl:Restriction .
_:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:onProperty T(ID) .
_:x owl:hasValue T(value) .
_:x
restriction(ID minCardinality(min)) _:x rdf:type owl:Restriction .
_:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:onProperty T(ID) .
_:x owl:minCardinality "min"^^xsd:nonNegativeInteger .
_:x
restriction(ID maxCardinality(max)) _:x rdf:type owl:Restriction .
_:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:onProperty T(ID) .
_:x owl:maxCardinality "max"^^xsd:nonNegativeInteger .
_:x
restriction(ID cardinality(card)) _:x rdf:type owl:Restriction .
_:x rdf:type owl:Class . [opt]
_:x rdf:type rdfs:Class . [opt]
_:x owl:onProperty T(ID) .
_:x owl:cardinality "card"^^xsd:nonNegativeInteger .
_:x
DatatypeProperty(ID
      annotation1 … annotationn
      super(super1)… super(supern)
      domain(domain1)…
      domain(domainn)
      range(range1)…
      range(rangen)
      [Functional])
ID rdf:type owl:DatatypeProperty .
ID rdf:type rdf:Property . [opt]
ID T(annotation1) . … ID T(annotationn) .
ID rdfs:subPropertyOf T(super1) . …
ID rdfs:subPropertyOf T(supern) .
ID rdfs:domain T(domain1) . …
ID rdfs:domain T(domainn) .
ID rdfs:range T(range1) . …
ID rdfs:range T(rangen) .
[ID rdf:type owl:FunctionalProperty . ]
ObjectProperty(ID
      annotation1 … annotationn
      super(super1)… super(supern)
      domain(domain1)…
      domain(domainn)
      range(range1)…
      range(rangen)
      [inverseOf(inverse)]
      [Symmetric]
      [Functional |
       InverseFunctional |
       Transitive])
ID rdf:type owl:ObjectProperty .
ID rdf:type rdf:Property . [opt]
ID T(annotation1) . … ID T(annotationn) .
ID rdfs:subPropertyOf T(super1) . …
ID rdfs:subPropertyOf T(supern) .
ID rdfs:domain T(domain1) . …
ID rdfs:domain T(domainn) .
ID rdfs:range T(range1) . …
ID rdfs:range T(rangen) .
[ID owl:inverseOf T(inverse) .]
[ID rdf:type owl:SymmetricProperty . ]
[ID rdf:type owl:FunctionalProperty . ]
[ID rdf:type owl:InverseFunctionalProperty . ]
[ID rdf:type owl:TransitiveProperty . ]
EquivalentProperties(dvpID1 … dvpIDn) T(dvpIDi) owl:samePropertyAs T(dvpIDj) . 1≤ij≤n
SubPropertyOf(dvpID1 dvpID2) T(dvpID1) rdfs:subPropertyOf T(dvpID2) .
EquivalentProperties(ivpID1 … ivpIDn) T(ivpIDi) owl:samePropertyAs T(ivpIDj) . 1≤ij≤n
SubPropertyOf(ivpID1 ivpID2) T(ivpID1) rdfs:subPropertyOf T(ivpID2) .
annotation (URIreference URIreference) <URIreference> <URIreference>
annotation (URIreference dataLiteral) <URIreference> T(dataLiteral)
SEQ rdf:nil
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.2. Definition of OWL DL and OWL Lite Ontologies in RDF Graph Form

Definition: An RDF graph is an OWL DL ontology in RDF graph form if it is equal (see below for a slight expansion) to a result of the transformation to triples above of the imports closure of an OWL DL 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 argument of an Annotation directive or an annotation portion of a directive as a classID, a datatypeID, an individualID, a datavaluedPropertyID, or an individualvaluedPropertyID; and
  4. the abstract syntax form provides a type for every individualID;
  5. the abstract syntax form does not mention any of the URI references from the RDF, RDFS, or OWL namespaces that are given special meaning in RDF, RDFS, or OWL except owl:Thing and owl:Nothing.

For the purposes of determining whether an RDF graph is an OWL DL ontology in RDF graph form, cardinality restrictions are explicitly allowed to use constructions like "1"^^xsd:decimal so long as the data value so encoded is a non-negative integer.

Definition: An RDF graph is an OWL Lite ontology in RDF graph form if it is equal (with the same relaxation as for OWL DL) to a result of the transformation to triples above of the imports closure of an OWL Lite ontology in abstract syntax form that meets the requirements given just above.

This transformation is not injective, as several OWL abstract ontologies that do not use the above reserved vocabulary can map into equal RDF graphs. 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.

The above definition of OWL DL and OWL Lite ontologies in RDF graph form is couched from the perspective of the abstract syntax, as this is the perspective from which it can be easily stated. The following, much longer description of OWL DL ontologies in RDF graph form is couched from the perspective of RDF graphs. This description is strictly informative. The normative definition of what constitutes an OWL DL ontology in RDF graph form is given above.

Let G be an RDF graph. A node x1 in G is a non-empty list in G with elements e1,…,en if there is a set of triples in G of the form

	x1 rdf:type rdf:List .
	x1 rdf:first e1 .
	x1 rdf:rest x2 .
	...
	xn rdf:type rdf:List .
	xn rdf:first en .
	xn rdf:rest rdf:nil .

where each xi is a distinct blank node that appears as the object of exactly one triple in G and x1 does not appear as the object of an rdf:rest triple. The definition triples of x1 are the triples above plus the definition triples of e1,...,en.

A node x in G is a description in G if x is a blank node and there is a set of triples of one of the entries in the Description Triples table, where

  1. r is an object property or a datatype property in G.
  2. if r is an object property in G then d is a description or a class; if r is a datatype property in G then d is a data range or a datatype.
  3. if r is an object property in G then i is an individual and URI reference; if r is a datatype property in G then i is a typed or untyped literal.
  4. n is a typed literal whose data value is a non-negative integer.
  5. ds is rdf:nil or a non-empty list whose elements are descriptions or classes.
  6. dc is a description or a class.
  7. is is rdf:nil or a non-empty list whose elements are individuals that are also URI references.
Description Triples
ConstructorTriples
allValuesFrom x rdf:type owl:Restriction .
x owl:onProperty r .
x owl:allValuesFrom d .
someValuesFrom x rdf:type owl:Restriction .
x owl:onProperty r .
x owl:someValuesFrom d .
hasValue x rdf:type owl:Restriction .
x owl:onProperty r .
x owl:hasValue i .
minCardinality x rdf:type owl:Restriction .
x owl:onProperty r .
x owl:minCardinality n .
maxCardinality x rdf:type owl:Restriction .
x owl:onProperty r .
x owl:maxCardinality n .
cardinality x rdf:type owl:Restriction .
x owl:onProperty r .
x owl:cardinality n .
unionOf x owl:unionOf ds .
intersectionOf x owl:intersectionOf ds .
complementOf x owl:complementOf dc .
oneOf x owl:oneOf is .

The definition triples of the description are the triples above plus any x rdf:type owl:Class . or x rdf:type rdfs:Class . triples plus the definition triples of any description, data range, or list in the triples above.

A node x in G is a data range in G if x is a blank node and there is a triple of the form x owl:oneOf rdf:nil . or x owl:oneOf is . where is is a non-empty list whose elements are typed or untyped literals. The definition triples of the data range are the triples above plus any triples of the form x rdf:type rdfs:Class . plus the definition triples of the list.

A node x in G is a datatype property if x is a URI reference and there is a triple of the form x rdf:type owl:DatatypeProperty . but no triple of any of the following forms

	x rdf:type owl:SymmetricProperty .
	x rdf:type owl:InverseFunctionalProperty .
	x rdf:type owl:TransitiveProperty .

The assertions about x in G are the triples in G of the following forms, where y is a datatype property in G, d is a description or class in G, and r is a data range or datatype in G

	x rdf:type owl:DatatypeProperty .
	x rdf:type rdf:Property .
	x rdfs:subPropertyOf y .
	x rdfs:domain d .
	x rdfs:range r .
	x rdf:type owl:FunctionalProperty .
	x owl:samePropertyAs y .

plus the definition triples of any description or data range in these triples.

A node x in G is an object property if x is a URI reference and there is a triple of the form x rdf:type owl:ObjectProperty . The assertions about x in G are the triples in G of the following forms, where y is an object property in G, d is a description or class in G

	x rdf:type owl:ObjectProperty .
	x rdf:type rdf:Property .
	x rdfs:subPropertyOf y .
	x rdfs:domain d .
	x rdfs:range d .
	x owl:inverseOf y .
	x rdf:type owl:SymmetricProperty .
	x rdf:type owl:FunctionalProperty .
	x rdf:type owl:InverseFunctionalProperty .
	x rdf:type owl:TransitiveProperty .
	x owl:samePropertyAs y .

plus the definition triples of any description in these triples.

A node x in G is a transitive object property if x is an object property and there is a triple of the form x rdf:type owl:TransitiveProperty .

A node x in G is a complex object property if x is an object property and there is a triple of any of the following forms in G

	x rdf:type owl:FunctionalProperty .
	x rdf:type owl:InverseFunctionalProperty .
	x owl:inverseOf y .
	x owl:samePropertyAs y .
	y rdfs:subClassOf x .

where y is a complex object property in G or if there are triples of each of the forms

	z owl:onProperty x .
	z c y .

where c is one of owl:minCardinality, owl:maxCardinality, or owl:cardinality.

A node x in G is a datatype if x is a URI reference and there is a triple of the form x rdf:type rdfs:Datatype . The assertions about x in G are the triples in G of the following forms, where d is a top-level description or class in G x rdf:type rdfs:Datatype .

A node x in G is a class if x is owl:Thing or owl:Nothing or x is a URI reference and there is a triple of the form x rdf:type owl:Class . The assertions about x in G are the triples in G of the following forms, where d is a top-level description or class in G and ds is rdf:nil or a non-empty list whose elements are descriptions or classes and is is rdf:nil or a non-empty list whose elements are individuals, plus the definition triples of any non-empty lists in these triples

	x rdf:type owl:Class .
	x rdf:type rdfs:Class .
	x rdfs:subClassOf d .
	x owl:sameClassAs d .
	x owl:disjointFrom d.
	x owl:complementOf d.
	x owl:intersectionOf ds.
	x owl:unionOf ds.
	x owl:oneOf is .

A node x in G is a top-level description if x is a description that is not in the definition triples of any other description in G nor an element of a list in G. The assertions about x in G are the triples in G of the following forms, where d is a top-level description or class in G

	x rdf:type owl:Class .
	x rdfs:subClassOf d .
	x owl:sameClassAs d .
	x owl:disjointWith d .

plus the definition triples of x.

A node x in G is an individual if there is a triple of the form x rdf:type c . where c is a description or class. The assertions about x in G are the triples of G of the following forms, where c is a description or class, rd is a datatype property, v is a typed or untyped literal, ro is an object property, and i is an individual.

	x rdf:type c .
	x rd v .
	x ro i .
	x owl:sameIndividualAs i .
	x owl:differentFrom i .

plus the definition triples of any description in these triples.

A node x in G is an all-different node if there is a triple of the form x rdf:type owl:allDifferent . and there is exactly one other triple in G whose subject is x and this triple is of one of the following forms, where l is a non-empty list whose elements are individuals

	x owl:distinctMembers owl:nil .
	x owl:distinctMembers l .

The assertions about x are the above triples, plus the definition triples of l, if present.

A node x in G is an ontology if x is a URI reference and there is a triple of the form x rdf:type owl:Ontology . The assertions about x are the triples of G of the following form

	x rdf:type owl:Ontology .
	x owl:imports y .

where y is a URI reference that is not a datatype property, an object property, a class, or an individual.

An RDF graph is an OWL DL graph if:

  1. The datatype properties of G, the object properties of G, the classes of G, the datatypes of G, the individuals of G, and the ontologies of G are pairwise disjoint and disjoint from the RDF, RDFS, and OWL vocabularies (except owl:Thing, owl:Nothing, rdfs:Literal, and rdf:XMLLiteral).
  2. The definition triples of any description or datarange are disjoint from the definition triples of other description or data range except for any description or data range that is a node of some triple in the definition triples of the description or data range. (Therefore the definition triples of any description or datarange form a tree.)
  3. The triples of the graph can be disjointly partitioned such that each partition is either
    1. the assertions about a datatype property, object property, datatype, class, top-level description, individual, all-different node, or ontology;
    2. (annotation) triples whose subject is a datatype property, an object property, a datatype, a class, or an individual and whose predicate is not a datatype property, an object property, a class, an individual, nor any URI reference from the RDF, RDFS, or OWL namespaces that is given special meaning by RDF, RDFS, or OWL; or
    3. (ontology annotation) triples whose subject is an ontology and whose predicate is not a datatype property, an object property, a datatype, a class, an individual, or any URI reference from the RDF, RDFS, or OWL namespaces that is given special meaning by RDF, RDFS, or OWL.
  4. The complex object properties and the transitive object properties of G are disjoint.

A quick incomplete gloss of the above is that

  1. In an OWL DL ontology in RDF graph form a resource cannot be more than one of a class, a datatype, an object property, a datatype property, or an individual. OWL DL requires that inverse functional properties, symmetric properties, and transitive properties be object properties, so they cannot be datatype properties.
  2. In an OWL DL ontology in RDF graph form an object property that participates in a cardinality restriction cannot be specified as a transitive property nor can it have a transitively-specified property as a descendant.
  3. In an OWL DL ontology in RDF graph form all descriptions must be well-formed, with no missing or extra components, and must form tree-like structures.