# Mapping to RDF Graphs

(Difference between revisions)
 Revision as of 21:45, 19 August 2008 (view source)Bmotik2 (Talk | contribs) (→Parsing Ontology Header and Declarations)← Older edit Revision as of 18:09, 20 August 2008 (view source) (adding annotations on annotations)Newer edit → Line 627: Line 627: + + ==== Annotations on Annotations ==== + + An annotation always generates a single triple + or a group of similar triples (for axioms that are translated to + multiple triples) for the annotation (which are in addition to the + triples used to represent the axiom being annotated for annotation + axioms).  An annotation on this annotation + generates the following triples instead of each triple produced by the + annotation s p o: +
+ _:x ''rdf:type'' ''owl:Annotation''
+ _:x ''owl:subject'' s
+ _:x ''owl:predicate'' p
+ _:x ''owl:object'' o
+
+ _:x T(AP1) T(elt1)
+ ...
+ _:x T(APn) T(eltn) +
+ +
+ Consider the following subclass axiom: + +
+ SubClassOf( Comment( Label("Profound") "Children are people." ) ''a:Child'' ''a:Person'' ) +
+ + This doubly annotated axiom generates + +
+ _:x ''rdf:type'' ''owl:Axiom''
+ _:x ''owl:subject'' ''a:Child''
+ _:x ''owl:predicate'' ''rdfs:subClassOf''
+ _:x ''owl:object'' ''a:Person''
+ _:y ''rdf:type'' ''owl:Annotation''
+ _:y ''owl:subject'' _:x
+ _:y ''owl:predicate'' ''rdfs:comment''
+ _:y ''owl:object'' "Children are people."
+ _:y ''rdfs:label'' "Profound" +
+
+ + Deeper nesting is handled in the same way. == Mapping from RDF Graphs to Functional-Style Syntax == == Mapping from RDF Graphs to Functional-Style Syntax == Line 860: Line 904: The function ''OPEorDPE'' is defined as follows: ''OPEorDPE(x)'' = ''OPE(x)'' if ''OPE(x)'' ≠ ε; ''OPEorDPE(x)'' = ''DPE(x)'' if ''DPE(x)'' ≠ ε; and ''OPEorDPE(x)'' = ε otherwise. The function ''OPEorDPE'' is defined as follows: ''OPEorDPE(x)'' = ''OPE(x)'' if ''OPE(x)'' ≠ ε; ''OPEorDPE(x)'' = ''DPE(x)'' if ''DPE(x)'' ≠ ε; and ''OPEorDPE(x)'' = ε otherwise. - === Parsing of Axioms === + === Parsing of Annotations === Triples of the form x *:y *:z where *:y is an annotation property (that is, where ''AP(*:y)'' ≠ ε) are encountered in a number of patterns and they correspond to a set of annotations, denoted as ExpandAnnotations( x *:y *:z ), as described in Table 8. Thus, ExpandAnnotations( x *:y *:z ) contains the annotations that correspond to all possible interpretations of *:z as an entity. Triples of the form x *:y *:z where *:y is an annotation property (that is, where ''AP(*:y)'' ≠ ε) are encountered in a number of patterns and they correspond to a set of annotations, denoted as ExpandAnnotations( x *:y *:z ), as described in Table 8. Thus, ExpandAnnotations( x *:y *:z ) contains the annotations that correspond to all possible interpretations of *:z as an entity. Line 891: Line 935: |} |} + + To handle annotations on annotations any triple match for s p o that + produces an annotation (either directly or via ExpandAnnotations), also + allows a match of the four-triple pattern
+ _:x ''rdf:type'' ''owl:Annotation''
+ _:x ''owl:subject'' s
+ _:x ''owl:predicate'' p
+ _:x ''owl:object'' o
+ and + for each triple in G with _:x as the subject + adds annotations to the each annotation generated as follows: +
+ {| class="allname" style="text-align: left" border="2" cellpadding="5" + |+ Table 8a. Parsing of Annotations on Annotations + |- + ! If ''G'' contains this triple... + ! ...then add these annotations to the generated annotation. + |- + | _:x *:y lt
{ ''AP(*:y)'' ≠ ε } + | Annotation( *:y lt ) + |- + | _:x *:y *:z
{ ''AP(*:y)'' ≠ ε } + | ExpandAnnotations( _:x *:y *:z ) + |- + | _:x *:y _:z
{ ''AP(*:y)'' ≠ ε } + | Annotation( *:y _:z ) + |- + |} +
+ + Any matched triples are removed. + + + + === Parsing of Axioms === Let x be the node that is matched to *:x or _:x while parsing the ontology header of ''O'' according to the patters from Table 2. The triples in ''G'' matching the patterns shown in Table 9 are converted to ontology annotations of ''O'' as shown in the table. The matched triples are removed from ''G''. Let x be the node that is matched to *:x or _:x while parsing the ontology header of ''O'' according to the patters from Table 2. The triples in ''G'' matching the patterns shown in Table 9 are converted to ontology annotations of ''O'' as shown in the table. The matched triples are removed from ''G''.

## Revision as of 18:09, 20 August 2008

Document title:
OWL 2 Web Ontology Language
Mapping to RDF Graphs (Second Edition)
Authors
Bernardo Cuenca Grau, Oxford University
Boris Motik, Oxford University
Peter F. Patel-Schneider, Bell Labs Research, Alcatel-Lucent
Contributors
Ian Horrocks, Oxford University
Bijan Parsia, The University of Manchester
Abstract
The OWL 2 Web Ontology Language, informally OWL 2, is an ontology language for the Semantic Web with formally defined meaning. OWL 2 ontologies provide classes, properties, individuals, and data values and are stored as Semantic Web documents. OWL 2 ontologies can be used along with information written in RDF, and OWL 2 ontologies themselves are primarily exchanged as RDF documents. The OWL 2 Document Overview describes the overall state of OWL 2, and should be read before other OWL 2 documents.
This document provides a mapping from the functional-style syntax of OWL 2 to the RDF exchange syntax for OWL 2, and vice versa.
Status of this Document
This document is an evolution of the OWL 1.1 Web Ontology Language: Mapping to RDF Graphs document that forms part of the OWL 1.1 Web Ontology Language W3C Member Submission.

## 1 Introduction and Preliminaries

This document provides mappings by means of which every OWL 2 ontology in the functional-style syntax [OWL 2 Specification] can be mapped into RDF triples and back without any change in the formal meaning of the ontology. More precisely, let O be any OWL 2 ontology in functional-style syntax, let RDF(O) be the set of RDF triples obtained by transforming O into RDF triples as specified in Section 2, and let O' be the OWL 2 ontology in functional-style syntax obtained by applying the reverse transformation from Section 3 to RDF(O); then, O and O' are logically equivalent — that is, they have exactly the same set of models.

The RDF syntax of OWL 2 is backwards-compatible with that of OWL DL: every OWL DL ontology in RDF syntax can be mapped into a valid OWL 2 ontology using the reverse-transformation from Section 3 such that the resulting OWL 2 ontology has exactly the same set of models as the original OWL DL ontology.

The syntax for triples used in this document is the one used in the RDF Semantics [RDF Semantics]. Full URIs are abbreviated using the namespaces from the OWL 2 Specification [OWL 2 Specification].

The following notation is used throughout this document for referring to parts of RDF graphs:

• *:x denotes a URI reference;
• _:x denotes a blank node;
• x denotes a blank node or a URI reference; and
• lt denotes a literal.

## 2 Mapping from Functional-Style Syntax to RDF Graphs

This section defines a mapping of an OWL 2 ontology O in functional-style syntax into a set of RDF triples RDF(O). The mapping is presented in two parts. Section 2.1 shows how to translate axioms that do not contain annotations, and Section 2.2 shows how to translate annotated axioms.

### 2.1 Translation of Axioms without Annotations

Table 1 presents the operator T that maps an OWL 2 ontology O in functional-style syntax into a set of RDF triples RDF(O), provided that no axiom in O is annotated. In the mapping of DatatypeRestriction, faceti can be one of the facets listed in Section 7.3 of the OWL 2 Specification [OWL 2 Specification], and xsd:faceti is a URI resource whose namespace is xsd: and whose fragment is the facet name. In the mapping, each generated blank node (i.e., all except for blank nodes corresponding to anonymous individuals) is fresh in each application of a mapping rule. Furthermore, the following conventions are used in this section to denote different syntactic parts of OWL 2 ontologies:

