MakePrimitiveSubClassesMutuallyDisjoint 不起作用
MakePrimitiveSubClassesMutuallyDisjoint doesn't work
我想使用 MakePrimitiveSubClassesMutuallyDisjoint
使 class 的所有子 class 不相交。但是用我的代码这不会发生:
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);
我没能找到它如何使用的例子,我不确定我是否遗漏了 manager
的步骤(比如 addAxiom
但是为了这个)。
我无法在方法内部进行调试,但我通过调用此方法检查了递归后是否设置了子classes:
ontology.getSubClassAxiomsForSuperClass(owlClass).size();
结果是预期的。
但是,我仍然没有在结果 ontology 中看到任何说明 class 不相交的内容。
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);
我想使用 MakePrimitiveSubClassesMutuallyDisjoint
使 class 的所有子 class 不相交。但是用我的代码这不会发生:
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);
我没能找到它如何使用的例子,我不确定我是否遗漏了 manager
的步骤(比如 addAxiom
但是为了这个)。
我无法在方法内部进行调试,但我通过调用此方法检查了递归后是否设置了子classes:
ontology.getSubClassAxiomsForSuperClass(owlClass).size();
结果是预期的。
但是,我仍然没有在结果 ontology 中看到任何说明 class 不相交的内容。
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);