问题
I am building an Ontology.
I have a Class called Vehicle
I have an Object Property called hasType
I have a Class called VehicleTypes
How can I force all the instances from Vehicle
class to have one and just one instance of VehicleTypes
What I have tried
I am working on Protege.
I made the
hasType
as a functional property.I added an
Equivalent To
which is like this: hasType exactly 1 VehicleTypes
Is that enough please?
回答1:
Making hasType
functional is the right move since every Vehicle
can only have one VehicleType
. However, you need to describe Vehicle hasType exactly 1 VehicleType
as a subClassOf
relation rather than equivalentTo
relation.
Definition of subclass relation:
if the class description C1 is defined as a subclass of class description C2, then the set of individuals in the class extension of C1 should be a subset of the set of individuals in the class extension of C2.
Definition of equivalent relation:
links a class description to another class description. The meaning of such a class axiom is that the two class descriptions involved have the same class extension (i.e., both class extensions contain exactly the same set of individuals).
回答2:
The following axiom is sufficient to guarantee that all the instances from the Vehicle
class have one and just one instance of VehicleTypes
(in Manchester syntax):
Class: Vehicle
SubClassOf: hasType exactly 1 VehicleType
This, in fact, is the minimal ontology that guarantees it. If you do not need to be minimal, you can also enforce it with the following:
ObjectProperty: hasType
Characteristics: Functional
Class: Vehicle
SubClassOf: hasType some VehicleType
This can be useful if you use a reasoner that does not support cardinality restrictions, for instance.
回答3:
Don't create your own vehicleType property and VehicleType class, just use rdf:Type
and rdfs:subClassOf
:
:Car rdfs:subClassOf :Vehicle.
:Boat rdfs:subClassOf :Vehicle.
Then if you want to say that certain classes are disjunctive, use:
:Car owl:disjointWith :Boat.
来源:https://stackoverflow.com/questions/29462344/owl-how-to-force-all-the-instances-of-a-specific-class-to-have-a-specific-relati