I am building a smart home ontology. I now have a class hierarchy like that:
I
Hatim's answer may work for you, but I think it might be better not to use equivalent class axioms when you don't have to, and to avoid tying Mild Status to particular temperatures and humidities. After all, what it means for a Room to have a mild status is very different for what it means for a Sauna to have a mild status.
I'd recommend using a General Class Axiom to say that:
If a Room has a temperature and a humidity within the specified ranges, then the Room has a mild status.
As a class axiom, that's:
Room and (hasTemperature some integer[≥18,≤22]) and (hasHumidity some integer[≥40,≤50]) subClassOf (hasStatus value Mild_Status)
That's almost exactly what you can write in Protege:
Here's the ontology (in RDF/XML and in TTL) with that axiom:
@prefix : .
@prefix rdfs: .
@prefix owl: .
@prefix xsd: .
@prefix rdf: .
: a owl:Ontology .
:Room a owl:Class .
:Status a owl:Class .
:Mild_Status a owl:NamedIndividual , :Status .
:hasStatus a owl:ObjectProperty .
:hasTemperature a owl:DatatypeProperty .
:hasHumidity a owl:DatatypeProperty .
[ a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:hasValue :Mild_Status ;
owl:onProperty :hasStatus
] ;
owl:intersectionOf ( :Room _:b2 _:b3 )
] .
_:b3 a owl:Restriction ;
owl:onProperty :hasTemperature ;
owl:someValuesFrom [ a rdfs:Datatype ;
owl:onDatatype xsd:integer ;
owl:withRestrictions ( _:b0 _:b4 )
] .
_:b0 xsd:minInclusive 18 .
_:b4 xsd:maxInclusive 22 .
_:b2 a owl:Restriction ;
owl:onProperty :hasHumidity ;
owl:someValuesFrom [ a rdfs:Datatype ;
owl:onDatatype xsd:integer ;
owl:withRestrictions ( _:b5 _:b1 )
] .
_:b1 xsd:minInclusive 40 .
_:b5 xsd:maxInclusive 50 .
50
40
18
22