I have an object property partOf which is transitive.
And I want to say that:
a partOf Yearthenais aTermb partOf Termthenbis aCourse
And simultaneously:
a partOf Knowledge_Groupthenais aKnowledge_Areab partOf Knowledge_Areathenbis aCourse
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:
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


The semantics of transitive roles are if
(x, y) \in Rand(y, z) \in Rthen(x, z) \in R. Based on this from your ontology you have that:(1)
Course_1 partOf Knowledge_Area_1 partOf Knowledge_Group_1which meansCourse_1 partOf Knowledge_Group_1which is equivalent toKnowledge_Area.(2)
Course_1 partOf Term_1 partOf partOf Year_1which meansCourse_1 partOf Year_1which is equivalent toTerm.Hence
Course_1is aTermand aKnowledge_Areaand sinceCourseis equivalent toTerm or Knowledge_Area,Course_1is also aCourse, which is pretty much what an explanation says for whyCourse_1is aTerm.In my opinion the key thing to realize here is that you in actual fact are dealing with different
partOfrelations, not a single one. The clue to this fact is that in different contexts you want to infer different type information from yourpartOfrelation. Type information from relations in OWL is inferred mostly from domain and range restrictions. Here is a possible solution to your problem:Strictly speaking you do not need the
partOfproperty in my example ontology. I merely added it for conceptual clarity. Moreover, in my example ontology there is no need for transitive properties.