+++ to secure your transactions use the Bitcoin Mixer Service +++

 

W3C

OWL 2 Web Ontology Language
Structural Specification and Functional-Style Syntax

W3C Recommendation 27 October 2009

This version:
http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/
Latest version (series 2):
http://www.w3.org/TR/owl2-syntax/
Latest Recommendation:
http://www.w3.org/TR/owl-syntax
Previous version:
http://www.w3.org/TR/2009/PR-owl2-syntax-20090922/ (color-coded diff)
Editors:
Boris Motik, Oxford University Computing Laboratory
Peter F. Patel-Schneider, Bell Labs Research, Alcatel-Lucent
Bijan Parsia, University of Manchester
Contributors: (in alphabetical order)
Conrad Bock, National Institute of Standards and Technology (NIST)
Achille Fokoue, IBM Corporation
Peter Haase, FZI Research Center for Information Technology
Rinke Hoekstra, University of Amsterdam
Ian Horrocks, Oxford University Computing Laboratory
Alan Ruttenberg, Science Commons (Creative Commons)
Uli Sattler, University of Manchester
Michael Smith, Clark & Parsia

Please refer to the errata for this document, which may include some normative corrections.

This document is also available in these non-normative formats: PDF version.

See also translations.


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.

The meaningful constructs provided by OWL 2 are defined in terms of their structure. As well, a functional-style syntax is defined for these constructs, with examples and informal descriptions. One can reason with OWL 2 ontologies under either the RDF-Based Semantics [OWL 2 RDF-Based Semantics] or the Direct Semantics [OWL 2 Direct Semantics]. If certain restrictions on OWL 2 ontologies are satisfied and the ontology is in OWL 2 DL, reasoning under the Direct Semantics can be implemented using techniques well known in the literature.

Status of this Document

May Be Superseded

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

XML Schema Datatypes Dependency

OWL 2 is defined to use datatypes defined in the XML Schema Definition Language (XSD). As of this writing, the latest W3C Recommendation for XSD is version 1.0, with version 1.1 progressing toward Recommendation. OWL 2 has been designed to take advantage of the new datatypes and clearer explanations available in XSD 1.1, but for now those advantages are being partially put on hold. Specifically, until XSD 1.1 becomes a W3C Recommendation, the elements of OWL 2 which are based on it should be considered optional, as detailed in Conformance, section 2.3. Upon the publication of XSD 1.1 as a W3C Recommendation, those elements cease to be optional and are to be considered required as otherwise specified.

We suggest that for now developers and users follow the XSD 1.1 Candidate Recommendation. Based on discussions between the Schema and OWL Working Groups, we do not expect any implementation changes will be necessary as XSD 1.1 advances to Recommendation.

Summary of Changes

There have been no substantive changes since the previous version. For details on the minor changes see the change log and color-coded diff.

Please Send Comments

Please send any comments to public-owl-comments@w3.org (public archive). Although work on this document by the OWL Working Group is complete, comments may be addressed in the errata or in future revisions. Open discussion among developers is welcome at public-owl-dev@w3.org (public archive).

Endorsed By W3C

This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

Patents

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent.


Table of Contents

1 Introduction

This document defines the OWL 2 language. The core part of this specification — called the structural specification — is independent of the concrete exchange syntaxes for OWL 2 ontologies. The structural specification describes the conceptual structure of OWL 2 ontologies and thus provides a normative abstract representation for all (normative and nonnormative) syntaxes of OWL 2. This allows for a clear separation of the essential features of the language from issues related to any particular syntax. Furthermore, such a structural specification of OWL 2 provides the foundation for the implementation of OWL 2 tools such as APIs and reasoners. Each OWL 2 ontology represented as an instance of this conceptual structure can be converted into an RDF graph [OWL 2 RDF Mapping]; conversely, most OWL 2 ontologies represented as RDF graphs can be converted into the conceptual structure defined in this document [OWL 2 RDF Mapping].

This document also defines the functional-style syntax, which closely follows the structural specification and allows OWL 2 ontologies to be written in a compact form. This syntax is used in the definitions of the semantics of OWL 2 ontologies, the mappings from and into the RDF/XML exchange syntax, and the different profiles of OWL 2. Concrete syntaxes, such as the functional-style syntax, often provide features not found in the structural specification, such as a mechanism for abbreviating IRIs.

Finally, this document defines OWL 2 DL — the subset of OWL 2 with favorable computational properties. Each RDF graph obtained by applying the RDF mapping to an OWL 2 DL ontology can be converted back into the conceptual structure defined in this document by means of the reverse RDF mapping [OWL 2 RDF Mapping].

An OWL 2 ontology is a formal description of a domain of interest. OWL 2 ontologies consist of the following three different syntactic categories:

These three syntactic categories are used to express the logical part of OWL 2 ontologies — that is, they are interpreted under a precisely defined semantics that allows useful inferences to be drawn. For example, if an individual a:Peter is an instance of the class a:Student, and a:Student is a subclass of a:Person, then from the OWL 2 semantics one can derive that a:Peter is also an instance of a:Person.

In addition, entities, axioms, and ontologies can be annotated in OWL 2. For example, a class can be given a human-readable label that provides a more descriptive name for the class. Annotations have no effect on the logical aspects of an ontology — that is, for the purposes of the OWL 2 semantics, annotations are treated as not being present. Instead, the use of annotations is left to the applications that use OWL 2. For example, a graphical user interface might choose to visualize a class using one of its labels.

Finally, OWL 2 provides basic support for ontology modularization. In particular, an OWL 2 ontology O can import another OWL 2 ontology O' and thus gain access to all entities, expressions, and axioms in O'.

This document defines the structural specification of OWL 2, the functional syntax for OWL 2, the behavior of datatype maps, and OWL 2 DL. Only the parts of the document related to these three purposes are normative. The examples in this document are informative and any part of the document that is specifically identified as informative is not normative. Further, the informal descriptions of the semantics of OWL 2 constructs in this document are informative; the Direct Semantics [OWL 2 Direct Semantics] and the RDF-Based [OWL 2 RDF-Based Semantics] are precisely specified in separate documents.

The italicized keywords MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY are used to specify normative features of OWL 2 documents and tools, and are interpreted as specified in RFC 2119 [RFC 2119].

2 Preliminary Definitions

This section presents certain preliminary definitions that are used in the rest of this document.

2.1 Structural Specification

The structural specification of OWL 2 consists of all the figures in this document and the notion of structural equivalence given below. It is used throughout this document to precisely specify the structure of OWL 2 ontologies and the observable behavior of OWL 2 tools. An OWL 2 tool MAY base its APIs and/or internal storage model on the structural specification; however, it MAY also choose a completely different approach as long as its observable behavior conforms to the one specified in this document.

The structural specification is defined using the Unified Modeling Language (UML) [UML], and the notation used is compatible with the Meta-Object Facility (MOF) [MOF]. This document uses only a very simple form of UML class diagrams that are expected to be easily understandable by readers familiar with the basic concepts of object-oriented systems. The following list summarizes the UML notation used in this document.

The narrative in this document often refers to various parts of the structural specification. These references are mainly intended to be informal, but they can often be interpreted as statements about the instances of the UML classes from the structural specification. When precision is required, such statements are captured using the functional-style syntax, which is defined in Section 3.7 and other relevant parts of this document. In order to avoid confusion, the term "UML class" is used to refer to elements of the structural specification of OWL 2, whereas the term "class" is used to refer to OWL 2 classes (see Section 5.1).

The sentence "The individual I is an instance of the class C" can be understood as a statement that I is an instance of the UML class Individual, C is an instance of the UML class Class, and there is an instance of the UML class ClassAssertion that connects I with C. This statement can be captured precisely using the structural specification as ClassAssertion( C I ).

Objects o1 and o2 from the structural specification are structurally equivalent if the following conditions hold:

The notion of structural equivalence is used throughout this specification to define various conditions on the structure of OWL 2 ontologies. Note that this is a syntactic, rather than a semantic notion — that is, it compares structures, rather than their meaning under a formal semantics.

The class expression

ObjectUnionOf( a:Person a:Animal )

is structurally equivalent to the class expression

ObjectUnionOf( a:Animal a:Person )

because the order of the elements in an unordered association is not important. In contrast, the class expression

ObjectUnionOf( a:Person ObjectComplementOf( a:Person ) )

is not structurally equivalent to owl:Thing even though the two expressions are semantically equivalent.

Sets written in one of the exchange syntaxes (e.g., XML or RDF/XML) are not necessarily expected to be duplicate free. Duplicates SHOULD be eliminated when ontology documents written in such syntaxes are converted into instances of the UML classes of the structural specification.

An ontology written in functional-style syntax can contain the following class expression:

ObjectUnionOf( a:Person a:Animal a:Animal )

During parsing, this expression should be "flattened" to the following expression:

ObjectUnionOf( a:Person a:Animal )

2.2 BNF Notation

Grammars in this document are written using the BNF notation, summarized in Table 1.

Table 1. The BNF Notation
Construct Syntax Example
terminal symbols enclosed in single quotes 'PropertyRange'
a set of terminal symbols described in English italic a finite sequence of characters
matching the PNAME_LN production of [SPARQL]
nonterminal symbols boldface ClassExpression
zero or more curly braces { ClassExpression }
zero or one square brackets [ ClassExpression ]
alternative vertical bar Assertion | Declaration

The following characters are called delimiters:

Whitespace is a maximal sequence of space (U+20), horizontal tab (U+9), line feed (U+A), and carriage return (U+D) characters not occurring within a pair of " (U+22) characters. A comment is a maximal sequence of characters that starts with the # (U+23) character not enclosed in a pair of < (U+3C) and > (U+3E) characters, and that contains neither a line feed (U+A) nor a carriage return (U+D) character. Whitespace and comments cannot occur within terminal symbols. Whitespace and comments can occur between any two terminal symbols, and all whitespace MUST be ignored. Whitespace MUST be introduced between a pair of terminal symbols if the first symbol does not end and the second symbol does not start with a delimiter.

2.3 Integers, Characters, Strings, Language Tags, and Node IDs

Nonnegative integers are defined as usual.

