Map subclasses = new HashMap();
Iterator iter = classMap.keySet().iterator();
while (iter.hasNext()) {
//OntClass resource = (OntClass) iter.next();
OntResource resource = (OntResource) iter.next();
if (resource instanceof OntClass) {
//get subclasses
for (Iterator i=((OntClass)resource).listSubClasses(); i.hasNext();) {
OntResource subclass = (OntResource) i.next();
for (Iterator j=subclass.listLabels(null); j.hasNext();) {
Literal l = (Literal) j.next();
subclasses.put(l.toString(), "1");
}
}
//get individuals
for (Iterator i=((OntClass)resource).listInstances(); i.hasNext();) {
OntResource subclass = (OntResource) i.next();
for (Iterator j=subclass.listLabels(null); j.hasNext();) {
Literal l = (Literal) j.next();
subclasses.put(l.toString(), "1");
}
}
} else if (resource instanceof Individual) {
for (Iterator i=resource.listSameAs(); i.hasNext();) {
OntResource subclass = (OntResource) i.next();
for (Iterator j=subclass.listLabels(null); j.hasNext();) {
Literal l = (Literal) j.next();
subclasses.put(l.toString(), "1");
}
}
}