Search code examples
ontologysemantic-webprotege

How would you model that a potential relationship exists between two classes, but doesn't always?


I want to model that something may be, but is not guaranteed, to be true. For example, a house may have a garage, but not necessarily. And a garage may be part of a house, but not necessarily.

If I add as an axiom "has_part some 'garage'" to my 'house' class, I'm claiming that all houses have garages, which isn't always true. Similarly, I can't add "partOf" to my garage class for the same reaosn.

What would be the ideal way to model this relationship?

I've tinkered with declaring that the class 'house' "has_part some 'garage' min 0" in order to use cardinality to set the minimum bound to zero, but I'm not sure that's correct.


Solution

  • In that case you you can think of the class House consisting of two different classes: (1) the class of houses that do not have garages and (2) the class of houses that do have garages.

    You could do this in Manchester syntax as follows:

     Class: ClassWithoutGarage
        SubClassOf: hasGarage max 0 Thing //has no garage
    
     Class: ClassWithGarage
        SubClassOf: hasGarage min 1 Thing
        DisjointWith: ClassWithoutGarage //has at least 1 garage
    
     ObjectProperty: hasGarage
        Domain: ClassWithGarage
        Range: Garage
    
     Class: House 
       EquivalentTo: ClassWithGarage or ClasWithoutGarage
    

    In this case we have given explicit names to these 2 possible classes. Often in ontologies, the existence of these classes can be implied without explicitly naming them:

    Class: House
       EquivalentTo: hasGarage max 0 Thing 
                     or  
                     hasGarage min 1 Thing
    

    which can be stated more concisely with

    Class: House
        EquivalentTo: hasGarage only Garage
    

    hasGarage only Garage defines the class of individuals consisting of those individuals x such that when individual y is linked via hasGarage to individual x, then y is of type Garage, or those individuals x that has no link via hasGarage.