• OP denotes an object property;
• OPE denotes an object property expression;
• DP denotes a data property;
• DPE denotes a data property expression;
• PE denotes an object or a data property expression;
• AP denotes an annotation property;
• C denotes a class;
• CE denotes a class expression;
• DT denotes a data type;
• DR denotes a data range;
• a denotes an individual (named or anonymous);
• *:a denotes a named individual;
• _:a denotes an anonymous individual;
• lt denotes a literal; and
• elt denotes an entity, an anonymous individual, or a literal.

In this section, T(SEQ y1 ... yn) denotes the translation of a sequence of objects from the functional-style syntax into an RDF list, as shown in Table 1.

Table 1. Transformation to Triples
Functional-Style Syntax S Triples Generated in an Invocation of T(S) Main Node of T(S)
SEQ rdf:nil
SEQ y1 ... yn _:x rdf:first T(y1)
_:x rdf:rest T(SEQ y2 ... yn)
_:x
Ontology( ontologyURI [ versionURI ]
Import( importedOntologyURI1 )
...
Import( importedOntologyURIk )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
axiom1
...
axiomn
)
ontologyURI rdf:type owl:Ontology
[ ontologyURI owl:versionInfo versionURI ]
ontologyURI owl:imports importedOntologyURI1
...
ontologyURI owl:imports importedOntologyURIk
ontologyURI T(AP1) T(elt1)
...
ontologyURI T(APm) T(eltm)
T(axiom1)
...
T(axiomn)
ontologyURI
Ontology(
Import( importedOntologyURI1 )
...
Import( importedOntologyURIk )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
axiom1
...
axiomn
)
_:x rdf:type owl:Ontology
_:x owl:imports importedOntologyURI1
...
_:x owl:imports importedOntologyURIk
_:x T(AP1) T(elt1)
...
_:x T(APm) T(eltm)
T(axiom1)
...
T(axiomn)
_:x
C C
Class( C ) C
DT DT
Datatype( DT ) DT
OP OP
ObjectProperty( OP ) OP
DP DP
DataProperty( DP ) DP
AP AP
AnnotationProperty( AP ) AP
a a
NamedIndividual( *:a ) *:a
lt lt
Declaration( Datatype( DT ) ) T(DT) rdf:type rdfs:Datatype
Declaration( Class( C ) ) T(C) rdf:type owl:Class
Declaration( ObjectProperty( OP ) ) T(OP) rdf:type owl:ObjectProperty
Declaration( DataProperty( DP ) ) T(DP) rdf:type owl:DatatypeProperty
Declaration( AnnotationProperty( AP ) ) T(AP) rdf:type owl:AnnotationProperty
Declaration( NamedIndividual( *:a ) ) T(*:a) rdf:type owl:NamedIndividual
InverseOf( OP ) _:x owl:inverseOf T(OP) _:x
ComplementOf( DR ) _:x rdf:type rdfs:Datatype
_:x owl:datatypeComplementOf T(DR)
_:x
OneOf( lt1 ... ltn ) _:x rdf:type rdfs:Datatype
_:x owl:oneOf T(SEQ lt1 ... ltn)
_:x
DatatypeRestriction( DT
facet1 lt1
...
facetn ltn
)
_:x rdf:type rdfs:Datatype
_:x owl:onDatatype T(DT)
_:x owl:withRestrictions T(SEQ _:y1 ... _:yn)
_:y1 xsd:facet1 lt1
...
_:yn xsd:facetn ltn
_:x
IntersectionOf( CE1 ... CEn ) _:x rdf:type owl:Class
_:x owl:intersectionOf T(SEQ CE1 ... CEn)
_:x
UnionOf( CE1 ... CEn ) _:x rdf:type owl:Class
_:x owl:unionOf T(SEQ CE1 ... CEn)
_:x
ComplementOf( CE ) _:x rdf:type owl:Class
_:x owl:complementOf T(CE)
_:x
OneOf( a1 ... an ) _:x rdf:type owl:Class
_:x owl:oneOf T(SEQ a1 ... an)
_:x
SomeValuesFrom( OPE CE ) _:x rdf:type owl:Restriction
_:x owl:onProperty T(OPE)
_:x owl:someValuesFrom T(CE)
_:x
AllValuesFrom( OPE CE ) _:x rdf:type owl:Restriction
_:x owl:onProperty T(OPE)
_:x owl:allValuesFrom T(CE)
_:x
HasValue( OPE a ) _:x rdf:type owl:Restriction
_:x owl:onProperty T(OPE)
_:x owl:hasValue T(a)
_:x
ExistsSelf( OPE ) _:x rdf:type owl:SelfRestriction
_:x owl:onProperty T(OPE)
_:x
MinCardinality( n OPE ) _:x rdf:type owl:Restriction
_:x owl:minCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(OPE)
_:x
MinCardinality( n OPE CE ) _:x rdf:type owl:Restriction
_:x owl:minQualifiedCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(OPE)
_:x owl:onClass T(CE)
_:x
MaxCardinality( n OPE ) _:x rdf:type owl:Restriction
_:x owl:maxCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(OPE)
_:x
MaxCardinality( n OPE CE ) _:x rdf:type owl:Restriction
_:x owl:maxQualifiedCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(OPE)
_:x owl:onClass T(CE)
_:x
ExactCardinality( n OPE ) _:x rdf:type owl:Restriction
_:x owl:cardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(OPE)
_:x
ExactCardinality( n OPE CE ) _:x rdf:type owl:Restriction
_:x owl:qualifiedCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(OPE)
_:x owl:onClass T(CE)
_:x
SomeValuesFrom( DPE DR ) _:x rdf:type owl:Restriction
_:x owl:onProperty T(DPE)
_:x owl:someValuesFrom T(DR)
_:x
SomeValuesFrom( DPE1 ... DPEn DR ), n ≥ 2 _:x rdf:type owl:Restriction
_:x owl:onProperties T(SEQ DPE1 ... DPEn)
_:x owl:someValuesFrom T(DR)
_:x
AllValuesFrom( DPE DR ) _:x rdf:type owl:Restriction
_:x owl:onProperty T(DPE)
_:x owl:allValuesFrom T(DR)
_:x
AllValuesFrom( DPE1 ... DPEn DR ), n ≥ 2 _:x rdf:type owl:Restriction
_:x owl:onProperties T(SEQ DPE1 ... DPEn)
_:x owl:allValuesFrom T(DR)
_:x
HasValue( DPE lt ) _:x rdf:type owl:Restriction
_:x owl:onProperty T(DPE)
_:x owl:hasValue T(lt)
_:x
MinCardinality( n DPE ) _:x rdf:type owl:Restriction
_:x owl:minCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(DPE)
_:x
MinCardinality( n DPE DR ) _:x rdf:type owl:Restriction
_:x owl:minQualifiedCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(DPE)
_:x owl:onDataRange T(DR)
_:x
MaxCardinality( n DPE ) _:x rdf:type owl:Restriction
_:x owl:maxCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(DPE)
_:x
MaxCardinality( n DPE DR ) _:x rdf:type owl:Restriction
_:x owl:maxQualifiedCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(DPE)
_:x owl:onDataRange T(DR)
_:x
ExactCardinality( n DPE ) _:x rdf:type owl:Restriction
_:x owl:cardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(DPE)
_:x
ExactCardinality( n DPE DR ) _:x rdf:type owl:Restriction
_:x owl:qualifiedCardinality "n"^^xsd:nonNegativeInteger
_:x owl:onProperty T(DPE)
_:x owl:onDataRange T(DR)
_:x
SubClassOf( CE1 CE2 ) T(CE1) rdfs:subClassOf T(CE2)
EquivalentClasses( CE1 ... CEn ) T(CE1) owl:equivalentClass T(CE2)
...
T(CEn-1) owl:equivalentClass T(CEn)
DisjointClasses( CE1 CE2 ) T(CE1) owl:disjointWith T(CE2)
DisjointClasses( CE1 ... CEn ), n > 2 _:x rdf:type owl:AllDisjointClasses
_:x owl:members T(SEQ CE1 ... CEn)
DisjointUnion( C CE1 ... CEn ) T(C) owl:disjointUnionOf T(SEQ CE1 ... CEn)
SubPropertyOf( OPE1 OPE2 ) T(OPE1) rdfs:subPropertyOf T(OPE2)
SubPropertyOf( PropertyChain( OPE1 ... OPEn ) OPE ) _:x rdfs:subPropertyOf T(OPE)
_:x owl:propertyChain T(SEQ OPE1 ... OPEn)
EquivalentProperties( OPE1 ... OPEn ) T(OPE1) owl:equivalentProperty T(OPE2)
...
T(OPEn-1) owl:equivalentProperty T(OPEn)
DisjointProperties( OPE1 OPE2 ) T(op1) owl:propertyDisjointWith T(op2)
DisjointProperties( OPE1 ... OPEn), n > 2 _:x rdf:type owl:AllDisjointProperties
_:x owl:members T(SEQ OPE1 ... OPEn)
PropertyDomain( OPE CE ) T(OPE) rdfs:domain T(CE)
PropertyRange( OPE CE ) T(OPE) rdfs:range T(CE)
InverseProperties( OPE1 OPE2 ) T(OPE1) owl:inverseOf T(OPE2)
FunctionalProperty( OPE ) T(OPE) rdf:type owl:FunctionalProperty
InverseFunctionalProperty( OPE ) T(OPE) rdf:type owl:InverseFunctionalProperty
ReflexiveProperty( OPE ) T(OPE) rdf:type owl:ReflexiveProperty
IrreflexiveProperty( OPE ) T(OPE) rdf:type owl:IrreflexiveProperty
SymmetricProperty( OPE ) T(OPE) rdf:type owl:SymmetricProperty
AsymmetricProperty( OPE ) T(OPE) rdf:type owl:AsymmetricProperty
TransitiveProperty( OPE ) T(OPE) rdf:type owl:TransitiveProperty
SubPropertyOf( DPE1 DPE2 ) T(DPE1) rdfs:subPropertyOf T(DPE2)
EquivalentProperties( DPE1 ... DPEn ) T(DPE1) owl:equivalentProperty T(DPE2)
...
T(DPEn-1) owl:equivalentProperty T(DPEn)
DisjointProperties( DPE1 DPE2 ) T(DPE1) owl:propertyDisjointWith T(DPE2)
DisjointProperties( DPE1 ... DPEn ), n > 2 _:x rdf:type owl:AllDisjointProperties
_:x owl:members T(SEQ DPE1 ... DPEn)
PropertyDomain( DPE CE ) T(DPE) rdfs:domain T(CE)
PropertyRange( DPE DR ) T(DPE) rdfs:range T(DR)
FunctionalProperty( DPE ) T(DPE) rdf:type owl:FunctionalProperty
KeyFor( PE1 ... PEn CE ) T(CE) owl:hasKey T(SEQ PE1 ... PEn)
SameIndividual( a1 ... an ) T(a1) owl:sameAs T(a2)
...
T(an-1) owl:sameAs T(an)
DifferentIndividuals( a1 a2 ) T(a1) owl:differentFrom T(a2)
DifferentIndividuals( a1 ... an ), n > 2 _:x rdf:type owl:AllDifferent
_:x owl:distinctMembers T(SEQ a1 ... an)
ClassAssertion( CE a ) T(a) rdf:type T(CE)
PropertyAssertion( OP a1 a2 ) T(a1) T(OP) T(a2)
PropertyAssertion( InverseOf( OP ) a1 a2 ) T(a2) T(OP) T(a1)
NegativePropertyAssertion( OPE a1 a2 ) _:x rdf:type owl:NegativePropertyAssertion
_:x owl:sourceIndividual T(a1)
_:x owl:assertionProperty T(OPE)
_:x owl:targetIndividual T(a2)
PropertyAssertion( DPE a lt ) T(a) T(DPE) T(lt)
NegativePropertyAssertion( DPE a lt ) _:x rdf:type owl:NegativePropertyAssertion
_:x owl:sourceIndividual T(a)
_:x owl:assertionProperty T(DPE)
_:x owl:targetValue T(lt)
EntityAnnotation( Class( C )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
)
T(C) T(AP1) T(elt1)
...
T(C) T(APm) T(eltm)
EntityAnnotation( Datatype( DT )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
)
T(DT) T(AP1) T(elt1)
...
T(DT) T(APm) T(eltm)
EntityAnnotation( ObjectProperty( OP )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
)
T(OP) T(AP1) T(elt1)
...
T(OP) T(APm) T(eltm)
EntityAnnotation( DataProperty( DP )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
)
T(DP) T(AP1) T(elt1)
...
T(DP) T(APm) T(eltm)
EntityAnnotation( AnnotationProperty( AP )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
)
T(AP) T(AP1) T(elt1)
...
T(AP) T(APm) T(eltm)
EntityAnnotation( NamedIndividual( *:a )
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
)
T(*:a) T(AP1) T(elt1)
...
T(*:a) T(APm) T(eltm)
AnonymousIndividualAnnotation( _:a
Annotation( AP1 elt1 )
...
Annotation( APm eltm )
)
T(_:a) T(AP1) T(elt1)
...
T(_:a) T(APm) T(eltm)

