要检查资源是否是类等,我可以这样做:
OntModel onto = onto.getOntology();
if (onto.getOntResource(s).isClass())
OntClass c = onto.getOntResource(s).asClass();
if (onto.getOntResource(s).isProperty()) {
OntProperty prop = onto.getOntResource(s).asProperty();
if (onto.getOntResource(s).isIndividual())
但是,如果我使用相同的本体创建推理模型如下:
InfModel InfOnto = ModelFactory.createInfModel(reasoner, onto1.getOntology());
如上所述的课程,财产和个人检查?
例如,InfOnto没有方法来检查资源是否是类,还是将资源转换为类