What is the difference between EquivalentClass and SubClass of? While reading through OWL primer, i find the tutorial uses SubClassOf a lot to declare a new class, as follows
SubClassOf(
:Teenager
DataSomeValuesFrom( :hasAge
DatatypeRestriction( xsd:integer
xsd:minExclusive "12"^^xsd:integ开发者_如何学运维er
xsd:maxInclusive "19"^^xsd:integer
)
)
)
Can I write
EquivalentClass(
:Teenager
DataSomeValuesFrom( :hasAge
DatatypeRestriction( xsd:integer
xsd:minExclusive "12"^^xsd:integer
xsd:maxInclusive "19"^^xsd:integer
)
)
)
instead?
When stating that A
is a subclass of B
, this restricts A
to necessarily inherit all characteristics of B
, but not the other way around. In your example, A
= Teenager
, and B
= hasAge [12:19]
(my own notation, but you get the idea).
This means that any instance of Teenager
in the OWL ontology must necessarily also have the property hasAge
with a value in the range [12:19]
, but not the other way around. Specifically, this does not mean that any instance of something with the property hasAge
with a value in the range [12:19]
is also an instance of Teenager
. To make this clear, consider an instance (called c
) of class Car
. We might also say that:
c . hasAge 13
This says that instance c
of Car
is 13 years old. However, with the subclass axiom defining Teenager
above, a reasoner would not infer that c
is also an instance of Teenager
(perhaps as we'd want, if teenagers are people, not cars).
The difference when using equivalence is that the subclass relationship is implied to go in both directions. So, if we were to instead include the second axiom that defined Teenager
to be equivalent to anything with the property hasAge
with a value in the range [12:19]
, then a reasoner would infer that the car c
is also an instance of Teenager
.
Equivalent classes might have the same members, e.g.,
:USPresident owl:equivalentClass :USCommanderInChief
will both have the same individuals (all or some of the US presidents). So if we assert that John Adams was a USCommanderInChief it can be inferred that John Adams was also a US President.
With subclass, we're indicating a hierarchy. e.g., GrannySmithApple is a type of Apple.
:USPresident owl:equivalentClass :USCommanderInChief .
is the same as
:USPresident rdfs:subClassOf :USCommanderInChief ;
:USCommanderInChief rdfs:subClassOf :USPresident .
精彩评论