### 2.2 Translation of Annotated Axioms

Editor's Note: See Issue-67 (reification).

If an axiom ax contains embedded annotations Annotation( APi elti ), 1 ≤ i ≤ n, its serialization into RDF depends on the type of the axiom. In the following discussion, let ax' be the axiom that is equivalent to ax but that contains no annotations. Note that the Label and Comment annotations are just abbreviations, so they are serialized into RDF by expanding the abbreviation and then applying the serialization presented here.

#### 2.2.1 Axioms that Generate a Single Triple or that Have a Main Triple

If ax' is translated into a single RDF triple s p o, then the axiom ax generates the following triples instead of triple s p o:

_:x rdf:type owl:Axiom
_:x owl:subject s
_:x owl:predicate p
_:x owl:object o

_:x T(AP1) T(elt1)
...
_:x T(APn) T(eltn)

This is the case for the following axioms: SubClassOf, DisjointUnion, DisjointClasses with two classes, SubPropertyOf with a property chain as the subproperty expression, PropertyDomain, PropertyRange, InverseProperties, TransitiveProperty, FunctionalProperty, InverseFunctionalProperty, ReflexiveProperty, IrreflexiveProperty, SymmetricProperty, AsymmetricProperty, ClassAssertion, PropertyAssertion, Declaration, and DifferentIndividuals with two individuals.

Consider the following subclass axiom:

SubClassOf( Comment( "Children are people." ) a:Child a:Person )

Without the annotation, the axiom would be translated into the following triple:

a:Child rdfs:subClassOf a:Person

Thus, the annotated axiom is transformed into the following triples:

_:x rdf:type owl:Axiom
_:x owl:subject a:Child
_:x owl:predicate rdfs:subClassOf
_:x owl:object a:Person
_:x rdfs:comment "Children are people."

Axioms SubPropertyOf with a subproperty chain and KeyFor are, without annotations, translated into several, and not a single triple. If such such axioms are annotated, then the main triple is subjected to the transformation described above. The other triples — called side triples — are output without any change.

Consider the following subproperty axiom:

SubPropertyOf( Comment( "An aunt is a mother's sister." ) PropertyChain( a:hasMother a:hasSister ) a:hasAunt ) )

Without the annotation, the axiom would be translated into the following triples:

_:y rdfs:subPropertyOf a:hasAunt
_:y owl:propertyChain _:z1
_:z1 rdf:first a:hasMother
_:z1 rdf:rest _:z2
_:z2 rdf:first a:hasSister
_:z2 rdf:rest rdf:nil

In order to capture the annotation on the axiom, the first triple plays the role of the main triple for the axiom, so it is represented using a fresh blank node _:x in order to be able to attach the annotation to it.

_:x rdf:type owl:Axiom
_:x owl:subject _:y
_:x owl:predicate rdfs:subPropertyOf
_:x owl:object a:hasAunt
_:x rdfs:comment "An aunt is a mother's sister."

