Search code examples
owlsemantic-webprotege

OWL 2 - Assert that if not likes smth then dislikes it


I have the axiom: individual A does not like what individual B likes. Then, there are the properties, like and dislike. I want to be inferred that when someone does not like something then he dislikes it.

I have added that like and dislike are disjoint but I don't know how to go further using Protege.


Solution

  • If you do not insist on inferring object properties, there is a workaround using the covering axiom which sort of closes the world.

    Let's say we have a :Person_A and if he/she doesn't like something, then he/she dislikes it. The focus needs to be changed to the things that :Person_A likes or dislikes. They would belong to the class :ThingsThatAHasAttitudeTo.

    Properties

    First, it is important to declare a property for both liking and disliking.

    :dislikes rdf:type owl:ObjectProperty ;
              rdfs:subPropertyOf :hasAttitude ;
              owl:inverseOf :isDislikedBy .
    
    :hasAttitude rdf:type owl:ObjectProperty .
    
    :isDislikedBy rdf:type owl:ObjectProperty ;
                  rdfs:subPropertyOf :isLikedOrDislikedBy .
    
    :isLikedBy rdf:type owl:ObjectProperty ;
               rdfs:subPropertyOf :isLikedOrDislikedBy ;
               owl:inverseOf :likes .
    
    :isLikedOrDislikedBy rdf:type owl:ObjectProperty .
    
    :likes rdf:type owl:ObjectProperty ;
           rdfs:subPropertyOf :hasAttitude .
    

    Classes

    Then, if you have an enumerated class containing only the individual Person_A,

    :PersonClass_A rdf:type owl:Class ;
                   owl:equivalentClass [ rdf:type owl:Class ;
                                         owl:oneOf ( :PersonClass_A
                                                   )
                                       ] .
    

    the following restrictions would be needed, for things liked:

    :ThingsThatALikes rdf:type owl:Class ;
                      owl:equivalentClass [ owl:intersectionOf ( :ThingsThatAHasAttitudeTo
                                                                 [ rdf:type owl:Restriction ;
                                                                   owl:onProperty :isLikedBy ;
                                                                   owl:someValuesFrom :PersonClass_A
                                                                 ]
                                                               ) ;
                                            rdf:type owl:Class
                                          ] .
    

    ... and for things disliked:

    :ThingsThatADislikes rdf:type owl:Class ;
                         owl:equivalentClass [ rdf:type owl:Class ;
                                               owl:unionOf ( [ owl:intersectionOf ( :ThingsThatAHasAttitudeTo
                                                                                    [ rdf:type owl:Restriction ;
                                                                                      owl:onProperty :isDislikedBy ;
                                                                                      owl:someValuesFrom :PersonClass_A
                                                                                    ]
                                                                                  ) ;
                                                               rdf:type owl:Class
                                                             ]
                                                             [ owl:intersectionOf ( :ThingsThatAHasAttitudeTo
                                                                                    [ rdf:type owl:Restriction ;
                                                                                      owl:onProperty :isLikedOrDislikedBy ;
                                                                                      owl:someValuesFrom :PersonClass_A
                                                                                    ]
                                                                                  ) ;
                                                               rdf:type owl:Class
                                                             ]
                                                           )
                                             ] .
    

    And last, it is important to cover the class :ThingsThatAHasAttitudeTo

    :ThingsThatAHasAttitudeTo rdf:type owl:Class ;
                              rdfs:subClassOf [ rdf:type owl:Class ;
                                                owl:unionOf ( :ThingsThatADislikes
                                                              :ThingsThatALikes
                                                            )
                                              ] .
    

    The classes needs to be disjoint and the individuals different.

    With these definitions, if there are individuals that are members of the class :ThingsThatAHasAttitudeTo, for those of them that is not asserted that :Person_A likes, they will be inferred as members of the class :ThingsThatADislikes.