I have 2 properties, e.g. 'hasColor' and 'hasFinish'. I want to express with ontology that in case of ontology class A are properties 'hasColor' and 'hasFinish' equal (owl:equivalentProperty). But in case of ontology class B the properties 'hasColor' and 'hasFinish' are NOT equal.
How can I achieve this?
One way probably is to create 'hasColor' and 'hasFinish' properties with class A as a range and set them to be equal. Then create another ones 'hasColor' and 'hasFinish' properties with class B as a range and without equal relationship. But is it right approach?
It's not entirely clear yet what you mean by making two properties un-equal. By default, two properties can be distinct, so you don't really have to do anything special to let them be unequal. If the question is clarified, though, perhaps more information can be added about that.
It's not entirely trivial to say that, e.g.,
in OWL, but you can do it. If you want to say this for all classes, you can, as you pointed out, use
owl:equivalentProperty
. Now, when you say thatp
is an equivalent property tor
, you could also say thatthat is, that each of
p
andr
are subproperties of the other. In OWL 2 (but, unfortunately, not OWL 2 DL, as Antoine Zimmermann pointed out in the comments), you can assert that a given property is a superproperty of a chain of properties, e.g.,which says that if someone has a father who has a brother, then that father's brother is that person's uncle.
There's also a concept called rolification, which has been described more in OWL 2 rolification, which is the process of creating a property corresponding to a class that relates each individual of that class to itself. For you class A, there would be a relation RA that relates each A to itself, and only relates those instances. If you then look at a property chain like
you'll notice that it's really the subproperty of hasFinish where the first argument is an A. This means that you can say that hasFinish and hasColor are the same for the class A by making two subproperty assertions:
These assume that individuals of type A are the subjects of these statements. If A is actually the range here, then you'd just use
To get the property RA, you need to add the definition
to your ontology. In Protégé, this would look like:
and the resulting ontology looks like (in RDF/XML):
and in Turtle: