There are a variety of syntaxes for persisting, sharing and editing OWL ontologies. These syntaxes range from the officially recommended RDF/XML exchange syntax, that any OWL compliant tool must support, through de facto standard syntaxes that virtually all OWL tools and APIs support, to bespoke syntaxes that are designed for particular purposes and applications. What ever syntax is used, it is important to realise that the OWL language is not defined using a particular concrete syntax, but is defined in a high level structural specification which is then mapped into various concrete syntaxes. Although the OWL World Wide Web Consortium (W3C) Recommendation specifies RDF/XML as the default exchange syntax there are a variety of alternative syntaxes with tools support that can be used for concrete representations of ontologies. Some of these syntaxes are specified in W3C notes, which means that an OWL compliant implementation need not support them, however, in practice the main APIs and editing tools do support them. In what follows some of the most widely used syntaxes are discussed. We begin by looking at how OWL is defined and then by looking at how the definition is mapped into concrete syntaxes.
The OWL 2 Structural Specification describes what constitutes an ontology from a structural point of view, for example, an ontology can be named with an IRI and is a set of axioms. It describes the various types of axioms and the types of class descriptions and entities that make up these axioms. It does this in a high level way which does not commit to any particular concrete representation syntax. This makes it possible to clearly describe the essential features of the OWL language without getting bogged down in the technical details of exchange syntaxes.
The first step towards concrete syntaxes is the functional syntax, which is a simple text base syntax that is used as a bridge between the structural specification and various concrete syntaxes. The example below shows an equivalent classes axiom, which specifies that Teenager is equivalent to a person whose ages is between 12 and 20. Generally speaking, this syntax is not intended to be used as a primary exchange syntax, but is simply used for translating the structural specification into other concrete syntaxes.
EquivalentClasses(:Teenager ObjectIntersectionOf(:Person DataSomeValuesFrom(:hasAge DatatypeRestriction(xsd:integer xsd:maxExclusive "20"^^xsd:integer xsd:minExclusive "12"^^xsd:integer))))
The primary syntax that all OWL compliant tools must support is RDF/XML. As the name suggests, this syntax provides an XML representation of an RDF graph. The OWL specification therefore provides a bidirectional mapping from the OWL Functional Syntax to RDF Graphs, which can then be serialised into any concrete RDF representations such as RDF/XML and Turtle.
The example below shows the definition of Teenager in RDF/XML. This is the same definition as shown above. As can be seen, RDF/XML is a very verbose syntax that is difficult to read. Although some people enjoy reading RDF/XML most people would not choose to edit this syntax by hand. Most OWL tools use this syntax as the default syntax for saving ontologies.
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/ontogenesis/example#Teenager"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/ontogenesis/example#Person"/> <owl:Restriction> <owl:onProperty rdf:resource="http://www.semanticweb.org/ontologies/ontogenesis/example#hasAge"/> <owl:someValuesFrom> <rdfs:Datatype> <owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> <owl:withRestrictions rdf:parseType="Collection"> <rdf:Description> <xsd:maxExclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">20</xsd:maxExclusive> </rdf:Description> <rdf:Description> <xsd:minExclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">12</xsd:minExclusive> </rdf:Description> </owl:withRestrictions> </rdfs:Datatype> </owl:someValuesFrom> </owl:Restriction> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class>
The advantages of RDF/XML are: Any tool claiming to be an OWL tool must be able to consume and produce it, which means that it is widely supported. RDF based syntaxes (including non-XML syntaxes) are good for representing the assertional axioms (ABox, data) in OWL ontologies. This is because these axioms correspond directly to triples.
The disadvantages of RDF/XML are: It is very verbose. It can be difficult to read. A feature of RDF/XML (and other RDF based syntaxes) is that because the syntax is triple based, the translation from complex class expressions, annotations and various OWL axioms into triples can require “reification” and the resulting RDF can be very verbose and ugly. The design of the OWL/RDF mapping (inherited from OWL 1) means that it is non-trivial to parse OWL ontologies represented in RDF. In fact, parsing almost always requires two passes which means that much more memory is required for parsing an OWL/RDF document that is required to hold the actual ontology in memory.
Another RDF concrete syntax is Turtle. This syntax is slighly less verbose and slightly more readable than RDF/XML. However, as can be seen from the representation of Teenager below, it is arguable that RDF based syntaxes do not really provide a convenient human readable format for representing complex OWL class expressions and OWL axioms.
:Teenager rdf:type owl:Class ; owl:equivalentClass [ rdf:type owl:Class ; owl:intersectionOf ( : Person [ rdf:type owl:Restriction ; owl:onProperty :hasAge ; owl:someValuesFrom [ rdf:type rdfs:Datatype ; owl:onDatatype xsd:integer ; owl:withRestrictions ( [ xsd:maxExclusive "20"^^xsd:integer ] [ xsd:minExclusive "12"^^xsd:integer] ) ] ] ) ] .
The advantages of Turtle are: It is much more concise and human readable than RDF/XML. It is quite widely supported – widely used tools and APIs such and Jena and the OWL API can produce and consume Turtle.
The disadvantages of Turtle are: Similar to the disadvantages of any RDF based syntax as described above.
Although it is possible to represent an OWL ontology in RDF/XML, the design of RDF/XML means that it is difficult or impossible to use off the shelf XML tools for tasks other than parsing and rendering it. Neither standard XML tools like XPath or XSLT work well with RDF/XML representations of ontologies. Because of this, and because of the desire for a more regular and simple XML format, OWL/XML was invented as a concrete representation format for OWL ontologies. The format is essentially derived directly from the Functional Syntax. The example below shows the description of Teenager. Compare this example with the irregular RDF/XML example above in order to note the regularity of OWL/XML.
<EquivalentClasses> <Class IRI="#Teenager"/> <ObjectIntersectionOf> <Class IRI="#Person"/> <DataSomeValuesFrom> <DataProperty IRI="#hasAge"/> <DatatypeRestriction> <Datatype abbreviatedIRI="xsd:integer"/> <FacetRestriction facet="http://www.w3.org/2001/XMLSchema#maxExclusive"> <Literal datatypeIRI="http://www.w3.org/2001/XMLSchema#integer">20</Literal> </FacetRestriction> <FacetRestriction facet="http://www.w3.org/2001/XMLSchema#minExclusive"> <Literal datatypeIRI="http://www.w3.org/2001/XMLSchema#integer">12</Literal> </FacetRestriction> </DatatypeRestriction> </DataSomeValuesFrom> </ObjectIntersectionOf> </EquivalentClasses>
The advantages of OWL/XML are: It conforms to an XML Schema and is regular so it is possible to use off the shelf tools for processing and querying it such as XPath and XSLT. It is easy to write and parse. Parsing can be done in a streaming mode, in one pass, using a SAX parser.
The disadvantages of OWL/XML are: It is very verbose. File sizes can be very large and this can make parsing slow.
The Manchester OWL Syntax provides a compact textual based representation for OWL ontologies that is easy to read and write. The primary motivation for the design of the Manchester OWL Syntax was to produce a syntax that could be used for editing class expressions in tools such as Protege. It has since been extended so that it is possible to represent complete ontologies, and is now specified in a W3C note. The example below shows the definition of Teenager. Notice how much more compact and readable this syntax is. The Manchester Syntax is used throughout many ontology development environments such as Protege 3, Protege 4, and Top Braid Composer for presenting and editing components of axioms such as class expressions.
Class: Teenager EquivalentTo: Person and (hasAge some integer[> 12 , < 20])
The advantages of Manchester Syntax are: It is very compact, it is easy to read and write.
The disadvantages of Manchester Syntax are: It is cumbersome to represent some axioms in OWL such as general subclass axioms, which have class expressions for their left hand side.
The OWL API is a de facto standard API for creating, manipulating and serialising OWL ontologies. It has parsing and rendering support for all of the concrete syntaxes described above. A web based syntax converter is available at http://owl.cs.manchester.ac.uk/converter/
Jena is an API for dealing with RDF and OWL. It has a large user base and has good support.
For more information see the OWL 2 Overview.
This paper is an open access work distributed under the terms of the Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided that the original author and source are attributed.
The paper and its publication environment form part of the work of the Ontogenesis Network, supported by EPSRC grant EP/E021352/1.