use of org.apache.jena.ontology.OntClass in project jena by apache.
the class ClassHierarchy method showClass.
// Internal implementation methods
// ////////////////////////////////
/**
* Present a class, then recurse down to the sub-classes.
* Use occurs check to prevent getting stuck in a loop
*/
protected void showClass(PrintStream out, OntClass cls, List<OntClass> occurs, int depth) {
renderClassDescription(out, cls, depth);
out.println();
// recurse to the next level down
if (cls.canAs(OntClass.class) && !occurs.contains(cls)) {
for (Iterator<OntClass> i = cls.listSubClasses(true); i.hasNext(); ) {
OntClass sub = i.next();
// we push this expression on the occurs list before we recurse
occurs.add(cls);
showClass(out, sub, occurs, depth + 1);
occurs.remove(cls);
}
}
}
Aggregations