What I am trying to do is create a datatype property that accepts and recognizes numeric intervals. For example lets say I have the property "temperature". In the ontology I want to create 2 sub properties "hot" and "cold". Hot would be temperatures 20-30 and cold 0-19. What I am doing at the moment is having some properties set as lowerlim and upperlim. But is there a more convenient way to express intervals directly through the property? So that when I query for example "23" it would recognise its "hot". Any tips?
Thank you in advance
This is quite straightforward in OWL, however the kind of inferences you're expecting may be a little different to the ones I'll now explain.
In OWL, you can define restrictions on datatype properties (as I've shown before).
However, datatype reasoning is required to infer that some resource/individual with a particular datatype value belongs to some class. Note that not all reasoner implementations support this, however I'll focus on Pellet, which does.
To demonstrate, I'll create a small OWL ontology. I'll write it out in OWL/XML syntax. It will be long, but hopefully will explain how it's done.
Firstly, define a 'reified' class called
Temp
:Next, two sub-classes called
Hot
andCold
:Now, we can define our datatype property, called
tempDegC
:I'll also create a couple of individuals which use this property, as follows:
Note that I haven't asserted which class
x
ory
belong to, just that they havetempDegC
of certainxsd:double
values.If we asked a reasoner to classify the ontology at this point, we wouldn't see any new inferences.
What we want is for the reasoner to automatically infer that
x
belongs to classCold
, and thaty
belongs to classHot
.We can achieve this by restricting the definition of the classes
Cold
andHot
in terms of the datatype propertytempDegC
, as follows:Here, this axiom defines
Cold
as "any instance which has atempDegC
with axsd:double
value which is<= 19
".Similarly, we can restrict
Hot
as follows:Here, this axiom defines
Hot
as "any instance which has atempDegC
with axsd:double
value which is> 19
and<= 30
".Now, with these definitions, asking the reasoner to classify the ontology infers two new statements:
x : Cold
y : Hot
Explanation
A key to obtaining these inferences was the use of
EquivalentClasses
to define the restriction onCold
andHot
classes. By usingEquivalentClasses
instead ofSubClassOf
, we're saying that anything with atempdegC
within the specified ranges belongs in the class.If, however, we were to instead use
SubClassOf
in defining the restriction onCold
andHot
classes above, this would only restrict instances ofCold
andHot
to abide by the constraint, a so-called necessary condition, in that it is necessary for all instances to abide by the restriction.In contrast,
EquivalentClasses
defines both necessary and so-called sufficient conditions: not only must all instances (necessarily) abide by the restriction, but it is sufficient that if any individual (such asx
ory
) meet the restrictions, that they are also members. It is this sufficient condition which the reasoner uses to infer thatx : Cold
andy : Hot
.A link to the full example ontology is here. Try loading it into Protege and classify it using the Pellet reasoner plugin.
Note that I tried classifying this ontology with HermiT and FaCT++ which otherwise failed to produce the inferences, throwing exceptions, indicating they do not support such datatype reasoning.