Reputation: 4491
I wanted to use MakePrimitiveSubClassesMutuallyDisjoint
to make all the subclasses of a class disjoint. But with my code this doesn't happen:
OWLClass owlClass = createClass(concept.getId());
// Here I recursively create the subclasses
processByLevel(skos, owlClass, concept.getNarrowerConcepts());
// But at this point all the subclass should have been created and set as subclasses
MakePrimitiveSubClassesMutuallyDisjoint primitive = new MakePrimitiveSubClassesMutuallyDisjoint(dataFactory, owlClass, ontology);
manager.saveOntology(ontology);
I haven't been able to find an example of how it is used, and I'm not sure if I'm missing a step with the manager
maybe (something like addAxiom
but for this).
I can't debug inside the method, but I checked if the subclasses where set after the recursion by calling this:
ontology.getSubClassAxiomsForSuperClass(owlClass).size();
And the result is the expected one.
But still, I don't see anything on the resulting ontology stating that the classes are disjoint.
Upvotes: 0
Views: 29
Reputation: 10659
OWLClass owlClass = createClass(concept.getId());
// Here I recursively create the subclasses
processByLevel(skos, owlClass, concept.getNarrowerConcepts());
// But at this point all the subclass should have been created and set as subclasses
MakePrimitiveSubClassesMutuallyDisjoint primitive = new MakePrimitiveSubClassesMutuallyDisjoint(dataFactory, owlClass, ontology);
// this line is necessary, it actually changes the content of the ontology
manager.applyChanges(primitive.getChanges());
manager.saveOntology(ontology);
Upvotes: 2