nonNegativeInteger := a nonempty finite sequence of digits between 0 and 9

Characters and strings are defined in the same way as in [RDF:PLAINLITERAL]. A character is an atomic unit of communication. The structure of characters is not further specified in this document, other than to note that each character has a Universal Character Set (UCS) code point [ISO/IEC 10646] (or, equivalently, a Unicode code point [UNICODE]). Each character MUST match the Char production from XML [XML]. Code points are written as U+ followed by the hexadecimal value of the code point. A string is a finite sequence of characters, and the length of a string is the number of characters in it. Two strings are identical if and only if they contain exactly the same characters in exactly the same sequence. Strings are written by enclosing them in double quotes (U+22) and using a subset of the N-triples escaping mechanism [RDF Test Cases] to encode strings containing quotes. Note that the definition below allows a string to span several lines of a document.

quotedString := a finite sequence of characters in which " (U+22) and \ (U+5C) occur only in pairs of the form \" (U+5C, U+22) and \\ (U+5C, U+5C), enclosed in a pair of " (U+22) characters

Language tags are used to identify the language in which a string has been written. They are defined in the same way as in [RDF:PLAINLITERAL], which follows [BCP 47]. Language tags are written by prepending them with the @ (U+40) character.

languageTag := @ (U+40) followed a nonempty sequence of characters matching the langtag production from [BCP 47]

Node IDs are used to identify anonymous individuals (aka blank nodes in RDF [RDF Concepts]).

nodeID := a finite sequence of characters matching the BLANK_NODE_LABEL production of [SPARQL]

2.4 IRIs

Ontologies and their elements are identified using Internationalized Resource Identifiers (IRIs) [RFC3987]; thus, OWL 2 extends OWL 1, which uses Uniform Resource Identifiers (URIs). Each IRI MUST be absolute (i.e., not relative). In the structural specification, IRIs are represented by the IRI UML class. Two IRIs are structurally equivalent if and only if their string representations are identical.

IRIs can be written as full IRIs by enclosing them in a pair of < (U+3C) and > (U+3E) characters. These characters are not part of the IRI, but are used for quotation purposes to identify an IRI as a full IRI.

Alternatively, IRIs can be abbreviated as in SPARQL [SPARQL]. To this end, one can declare a prefix name pn: — that is, a possibly empty string followed by the : (U+3A) character — by associating it with a prefix IRI PI; then, an IRI I whose string representation consists of PI followed by the remaining characters rc can be abbreviated as pn:rc. By a slight abuse of terminology, a prefix name is often used to refer to the prefix IRI that is associated with the prefix name, and phrases such as "an IRI whose string representation starts with the prefix IRI associated with the prefix name pn:" are typically shortened to less verbose phrases such as "an IRI with prefix pn:".

If a concrete syntax uses this IRI abbreviation mechanism, it SHOULD provide a suitable mechanism for declaring prefix names. Furthermore, abbreviated IRIs are not represented in the structural specification of OWL 2, and OWL 2 implementations MUST exhibit the same observable behavior as if all abbreviated IRIs were expanded into full IRIs during parsing. Concrete syntaxes such as the RDF/XML Syntax [RDF Syntax] allow IRIs to be abbreviated in relation to the IRI of the document they are contained in. If used, such mechanisms are independent from the above described abbreviation mechanism. The abbreviated IRIs have the syntactic form of qualified names from the XML Namespaces specification [XML Namespaces]; therefore, it is common to refer to PI as a namespace and rc as a local name. This abbreviation mechanism, however, is independent from XML namespaces and can be understood as a simple macro mechanism that expands prefix names with the associated IRIs.

fullIRI := an IRI as defined in [RFC3987], enclosed in a pair of < (U+3C) and > (U+3E) characters
prefixName := a finite sequence of characters matching the as PNAME_NS production of [SPARQL]
abbreviatedIRI := a finite sequence of characters matching the PNAME_LN production of [SPARQL]
IRI := fullIRI | abbreviatedIRI

Table 2 declares the prefix names that are commonly used throughout this specification.

Table 2. Declarations of the Standard Prefix Names
Prefix name Prefix IRI
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
rdfs: <http://www.w3.org/2000/01/rdf-schema#>
xsd: <http://www.w3.org/2001/XMLSchema#>
owl: <http://www.w3.org/2002/07/owl#>

IRIs with prefixes rdf:, rdfs:, xsd:, and owl: constitute the reserved vocabulary of OWL 2. As described in the following sections, the IRIs from the reserved vocabulary that are listed in Table 3 have special treatment in OWL 2.

Table 3. Reserved Vocabulary of OWL 2 with Special Treatment
owl:backwardCompatibleWith owl:bottomDataProperty owl:bottomObjectProperty owl:deprecated owl:incompatibleWith
owl:Nothing owl:priorVersion owl:rational owl:real owl:versionInfo
owl:Thing owl:topDataProperty owl:topObjectProperty rdf:langRange rdf:PlainLiteral
rdf:XMLLiteral rdfs:comment rdfs:isDefinedBy rdfs:label rdfs:Literal
rdfs:seeAlso xsd:anyURI xsd:base64Binary xsd:boolean xsd:byte
xsd:dateTime xsd:dateTimeStamp xsd:decimal xsd:double xsd:float
xsd:hexBinary xsd:int xsd:integer xsd:language xsd:length
xsd:long xsd:maxExclusive xsd:maxInclusive xsd:maxLength xsd:minExclusive
xsd:minInclusive xsd:minLength xsd:Name xsd:NCName xsd:negativeInteger
xsd:NMTOKEN xsd:nonNegativeInteger xsd:nonPositiveInteger xsd:normalizedString xsd:pattern
xsd:positiveInteger xsd:short xsd:string xsd:token xsd:unsignedByte
xsd:unsignedInt xsd:unsignedLong xsd:unsignedShort

3 Ontologies

An OWL 2 ontology is an instance O of the Ontology UML class from the structural specification of OWL 2 shown in Figure 1 that satisfies certain conditions given below. The main component of an OWL 2 ontology is its set of axioms, the structure of which is described in more detail in Section 9. Because the association between an ontology and its axioms is a set, an ontology cannot contain two axioms that are structurally equivalent. Apart from axioms, ontologies can also contain ontology annotations (as described in more detail in Section 3.5), and they can also import other ontologies (as described in Section 3.4).

The Structure of OWL 2 Ontologies
Figure 1. The Structure of OWL 2 Ontologies

The following list summarizes all the conditions that O is required to satisfy to be an OWL 2 ontology.

The following list summarizes all the conditions that an OWL 2 ontology O is required to satisfy to be an OWL 2 DL ontology.

An instance O of the Ontology UML class MAY have consistent declarations as specified in Section 5.8.2; however, this is not strictly necessary to make O an OWL 2 ontology.

3.1 Ontology IRI and Version IRI

Each ontology MAY have an ontology IRI, which is used to identify an ontology. If an ontology has an ontology IRI, the ontology MAY additionally have a version IRI, which is used to identify the version of the ontology. The version IRI MAY be, but need not be, equal to the ontology IRI. An ontology without an ontology IRI MUST NOT contain a version IRI.

IRIs from the reserved vocabulary MUST NOT be used as an ontology IRI or a version IRI of an OWL 2 DL ontology.

The following list provides conventions for choosing ontology IRIs and version IRIs in OWL 2 ontologies. This specification provides no mechanism for enforcing these constraints across the entire Web; however, OWL 2 tools SHOULD use them to detect problems in ontologies they process.

The ontology IRI and the version IRI together identify a particular version from an ontology series — the set of all the versions of a particular ontology identified using a common ontology IRI. In each ontology series, exactly one ontology version is regarded as the current one. Structurally, a version of a particular ontology is an instance of the Ontology UML class from the structural specification. Ontology series are not represented explicitly in the structural specification of OWL 2: they exist only as a side effect of the naming conventions described in this and the following sections.

3.2 Ontology Documents

An OWL 2 ontology is an abstract notion defined in terms of the structural specification. Each ontology is associated with an ontology document, which physically contains the ontology stored in a particular way. The name "ontology document" reflects the expectation that a large number of ontologies will be stored in physical text documents written in one of the syntaxes of OWL 2. OWL 2 tools, however, are free to devise other types of ontology documents — that is, to introduce other ways of physically storing ontologies.

Ontology documents are not represented in the structural specification of OWL 2, and the specification of OWL 2 makes only the following two assumptions about their nature:

An OWL 2 tool might publish an ontology as a text document written in the functional-style syntax (see Section 3.7) and accessible via the IRI <http://www.example.com/ontology>. An OWL 2 tool could also devise a scheme for storing OWL 2 ontologies in a relational database. In such a case, each subset of the database representing the information about one ontology corresponds to one ontology document. To provide a mechanism for accessing these ontology documents, the OWL 2 tool should identify different database subsets with distinct IRIs.

The ontology document of an ontology O SHOULD be accessible via the IRIs determined by the following rules:

Thus, the document containing the current version of an ontology series with some IRI OI SHOULD be accessible via OI. To access a particular version of OI, one needs to know that version's version IRI VI; the ontology document of the version SHOULD then be accessible via VI.

An ontology document of an ontology that contains an ontology IRI <http://www.example.com/my> but no version IRI should be accessible via the IRI <http://www.example.com/my>. In contrast, an ontology document of an ontology that contains an ontology IRI <http://www.example.com/my> and a version IRI <http://www.example.com/my/2.0> should be accessible via the IRI <http://www.example.com/my/2.0>. In both cases, the ontology document should be accessible via the respective IRIs using the HTTP protocol.

OWL 2 tools will often need to implement functionality such as caching or off-line processing, where ontology documents may be stored at addresses different from the ones dictated by their ontology IRIs and version IRIs. OWL 2 tools MAY implement a redirection mechanism: when a tool is used to access an ontology document at IRI I, the tool MAY redirect I to a different IRI DI and access the ontology document via DI instead. The result of accessing the ontology document via DI MUST be the same as if the ontology were accessed via I. Furthermore, once the ontology document is converted into an ontology, the ontology SHOULD satisfy the three conditions from the beginning of this section in the same way as if it the ontology document were accessed via I. No particular redirection mechanism is specified — this is assumed to be implementation dependent.

To enable off-line processing, an ontology document that — according to the above rules — should be accessible via <http://www.example.com/my> might be stored in a file accessible via <file:///usr/local/ontologies/example.owl>. To access this ontology document, an OWL 2 tool might redirect the IRI <http://www.example.com/my> and actually access the ontology document via <file:///usr/local/ontologies/example.owl>. The ontology obtained after accessing the ontology document should satisfy the usual accessibility constraints: if the ontology contains only the ontology IRI, then the ontology IRI should be equal to <http://www.example.com/my>, and if the ontology contains both the ontology IRI and the version IRI, then one of them should be equal to <http://www.example.com/my>.

3.3 Versioning of OWL 2 Ontologies

The conventions from Section 3.2 provide a simple mechanism for versioning OWL 2 ontologies. An ontology series is identified using an ontology IRI, and each version in the series is assigned a different version IRI. The ontology document of the ontology representing the current version of the series SHOULD be accessible via the ontology IRI and, if present, via its version IRI as well; the ontology documents of the previous versions SHOULD be accessible solely via their respective version IRIs. When a new version O in the ontology series is created, the ontology document of O SHOULD replace the one accessible via the ontology IRI (and it SHOULD also be accessible via its version IRI).

The ontology document containing the current version of an ontology series might be accessible via the IRI <http://www.example.com/my>, as well as via the version-specific IRI <http://www.example.com/my/2.0>. When a new version is created, the ontology document of the previous version should remain accessible via <http://www.example.com/my/2.0>; the ontology document of the new version, called, say, <http://www.example.com/my/3.0>, should be made accessible via both <http://www.example.com/my> and <http://www.example.com/my/3.0>.

3.4 Imports

An OWL 2 ontology can import other ontologies in order to gain access to their entities, expressions, and axioms, thus providing the basic facility for ontology modularization.

Assume that one wants to describe research projects about diseases. Managing information about the projects and the diseases in the same ontology might be cumbersome. Therefore, one might create a separate ontology O about diseases and a separate ontology O' about projects. The ontology O' would import O in order to gain access to the classes representing diseases; this allows one to use the diseases from O when writing the axioms of O'.

From a physical point of view, an ontology contains a set of IRIs, shown in Figure 1 as the directlyImportsDocuments association; these IRIs identify the ontology documents of the directly imported ontologies as specified in Section 3.2. The logical directly imports relation between ontologies, shown in Figure 1 as the directlyImports association, is obtained by accessing the directly imported ontology documents and converting them into OWL 2 ontologies. The logical imports relation between ontologies, shown in Figure 1 as the imports association, is the transitive closure of directly imports. In Figure 1, associations directlyImports and imports are shown as derived associations, since their values are derived from the value of the directlyImportsDocuments association. Ontology documents usually store the directlyImportsDocuments association. In contrast, the directlyImports and imports associations are typically not stored in ontology documents, but are determined during parsing as specified in Section 3.6.

The following ontology document contains an ontology that directly imports an ontology contained in the ontology document accessible via the IRI <http://www.example.com/my/2.0>.

Ontology( <http://www.example.com/importing-ontology>
    Import( <http://www.example.com/my/2.0> )

...
)

The IRIs identifying the ontology documents of the directly imported ontologies can be redirected as described in Section 3.2. For example, in order to access the above mentioned ontology document from a local cache, the IRI <http://www.example.com/my/2.0> might be redirected to <file:///usr/local/ontologies/imported.v20.owl>. Note that this can be done without changing the ontology document of the importing ontology.

The import closure of an ontology O is a set containing O and all the ontologies that O imports. The import closure of O SHOULD NOT contain ontologies O1 and O2 such that

The axiom closure of an ontology O is the smallest set that contains all the axioms from each ontology O' in the import closure of O with all anonymous individuals standardized apart — that is, the anonymous individuals from different ontologies in the import closure of O are treated as being different; see Section 5.6.2 for further details.

3.5 Ontology Annotations

An OWL 2 ontology contains a set of annotations. These can be used to associate information with an ontology — for example the ontology creator's name. As discussed in more detail in Section 10, each annotation consists of an annotation property and an annotation value, and the latter can be a literal, an IRI, or an anonymous individual.

ontologyAnnotations := { Annotation }

OWL 2 provides several built-in annotation properties for ontology annotations. The usage of these annotation properties on entities other than ontologies is discouraged.

3.6 Canonical Parsing of OWL 2 Ontologies

Many OWL 2 tools need to support ontology parsing — the process of converting an ontology document written in a particular syntax into an OWL 2 ontology. Depending on the syntax used, the ontology parser may need to know which IRIs are used in the ontology as entities of which type. This typing information is extracted from declarations — axioms that associate IRIs with entity types. Please refer to Section 5.8 for more information about declarations.

An ontology parser for the ontology documents written in the RDF syntax might encounter the following triples:

a:Father rdfs:subClassOf _:x .
_:x owl:someValuesFrom a:Child .
_:x owl:onProperty a:parentOf.

From this axiom alone, it is not clear whether a:parentOf is an object or a data property, and whether a:Child is a class or a datatype. In order to disambiguate the types of these IRIs, the parser needs to look at the declarations in the ontology document being parsed, as well as those in the directly or indirectly imported ontology documents.

In OWL 2 there is no requirement for a declaration of an entity to physically precede the entity's usage in ontology documents; furthermore, declarations for entities can be placed in imported ontology documents and imports are allowed to be cyclic. In order to precisely define the result of ontology parsing, this specification defines the notion of canonical parsing. An OWL 2 parser MAY implement parsing in any way it chooses, as long as it produces a result that is structurally equivalent to the result of canonical parsing.

An OWL 2 ontology corresponding to an ontology document DGI accessible via a given IRI GI can be obtained using the following canonical parsing process. All steps of this process MUST be successfully completed.

CP 1 Make AllDoc and Processed equal to the empty set, and make ToProcess equal to the set containing only the IRI GI.
CP 2 While ToProcess is not empty, remove an arbitrary IRI I from it and, if I is not contained in Processed, perform the following steps:
CP 2.1 Retrieve the ontology document DI from I as specified in Section 3.2.
CP 2.2 Using the rules of the relevant syntax, analyze DI and compute the set Decl(DI) of declarations explicitly present in DI and the set Imp(DI) of IRIs of ontology documents directly imported in DI.
CP 2.3 Add DI to AllDoc, add I to Processed, and add each IRI from Imp(DI) to ToProcess.
CP 3 For each ontology document D in AllDoc, perform the following steps:
CP 3.1 Compute the set AllDecl(D) as the union of the set Decl(D), the sets Decl(D') for each ontology document D' that is (directly or indirectly) imported into D, and the set of all declarations listed in Table 5. For an OWL 2 DL ontology, the set AllDecl(D) MUST satisfy the typing constraints from Section 5.8.1.
CP 3.2 Create an instance OD of the Ontology UML class from the structural specification.
CP 3.3 Using the rules of the relevant syntax, analyze D and populate OD by instantiating appropriate classes from the structural specification. Use the declarations in AllDecl(D) to disambiguate IRIs if needed; it MUST be possible to disambiguate all IRIs.
CP 4 For each pair of ontology documents DS and DT in AllDoc such that the latter is directly imported into the former, add ODT to the directlyImports association of ODS.
CP 5 For each ontology document D in AllDoc, set the imports association of OD to the transitive closure of the directlyImports association of OD.
CP 6 For each ontology document D in AllDoc, ensure that OD is an OWL 2 ontology — that is, OD MUST satisfy all the restrictions listed in Section 3.

It is important to understand that canonical parsing merely defines the result of the parsing process, and that an implementation of OWL 2 MAY optimize this process in numerous ways. In order to enable efficient parsing, OWL 2 implementations are encouraged to write ontologies into documents by placing all IRI declarations before the axioms that use these IRIs; however, this is not required for conformance.

3.7 Functional-Style Syntax

A functional-style syntax ontology document is a sequence of Unicode characters [UNICODE] accessible via some IRI by means of the standard protocols such that its text matches the ontologyDocument production of the grammar defined in this specification document, and it can be converted into an ontology by means of the canonical parsing process described in Section 3.6 and other parts of this specification document. A functional-style syntax ontology document SHOULD use the UTF-8 encoding [RFC 3629].

ontologyDocument := { prefixDeclaration } Ontology
prefixDeclaration := 'Prefix' '(' prefixName '=' fullIRI ')'
Ontology :=
    'Ontology' '(' [ ontologyIRI [ versionIRI ] ]
       directlyImportsDocuments
       ontologyAnnotations
       axioms
    ')'
ontologyIRI := IRI
versionIRI := IRI
directlyImportsDocuments := { 'Import' '(' IRI ')' }
axioms := { Axiom }

Each part of the ontology document matching the prefixDeclaration production declares a prefix name and associates it with a prefix IRI. An ontology document MUST contain at most one such declaration per prefix name, and it MUST NOT declare a prefix name listed in Table 2. Prefix declarations are used during parsing to expand abbreviated IRIs in the ontology document — that is, parts of the ontology document matching the abbreviatedIRI production — into full IRIs. This is done as follows:

The following is a functional-style syntax ontology document containing an ontology with the ontology IRI <http://www.example.com/ontology1>. The IRI <http://www.example.com/ontology1#> is associated with the prefix name : (that is, the prefix name consisting only of a colon character); this prefix is often called "empty" or "default". This ontology imports an ontology whose ontology document should be accessed via <http://www.example.com/ontology2>, and it contains an ontology annotation providing a label for the ontology and a single subclass axiom. The abbreviated IRI :Child is expanded into the full IRI <http://www.example.com/ontology1#Child> during parsing. The prefix name owl: occurs in Table 2 and therefore does not need to be explicitly declared in the ontology document.

Prefix(:=<http://www.example.com/ontology1#>)
Ontology( <http://www.example.com/ontology1>
    Import( <http://www.example.com/ontology2> )
    Annotation( rdfs:label "An example" )

    SubClassOf( :Child owl:Thing )
)

4 Datatype Maps

OWL 2 ontologies can refer to data values such as strings or integers. Each kind of such values is called a datatype. Datatypes can be used in OWL 2 ontologies as described in Section 5.2. Each datatype is identified by an IRI and is defined by the following components:

A set of datatypes supported by a reasoner is called a datatype map. This is not a syntactic construct — that is, it is not used directly to construct OWL 2 ontologies in a way that, say, classes and datatypes are. Because of that, a datatype map is not represented in the structural specification of OWL 2.

The rest of this section defines a particular datatype map called the OWL 2 datatype map, which lists the datatypes that can be used in OWL 2 ontologies. Most datatypes are taken from the set of XML Schema Datatypes, version 1.1 [XML Schema Datatypes] (but see Section 2.3 in OWL 2 Conformance [OWL 2 Conformance]), the RDF specification [RDF Concepts], or the specification for plain literals [RDF:PLAINLITERAL]. The normative definitions of these datatypes are provided by the respective specifications, and this document merely provides guidance on how to interpret these definitions properly in the context of OWL 2. For all these datatypes, this section lists the normative constraining facets that OWL 2 implementations MUST support. This section also contains the complete normative definitions of the datatypes owl:real and owl:rational, as these datatypes have not been taken from other specifications.

4.1 Real Numbers, Decimal Numbers, and Integers

The OWL 2 datatype map provides the following datatypes for the representation of real numbers, decimal numbers, and integers:

For each datatype from the above list that is identified by an IRI with the xsd: prefix, the definitions of the value space, the lexical space, and the facet space are provided by XML Schema [XML Schema Datatypes]; furthermore, the normative constraining facets for the datatype are xsd:minInclusive, xsd:maxInclusive, xsd:minExclusive, and xsd:maxExclusive. An OWL 2 implementation MAY support all lexical forms of these datatypes; however, it MUST support at least the lexical forms listed in Section 5.4 of XML Schema Datatypes [XML Schema Datatypes], which can be mapped to the primitive values commonly found in modern implementation platforms.

The datatypes owl:real and owl:rational are defined as follows.

Value Spaces.

Lexical Spaces.

Facet Spaces. The facet spaces of owl:real and owl:rational are defined in Table 4.

Table 4. The Facet Spaces of owl:real and owl:rational
Each pair of the form... ...is mapped to...
( xsd:minInclusive , v )
where v is from the value space of owl:real
the set of all numbers x from the value space of DT such that x = v or x > v
( xsd:maxInclusive , v )
where v is from the value space of owl:real
the set of all numbers x from the value space of DT such that x = v or x < v
( xsd:minExclusive , v )
where v is from the value space of owl:real
the set of all numbers x from the value space of DT such that x > v
( xsd:maxExclusive , v )
where v is from the value space of owl:real
the set of all numbers x from the value space of DT such that x < v
Note. DT is either owl:real or owl:rational.

4.2 Floating-Point Numbers

The OWL 2 datatype map supports the following datatypes for the representation of floating-point numbers:

As specified in XML Schema [XML Schema Datatypes], the value spaces of xsd:double, xsd:float, and xsd:decimal are pairwise disjoint. In accordance with this principle, the value space of owl:real is defined as being disjoint with the value spaces of xsd:double and xsd:float as well. The normative constraining facets for these datatypes are xsd:minInclusive, xsd:maxInclusive, xsd:minExclusive, and xsd:maxExclusive.

Although floating-point values are numbers, they are not contained in the value space of owl:real. Thus, the value spaces of xsd:double and xsd:float can be understood as containing "fresh copies" of the appropriate subsets of the value space of owl:real. To understand how this impacts the consequences of OWL 2 ontologies, consider the following example.

DataPropertyRange( a:hasAge xsd:integer ) The range of the a:hasAge property is xsd:integer.
DataPropertyAssertion( a:hasAge a:Meg "17"^^xsd:double ) Meg is seventeen years old.

The first axiom states that all values of the a:hasAge property must be in the value space of xsd:integer, but the second axiom provides a value for a:hasAge that is equal to the floating-point number 17. Since floating-point numbers are not contained in the value space of xsd:integer, the mentioned ontology is inconsistent.

According to XML Schema, the value spaces of xsd:double and xsd:float contain positive and negative zeros. These two objects are equal, but not identical. To understand this distinction, consider the following example ontology:

DataPropertyAssertion( a:numberOfChildren a:Meg "+0"^^xsd:float ) The value of a:numberOfChildren for a:Meg is +0.
DataPropertyAssertion( a:numberOfChildren a:Meg "-0"^^xsd:float ) The value of a:numberOfChildren for a:Meg is -0.
FunctionalDataProperty( a:numberOfChildren ) An individual can have at most one value for a:numberOfChildren.

The last axiom states that no individual should have more than one distinct value for a:numberOfChildren. Since positive and negative zero are not identical, the first two axioms violate the restriction of the last axiom, which makes the ontology inconsistent. In other words, equality of values from the value space of xsd:double and xsd:float has no effect on the semantics of cardinality restrictions of OWL 2; in fact, equality is used only in the definition of facets.

According to XML Schema, the semantics of facets is defined with respect to equality, and positive and negative zeros are equal. Therefore, the subset of the value space of xsd:double between -1.0 and 1.0 contains both +0 and -0.

4.3 Strings

The OWL 2 datatype map provides the rdf:PlainLiteral datatype for the representation of strings in a particular language. The definitions of the value space, the lexical space, the facet space, and the necessary mappings are given in [RDF:PLAINLITERAL]. The normative constraining facets for rdf:PlainLiteral are xsd:length, xsd:minLength, xsd:maxLength, xsd:pattern, and rdf:langRange; furthermore, only basic language ranges [BCP 47] are supported in the rdf:langRange constraining facet.

In addition, OWL 2 supports the following datatypes defined in XML Schema [XML Schema Datatypes]:

As explained in [RDF:PLAINLITERAL], the value spaces of all of these datatypes are contained in the value space of rdf:PlainLiteral. Furthermore, for each datatype from the above list, the normative constraining facets are xsd:length, xsd:minLength, xsd:maxLength, and xsd:pattern.

4.4 Boolean Values

The OWL 2 datatype map provides the xsd:boolean XML Schema datatype [XML Schema Datatypes] for the representation of Boolean values. No constraining facet is normative for this datatype.

4.5 Binary Data

The OWL 2 datatype map provides the following XML Schema datatypes [XML Schema Datatypes] for the representation of binary data:

As specified in XML Schema [XML Schema Datatypes], the value spaces of these two datatypes are disjoint. For each datatype from the above list, the normative constraining facets are xsd:minLength, xsd:maxLength, and xsd:length.

According to XML Schema, the value spaces of xsd:hexBinary and xsd:base64Binary are isomorphic copies of the set of all finite sequences of octets — integers between 0 and 255, inclusive. To understand the effect that the disjointness requirement has on the semantics of OWL 2, consider the following example ontology:

DataPropertyRange( a:personID xsd:base64Binary ) The range of the a:personID property is xsd:base64Binary.
DataPropertyAssertion( a:personID a:Meg "0203"^^xsd:hexBinary ) The ID of Meg is the octet sequence consisting of the octets 2 and 3.

The first axiom states that all values of the a:personID property must be in the value space of xsd:base64Binary, but the second axiom provides a value for a:personID that is in the value space of xsd:hexBinary. Since the value spaces of xsd:hexBinary and xsd:base64Binary are disjoint, the above ontology is inconsistent.

4.6 IRIs

The OWL 2 datatype map provides the xsd:anyURI XML Schema datatype [XML Schema Datatypes] for the representation of IRIs. As specified in XML Schema [XML Schema Datatypes], the value spaces of xsd:anyURI and xsd:string are disjoint. The normative constraining facets are xsd:minLength, xsd:maxLength, xsd:length, and xsd:pattern.

According to XML Schema, the value space of xsd:anyURI is the set of all IRIs. Although each IRI has a string representation, IRIs are not strings. The value space of xsd:anyURI can therefore be seen as an "isomorphic copy" of a subset of the value space of xsd:string.

The lexical forms of xsd:anyURI include relative IRIs. If an OWL 2 syntax employs rules for the resolution of relative IRIs (e.g., the OWL 2 XML Syntax [OWL 2 XML Serialization] uses xml:base for that purpose), such rules do not apply to xsd:anyURI lexical forms that represent relative IRIs; that is, the lexical forms representing relative IRIs MUST be parsed as they are.

4.7 Time Instants

The OWL 2 datatype map provides the following XML Schema datatypes [XML Schema Datatypes] for the representation of time instants with and without time zone offsets:

For each datatype from the above list, the normative constraining facets are xsd:minInclusive, xsd:maxInclusive, xsd:minExclusive, and xsd:maxExclusive. An OWL 2 implementation MAY support all lexical forms of these datatypes; however, it MUST support at least the lexical forms listed in Section 5.4 of XML Schema Datatypes [XML Schema Datatypes].

According to XML Schema, two xsd:dateTime values representing the same time instant but with different time zone offsets are equal, but not identical. The consequences of this definition are demonstrated by the following example ontology:

FunctionalDataProperty( a:birthDate ) Each object can have at most one birth date.
DataPropertyAssertion( a:birthDate a:Peter
    "1956-06-25T04:00:00-05:00"^^xsd:dateTime )
Peter was born on June 25th, 1956, at 4am EST.
DataPropertyAssertion( a:birthDate a:Peter
    "1956-06-25T10:00:00+01:00"^^xsd:dateTime )
Peter was born on June 25th, 1956, at 10am CET.

June 25th, 1956, 4am EST and June 25th, 1956, 10am CET denote the same time instants, but have different time zone offsets. Consequently, the two xsd:dateTime literals are mapped to two equal, but nonidentical data values. Consequently, a:Peter is connected by the property a:birthDate to two distinct data values, which violates the functionality requirement on a:birthDate and makes the ontology inconsistent.

The semantics of constraining facets on xsd:dateTime is defined with respect to equality and ordering on time instants. For example, the following datatype restriction contains all time instants that are larger than or equal to the time instant corresponding to the lexical form "1956-01-01T04:00:00-05:00".

DatatypeRestriction( xsd:dateTime xsd:minInclusive "1956-01-01T04:00:00-05:00"^^xsd:dateTime )

According to XML Schema datatypes [XML Schema Datatypes], time instants are compared with respect to their timeOnTimeline value, which roughly corresponds to the number of seconds elapsed from the origin of the proleptic Gregorian calendar. Thus, the above data range contains the time instants corresponding to the lexical forms "1956-06-25T04:00:00-05:00" and "1956-06-25T10:00:00+01:00" despite the fact that the time zone offset of the latter does not match the one used in the datatype restriction.

A time instant might not contain a time zone offset, in which case comparisons are slightly more involved. Let T1 and T2 be time instants with and without time zone offsets, respectively. Then, T1 is not equal to T2, and comparisons are defined as follows:

Thus, for T1 to be smaller than T2, the timeOnTimeline value of T1 should be smaller than the timeOnTimeline value of T2 even if we substitute the largest positive time zone offset in T2; the definition of "greater than" is analogous. Note that, for certain T1 and T2, it is possible that neither condition holds, in which case T1 and T2 are incomparable.

According to this definition, the datatype restriction mentioned earlier in this example contains the time instant corresponding to the lexical form "1956-01-01T10:00:00Z", but not the one corresponding to "1956-01-01T10:00:00"; the latter is the case because the time instant corresponding to "1956-01-01T10:00:00+14:00" is not greater than or equal to the one corresponding to "1956-01-01T04:00:00-05:00".

4.8 XML Literals

The OWL 2 datatype map provides the rdf:XMLLiteral datatype for the representation of XML content in OWL 2 ontologies. The datatype is defined in Section 5.1 of the RDF specification [RDF Concepts]. It has no normative constraining facets.

5 Entities, Literals, and Anonymous Individuals

Entities are the fundamental building blocks of OWL 2 ontologies, and they define the vocabulary — the named terms — of an ontology. In logic, the set of entities is usually said to constitute the signature of an ontology. Apart from entities, OWL 2 ontologies typically also contain literals, such as strings or integers.

The structure of entities and literals in OWL 2 is shown in Figure 2. Classes, datatypes, object properties, data properties, annotation properties, and named individuals are entities, and they are all uniquely identified by an IRI. Classes represent sets of individuals; datatypes are sets of literals such as strings or integers; object and data properties can be used to represent relationships in the domain; annotation properties can be used to associate nonlogical information with ontologies, axioms, and entities; and named individuals can be used to represent actual objects from the domain. Apart from named individuals, OWL 2 also provides for anonymous individuals — that is, individuals that are analogous to blank nodes in RDF [RDF Concepts] and that are accessible only from within the ontology they are used in. Finally, OWL 2 provides for literals, which consist of a string called a lexical form and a datatype specifying how to interpret this string.

The Hierarchy of Entities in OWL 2
Figure 2. Entities, Literals, and Anonymous Individuals in OWL 2

5.1 Classes

Classes can be understood as sets of individuals.

Class := IRI

The classes with the IRIs owl:Thing and owl:Nothing are available in OWL 2 as built-in classes with a predefined semantics:

IRIs from the reserved vocabulary other than owl:Thing and owl:Nothing MUST NOT be used to identify classes in an OWL 2 DL ontology.

Classes a:Child and a:Person can be used to represent the set of all children and persons, respectively, in the application domain, and they can be used in an axiom such as the following one:

SubClassOf( a:Child a:Person ) Each child is a person.

5.2 Datatypes

Datatypes are entities that refer to sets of data values. Thus, datatypes are analogous to classes, the main difference being that the former contain data values such as strings and numbers, rather than individuals. Datatypes are a kind of data range, which allows them to be used in restrictions. As explained in Section 7, each data range is associated with an arity; for datatypes, the arity is always one. The built-in datatype rdfs:Literal denotes any set of data values that contains the union of the value spaces of all datatypes.

An IRI used to identify a datatype in an OWL 2 DL ontology MUST

The conditions from the previous paragraph and the restrictions on datatypes in Section 11.2 require each datatype in an OWL 2 DL ontology to be rdfs:Literal, one of the datatypes from Section 4, or a datatype defined by means of a datatype definition (see Section 9.4).

Datatype := IRI

The datatype xsd:integer denotes the set of all integers. It can be used in axioms such as the following one:

DataPropertyRange( a:hasAge xsd:integer ) The range of the a:hasAge data property is xsd:integer.

5.3 Object Properties

Object properties connect pairs of individuals.

ObjectProperty := IRI

The object properties with the IRIs owl:topObjectProperty and owl:bottomObjectProperty are available in OWL 2 as built-in object properties with a predefined semantics:

IRIs from the reserved vocabulary other than owl:topObjectProperty and owl:bottomObjectProperty MUST NOT be used to identify object properties in an OWL 2 DL ontology.

The object property a:parentOf can be used to represent the parenthood relationship between individuals. It can be used in axioms such as the following one:

ObjectPropertyAssertion( a:parentOf a:Peter a:Chris ) Peter is a parent of Chris.

5.4 Data Properties

Data properties connect individuals with literals. In some knowledge representation systems, functional data properties are called attributes.

DataProperty := IRI

The data properties with the IRIs owl:topDataProperty and owl:bottomDataProperty are available in OWL 2 as built-in data properties with a predefined semantics:

IRIs from the reserved vocabulary other than owl:topDataProperty and owl:bottomDataProperty MUST NOT be used to identify data properties in an OWL 2 DL ontology.

The data property a:hasName can be used to associate a name with each person. It can be used in axioms such as the following one:

DataPropertyAssertion( a:hasName a:Peter "Peter Griffin" ) Peter's name is "Peter Griffin".

5.5 Annotation Properties

Annotation properties can be used to provide an annotation for an ontology, axiom, or an IRI. The structure of annotations is further described in Section 10.

AnnotationProperty := IRI

The data properties with the IRIs listed below are available in OWL 2 as built-in data properties with a predefined semantics:

IRIs from the reserved vocabulary other than the ones listed above MUST NOT be used to identify annotation properties in an OWL 2 DL ontology.

The comment provided by the following annotation assertion axiom might, for example, be used by an OWL 2 tool to display additional information about the IRI a:Peter.

AnnotationAssertion( rdfs:comment a:Peter "The father of the Griffin family from Quahog." ) This axiom provides a comment for the IRI a:Peter.

5.6 Individuals

Individuals in the OWL 2 syntax represent actual objects from the domain. There are two types of individuals in the syntax of OWL 2. Named individuals are given an explicit name that can be used in any ontology to refer to the same object. Anonymous individuals do not have a global name and are thus local to the ontology they are contained in.

Individual := NamedIndividual | AnonymousIndividual

5.6.1 Named Individuals

Named individuals are identified using an IRI. Since they are given an IRI, named individuals are entities.

IRIs from the reserved vocabulary MUST NOT be used to identify named individuals in an OWL 2 DL ontology.

NamedIndividual := IRI

The individual a:Peter can be used to represent a particular person. It can be used in axioms such as the following one:

ClassAssertion( a:Person a:Peter ) Peter is a person.

5.6.2 Anonymous Individuals

If an individual is not expected to be used outside a particular ontology, one can use an anonymous individual, which is identified by a local node ID rather than a global IRI. Anonymous individuals are analogous to blank nodes in RDF [RDF Concepts].

AnonymousIndividual := nodeID

Anonymous individuals can be used, for example, to represent objects whose identity is of no relevance, such as the address of a person.

ObjectPropertyAssertion( a:livesAt a:Peter _:a1 ) Peter lives at some (unknown) address.
ObjectPropertyAssertion( a:city _:a1 a:Quahog ) This unknown address is in the city of Quahog and...
ObjectPropertyAssertion( a:state _:a1 a:RI ) ...in the state of Rhode Island.

Special treatment is required in case anonymous individuals with the same node ID occur in two different ontologies. In particular, these two individuals are structurally equivalent (because they have the same node ID); however, they are not treated as identical in the semantics of OWL 2 (because anonymous individuals are local to an ontology they are used in). The latter is achieved by standardizing anonymous individuals apart when constructing the axiom closure of an ontology O: if anonymous individuals with the same node ID occur in two different ontologies in the import closure of O, then one of these individuals MUST be replaced in the axiom closure of O with a fresh anonymous individual (i.e., an anonymous individual whose node ID is unique in the import closure of O).

Assume that ontologies O1 and O2 both use _:a5, and that O1 imports O2. Although they both use the same local node ID, the individual _:a5 in O1 may be different from the individual _:a5 in O2.

At the level of the structural specification, individual _:a5 in O1 is structurally equivalent to individual _:a5 in O2. This might be important, for example, for tools that use structural equivalence to define the semantics of axiom retraction.

In order to ensure that these individuals are treated differently by the semantics they are standardized apart when computing the axiom closure of O1 — either _:a5 in O1 is replaced with a fresh anonymous individual, or this is done for _:a5 in O2.

5.7 Literals

Literals represent data values such as particular strings or integers. They are analogous to typed RDF literals [RDF Concepts] and can also be understood as individuals denoting data values. Each literal consists of a lexical form, which is a string, and a datatype; the datatypes supported in OWL 2 are described in more detail in Section 4. A literal consisting of a lexical form "abc" and a datatype identified by the IRI datatypeIRI is written as "abc"^^datatypeIRI. Furthermore, literals whose datatype is rdf:PlainLiteral can be abbreviated in functional-style syntax ontology documents as plain RDF literals [RDF Concepts]. These abbreviations are purely syntactic shortcuts and are thus not reflected in the structural specification of OWL 2. The observable behavior of OWL 2 implementation MUST be as if these shortcuts were expanded during parsing.

The lexical form of each literal occurring in an OWL 2 DL ontology MUST belong to the lexical space of the literal's datatype.

Literal := typedLiteral | stringLiteralNoLanguage | stringLiteralWithLanguage
typedLiteral := lexicalForm '^^' Datatype
lexicalForm := quotedString
stringLiteralNoLanguage := quotedString
stringLiteralWithLanguage := quotedString languageTag

"1"^^xsd:integer is a literal that represents the integer 1.

"Family Guy" is an abbreviation for "Family Guy@"^^rdf:PlainLiteral — a literal with the lexical form "Family Guy@" and the datatype rdf:PlainLiteral — which denotes a string "Family Guy" without a language tag.

Furthermore, "Padre de familia"@es is an abbreviation for the literal "Padre de familia@es"^^rdf:PlainLiteral, which denotes a pair consisting of the string "Padre de familia" and the language tag es.

Two literals are structurally equivalent if and only if both the lexical form and the datatype are structurally equivalent; that is, literals denoting the same data value are structurally different if either their lexical form or the datatype is different.

Even though literals "1"^^xsd:integer and "+1"^^xsd:integer are interpreted as the integer 1, these two literals are not structurally equivalent because their lexical forms are not identical. Similarly, "1"^^xsd:integer and "1"^^xsd:positiveInteger are not structurally equivalent because their datatypes are not identical.

5.8 Entity Declarations and Typing

Each IRI I used in an OWL 2 ontology O can be, and sometimes even needs to be, declared in O; roughly speaking, this means that the axiom closure of O must contain an appropriate declaration for I. A declaration for I in O serves two purposes:

An ontology might contain a class declaration for the IRI a:Person. Such a declaration introduces the class a:Person into the ontology, and it states that the IRI a:Person is used to name a class in the ontology. An ontology editor might use declarations to implement functions such as "Add New Class".

In OWL 2, declarations are a type of axiom; thus, to declare an entity in an ontology, one can simply include the appropriate axiom in the ontology. These axioms are nonlogical in the sense that they do not affect the consequences of an OWL 2 ontology. The structure of entity declarations is shown in Figure 3.

Entity Declarations in OWL 2
Figure 3. Entity Declarations in OWL 2

Declaration := 'Declaration' '(' axiomAnnotations Entity ')'
Entity :=
    'Class' '(' Class ')' |
    'Datatype' '(' Datatype ')' |
    'ObjectProperty' '(' ObjectProperty ')' |
    'DataProperty' '(' DataProperty ')' |
    'AnnotationProperty' '(' AnnotationProperty ')' |
    'NamedIndividual' '(' NamedIndividual ')'

The following axioms state that the IRI a:Person is used as a class and that the IRI a:Peter is used as an individual.

Declaration( Class( a:Person ) )
Declaration( NamedIndividual( a:Peter ) )

Declarations for the built-in entities of OWL 2, listed in Table 5, are implicitly present in every OWL 2 ontology.

Table 5. Declarations of Built-In Entities
Declaration( Class( owl:Thing ) )
Declaration( Class( owl:Nothing ) )
Declaration( ObjectProperty( owl:topObjectProperty ) )
Declaration( ObjectProperty( owl:bottomObjectProperty ) )
Declaration( DataProperty( owl:topDataProperty ) )
Declaration( DataProperty( owl:bottomDataProperty ) )
Declaration( Datatype( rdfs:Literal ) )
Declaration( Datatype( I ) ) for each IRI I of a datatype in the OWL 2 datatype map (see Section 4)
Declaration( AnnotationProperty( I ) ) for each IRI I of a built-in annotation property listed in Section 5.5

5.8.1 Typing Constraints of OWL 2 DL

Let Ax be a set of axioms. An IRI I is declared to be of type T in Ax if a declaration axiom of type T for I is contained in Ax or in the set of built-in declarations listed in Table 5. The set Ax satisfies the typing constraints of OWL 2 DL if all of the following conditions are satisfied:

The axiom closure Ax of each OWL 2 DL ontology O MUST satisfy the typing constraints of OWL 2 DL.

The typing constraints thus ensure that the sets of IRIs used as object, data, and annotation properties in O are disjoint and that, similarly, the sets of IRIs used as classes and datatypes in O are disjoint as well. These constraints are used for disambiguating the types of IRIs when reading ontologies from external transfer syntaxes. All other declarations are optional.

An IRI I can be used as an individual in O even if I is not declared as an individual in O.

Declarations are often omitted in the examples in this document in cases where the types of entities are clear.

5.8.2 Declaration Consistency

Although declarations are not always required, they can be used to catch obvious errors in ontologies.

The following ontology erroneously refers to the individual a:Petre instead of the individual a:Peter.

Ontology( <http://www.my.example.com/example>
    Declaration( Class( a:Person ) )
    ClassAssertion( a:Person a:Petre )
)

There is no way of telling whether a:Petre was used by mistake. If, in contrast, all individuals in an ontology were by convention required to be declared, this error could be caught by a simple tool.

An ontology O is said to have consistent declarations if each IRI I occurring in the axiom closure of O in position of an entity with a type T is declared in O as having type T. OWL 2 ontologies are not required to have consistent declarations: an ontology MAY be used even if its declarations are not consistent.

The ontology from the previous example fails this check: a:Petre is used as an individual but the ontology does not declare a:Petre to be an individual. In contrast, the following ontology satisfies this condition.

Ontology( <http://www.my.example.com/example>
    Declaration( Class( a:Person ) )
    Declaration( NamedIndividual( a:Peter ) )
    ClassAssertion( a:Person a:Peter )
)

5.9 Metamodeling

An IRI I can be used in an OWL 2 ontology to refer to more than one type of entity. Such usage of I is often called metamodeling, because it can be used to state facts about classes and properties themselves. In such cases, the entities that share the same IRI I should be understood as different "views" of the same underlying notion identified by the IRI I.

Consider the following ontology.

ClassAssertion( a:Dog a:Brian ) Brian is a dog.
ClassAssertion( a:Species a:Dog ) Dog is a species.

In the first axiom, the IRI a:Dog is used as a class, while in the second axiom, it is used as an individual; thus, the class a:Species acts as a metaclass for the class a:Dog. The individual a:Dog and the class a:Dog should be understood as two "views" of one and the same IRI — a:Dog. Under the OWL 2 Direct Semantics [OWL 2 Direct Semantics], these two views are interpreted independently: the class view of a:Dog is interpreted as a unary predicate, while the individual view of a:Dog is interpreted as a constant.

Both metamodeling and annotations provide means to associate additional information with classes and properties. The following rule-of-the-thumb can be used to determine when to use which construct:

Consider the following ontology.

ClassAssertion( a:Dog a:Brian ) Brian is a dog.
ClassAssertion( a:PetAnimals a:Dog ) Dogs are pet animals.
AnnotationAssertion( a:addedBy a:Dog "Seth MacFarlane" ) The IRI a:Dog has been added to the ontology by Seth MacFarlane.

The facts that Brian is a dog and that dogs are pet animals are statements about the domain. Therefore, these facts are represented in the above ontology via metamodeling. In contrast, the information about who added the IRI a:Dog to the ontology does not describe the actual domain, but might be interesting from a management point of view. Therefore, this information is represented using an annotation.

6 Property Expressions

Properties can be used in OWL 2 to form property expressions.

6.1 Object Property Expressions

Object properties can by used in OWL 2 to form object property expressions. They are represented in the structural specification of OWL 2 by ObjectPropertyExpression, and their structure is shown in Figure 4.

Object Property Expressions in OWL 2
Figure 4. Object Property Expressions in OWL 2

As one can see from the figure, OWL 2 supports only two kinds of object property expressions. Object properties are the simplest form of object property expressions, and inverse object properties allow for bidirectional navigation in class expressions and axioms.

ObjectPropertyExpression := ObjectProperty | InverseObjectProperty

6.1.1 Inverse Object Properties

An inverse object property expression ObjectInverseOf( P ) connects an individual I1 with I2 if and only if the object property P connects I2 with I1.

InverseObjectProperty := 'ObjectInverseOf' '(' ObjectProperty ')'

Consider the ontology consisting of the following assertion.

ObjectPropertyAssertion( a:fatherOf a:Peter a:Stewie ) Peter is Stewie's father.

This ontology entails that a:Stewie is connected by the following object property expression to a:Peter:

ObjectInverseOf( a:fatherOf )

6.2 Data Property Expressions

For symmetry with object property expressions, the structural specification of OWL 2 also introduces data property expressions, as shown in Figure 5. The only allowed data property expression is a data property; thus, DataPropertyExpression in the structural specification of OWL 2 can be seen as a place-holder for possible future extensions.

Data Property Expressions in OWL 2
Figure 5. Data Property Expressions in OWL 2

DataPropertyExpression := DataProperty

7 Data Ranges

Datatypes, such as xsd:string or xsd:integer, and literals such as "1"^^xsd:integer, can be used to express data ranges — sets of tuples of literals, where tuples consisting of only one literal are identified with the literal itself. Each data range is associated with a positive arity, which determines the size of the tuples in the data range. All datatypes have arity one. This specification currently does not define data ranges of arity more than one; however, by allowing for n-ary data ranges, the syntax of OWL 2 provides a "hook" allowing implementations to introduce extensions such as comparisons and arithmetic.

Data ranges can be used in restrictions on data properties, as discussed in Sections 8.4 and 8.5. The structure of data ranges in OWL 2 is shown in Figure 6. The simplest data ranges are datatypes. The DataIntersectionOf, DataUnionOf, and DataComplementOf data ranges provide for the standard set-theoretic operations on data ranges; in logical languages these are usually called conjunction, disjunction, and negation, respectively. The DataOneOf data range consists of exactly the specified set of literals. Finally, the DatatypeRestriction data range restricts the value space of a datatype by a constraining facet.

Data Ranges in OWL 2
Figure 6. Data Ranges in OWL 2

DataRange :=
    Datatype |
    DataIntersectionOf |
    DataUnionOf |
    DataComplementOf |
    DataOneOf |
    DatatypeRestriction

7.1 Intersection of Data Ranges

An intersection data range DataIntersectionOf( DR1 ... DRn ) contains all tuples of literals that are contained in each data range DRi for 1 ≤ i ≤ n. All data ranges DRi MUST be of the same arity, and the resulting data range is of that arity as well.

DataIntersectionOf := 'DataIntersectionOf' '(' DataRange DataRange { DataRange } ')'

The following data range contains exactly the integer 0:

DataIntersectionOf( xsd:nonNegativeInteger xsd:nonPositiveInteger )

7.2 Union of Data Ranges

A union data range DataUnionOf( DR1 ... DRn ) contains all tuples of literals that are contained in the at least one data range DRi for 1 ≤ i ≤ n. All data ranges DRi MUST be of the same arity, and the resulting data range is of that arity as well.

DataUnionOf := 'DataUnionOf' '(' DataRange DataRange { DataRange } ')'

The following data range contains all strings and all integers:

DataUnionOf( xsd:string xsd:integer )

7.3 Complement of Data Ranges

A complement data range DataComplementOf( DR ) contains all tuples of literals that are not contained in the data range DR. The resulting data range has the arity equal to the arity of DR.

DataComplementOf := 'DataComplementOf' '(' DataRange ')'

The following complement data range contains literals that are not positive integers:

DataComplementOf( xsd:positiveInteger )

In particular, this data range contains the integer zero and all negative integers; however, it also contains all strings (since strings are not positive integers).

7.4 Enumeration of Literals

An enumeration of literals DataOneOf( lt1 ... ltn ) contains exactly the explicitly specified literals lti with 1 ≤ i ≤ n. The resulting data range has arity one.

DataOneOf := 'DataOneOf' '(' Literal { Literal } ')'

The following data range contains exactly two literals: the string "Peter" and the integer one.

DataOneOf( "Peter" "1"^^xsd:integer )

7.5 Datatype Restrictions

A datatype restriction DatatypeRestriction( DT F1 lt1 ... Fn ltn ) consists of a unary datatype DT and n pairs ( Fi , lti ). The resulting data range is unary and is obtained by restricting the value space of DT according to the semantics of all ( Fi , vi ) (multiple pairs are interpreted conjunctively), where vi are the data values of the literals lti.

In an OWL 2 DL ontology, each pair ( Fi , vi ) MUST be contained in the facet space of DT (see Section 4).

DatatypeRestriction := 'DatatypeRestriction' '(' Datatype constrainingFacet restrictionValue { constrainingFacet restrictionValue } ')'
constrainingFacet := IRI
restrictionValue := Literal

The following data range contains exactly the integers 5, 6, 7, 8, and 9:

DatatypeRestriction( xsd:integer xsd:minInclusive "5"^^xsd:integer xsd:maxExclusive "10"^^xsd:integer )

8 Class Expressions

In OWL 2, classes and property expressions are used to construct class expressions, sometimes also called descriptions, and, in the description logic literature, complex concepts. Class expressions represent sets of individuals by formally specifying conditions on the individuals' properties; individuals satisfying these conditions are said to be instances of the respective class expressions. In the structural specification of OWL 2, class expressions are represented by ClassExpression.

A class expression can be used to represent the set of "people that have at least one child". If an ontology additionally contains statements that "Peter is a person" and that "Peter has child Chris", then Peter can be classified as an instance of the mentioned class expression.

OWL 2 provides a rich set of primitives that can be used to construct class expressions. In particular, it provides the well known Boolean connectives and, or, and not; a restricted form of universal and existential quantification; number restrictions; enumeration of individuals; and a special self-restriction.

As shown in Figure 2, classes are the simplest form of class expressions. The other, complex, class expressions, are described in the following sections.

ClassExpression :=
    Class |
    ObjectIntersectionOf | ObjectUnionOf | ObjectComplementOf | ObjectOneOf |
    ObjectSomeValuesFrom | ObjectAllValuesFrom | ObjectHasValue | ObjectHasSelf |
    ObjectMinCardinality | ObjectMaxCardinality | ObjectExactCardinality |
    DataSomeValuesFrom | DataAllValuesFrom | DataHasValue |
    DataMinCardinality | DataMaxCardinality | DataExactCardinality

8.1 Propositional Connectives and Enumeration of Individuals

OWL 2 provides for enumeration of individuals and all standard Boolean connectives, as shown in Figure 7. The ObjectIntersectionOf, ObjectUnionOf, and ObjectComplementOf class expressions provide for the standard set-theoretic operations on class expressions; in logical languages these are usually called conjunction, disjunction, and negation, respectively. The ObjectOneOf class expression contains exactly the specified individuals.

Propositional Connectives and Enumeration of Individuals in OWL 2
Figure 7. Propositional Connectives and Enumeration of Individuals in OWL 2

8.1.1 Intersection of Class Expressions

An intersection class expression ObjectIntersectionOf( CE1 ... CEn ) contains all individuals that are instances of all class expressions CEi for 1 ≤ i ≤ n.

ObjectIntersectionOf := 'ObjectIntersectionOf' '(' ClassExpression ClassExpression { ClassExpression } ')'

Consider the ontology consisting of the following axioms.

ClassAssertion( a:Dog a:Brian ) Brian is a dog.
ClassAssertion( a:CanTalk a:Brian ) Brian can talk.

The following class expression describes all dogs that can talk; furthermore, a:Brian is classified as its instance.

ObjectIntersectionOf( a:Dog a:CanTalk )

8.1.2 Union of Class Expressions

A union class expression ObjectUnionOf( CE1 ... CEn ) contains all individuals that are instances of at least one class expression CEi for 1 ≤ i ≤ n.

ObjectUnionOf := 'ObjectUnionOf' '(' ClassExpression ClassExpression { ClassExpression } ')'

Consider the ontology consisting of the following axioms.

ClassAssertion( a:Man a:Peter ) Peter is a man.
ClassAssertion( a:Woman a:Lois ) Lois is a woman.

The following class expression describes all individuals that are instances of either a:Man or a:Woman; furthermore, both a:Peter and a:Lois are classified as its instances:

ObjectUnionOf( a:Man a:Woman )

8.1.3 Complement of Class Expressions

A complement class expression ObjectComplementOf( CE ) contains all individuals that are not instances of the class expression CE.

ObjectComplementOf := 'ObjectComplementOf' '(' ClassExpression ')'

Consider the ontology consisting of the following axioms.

DisjointClasses( a:Man a:Woman ) Nothing can be both a man and a woman.
ClassAssertion( a:Woman a:Lois ) Lois is a woman.

The following class expression describes all things that are not instances of a:Man:

ObjectComplementOf( a:Man )

Since a:Lois is known to be a woman and nothing can be both a man and a woman, then a:Lois is necessarily not a a:Man; therefore, a:Lois is classified as an instance of this complement class expression.

OWL 2 has open-world semantics, so negation in OWL 2 is the same as in classical (first-order) logic. To understand open-world semantics, consider the ontology consisting of the following assertion.

ClassAssertion( a:Dog a:Brian ) Brian is a dog.

One might expect a:Brian to be classified as an instance of the following class expression:

ObjectComplementOf( a:Bird )

Intuitively, the ontology does not explicitly state that a:Brian is an instance of a:Bird, so this statement seems to be false. In OWL 2, however, this is not the case: it is true that the ontology does not state that a:Brian is an instance of a:Bird; however, the ontology does not state the opposite either. In other words, this ontology simply does not contain enough information to answer the question whether a:Brian is an instance of a:Bird or not: it is perfectly possible that the information to that effect is actually true but it has not been included in the ontology.

The ontology from the previous example (in which a:Lois has been classified as a:Man), however, contains sufficient information to draw the expected conclusion. In particular, we know for sure that a:Lois is an instance of a:Woman and that a:Man and a:Woman do not share instances. Therefore, any additional information that does not lead to inconsistency cannot lead to a conclusion that a:Lois is an instance of a:Man; furthermore, if one were to explicitly state that a:Lois is an instance of a:Man, the ontology would be inconsistent and, by definition, it then entails all possible conclusions.

8.1.4 Enumeration of Individuals

An enumeration of individuals ObjectOneOf( a1 ... an ) contains exactly the individuals ai with 1 ≤ i ≤ n.

ObjectOneOf := 'ObjectOneOf' '(' Individual { Individual }')'

Consider the ontology consisting of the following axioms.

EquivalentClasses( a:GriffinFamilyMember
    ObjectOneOf( a:Peter a:Lois a:Stewie a:Meg a:Chris a:Brian )
)
The Griffin family consists exactly of Peter, Lois, Stewie, Meg, Chris, and Brian.
DifferentIndividuals( a:Quagmire a:Peter a:Lois a:Stewie a:Meg a:Chris a:Brian ) Quagmire, Peter, Lois, Stewie, Meg, Chris, and Brian are all different from each other.

The class a:GriffinFamilyMember now contains exactly the six explicitly listed individuals. Since we also know that a:Quagmire is different from these six individuals, this individual is classified as an instance of the following class expression:

ObjectComplementOf( a:GriffinFamilyMember )

The last axiom in the ontology is necessary to derive the mentioned conclusion; without it, the open-world semantics of OWL 2 would allow for situations where a:Quagmire is the same as a:Peter, a:Lois, a:Stewie, a:Meg, a:Chris, or a:Brian.

To understand how the open-world semantics affects enumerations of individuals, consider the ontology consisting of the following axioms.

ClassAssertion( a:GriffinFamilyMember a:Peter ) Peter is a member of the Griffin Family.
ClassAssertion( a:GriffinFamilyMember a:Lois ) Lois is a member of the Griffin Family.
ClassAssertion( a:GriffinFamilyMember a:Stewie ) Stewie is a member of the Griffin Family.
ClassAssertion( a:GriffinFamilyMember a:Meg ) Meg is a member of the Griffin Family.
ClassAssertion( a:GriffinFamilyMember a:Chris ) Chris is a member of the Griffin Family.
ClassAssertion( a:GriffinFamilyMember a:Brian ) Brian is a member of the Griffin Family.

The class a:GriffinFamilyMember now also contains the mentioned six individuals, just as in the previous example. The main difference to the previous example, however, is that the extension of a:GriffinFamilyMember is not closed: the semantics of OWL 2 assumes that information about a potential instance of a:GriffinFamilyMember may be missing. Therefore, a:Quagmire is now not classified as an instance of the following class expression, and this does not change even if we add the axiom stating that all of these six individuals are different from each other:

ObjectComplementOf( a:GriffinFamilyMember )

8.2 Object Property Restrictions

Class expressions in OWL 2 can be formed by placing restrictions on object property expressions, as shown in Figure 8. The ObjectSomeValuesFrom class expression allows for existential quantification over an object property expression, and it contains those individuals that are connected through an object property expression to at least one instance of a given class expression. The ObjectAllValuesFrom class expression allows for universal quantification over an object property expression, and it contains those individuals that are connected through an object property expression only to instances of a given class expression. The ObjectHasValue class expression contains those individuals that are connected by an object property expression to a particular individual. Finally, the ObjectHasSelf class expression contains those individuals that are connected by an object property expression to themselves.

Restricting Object Property Expressions in OWL 2
Figure 8. Restricting Object Property Expressions in OWL 2

8.2.1 Existential Quantification

An existential class expression ObjectSomeValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE to an individual that is an instance of CE. Provided that OPE is simple according to the definition in Section 11, such a class expression can be seen as a syntactic shortcut for the class expression ObjectMinCardinality( 1 OPE CE ).

ObjectSomeValuesFrom := 'ObjectSomeValuesFrom' '(' ObjectPropertyExpression ClassExpression ')'

Consider the ontology consisting of the following axioms.

ObjectPropertyAssertion( a:fatherOf a:Peter a:Stewie ) Peter is Stewie's father.
ClassAssertion( a:Man a:Stewie ) Stewie is a man.

The following existential expression contains those individuals that are connected by the a:fatherOf property to individuals that are instances of a:Man; furthermore, a:Peter is classified as its instance:

ObjectSomeValuesFrom( a:fatherOf a:Man )

8.2.2 Universal Quantification

A universal class expression ObjectAllValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE only to individuals that are instances of CE. Provided that OPE is simple according to the definition in Section 11, such a class expression can be seen as a syntactic shortcut for the class expression ObjectMaxCardinality( 0 OPE ObjectComplementOf( CE ) ).

ObjectAllValuesFrom := 'ObjectAllValuesFrom' '(' ObjectPropertyExpression ClassExpression ')'

Consider the ontology consisting of the following axioms.

ObjectPropertyAssertion( a:hasPet a:Peter a:Brian ) Brian is a pet of Peter.
ClassAssertion( a:Dog a:Brian ) Brian is a dog.
ClassAssertion( ObjectMaxCardinality( 1 a:hasPet ) a:Peter ) Peter has at most one pet.

The following universal expression contains those individuals that are connected through the a:hasPet property only with individuals that are instances of a:Dog — that is, it contains individuals that have only dogs as pets:

ObjectAllValuesFrom( a:hasPet a:Dog )

The ontology axioms clearly state that a:Peter is connected by a:hasPet only to instances of a:Dog: it is impossible to connect a:Peter by a:hasPet to an individual different from a:Brian without making the ontology inconsistent. Therefore, a:Peter is classified as an instance of the mentioned class expression.

The last axiom — that is, the one stating that a:Peter has at most one pet — is critical for the inference from the previous paragraph due to the open-world semantics of OWL 2. Without this axiom, the ontology might not have listed all the individuals to which a:Peter is connected by a:hasPet. In such a case a:Peter would not be classified as an instance of the mentioned class expression.

8.2.3 Individual Value Restriction

A has-value class expression ObjectHasValue( OPE a ) consists of an object property expression OPE and an individual a, and it contains all those individuals that are connected by OPE to a. Each such class expression can be seen as a syntactic shortcut for the class expression ObjectSomeValuesFrom( OPE ObjectOneOf( a ) ).

ObjectHasValue := 'ObjectHasValue' '(' ObjectPropertyExpression Individual ')'

Consider the ontology consisting of the following axiom.

ObjectPropertyAssertion( a:fatherOf a:Peter a:Stewie ) Peter is Stewie's father.

The following has-value class expression contains those individuals that are connected through the a:fatherOf property with the individual a:Stewie; furthermore, a:Peter is classified as its instance:

ObjectHasValue( a:fatherOf a:Stewie )

8.2.4 Self-Restriction

A self-restriction ObjectHasSelf( OPE ) consists of an object property expression OPE, and it contains all those individuals that are connected by OPE to themselves.

ObjectHasSelf := 'ObjectHasSelf' '(' ObjectPropertyExpression ')'

Consider the ontology consisting of the following axiom.

ObjectPropertyAssertion( a:likes a:Peter a:Peter ) Peter likes Peter.

The following self-restriction contains those individuals that like themselves; furthermore, a:Peter is classified as its instance:

ObjectHasSelf( a:likes )

8.3 Object Property Cardinality Restrictions

Class expressions in OWL 2 can be formed by placing restrictions on the cardinality of object property expressions, as shown in Figure 9. All cardinality restrictions can be qualified or unqualified: in the former case, the cardinality restriction only applies to individuals that are connected by the object property expression and are instances of the qualifying class expression; in the latter case the restriction applies to all individuals that are connected by the object property expression (this is equivalent to the qualified case with the qualifying class expression equal to owl:Thing). The class expressions ObjectMinCardinality, ObjectMaxCardinality, and ObjectExactCardinality contain those individuals that are connected by an object property expression to at least, at most, and exactly a given number of instances of a specified class expression, respectively.

Restricting the Cardinality of Object Property Expressions in OWL 2
Figure 9. Restricting the Cardinality of Object Property Expressions in OWL 2

8.3.1 Minimum Cardinality

A minimum cardinality expression ObjectMinCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at least n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing.

ObjectMinCardinality := 'ObjectMinCardinality' '(' nonNegativeInteger ObjectPropertyExpression [ ClassExpression ] ')'

Consider the ontology consisting of the following axioms.

ObjectPropertyAssertion( a:fatherOf a:Peter a:Stewie ) Peter is Stewie's father.
ClassAssertion( a:Man a:Stewie ) Stewie is a man.
ObjectPropertyAssertion( a:fatherOf a:Peter a:Chris ) Peter is Chris's father.
ClassAssertion( a:Man a:Chris ) Chris is a man.
DifferentIndividuals( a:Chris a:Stewie ) Chris and Stewie are different from each other.

The following minimum cardinality expression contains those individuals that are connected by a:fatherOf to at least two different instances of a:Man:

ObjectMinCardinality( 2 a:fatherOf a:Man )

Since a:Stewie and a:Chris are both instances of a:Man and are different from each other, a:Peter is classified as an instance of this class expression.

Due to the open-world semantics, the last axiom — the one stating that a:Chris and a:Stewie are different from each other — is necessary for this inference: without this axiom, it is possible that a:Chris and a:Stewie are actually the same individual.

8.3.2 Maximum Cardinality

A maximum cardinality expression ObjectMaxCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at most n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing.

ObjectMaxCardinality := 'ObjectMaxCardinality' '(' nonNegativeInteger ObjectPropertyExpression [ ClassExpression ] ')'

Consider the ontology consisting of the following axioms.

ObjectPropertyAssertion( a:hasPet a:Peter a:Brian ) Brian is a pet of Peter.
ClassAssertion( ObjectMaxCardinality( 1 a:hasPet ) a:Peter ) Peter has at most one pet.

The following maximum cardinality expression contains those individuals that are connected by a:hasPet to at most two individuals:

ObjectMaxCardinality( 2 a:hasPet )

Since a:Peter is known to be connected by a:hasPet to at most one individual, it is certainly also connected by a:hasPet to at most two individuals so, consequently, a:Peter is classified as an instance of this class expression.

The example ontology explicitly names only a:Brian as being connected by a:hasPet from a:Peter, so one might expect a:Peter to be classified as an instance of the mentioned class expression even without the second axiom. This, however, is not the case due to the open-world semantics. Without the last axiom, it is possible that a:Peter is connected by a:hasPet to other individuals. The second axiom closes the set of individuals that a:Peter is connected to by a:hasPet.

Consider the ontology consisting of the following axioms.

ObjectPropertyAssertion( a:hasDaughter a:Peter a:Meg ) Meg is a daughter of Peter.
ObjectPropertyAssertion( a:hasDaughter a:Peter a:Megan ) Megan is a daughter of Peter.
ClassAssertion( ObjectMaxCardinality( 1 a:hasDaughter ) a:Peter ) Peter has at most one daughter.

One might expect this ontology to be inconsistent: on the one hand, it says that a:Meg and a:Megan are connected to a:Peter by a:hasDaughter, but, on the other hand, it says that a:Peter is connected by a:hasDaughter to at most one individual. This ontology, however, is not inconsistent because the semantics of OWL 2 does not make the unique name assumption — that is, it does not assume distinct individuals to be necessarily different. For example, the ontology does not explicitly say that a:Meg and a:Megan are different individuals; therefore, since a:Peter can be connected by a:hasDaughter to at most one distinct individual, a:Meg and a:Megan must be the same. This example ontology thus entails the following assertion:

SameIndividual( a:Meg a:Megan )

One can axiomatize the unique name assumption in OWL 2 by explicitly stating that all individuals are different from each other. This can be done by adding the following axiom, which makes the example ontology inconsistent.

DifferentIndividuals( a:Peter a:Meg a:Megan ) Peter, Meg, and Megan are all different from each other.

8.3.3 Exact Cardinality

An exact cardinality expression ObjectExactCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to exactly n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing. Such an expression is actually equivalent to the expression

ObjectIntersectionOf( ObjectMinCardinality( n OPE CE ) ObjectMaxCardinality( n OPE CE ) ).

ObjectExactCardinality := 'ObjectExactCardinality' '(' nonNegativeInteger ObjectPropertyExpression [ ClassExpression ] ')'

Consider the ontology consisting of the following axioms.

ObjectPropertyAssertion( a:hasPet a:Peter a:Brian ) Brian is a pet of Peter.
ClassAssertion( a:Dog a:Brian ) Brian is a dog.
ClassAssertion(
    ObjectAllValuesFrom( a:hasPet
       ObjectUnionOf(
          ObjectOneOf( a:Brian )
          ObjectComplementOf( a:Dog )
        )
    )
    a:Peter
)
Each pet of Peter is either Brian or it is not a dog.

The following exact cardinality expression contains those individuals that are connected by a:hasPet to exactly one instance of a:Dog; furthermore, a:Peter is classified as its instance:

ObjectExactCardinality( 1 a:hasPet a:Dog )