David R Newman

<< Back to PhD Homepage

How to Write Good OWL Ontologies

In my experience of reviewing other ontologies, reading papers on OWL and writing my own ontologies, I have found some good design practices and some really quite bad ones. Therefore, in this blog I intend to set out good design practices for OWL ontologies and why I believe these to be better than some of the practices that I have found.

Contents

Entries

<< Previous Entry | Next Entry >>

29/09/2006 Defining Properties in OWL

There are two main property types in OWL, DatatypeProperty and ObjectProperty, (there is also AnnotationProperty) but this serve a slightly different purpose. The basic thing that differentiates the two is what rdfs:range defined for them. A DatatypeProperty must have a rdfs:range which only specifies literal values, whereas ObjectProperty's must sspecify a group of resources, (i.e. URIs). Look at the example below:

  <owl:DatatypeProperty rdf:about="&mmo;hasSortName">
    <rdfs:label>Sort Name</rdfs:label>
    <rdfs:comment>Version of an artists name to be used for sort
      ordering</rdfs:comment>
    <rdfs:domain rdf:resource="&mmo;MusicalEntity"/>
    <rdfs:range rdf:resource="&xsd;string"/>
    <rdfs:isDefinedBy rdf:resource="&mmo;"/>
  </owl:DatatypeProperty>

  <owl:ObjectProperty rdf:about="&mmo;hasReleaseType">
    <rdfs:label>Album Release Type</rdfs:label>
    <rdfs:comment>Release type for an album, e.g. ep, single,
      audiobook, etc.</rdfs:comment>
    <rdfs:domain rdf:resource="&mmo;AlbumInstance"/>
    <rdfs:range rdf:resource="&mmo;Type"/>
    <rdfs:isDefinedBy rdf:resource="&mmo;"/>
  </owl:ObjectProperty>

You can see that the DatatypeProperty has a range of string, whereas the ObjectProperty has a range of &mmo;Type, which is an OWL class with its own URI. There are several sub-classes of ObjectProperty that are designed specificly to allow inference over data to take place, this may either be at the time the data is imported or at the point of query. The OWL reference manual explains the purpose of all these properties better than I ever could.

So far I have discussed what OWL properties are are but not how I believe thay should be defined. The snippet of RDF/XML is above is how I would write a property. As you can see both properties have a five components to them rdfs:label, rdfs:comment, rdfs:domain, rdfs:range and rdfs:isDefinedBy. When some people define their ontologies they use dc:title and dc:description rather than rdfs:label and rdfs:comment respectively. In my opinion it is a mistake to use dc:title and dc:description, these should really be used by instances of classes not classes themselves. Using dc:title and dc:description in an ontologyactually makes life more difficult because you have to remember to define them as owl:AnnotationProperties as well. Using rdfs:label and rdfs:comment should also be used when classes are defined, as well as isDefinedBy. The purpose of isDeifined is to allow a simple one triple SPARQL (or similar query language) query to return all of the components of a particular ontology/domain. This may at first seem of little use but it is not that uncommon to want to know what is defined within at ontology/domain and it is much more complex to find this out without using the isDefinedBy property.

rdfs:domain and rdfs:range are the final two components of a property. These should all ways be defined unless there is a good reason not to, for example they are a sub-property of another class that has a domain and range. If you do not define a domain and range although you make it more difficult for a user to use your ontology because they will be unsure whether their queries will return what they expect because they won't know whether the predicates they use will be associated with the correct objects. Writing a clear rdfs:comment may reduce the confusion but using rdfs:doamin and rdfs:range will give absolute clarity.

<< Back to PhD Homepage

Page written by David R Newman (drn[at]ecs.soton.ac.uk). Last updated June 27 2018 14:44:18.