owlontologyprotege

OWL negate object property


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

Duck 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:

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:


Solution

  • There are 2 issues with your ontology:

    1. 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
      
    2. 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)
    

    Desired inference