[英]OWLAPI : Want to get inferred axioms from ontology using HermiT reasoner
[英]How to distinguish asserted from inferred axioms in OWLAPI?
我的目標是捕獲OWLAPI分別聲明和推斷的公理,換句話說,區別是本體中已經存在的公理與不存在但由推理者推斷的公理之間的區別。
例如:
public void printHierarchy(OWLReasoner r, OWLClass clazz, int level, Set<OWLClass> visited) throws OWLException {
//Only print satisfiable classes to skip Nothing
if (!visited.contains(clazz) && reasoner.isSatisfiable(clazz)) {
visited.add(clazz);
for (int i = 0; i < level * 4; i++) {
System.out.print(" ");
}
System.out.println(labelFor(clazz, r.getRootOntology()));
// Find the children and recurse
NodeSet<OWLClass> classes = r.getSubClasses(clazz, true);
for (OWLClass child : classes.getFlattened()) {
printHierarchy(r, child, level + 1);
}
}
}
函數getSubClasses返回OWL類的所有子類,而不區分是否在本體中提及。 我也可以執行手動檢查,但這可能會非常昂貴。 因此,我的問題如下:是否有內置函數或替代方法來捕獲與推論公理分開聲明的內容?
正如注釋中所建議的那樣,您可以創建推理結果提示的公理並檢查其是否存在於本體中。 該過程中最昂貴的部分將是公理的創建,但是復雜度仍然是線性的-推理仍可能是最大的開銷。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.