Search code examples
owlprotege

How to represent relation 'grandfather' in OWL?


1. Alex is Beck's father.
2. Beck is Carl's father.

Based on 1 and 2, we can infer:

3. Alex is Carl's grandfather.

For an OWL implementation, I set three OWL Classes and one Object Property that named 'isFatherOf' on Protege. How can I get the result of 3 as the consequence of inference of Reasoner?

<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#isFatherOf -->

<owl:ObjectProperty rdf:about="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#isFatherOf"/>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Alex -->

<owl:Class rdf:about="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Alex">
    <owl:equivalentClass>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#isFatherOf"/>
            <owl:someValuesFrom rdf:resource="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Beck"/>
        </owl:Restriction>
    </owl:equivalentClass>
</owl:Class>



<!-- http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Beck -->

<owl:Class rdf:about="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Beck">
    <owl:equivalentClass>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#isFatherOf"/>
            <owl:someValuesFrom rdf:resource="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Carl"/>
        </owl:Restriction>
    </owl:equivalentClass>
</owl:Class>



<!-- http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Carl -->

<owl:Class rdf:about="http://www.semanticweb.org/administrator/ontologies/2016/0/untitled-ontology-3#Carl"/>


Solution

  • The scenario that you have mentioned is easily achievable by using property chains, actually this link has fully explained the same scenario. But for short, you need to create 3 individuals (Carl, Alex, and Beck), and then assign the isFatherOf property to each of these individuals. Thus:

    onto:Alex rdf:type onto:Person ,
                   owl:NamedIndividual ;
          onto:isFatherOf onto:Beck .
    
    onto:Beck rdf:type onto:Person ,
                   owl:NamedIndividual ;
          onto:isFatherOf onto:Carl .
    
    onto:Carl rdf:type onto:Person ,
                   owl:NamedIndividual .
    

    The next important thing is to create a property isGrandFatherOf mentioning that is a chain of two isFatherOf:

    onto:isGrandFatherOf rdf:type owl:ObjectProperty ;             
                     owl:propertyChainAxiom ( onto:isFatherOf
                                              onto:isFatherOf) .
    

    Now it is able to infer that: enter image description here

    For a bit of clarity, I have added the inverse of isFatherOf to this example as well, so that the reasoner at each stage will tell you who is the father of whom:

    onto:hasFather rdf:type owl:ObjectProperty ;
               owl:inverseOf onto:isFatherOf .
    

    But do read the link about, it is very well explained.