on January 22, 2010
by
if (function_exists('coauthors')) {
coauthors();
}
else {
the_author();
}
?>
in Under Review,
Comments (5)

OWL Syntaxes

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.

From the OWL Structural Specification to OWL 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 Functional OWL Syntax

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.

RDF Based Syntaxes

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.

RDF/XML

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.

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.

Turtle

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.

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.

OWL/XML

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.

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

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.

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.

Tools

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.

Acknowledgements

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.