使用 OWL API 获取 ontology 中的人数

Getting the number of individuals in ontology with OWL API

我怎样才能得到 ontology 中的人数,而不管他们属于 类 或 sub类,只能使用 OWL API(不是 SPARQL 或其他工具)。 我正在尝试这个:

NodeSet<OWLNamedIndividual> inds = reasoner.getInstances(subClass, false);
int numofInd = inds.getNodes().size();

其中 subClassThing 的子类。但是我怎么能得到 ontology.

中的总人数呢?

OWLOntology::getIndividualsInSignature(boolean includeImportsClosure)returns所有个人包括进口关闭,见Javadocs