I am trying to model the following situation:
- A degree may be Bachelor or Master
- A student may be BachelorStudent or MasterStudent
- A degree may have students: Bachelor degrees only have BachelorStudents and viceversa.
I want to experiment with the usage of the "only" restriction, therefore I have defined Bachelor, for example, as equivalent to "has only BachelorStudent". Therefore, I generated the following code using Protegé:
:has rdf:type owl:ObjectProperty ;
rdfs:domain :Degree ;
rdfs:range :Student .
:Bachelor rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Restriction ;
owl:onProperty :has ;
owl:allValuesFrom :BachelorStudent
] ;
rdfs:subClassOf :Degree ;
owl:disjointWith :Master .
:BachelorStudent rdf:type owl:Class ;
rdfs:subClassOf :Student ;
owl:disjointWith :MasterStudent .
:Degree rdf:type owl:Class ;
owl:disjointWith :Student ;
owl:disjointUnionOf ( :Bachelor
:Master
) .
:Master rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Restriction ;
owl:onProperty :has ;
owl:allValuesFrom :MasterStudent
] ;
rdfs:subClassOf :Degree .
:MasterStudent rdf:type owl:Class ;
rdfs:subClassOf :Student .
:Student rdf:type owl:Class ;
owl:disjointUnionOf ( :BachelorStudent
:MasterStudent
) .
However, this leads to an inconsistency when I launch the reasoner. The provided explanation is the following:
I cannot figure out what I am doing wrong. Am I misunderstanding the use of "only", or are there any other mistakes?
The problem is the following: with the axiom:
it follows that things that do not have the
hasproperty are classified as Master (has only MasterStudentcontains the things that do not have thehasproperty at all). If this sounds strange, think of the classhasChild only Person. This class identifies the things such that, if they have children, then the children are people. Clearly, people belong to this class, even if they do not have children.The same is true for
Bachelor. So, if a thing does not have thehasproperty, it must belong to bothBachelorandMaster. But if such a thing existed, then it would violate the disjointness relation betweenBachelorandMaster. So we must conclude that everything has thehasproperty. This means that everything is aDegree(because of the domain ofhas) and is related to aStudent(because of the range ofhas). So there exists students, and since everything is aDegree, these students are degrees, which violates the disjointness betweenStudentandDegree.Now, the problem with your model is that you use an equivalence axiom. You should instead use a subclass relation, and add that all degrees must have the
hasrelation with at least some students, like this:or even, if you want it more constrained: