owlontologyprotegereasonerhermit

Equivalent class for transitive property


I have an object property partOf which is transitive.

And I want to say that:

And simultaneously:

For that I'm using this to say b partOf Term or Knowledge_Area then b is a Course:

:Course rdf:type owl:Class ;
        owl:equivalentClass [ rdf:type owl:Restriction ;
                              owl:onProperty :partOf ;
                              owl:someValuesFrom [ rdf:type owl:Class ;
                                                   owl:unionOf ( :Knowledge_Area
                                                                 :Term
                                                               )
                                                 ]
                            ] .

But when I run the reasoner I get all the courses listed as instances of the class Term and same for Knowledge_Area:

enter image description here

enter image description here

If I don't use the or and set that Course is equivalent only to partOf some Term or partOf some Knowledge_Area (separately and one at a time) I don't get this issue.

Is there a way I can say what I explained at the beginning and not get the courses inferred to be of type Term?

Here there is a minimal example:

@prefix : <http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27> .

<http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27> rdf:type owl:Ontology .

#################################################################
#    Object Properties
#################################################################

###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#partOf
:partOf rdf:type owl:ObjectProperty ,
                 owl:TransitiveProperty .


#################################################################
#    Classes
#################################################################

###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Course
:Course rdf:type owl:Class ;
        owl:equivalentClass [ rdf:type owl:Restriction ;
                              owl:onProperty :partOf ;
                              owl:someValuesFrom [ rdf:type owl:Class ;
                                                   owl:unionOf ( :Knowledge_Area
                                                                 :Term
                                                               )
                                                 ]
                            ] .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Knowledge_Area
:Knowledge_Area rdf:type owl:Class ;
                owl:equivalentClass [ rdf:type owl:Restriction ;
                                      owl:onProperty :partOf ;
                                      owl:someValuesFrom :Knowledge_Group
                                    ] .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Knowledge_Group
:Knowledge_Group rdf:type owl:Class ;
                 owl:disjointWith :Year .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Term
:Term rdf:type owl:Class ;
      owl:equivalentClass [ rdf:type owl:Restriction ;
                            owl:onProperty :partOf ;
                            owl:someValuesFrom :Year
                          ] .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Year
:Year rdf:type owl:Class .


#################################################################
#    Individuals
#################################################################

###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Course_1
:Course_1 rdf:type owl:NamedIndividual ;
          :partOf :Knowledge_Area_1 ,
                  :Term_1 .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Knowledge_Area_1
:Knowledge_Area_1 rdf:type owl:NamedIndividual ;
                  :partOf :Knowledge_Group_1 .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Knowledge_Group_1
:Knowledge_Group_1 rdf:type owl:NamedIndividual ,
                            :Knowledge_Group .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Term_1
:Term_1 rdf:type owl:NamedIndividual ;
        :partOf :Year_1 .


###  http://www.semanticweb.org/lucia/ontologies/2018/5/untitled-ontology-27#Year_1
:Year_1 rdf:type owl:NamedIndividual ,
                 :Year .


###  Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi

Solution

  • The semantics of transitive roles are if (x, y) \in R and (y, z) \in R then (x, z) \in R. Based on this from your ontology you have that:

    (1) Course_1 partOf Knowledge_Area_1 partOf Knowledge_Group_1 which means Course_1 partOf Knowledge_Group_1 which is equivalent to Knowledge_Area.

    (2) Course_1 partOf Term_1 partOf partOf Year_1 which means Course_1 partOf Year_1 which is equivalent to Term.

    Hence Course_1 is a Term and a Knowledge_Area and since Course is equivalent to Term or Knowledge_Area, Course_1 is also a Course, which is pretty much what an explanation says for why Course_1 is a Term.

    In my opinion the key thing to realize here is that you in actual fact are dealing with different partOf relations, not a single one. The clue to this fact is that in different contexts you want to infer different type information from your partOf relation. Type information from relations in OWL is inferred mostly from domain and range restrictions. Here is a possible solution to your problem:

    ObjectProperty: partOf
    
    ObjectProperty: partOfKA
        SubPropertyOf: partOf
        Domain: Course
    
    ObjectProperty: partOfKG
        SubPropertyOf: partOf
        Domain: Knowledge_Area
    
    ObjectProperty: partOfTerm
        SubPropertyOf: partOf
        Domain: Course
    
    ObjectProperty: partOfYear
        SubPropertyOf: partOf
        Domain: Term
    
    Class: Course
    Class: Knowledge_Area
    
    
    Class: Knowledge_Group
        DisjointWith: Year
    
    Class: Term
    
    Class: Year
        DisjointWith: Knowledge_Group
    
    Individual: Course_1
        Facts:  
         partOfKA  Knowledge_Area_1,
         partOfTerm  Term_1
    
    Individual: Knowledge_Area_1
        Facts:  partOfKG  Knowledge_Group_1
    
    Individual: Knowledge_Group_1
        Types: Knowledge_Group
    
    
    Individual: Term_1
        Facts: partOfYear  Year_1
    
    Individual: Year_1
        Types: Year
    

    Strictly speaking you do not need the partOf property in my example ontology. I merely added it for conceptual clarity. Moreover, in my example ontology there is no need for transitive properties.