Search code examples
rdfowlontologyinferencerdfs

How to describe an ontology to infer wheather two individuals are the same or not


I would like to infer wheather two individuals are the same or not. I show you three cases. In the first case I described an ontology to get the result of inference which means “If two individuals have the same value of a property then two individuals are the same”. A description of the case is below.

Person rdf:type owl:Class .
ID rdf:type owl:Class .
hasID rdf:type owl:ObjectProperty ,
               owl:InverseFunctionalProperty .
person1 rdf:type owl:NamedIndividual ,
                 Person ;
        hasID id1 .
person2 rdf:type owl:NamedIndividual ,
                 Person;
        hasID id1 .
id1 rdf:type owl:NamedIndividual ,
             ID .

The result of inference is “person1 owl: sameAs person2”, because person1 and person2 have the same value of hasID which is id1. The key point to get an expected result is what I described hasID as owl:InverseFunctionalProperty. It's not problem.

In the second case two individual have the same two properties. One property is hasName. The another is mailTo. I would like to get the result of inference which means “If two individuals have the same value of hasName and the same value of mailTo then two individuals are the same”. However I don’t know how to describe an ontology. How do I describe about it?

The third case is more complicated. How do I describe "the same value of hasID or the conjunction that means "the same value of hasName and the same value of mailTo" on ontology?


Solution

  • An answer of the third case is below.

    #  Data properties
    
    hasID rdf:type owl:DatatypeProperty .
    hasName rdf:type owl:DatatypeProperty .
    mailTo rdf:type owl:DatatypeProperty .
    
    #  Class
    Person rdf:type owl:Class ;
           owl:hasKey ( hasID
                      ) ,
                      ( hasName
                        mailTo
                      ) .
    
    #  Individuals
    person1 rdf:type owl:NamedIndividual ,
                     Person ;
            hasID 12 ;
            hasName "Donald" ;
            mailTo "[email protected]" .
    person2 rdf:type owl:NamedIndividual ,
                     Person ;
            hasID 12 ;
            hasName "Don" ;
            mailTo "[email protected]" .
    person3 rdf:type owl:NamedIndividual ,
                     Person ;
            hasID 34 ;
            hasName "Bill" ;
            mailTo "[email protected]" .
    person4 rdf:type owl:NamedIndividual ,
                     Person ;
            hasID 56 ;
            hasName "Bill" ;
            mailTo "[email protected]" .
    person5 rdf:type owl:NamedIndividual ,
                     Person ;
            hasID 78 ;
            hasName "Don" ;
            mailTo "[email protected]" .
    person6 rdf:type owl:NamedIndividual ,
                     Person ;
            hasID 90 ;
            hasName "Barack" ;
            mailTo "[email protected]" .
    

    Look at "owl:hasKey" in class expression above. Properties in a couple of parenthesis are components of a key. Therefore owl:hasKey (hasName mailTo) means "hasName and mailTo". A couple of parenthesis means independent key. Specifically,"hasID" and "hasName and mailTo" independently work as key. It means "or". I tried the code above, using Pellet on Protege5.5.0 and could get an expected result.Specifically, person1,person2 and person5 are the same, person3 and person4 are the same, and person6 does not have any same individual.