_:y owl:propertyChain _:z1
_:z1 rdf:first a:hasMother
_:z1 rdf:rest _:z2
_:z2 rdf:first a:hasSister
_:z2 rdf:rest rdf:nil

Consider the following key axiom:

KeyFor( Comment( "SSN uniquely determines a person." ) a:hasSSN a:Person )

Without the annotation, the axiom would be translated into the following triples:

_:y rdf:first a:hasSSN
_:y rdf:rest rdf:nil

In order to capture the annotation on the axiom, the first triple plays the role of the main triple for the axiom, so it is represented using a fresh blank node _:x in order to be able to attach the annotation to it.

_:x rdf:type owl:Axiom
_:x owl:subject a:Person
_:x owl:object _:y
_:x rdfs:comment "SSN uniquely determines a person."

_:y rdf:first a:hasSSN
_:y rdf:rest rdf:nil

#### 2.2.2 Axioms that are Translated to Multiple Triples

If the axiom ax' is of type EquivalentClasses, EquivalentProperties, DisjointProperties, SameIndividual, or EntityAnnotation its translation into RDF can be broken up into several RDF triples (because RDF can only represent binary relations). In this case, each of the RDF triples obtained by the translation of ax' is transformed as described in previous section, and the annotations are repeated for each of the triples obtained in the translation.

Consider the following individual equality axiom:

SameIndividual( Annotation( a:source a:Fox ) a:Meg a:Megan a:Megan_Griffin )

This axiom is first split into the following equalities between pairs of individuals, and the annotation is repeated on each axiom obtained in this process:

SameIndividual( Annotation( a:source a:Fox ) a:Meg a:Megan )
SameIndividual( Annotation( a:source a:Fox ) a:Megan a:Megan_Griffin )

Each of these axioms is now transformed into triples as explained in the previous section:

_:x1 rdf:type owl:Axiom
_:x1 owl:subject a:Meg
_:x1 owl:predicate owl:sameAs
_:x1 owl:object a:Megan
_:x1 a:source a:Fox

_:x2 rdf:type owl:Axiom
_:x2 owl:subject a:Megan
_:x2 owl:predicate owl:sameAs
_:x2 owl:object a:Megan_Griffin
_:x2 a:source a:Fox

#### 2.2.3 Axioms Represented by Blank Nodes

If the axiom ax' is of type NegativePropertyAssertion, DisjointClasses with more than two classes, or DifferentIndividuals with more than two individuals, then its translation already requires introducing a blank node _:x. In such cases, ax is translated by first translating ax' into _:x as shown in Table 2, and then attaching the annotations of ax to _:x.

Consider the following negative property assertion:

NegativePropertyAssertion( Annotation( a:author a:Seth_MacFarlane ) a:brotherOf a:Chris a:Stewie )

Even without the annotation, this axiom would be represented using a blank node. The annotation can readily be attached to this node, so the axiom is transformed into the following triples:

_:x rdf:type owl:NegativePropertyAssertion
_:x owl:sourceIndividual a:Chris
_:x owl:assertionProperty a:brotherOf
_:x owl:targetIndividual a:Stewie
_:x a:author a:Seth_MacFarlane

#### 2.2.4 Annotations on Annotations

An annotation always generates a single triple or a group of similar triples (for axioms that are translated to multiple triples) for the annotation (which are in addition to the triples used to represent the axiom being annotated for annotation axioms). An annotation on this annotation generates the following triples instead of each triple produced by the annotation s p o:

_:x rdf:type owl:Annotation
_:x owl:subject s
_:x owl:predicate p
_:x owl:object o

_:x T(AP1) T(elt1)
...
_:x T(APn) T(eltn)

Consider the following subclass axiom:

SubClassOf( Comment( Label("Profound") "Children are people." ) a:Child a:Person )

This doubly annotated axiom generates

_:x rdf:type owl:Axiom
_:x owl:subject a:Child
_:x owl:predicate rdfs:subClassOf
_:x owl:object a:Person
_:y rdf:type owl:Annotation
_:y owl:subject _:x
_:y owl:predicate rdfs:comment
_:y owl:object "Children are people."
_:y rdfs:label "Profound"

Deeper nesting is handled in the same way.

## 3 Mapping from RDF Graphs to Functional-Style Syntax

This section specifies canonical RDF parsing — a process that can be used to transform a set of RDF triples G into an OWL 2 ontology O in functional-style syntax, if possible. This process is specified as an instance of canonical parsing, defined in Section 5.9.3 of the OWL 2 Specification [OWL 2 Specification]. It is important to understand that canonical RDF parsing merely defines the result of the transformation. An OWL 2 implementation is free to implement whatever algorithm it chooses, as long as the result is structurally equivalent to the result of canonical RDF parsing.

Canonical RDF parsing maintains the following functions that can map an URI reference or a blank node x occurring in G into a fragment of the functional-style syntax. In particular,

• CE(x) maps x into a class expression,
• DR(x) maps x into a data range,
• OPE(x) maps x into an object property expression,
• DPE(x) maps x into a data property expression, and
• AP(x) maps x into an annotation property.

Initially, these functions are undefined for all URIs and blank nodes occurring in G; this is written as CE(x) = ε, DR(x) = ε, OPE(x) = ε, DPE(x) = ε, and AP(x) = ε. The functions are updated as parsing progresses. If at any point in time the following conditions become invalidated, G is rejected as syntactically incorrect.

• For each x, at most one of OPE(x), DPE(x), and AP(x) can be defined.
• For each x, at most one of CE(x) and DR(x) can be defined.
• The rules from the following sections are not allowed to redefine the value of any of these functions for some x.

The following sections contain rules in which triple patterns are matched to G. The following notation is used to denote parts of the patterns that are matched to literals with integer value:

• POS_INT(n) is matched to any literal whose value is a positive integer;
• NN_INT(n) is matched to any literal whose value is a nonnegative integer.

Possible conditions on the pattern are enclosed in curly braces. Some patterns use optional parts, which are enclosed in square brackets. If a pattern contains a variable number of triples, it must be matched to the maximal possible subset of G. The abbreviation T(SEQ y1 ... yn) denotes the pattern corresponding to RDF lists, as shown in Table 2.

Review comment from AlanRuttenberg 00:07, 17 June 2008 (EDT)
re: "must", above. 128

Table 2. Patterns Corresponding to RDF Lists
Sequence S Triples Corresponding to T(S) Main Node of T(S)
SEQ rdf:nil
SEQ y1 ... yn _:x rdf:first y1
_:x rdf:rest T(SEQ y2 ... yn)
_:x

### 3.1 Parsing Ontology Header and Declarations

First, the ontology header is extracted from G. In particular, if G does not contain a triple whose predicate is rdf:type and object is owl:Ontology, then the ontology header is Ontology( ... ). Otherwise, patterns from Table 3 are matched to G; if no such pattern can be matched in G, or if the pattern can be matched to G in more than one way, the graph G is rejected as invalid. The matched triples are removed from G.

Table 3. Parsing the Ontology Header
If G contains this pattern... ...then the ontology header has this form.
*:x rdf:type owl:Ontology
[ *:x owl:versionInfo *:y ]
*:x owl:imports z1
...
*:x owl:imports zk
{ The following triple pattern cannot be matched in G:
u w *:x
u rdf:type owl:Ontology
w rdf:type owl:OntologyProperty
}
Ontology( *:x [ *:y ]
Import( z1 )
...
Import( zk )
...
)
_:x rdf:type owl:Ontology
_:x owl:imports y1
...
_:x owl:imports yk
{ The following tiple pattern cannot be matched in G:
u w _:x
u rdf:type owl:Ontology
w rdf:type owl:OntologyProperty
}
Ontology(
Import( y1 )
...
Import( yk )
...
)

Next, for backwards compatibility with OWL DL, certain redundant triples are removed from G. In particular, if the triple pattern from the left-hand side of Table 4 is matched in G, then the triples on the right-hand side of Table 4 are deleted in G.

