traverse OWL_MEM ontology and resolve nth subclassof to the maxdepth ancestors