OWL Class Constants

There seems to be a bit of angst about when it’s appropriate to use typeof declarations as opposed to properties in OWL. It’s one version of the old class-as-property dilemma. But all this angst is completely unnecessary, as you can combine both.

Let’s say we have an owl class Vehicle. A vehicle can have a number of wheels, but of particular interest are two-wheeled and four-wheeled vehicles. Should we use a type or an attribute to indicate the number of wheels?

The problems with using types are:

  • we would have to create a type for every possible number of wheels that a vehicle might have, meaning that we would have to edit our ontology to handle strange data values
  • we could not compute, for instance, the total number of wheels for a set of vehicle instances – there are no integers to add, just names

But the great advantage of using types is that they are ontologically rich. Properties that are only relevant to two-wheeled vehicles (say: ForkGeometry) can be declared as being so. When you pull down a record for a truck, you are not left wondering if the “fork geometry” property has gone missing.

Luckily, OWL specifically accommodates this.

In most places where you use a class in OWL, you can use a class expression. A class in OWL is simply a subset of all possible OWL individuals, and there’s many ways to define such a subset. One way is with a DataHasValue assertion. Thus DataHasValue('NumWheels', '2') defines a class, every bit as much as TwoWheeledVehicle defines a class. This means that we can use it as the domain of a property – such as<code ForkGeometry. And we can give it a name with EquivalentClasses.

See: Ontology Sample Code

From here, one can easily go further. You can specify that the property RakeAngle applies to bikes with a raked fork geometry and is a real number between 0 and 90. You can give “bike with raked forks” a class name or not, depending on how often you need to use the idea.

More importantly, simply by saying
ObjectPropertyAssertion(MyBike ForkType RakedFork),

A reasoner can infer that my MyBikehas two wheels. That’s the point: we have effectively defined a constant property value for a named class, which logically applies to all individuals of the class.


One Response to OWL Class Constants

  1. Paul Murray says:

    This is not quite right. The reasoner does not infer that MyBike has two wheels, but if it does not, then the ontology is inconsistent.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: