I have a small toy ontology in protege and I want to represent that "a duck that is only white is an AlbinoDuck"
This is my ontology
I also created the property hasColor
I have the general class axiom for NormalDuck
as Duck and (hasColor some Color) SubClassOf NormalDuck
because if it's a Duck and it has any color then it's a NormalDuck (I don't care if Albino Ducks are also considered Normal)
Then for AlbinoDuck
I have hasColor only White SubClassOf AlbinoDuck
Now, I have created two individuals:
ThisIsNormalDuck
with types Duck
, hasColor some Black
, hasColor some White
. This represents a Black and white duck.ThisIsAlbinoDuck
with types Duck
and hasColor some White
.However, when I run the Reasoner the class NormalDuck
is inferred for both individuals. What I expected was that ThisIsAlbinoDuck
would be both Normal and Albino.
I have two questions about this:
What I want to define is that AlbinoDucks
can only have a single color and it has to be white. how can I do this in protege/owl language?
What if I want to define "Something that is White and could have other colors but not brown"? (it could be White
or White and Black
)
There are 2 issues with your ontology:
hasColor only White SubClassOf AlbinoDuck
means the hasColor only White
set is a subset of the AlbinoDuck
set. Thus it is possible to have individuals that belong to the AlbinoDuck set but the hasColor only White
set. You need to use EquivalentTo
rather than SubsetOf
.
Class: AlbinoDuck
EquivalentTo:
hasColor only White
SubClassOf:
Duck
Stating that ThisIsAlbinoDuck
has type hasColor some White
says that it has the color white, but is does not exclude the possibility that it also could have other colours. To force it not have other colors you should
(a) ensure that the only colors you can have are White
, Black
and Brown
and
Class: Color
DisjointUnionOf:
Black, Brown, White
(b) state that ThisIsAlbinoDuck
does not have the colors Black
and Brown
.
Types:
Duck,
not (hasColor some (Black or Brown)),
hasColor some Color
The complete ontology looks as follows:
ObjectProperty: hasColor
Class: AlbinoDuck
EquivalentTo:
hasColor only White
SubClassOf:
Duck
Class: Black
SubClassOf:
Color
Class: Brown
SubClassOf:
Color
Class: Color
DisjointUnionOf:
Black, Brown, White
Class: Duck
DisjointUnionOf:
AlbinoDuck, NormalDuck
Class: NormalDuck
EquivalentTo:
hasColor some (Black or Brown)
SubClassOf:
Duck
Class: White
SubClassOf:
Color
Individual: albinoDuck
Types:
Duck,
not (hasColor some (Black or Brown)),
hasColor some Color
Individual: normalDuck
Types:
Duck,
(hasColor some Black)
and (hasColor some White)