class LocalOntology implements Ontology {

  protected static void renderHierarchy(PrintStream out, OntClass cls, List<Object> 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<?> i = cls.listSubClasses(true); i.hasNext(); ) {
        OntClass sub = (OntClass) i.next();

        // we push this expression on the occurs list before we recurse
        occurs.add(cls);
        renderHierarchy(out, sub, occurs, depth + 1);
        occurs.remove(cls);
      }
      for (Iterator<?> i = cls.listInstances(); i.hasNext(); ) {
        Individual individual = (Individual) i.next();
        renderURI(out, individual.getModel(), individual.getURI());
        out.print(" [");
        for (Iterator<?> j = individual.listLabels(null); j.hasNext(); ) {
          out.print(((Literal) j.next()).getString() + ", ");
        }
        out.print("] ");
        out.println();
      }
    }
  }

  public  LocalOntology();

}