Review comment from AlanRuttenberg 23:50, 10 June 2008 (EDT)
Backwards compatibility issue regarding triples that declare solely rdf:type rdfs:Property, rdfs:Class, see email, email.
Table 4. Triples to be Deleted for Backwards Compatibility with OWL DL
If G contains this pattern... ...then these triples are deleted in G.
x rdf:type owl:Ontology x rdf:type owl:Ontology
x rdf:type owl:Class
x rdf:type rdfs:Class
x rdf:type rdfs:Class
x rdf:type rdfs:Datatype
x rdf:type rdfs:Class
x rdf:type rdfs:Class
x rdf:type owl:DataRange
x rdf:type rdfs:Class
x rdf:type rdfs:Class
x rdf:type owl:Restriction
x rdf:type rdfs:Class
x rdf:type rdfs:Class
x rdf:type owl:Restriction
x rdf:type owl:Class
x rdf:type owl:Class
x rdf:type owl:ObjectProperty
x rdf:type rdf:Property
x rdf:type rdf:Property
x rdf:type owl:FunctionalProperty
x rdf:type rdf:Property
x rdf:type rdf:Property
x rdf:type owl:InverseFunctionalProperty
x rdf:type rdf:Property
x rdf:type rdf:Property
x rdf:type owl:TransitiveProperty
x rdf:type rdf:Property
x rdf:type rdf:Property
x rdf:type owl:DatatypeProperty
x rdf:type rdf:Property
x rdf:type rdf:Property
x rdf:type owl:AnnotationProperty
x rdf:type rdf:Property
x rdf:type rdf:Property
x rdf:type owl:OntologyProperty
x rdf:type rdf:Property
x rdf:type rdf:Property
x rdf:type rdf:List
x rdf:first y
x rdf:rest z
x rdf:type rdf:List

Next, for backwards compatibility with OWL DL, G is modified such that declarations can be properly extracted in the next step. When a triple pattern from the first column of Table 5 is matched in G, the matching triples are replaced in G with the triples from the second column.

If G contains this pattern... ...then the matching triples are replaced in G with these triples.
*:x rdf:type owl:OntologyProperty *:x rdf:type owl:AnnotationProperty
*:x rdf:type owl:InverseFunctionalProperty *:x rdf:type owl:ObjectProperty
*:x rdf:type owl:InverseFunctionalProperty
*:x rdf:type owl:TransitiveProperty *:x rdf:type owl:ObjectProperty
*:x rdf:type owl:TransitiveProperty
*:x rdf:type owl:SymmetricProperty *:x rdf:type owl:ObjectProperty
*:x rdf:type owl:SymmetricProperty

Finally, the set of declarations Decl(O) is extracted from G according to Table 6. The matched triples are NOT removed from G — the triples from Table 6 can contain annotations so, in order to correctly parse the annotations, they will be matched again in the step described in Section 3.4.

Table 6. Parsing Declarations in G
If G contains this pattern... ...then this declaration is added to Decl(O).
*:x rdf:type owl:Class Declaration( Class( *:x ) )
*:x rdf:type rdfs:Datatype Declaration( Datatype( *:x ) )
*:x rdf:type owl:ObjectProperty Declaration( ObjectProperty( *:x ) )
*:x rdf:type owl:DatatypeProperty Declaration( DataProperty( *:x ) )
*:x rdf:type owl:AnnotationProperty Declaration( AnnotationProperty( *:x ) )
*:x rdf:type owl:NamedIndividual Declaration( NamedIndividual( *:x ) )
_:x rdf:type owl:Axiom
_:x owl:subject *:y
_:x owl:predicate rdf:type
_:x owl:object owl:Class
Declaration( Class( *:y ) )
_:x rdf:type owl:Axiom
_:x owl:subject *:y
_:x owl:predicate rdf:type
_:x owl:object rdfs:Datatype
Declaration( Datatype( *:y ) )
_:x rdf:type owl:Axiom
_:x owl:subject *:y
_:x owl:predicate rdf:type
_:x owl:object owl:ObjectProperty
Declaration( ObjectProperty( *:y ) )
_:x rdf:type owl:Axiom
_:x owl:subject *:y
_:x owl:predicate rdf:type
_:x owl:object owl:DatatypeProperty
Declaration( DataProperty( *:y ) )
_:x rdf:type owl:Axiom
_:x owl:subject *:y
_:x owl:predicate rdf:type
_:x owl:object owl:AnnotationProperty
Declaration( AnnotationProperty( *:y ) )
_:x rdf:type owl:Axiom
_:x owl:subject *:y
_:x owl:predicate rdf:type
_:x owl:object owl:NamedIndividual
Declaration( NamedIndividual( *:y ) )

### 3.2 Parsing the Imported Ontologies

Next, for each ontology O' imported into O, the ontology header and declarations are determined. If the ontology O' is written in RDF then this is done as above. If the ontology O' is written in some other format then the ontology header and declarations are determined according to the rules appropriate to the ontology format.

### 3.3 Declaration Checking and Initialization

