I have a simple ontology that consists of a Weather class and some subclasses (although I'm not sure if I should make them individuals instead) such as "Cold", "Rainy", "Sunny", etc. The thing is, I don't know which of these conditions hold until I get weather data at runtime. For instance, it is only "Cold" if the current temperature is less than, say, 70 degrees (I live in Texas ;p). Is there a way to structure the ontology so that this sort of reasoning can be done at runtime? (I am using Protege and Jena.)
Basically, I want to do different things based on which weather conditions are currently valid. For simplicity's sake, let's assume I just want to print out "It is currently cold, rainy ...", listing out the current weather conditions based on data such as temperature and amount of precipitation.
Writing the axioms in OWL
It sounds like you're trying to add some rules of the form:
You can do these in OWL without much problem with axioms like
These are called general class axioms because they have class expressions rather than atomic class names on the left hand side. The full set that I described above would be entered in Protégé as follows:
Seeing the results with Jena and Pellet
To do the reasoning about numbers, you'll need a reasoner. I'm not sure whether or not Jena's rule reasoners can do this type of reasoning or not, but I know that Pellet can. The following code uses a Pellet-backed inference model.
The output follows. Notice that in the second chunk
todaysWeather hasWeatherCondition Cold
.The ontology
You can copy and paste the content of the ontology from which I made the screenshot from the following.