Monday, August 31, 2009

Units ontology with SPIN support published

My co-workers at TopQuadrant have just published a new OWL ontology about Quantities, Units, Dimensions and Datatypes (QUDT). This is a result of a long term, ongoing project with NASA AMES, and our friends at NASA have permitted us to publish those ontologies to encourage the wider use outside of NASA.

The QUDT ontology is very carefully designed and provides comprehensive coverage of almost every unit of measurement that is known to humankind. For example, it defines the unit Centimeter as follows:

Each unit has a stable URI, making it possible to link to it from your own domain models in a reliable way. For each unit, the ontology defines some useful metadata including abbreviation, a link to DBpedia and a categorization of units into groups, such as length units.

I think this units ontology can fill an important gap in the current Semantic Web and Linked Data efforts. Numeric data without any formalized units is pretty useless for machines, and sometimes even for humans. Currently, a unit may be mentioned somewhere hidden in a comment or not at all, but the QUDT ontology allows ontology designers to clearly specify these implicit assumptions. With explicitly modeled units, linked data can be processed and transformed in much more useful ways. For example, if a height it specified in Centimeters, then a smart linked data browser can automatically translate it into Feet for US American readers.

There are two main ways of using the units ontology: you can use the unit resources to "annotate" your properties with a dedicated property such as qud:units. The values of your property would use built-in datatypes such as xsd:double. The other alternative is to embed the unit directly into the literals. For this use case, all units have also been declared to be rdfs:Datatypes. This makes it possible, to assign units as rdfs:ranges of a property as shown below:

Here, the property height has the range unit:Centimeter. An example instance would then show up like this:

The specific height will then be stored in RDF literals such as "8380"^^unit:Centimeter. (The upcoming version 3.2 of TopBraid Composer will show the unit in parantheses behind the property name, but I didn't want to play tricks here).

Now that the units have been formalized in an ontology, new ways of working with numeric data become possible. As described earlier, the SPIN framework can be used to define new SPARQL functions which can then be used to do things like unit conversion. We have published a SPIN Library which contains some generic unit conversion functions. For example, the qudspin:convert function can be used to convert any numeric value from a source unit (here: unit:Centimeter) to a target unit (unit:Foot):

If the units are used as datatypes, then the function qudspin:convertLiteral can be used, saving one argument in the function call:

In the following example, we iterate over all instances with a :height property and display the height (in cm) as well as the converted height (in feet) using the SPIN function:

Such unit conversion tasks have been made possible by adding conversion multipliers to the QUDT ontology. SPIN functions can use this extra metadata to drive mathematical computations. The function qudspin:convert is backed by a SPARQL query as shown below:

The SPIN framework makes it possible to define such SPARQL functions (and rules and constraints) in a completely declarative way. No extra hard-coding of anything is needed. Any SPIN-aware SPARQL engine can simply look up the definition of the qudspin:convert function on the web and learn about the underlying mathematics. Likewise, there is no need for humans to worry about the calculations themselves - they can treat the SPIN function as a black box.

Updated April 2012: The ontologies have been updated since the original blog entry was published. The easiest way to play with this (for example using TopBraid Composer Free Edition) is now to add an owl:imports statement to


Post a Comment

<< Home