private static Map<OWLClass, Integer> countIndividuals(OWLOntology ontology) {
Map<OWLClass, Integer> individualCount = new HashMap<OWLClass, Integer>();
for (OWLClassAssertionAxiom axiom : ontology.getAxioms(AxiomType.CLASS_ASSERTION)) {
OWLClassExpression desc = axiom.getClassExpression();
if (!desc.isAnonymous()) {
OWLClass assertedClass = desc.asOWLClass();
Integer oldCount = individualCount.get(assertedClass);
if (oldCount == null) {
oldCount = 0;
}
individualCount.put(assertedClass, oldCount + 1);