为什么OWLReasoner.getSubclasses(...)返回http://www.w3.org/2002/07/owl#Nothing?

时间:2016-12-30 13:18:20

标签: owl ontology owl-api

这是我的本体子类请求的一部分,使用JAVA-7和owlapi库:

>>> o = "the doG jUmPeD ovEr The MOOn"

# Python 2
>>> filter(str.isupper, o)
'GUPDETMOO'

# Python 3
>>> ''.join(filter(str.isupper, o))
'GUPDETMOO'

这是我的问题:

为什么OWLReasoner.getSubClasses(...)方法返回的子类包含myClazz的所有子类,但是总是还要添加带有import org.semanticweb.owlapi.reasoner.OWLReasoner; import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; import org.semanticweb.owlapi.reasoner.ConsoleProgressMonitor; import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration; ... ... OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory(); ConsoleProgressMonitor progressMonitor = new ConsoleProgressMonitor(); OWLReasonerConfiguration config = new SimpleConfiguration(myconfiguration); OWLReasoner reasoner = reasonerFactory.createReasoner(myontology, config); Set<OWLClass> subclasses = reasoner.getSubClasses(myClazz, true).getFlattened(); 的OWLClass?我已经定义了这个课程。

提前致谢。

1 个答案:

答案 0 :(得分:4)

owl:Nothing是定义为OWL中所有类的子类的类,因此它作为所有可满足类的子类包含在内(它等同于所有不可满足的类)。

要在迭代期间跳过它,Node有一个getEntitiesMinusBottom()方法会跳过owl:Nothing

在w3.org owl语义中,您可以找到有关owl:Nothing课程的更多信息:https://www.w3.org/TR/2004/REC-owl-semantics-20040210/#owl_Nothing