The set AllDecl(O) of all declarations is computed by taking the union of the set Decl(O), the sets Decl(O') for each ontology O' imported (directly or indirectly) into O, and the declarations for built-in entities from Table 2 of the OWL 2 Specification [OWL 2 Specification]. The declarations in AllDecl(O) are checked for typing constraints, as specified in Section 5.9.1 of the OWL 2 Specification [OWL 2 Specification]. If the constraints are not satisfied, the graph G is rejected as syntactically incorrect.

Next, the functions CE, DR, OPE, DPE, and AP are initialized as shown in Table 7.

Table 7. Initialization of CE', DR, OPE, DPE, and AP
If AllDecl(O) contains this declaration... ...then perform this assignment.
Declaration( Class( *:x ) ) CE(*:x) := a class with the URI *:x
Declaration( Datatype( *:x ) ) DR(*:x) := a datatype with the URI *:x
Declaration( ObjectProperty( *:x ) ) OPE(*:x) := an object property with the URI *:x
Declaration( DataProperty( *:x ) ) DPE(*:x) := a data property with the URI *:x
Declaration( AnnotationProperty( *:x ) ) AP(*:x) := an annotation property with the URI *:x

The function OPEorDPE is defined as follows: OPEorDPE(x) = OPE(x) if OPE(x) ≠ ε; OPEorDPE(x) = DPE(x) if DPE(x) ≠ ε; and OPEorDPE(x) = ε otherwise.

### 3.4 Parsing of Annotations

Triples of the form x *:y *:z where *:y is an annotation property (that is, where AP(*:y) ≠ ε) are encountered in a number of patterns and they correspond to a set of annotations, denoted as ExpandAnnotations( x *:y *:z ), as described in Table 8. Thus, ExpandAnnotations( x *:y *:z ) contains the annotations that correspond to all possible interpretations of *:z as an entity.

Table 8. Parsing of Annotations
The set ExpandAnnotations( x *:y *:z ) contains these annotations... ...if these conditions are satisfied.
Annotation( *:y Class( CE(*:z) ) ) CE(*:z) is a class
Annotation( *:y Datatype( DR(*:z) ) ) DR(*:z) is a datatype
Annotation( *:y ObjectProperty( OPE(*:z) ) ) OPE(*:z) is an object property
Annotation( *:y DataProperty( DPE(*:z) ) ) DPE(*:z) is a data property
Annotation( *:y AnnotationProperty( AP(*:z) ) ) AP(*:z) is an annotation property
Annotation( *:y NamedIndividual( *:z ) ) all of CE(*:z), DR(*:z), OPE(*:z),
DPE(*:z), and AP(*:z) are equal to ε

To handle annotations on annotations any triple match for s p o that produces an annotation (either directly or via ExpandAnnotations), also allows a match of the four-triple pattern
_:x rdf:type owl:Annotation
_:x owl:subject s
_:x owl:predicate p
_:x owl:object o
and for each triple in G with _:x as the subject adds annotations to the each annotation generated as follows:

Table 8a. Parsing of Annotations on Annotations
If G contains this triple... ...then add these annotations to the generated annotation.
_:x *:y lt
{ AP(*:y) ≠ ε }
Annotation( *:y lt )
_:x *:y *:z
{ AP(*:y) ≠ ε }
ExpandAnnotations( _:x *:y *:z )
_:x *:y _:z
{ AP(*:y) ≠ ε }
Annotation( *:y _:z )

Any matched triples are removed.

### 3.5 Parsing of Axioms

Let x be the node that is matched to *:x or _:x while parsing the ontology header of O according to the patters from Table 2. The triples in G matching the patterns shown in Table 9 are converted to ontology annotations of O as shown in the table. The matched triples are removed from G.

Table 9. Parsing of Ontology Annotations
If G contains this pattern... ...then add these ontology annotations to O.
_:x *:y lt
{ AP(*:y) ≠ ε }
Annotation( *:y lt )
_:x *:y *:z
{ AP(*:y) ≠ ε }
ExpandAnnotations( _:x *:y *:z )
_:x *:y _:z
{ AP(*:y) ≠ ε }
Annotation( *:y _:z )

Next, the functions OPE, DR, and CE are extended as shown in Tables 10, 11, and 12, as well as in Tables 13 and 14. The patterns in the latter two tables are not generated by the mapping from Section 2, but they can be present in RDF graphs that encode OWL DL ontologies. Each time a pattern is matched, the matched triples are removed from G. Pattern matching is repeated as long until no triple pattern can be matched to G.

Table 10. Parsing Object Property Expressions
If G contains this pattern... ...then OPE(_:x) is set to this object property expression.
_:x owl:inverseOf *:y
{ OPE(*:y) ≠ ε }
InverseOf( OPE(*:y) )
Table 11. Parsing of Data Ranges
If G contains this pattern... ...then DR(_:x) is set to this data range.
_:x rdf:type rdfs:Datatype
_:x owl:datatypeComplementOf y
{ DR(y) ≠ ε }
ComplementOf( DR(y) )
_:x rdf:type rdfs:Datatype
_:x owl:oneOf T(SEQ lt1 ... ltn)
OneOf( lt1 ... ltn )
_:x rdf:type rdfs:Datatype
_:x owl:onDatatype *:y
_:x owl:withRestrictions T(SEQ _:z1 ... _:zn)
_:z1 xsd:facet1 lt1
...
_:zn xsd:facetn ltn
{ DR(*:y) is a datatype }
DatatypeRestriction( DR(*:y)
facet1 lt1
...
facetn ltn
)
Table 12. Parsing of Class Expressions
If G contains this pattern... ...then CE(_:x) is set to this class expression.
_:x rdf:type owl:Class
_:x owl:complementOf y
{ CE(y) ≠ ε }
ComplementOf( CE(y) )
_:x rdf:type owl:Class
_:x owl:unionOf T(SEQ y1 ... yn)
{ n ≥ 2 and CE(yi) ≠ ε for each 1 ≤ i ≤ n }
UnionOf( CE(y1) ... CE(yn) )
_:x rdf:type owl:Class
_:x owl:intersectionOf T(SEQ y1 ... yn)
{ n ≥ 2 and CE(yi) ≠ ε for each 1 ≤ i ≤ n }
IntersectionOf( CE(y1) ... CE(yn) )
_:x rdf:type owl:Class
_:x owl:oneOf T(SEQ *:y1 ... *:yn)
OneOf( *:y1 ... *:yn )
_:x rdf:type owl:SelfRestriction
_:x owl:onProperty y
{ OPE(y) ≠ ε }
ExistsSelf( OPE(y) )
_:x rdf:type owl:Restriction
_:x owl:onProperty y
_:x owl:hasValue *:z
{ OPE(y) ≠ ε }
HasValue( OPE(y) *:z )
_:x rdf:type owl:Restriction
_:x owl:onProperty y
_:x owl:someValuesFrom z
{ OPE(y) ≠ ε and CE(z) ≠ ε }
SomeValuesFrom( OPE(y) CE(z) )
_:x rdf:type owl:Restriction
_:x owl:onProperty y
_:x owl:allValuesFrom z
{ OPE(y) ≠ ε and CE(z) ≠ ε }
AllValuesFrom( OPE(y) CE(z) )
_:x rdf:type owl:Restriction
_:x owl:minQualifiedCardinality NN_INT(n)
_:x owl:onProperty y
_:x owl:onClass z
{ OPE(y) ≠ ε and CE(z) ≠ ε }
MinCardinality( n OPE(y) CE(z) )
_:x rdf:type owl:Restriction
_:x owl:maxQualifiedCardinality NN_INT(n)
_:x owl:onProperty y
_:x owl:onClass z
{ OPE(y) ≠ ε and CE(z) ≠ ε }
MaxCardinality( n OPE(y) CE(z) )
_:x rdf:type owl:Restriction
_:x owl:qualifiedCardinality NN_INT(n)
_:x owl:onProperty y
_:x owl:onClass z
{ OPE(y) ≠ ε and CE(z) ≠ ε }
ExactCardinality( n OPE(y) CE(z) )
_:x rdf:type owl:Restriction
_:x owl:minCardinality NN_INT(n)
_:x owl:onProperty y
{ OPE(y) ≠ ε }
MinCardinality( n OPE(y) )
_:x rdf:type owl:Restriction
_:x owl:maxCardinality NN_INT(n)
_:x owl:onProperty y
{ OPE(y) ≠ ε }
MaxCardinality( n OPE(y) )
_:x rdf:type owl:Restriction
_:x owl:cardinality NN_INT(n)
_:x owl:onProperty y
{ OPE(y) ≠ ε }
ExactCardinality( n OPE(y) )
_:x rdf:type owl:Restriction
_:x owl:onProperty y
_:x owl:hasValue lt
{ DPE(y) ≠ ε }
HasValue( DPE(y) lt )
_:x rdf:type owl:Restriction
_:x owl:onProperty y
_:x owl:someValuesFrom z
{ DPE(y) ≠ ε and DR(z) ≠ ε }
SomeValuesFrom( DPE(y) DR(z) )
_:x rdf:type owl:Restriction
_:x owl:onProperties T(SEQ y1 ... yn)
_:x owl:someValuesFrom z
{ DPE(yi) ≠ ε for each 1 ≤ i ≤ n and DR(z) ≠ ε }
SomeValuesFrom( DPE(y1) ... DPE(yn) DR(z) )
_:x rdf:type owl:Restriction
_:x owl:onProperty y
_:x owl:allValuesFrom z
{ DPE(y) ≠ ε and DR(z) ≠ ε }
AllValuesFrom( DPE(y) DR(z) )
_:x rdf:type owl:Restriction
_:x owl:onProperties T(SEQ y1 ... yn)
_:x owl:allValuesFrom z
{ DPE(yi) ≠ ε for each 1 ≤ i ≤ n and DR(z) ≠ ε }
AllValuesFrom( DPE(y1) ... DPE(yn) DR(z) )
_:x rdf:type owl:Restriction
_:x owl:minQualifiedCardinality NN_INT(n)
_:x owl:onProperty y
_:x owl:onDataRange z
{ DPE(y) ≠ ε and DR(z) ≠ ε }
MinCardinality( n DPE(y) DR(z) )
_:x rdf:type owl:Restriction
_:x owl:maxQualifiedCardinality NN_INT(n)
_:x owl:onProperty y
_:x owl:onDataRange z
{ DPE(y) ≠ ε and DR(z) ≠ ε }
MaxCardinality( n DPE(y) DR(z) )
_:x rdf:type owl:Restriction
_:x owl:qualifiedCardinality NN_INT(n)
_:x owl:onProperty y
_:x owl:onDataRange z
{ DPE(y) ≠ ε and DR(z) ≠ ε }
ExactCardinality( n DPE(y) DR(z) )
_:x rdf:type owl:Restriction
_:x owl:minCardinality NN_INT(n)
_:x owl:onProperty y
{ DPE(y) ≠ ε }
MinCardinality( n DPE(y) )
_:x rdf:type owl:Restriction
_:x owl:maxCardinality NN_INT(n)
_:x owl:onProperty y
{ DPE(y) ≠ ε }
MaxCardinality( n DPE(y) )
_:x rdf:type owl:Restriction
_:x owl:cardinality NN_INT(n)
_:x owl:onProperty y
{ DPE(y) ≠ ε }
ExactCardinality( n DPE(y) )
Table 13. Parsing of Data Ranges for Compatibility with OWL DL
If G contains this pattern... ...then DR(_:x) is set to this object property expression.
_:x rdf:type owl:DataRange
_:x owl:oneOf T(SEQ lt1 ... ltn)
OneOf( lt1 ... ltn )
_:x rdf:type owl:DataRange
_:x owl:oneOf T(SEQ)
ComplementOf( rdfs:Literal )
Table 14. Parsing of Class Expressions for Compatibility with OWL DL
If G contains this pattern... ...then CE(_:x) is set to this class expression.
_:x rdf:type owl:Class
_:x owl:unionOf T(SEQ)
owl:Nothing
_:x rdf:type owl:Class
_:x owl:unionOf T(SEQ y)
{ CE(y) ≠ ε }
CE(y)
_:x rdf:type owl:Class
_:x owl:intersectionOf T(SEQ)
owl:Thing
_:x rdf:type owl:Class
_:x owl:intersectionOf T(SEQ y)
{ CE(y) ≠ ε }
CE(y)
_:x rdf:type owl:Class
_:x owl:oneOf T(SEQ)
owl:Nothing

The ontology O is then populated with axioms. The patterns from Table 15 are matched in G, the resulting axioms are added to O, and the matched triples are removed from G.

Table 15. Parsing of Axioms
If G contains this pattern... ...then the following axiom is added to O.
*:x rdf:type owl:Class Declaration( Class( *:x ) )
*:x rdf:type rdfs:Datatype Declaration( Datatype( *:x ) )
*:x rdf:type owl:ObjectProperty Declaration( ObjectProperty( *:x ) )
*:x rdf:type owl:DatatypeProperty Declaration( DataProperty( *:x ) )
*:x rdf:type owl:AnnotationProperty Declaration( AnnotationProperty( *:x ) )
*:x rdf:type owl:NamedIndividual Declaration( NamedIndividual( *:x ) )
*:x *:y1 lt1
...
*:x *:yk ltk
*:x *:z1 *:w1
...
*:x *:zm *:wm
*:x *:u1 _:v1
...
*:x *:un _:vn
[ *:x rdf:type owl:DeprecatedClass ]
{ CE(*:x) ≠ ε,
AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
EntityAnnotation( Class( *:x )
Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( *:x *:z1 *:w1 )
...
ExpandAnnotations( *:x *:zm *:wm )
Annotations( *:u1 _:v1 )
...
Annotations( *:un _:vn )
[ Deprecated ]
)
*:x *:y1 lt1
...
*:x *:yk ltk
*:x *:z1 *:w1
...
*:x *:zm *:wm
*:x *:u1 _:v1
...
*:x *:un _:vn
[ *:x rdf:type owl:DeprecatedClass ]
{ DR(*:x) ≠ ε,
AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
EntityAnnotation( Datatype( *:x )
Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( *:x *:z1 *:w1 )
...
ExpandAnnotations( *:x *:zm *:wm )
Annotations( *:u1 _:v1 )
...
Annotations( *:un _:vn )
[ Deprecated ]
)
*:x *:y1 lt1
...
*:x *:yk ltk
*:x *:z1 *:w1
...
*:x *:zm *:wm
*:x *:u1 _:v1
...
*:x *:un _:vn
[ *:x rdf:type owl:DeprecatedProperty ]
{ OPE(*:x) ≠ ε,
AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
EntityAnnotation( ObjectProperty( *:x )
Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( *:x *:z1 *:w1 )
...
ExpandAnnotations( *:x *:zm *:wm )
Annotations( *:u1 _:v1 )
...
Annotations( *:un _:vn )
[ Deprecated ]
)
*:x *:y1 lt1
...
*:x *:yk ltk
*:x *:z1 *:w1
...
*:x *:zm *:wm
*:x *:u1 _:v1
...
*:x *:un _:vn
[ *:x rdf:type owl:DeprecatedProperty ]
{ DPE(*:x) ≠ ε,
AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
EntityAnnotation( DataProperty( *:x )
Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( *:x *:z1 *:w1 )
...
ExpandAnnotations( *:x *:zm *:wm )
Annotations( *:u1 _:v1 )
...
Annotations( *:un _:vn )
[ Deprecated ]
)
*:x *:y1 lt1
...
*:x *:yk ltk
*:x *:z1 *:w1
...
*:x *:zm *:wm
*:x *:u1 _:v1
...
*:x *:un _:vn
[ *:x rdf:type owl:DeprecatedProperty ]
{ AP(*:x) ≠ ε,
AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
EntityAnnotation( AnnotationProperty( *:x )
Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( *:x *:z1 *:w1 )
...
ExpandAnnotations( *:x *:zm *:wm )
Annotations( *:u1 _:v1 )
...
Annotations( *:un _:vn )
[ Deprecated ]
)
*:x *:y1 lt1
...
*:x *:yk ltk
*:x *:z1 *:w1
...
*:x *:zm *:wm
*:x *:u1 _:v1
...
*:x *:un _:vn
{ CE(*:x) ≠ ε, DR(*:x) ≠ ε, OPE(*:x) ≠ ε,
DPE(*:x) ≠ ε, AP(*:x) ≠ ε,
AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
EntityAnnotation( Individual( *:x )
Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( *:x *:z1 *:w1 )
...
ExpandAnnotations( *:x *:zm *:wm )
Annotations( *:u1 _:v1 )
...
Annotations( *:un _:vn )
)
_:x *:y1 lt1
...
_:x *:yk ltk
_:x *:z1 *:w1
...
_:x *:zm *:wm
_:x *:u1 _:v1
...
_:x *:un _:vn
{ AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
AnonymousIndividualAnnotation( _:x
Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( _:x *:z1 *:w1 )
...
ExpandAnnotations( _:x *:zm *:wm )
Annotations( *:u1 _:v1 )
...
Annotations( *:un _:vn )
)
x rdfs:subClassOf y
{ CE(x) ≠ ε and CE(y) ≠ ε }
SubClassOf( CE(x) CE(y) )
x owl:equivalentClass y
{ CE(x) ≠ ε and CE(y) ≠ ε }
EquivalentClasses( CE(x) CE(y) )
x owl:disjointWith y
{ CE(x) ≠ ε and CE(y) ≠ ε }
DisjointClasses( CE(x) CE(y) )
_:x rdf:type owl:AllDisjointClasses
_:x owl:members T(SEQ y1 ... yn)
{ CE(yi) ≠ ε for each 1 ≤ i ≤ n }
DisjointClasses( CE(y1) ... CE(yn) )
x owl:disjointUnionOf T(SEQ y1 ... yn)
{ CE(x) ≠ ε and CE(yi) ≠ ε for each 1 ≤ i ≤ n }
DisjointUnion( CE(x) CE(y1) ... CE(yn) )
x rdfs:subPropertyOf y
{ OPE(x) ≠ ε and OPE(y) ≠ ε }
SubPropertyOf( OPE(x) OPE(y) )
_:x rdfs:subPropertyOf y
_:x owl:propertyChain T(SEQ x1 ... xn)
{ OPE(xi) ≠ ε for each 1 ≤ i ≤ n and OPE(y) ≠ ε }
SubPropertyOf(
PropertyChain( OPE(x1) ... OPE(xn) )
OPE(y)
)
x owl:equivalentProperty y
{ OPE(x) ≠ ε and OPE(y) ≠ ε }
EquivalentProperties( OPE(x) OPE(y) )
x owl:propertyDisjointWith y
{ OPE(x) ≠ ε and OPE(y) ≠ ε }
DisjointProperties( OPE(x) OPE(y) )
_:x rdf:type owl:AllDisjointProperties
_:x owl:members T(SEQ y1 ... yn)
{ OPE(yi) ≠ ε for each 1 ≤ i ≤ n }
DisjointProperties( OPE(y1) ... OPE(yn) )
x rdfs:domain y
{ OPE(x) ≠ ε and CE(y) ≠ ε }
PropertyDomain( OPE(x) CE(y) )
x rdfs:range y
{ OPE(x) ≠ ε and CE(y) ≠ ε }
PropertyRange( OPE(x) CE(y) )
*:x owl:inverseOf y
{ OPE(*:x) ≠ ε and OPE(y) ≠ ε }
InverseProperties( OPE(*:x) OPE(y) )
x rdf:type owl:FunctionalProperty
{ OPE(x) ≠ ε }
FunctionalProperty( OPE(x) )
x rdf:type owl:InverseFunctionalProperty
{ OPE(x) ≠ ε }
InverseFunctionalProperty( OPE(x) )
x rdf:type owl:ReflexiveProperty
{ OPE(x) ≠ ε }
ReflexiveProperty( OPE(x) )
x rdf:type owl:IrreflexiveProperty
{ OPE(x) ≠ ε }
IrreflexiveProperty( OPE(x) )
x rdf:type owl:SymmetricProperty
{ OPE(x) ≠ ε }
SymmetricProperty( OPE(x) )
x rdf:type owl:AsymmetricProperty
{ OPE(x) ≠ ε }
AsymmetricProperty( OPE(x) )
x rdf:type owl:TransitiveProperty
{ OPE(x) ≠ ε }
TransitiveProperty( OPE(x) )
x rdfs:subPropertyOf y
{ DPE(x) ≠ ε and DPE(y) ≠ ε }
SubPropertyOf( DPE(x) DPE(y) )
x owl:equivalentProperty y
{ DPE(x) ≠ ε and DPE(y) ≠ ε }
EquivalentProperties( DPE(x) DPE(y) )
x owl:propertyDisjointWith y
{ DPE(x) ≠ ε and DPE(y) ≠ ε }
DisjointProperties( DPE(x) DPE(y) )
_:x rdf:type owl:AllDisjointProperties
_:x owl:members T(SEQ y1 ... yn)
{ DPE(yi) ≠ ε for each 1 ≤ i ≤ n }
DisjointProperties( DPE(y1) ... DPE(yn) )
x rdfs:domain y
{ DPE(x) ≠ ε and CE(y) ≠ ε }
PropertyDomain( DPE(x) CE(y) )
x rdfs:range y
{ DPE(x) ≠ ε and DR(y) ≠ ε }
PropertyRange( DPE(x) DR(y) )
x rdf:type owl:FunctionalProperty
{ DPE(x) ≠ ε }
FunctionalProperty( DPE(x) )
x owl:hasKey T(SEQ y1 ... yn)
{ CE(x) ≠ ε and OPEorDPE(yi) ≠ ε for each 1 ≤ i ≤ n }
KeyFor( OPEorDPE(y1) ... OPEorDPE(yn) CE(x) )
x owl:sameAs y SameIndividual( x y )
x owl:differentFrom y DifferentIndividuals( x y )
_:x rdf:type owl:AllDifferent
_:x owl:distinctMembers T(SEQ x1 ... xn)
DifferentIndividuals( x1 ... xn )
x rdf:type y
{ CE(y) ≠ ε }
ClassAssertion( x CE(y) )
x *:y z
{ OPE(*:y) ≠ ε }
PropertyAssertion( OPE(*:y) x z )
_:x rdf:type owl:NegativePropertyAssertion
_:x owl:sourceIndividual w
_:x owl:assertionProperty *:y
_:x owl:targetIndividual z
{ OPE(*:y) ≠ ε }
NegativePropertyAssertion( OPE(*:y) w z )
x *:y lt
{ DPE(*:y) ≠ ε }
PropertyAssertion( DPE(*:y) x lt )
_:x rdf:type owl:NegativePropertyAssertion
_:x owl:sourceIndividual w
_:x owl:assertionProperty *:y
_:x owl:targetValue lt
{ OPE(*:y) ≠ ε }
NegativePropertyAssertion( DPE(*:y) w lt )

For clarity, Table 15 ignores annotations on axioms. In case of the patterns for owl:AllDisjointClasses, owl:AllDisjointProperties, owl:AllDifferent, and owl:NegativePropertyAssertion, axiom annotations are obtained by additionally maximally matching patterns from Table 16 in G during axiom matching. For other axioms, axiom annotations are obtained by additionally matching patterns from Table 17 in G during axiom matching. All matched triples are then discarded from G.

Table 16. Parsing of Annotations for Axioms Represented by a Blank Node
If G contains this pattern... ...then add these annotations to the axiom for _:x.
_:x *:y lt
{ AP(*:y) ≠ ε }
Annotation( *:y lt )
_:x *:y *:z
{ AP(*:y) ≠ ε }
ExpandAnnotations( _:x *:y *:z )
_:x *:y _:z
{ AP(*:y) ≠ ε }
Annotation( *:y _:z )
Table 17. Parsing of Annotated Axioms
If G contains this pattern... ...then the following axiom is added to O.
_:x rdf:type owl:Axiom
_:x *:y1 lt1
...
_:x *:yk ltk
_:x *:z1 *:w1
...
_:x *:zm *:wm
_:x *:u1 _:v1
...
_:x *:un _:vn
_:x owl:subject s
_:x owl:predicate *:p
_:x owl:object o
{ s *:p o is the main triple for an axiom,
G contains possible necessary side triples for the axiom,
AP(*:yi) ≠ ε for each 1 ≤ i ≤ k,
AP(*:zi) ≠ ε for each 1 ≤ i ≤ m, and
AP(*:ui) ≠ ε for each 1 ≤ i ≤ n }
The result is the axiom corresponding to s *:p o (and possible
side triples) that additionally contains the following annotations:

Annotation( *:y1 lt1 )
...
Annotation( *:yk ltk )
ExpandAnnotations( _:x *:z1 *:w1 )
...
ExpandAnnotations( _:x *:zm *:wm )
Annotation( _:x *:u1 _:v1 )
...
Annotation( _:x *:un _:vn )

Finally, the patterns from Table 18 are matched in G, the resulting axioms are added to O, and the matched triples are removed from G. These patterns are not generated by the mapping from Section 2, but they can be present in RDF graphs that encode OWL DL ontologies. (Note that the patterns from the table do not contain triples of the form *:x rdf:type owl:Class because such triples are deleted while parsing the entity declarations, as specified in Section 3.1).

Table 18. Parsing of Axioms for Compatibility with OWL DL
If G contains this pattern... ...then the following axiom is added to O.
*:x owl:complementOf y
{ CE(*:x) ≠ ε and CE(y) ≠ ε }
EquivalentClasses( CE(*:x) ComplementOf( CE(y) ) )
*:x owl:unionOf T(SEQ)
{ CE(*:x) ≠ ε }
EquivalentClasses( CE(*:x) owl:Nothing )
*:x owl:unionOf T(SEQ y1)
{ CE(*:x) ≠ ε and CE(y1) ≠ ε }
EquivalentClasses( CE(*:x) CE(y) )
*:x owl:unionOf T(SEQ y1 ... yn)
{ n ≥ 2, CE(*:x) ≠ ε, and CE(yi) ≠ ε for each 1 ≤ i ≤ n }
EquivalentClasses( CE(*:x) UnionOf( CE(y1) ... CE(yn) ) )
*:x owl:intersectionOf T(SEQ)
{ CE(*:x) ≠ ε }
EquivalentClasses( CE(*:x) owl:Thing )
*:x owl:intersectionOf T(SEQ y1)
{ CE(*:x) ≠ ε and CE(y1) ≠ ε }
EquivalentClasses( CE(*:x) CE(y) )
*:x owl:intersectionOf T(SEQ y1 ... yn)
{ n ≥ 2, CE(*:x) ≠ ε, and CE(yi) ≠ ε for each 1 ≤ i ≤ n }
EquivalentClasses( CE(*:x) IntersectionOf( CE(y1) ... CE(yn) ) )
*:x owl:oneOf T(SEQ)
{ CE(*:x) ≠ ε }
EquivalentClasses( CE(*:x) owl:Nothing )
*:x owl:oneOf T(SEQ *:y1 ... *:yn)
{ CE(*:x) ≠ ε }
EquivalentClasses( CE(*:x) OneOf( *:y1 ... *:yn ) )

At the end of this process, if G is not empty, then G is rejected as syntactically invalid.

## 4 References

[OWL 2 Specification]
OWL 2 Web Ontology Language: Structural Specification and Functional-Style Syntax. Peter F. Patel-Schneider, Ian Horrocks, and Boris Motik, eds., 2006.
[OWL 2 Semantics]
OWL 2 Web Ontology Language: Model-Theoretic Semantics. Bernardo Cuenca Grau and Boris Motik, eds., 2006.
[RDF Semantics]
RDF Semantics. Patrick Hayes, Editor, W3C Recommendation, 10 February 2004, http://www.w3.org/TR/2004/REC-rdf-mt-20040210/.