Re: Ontology tree

Posted by Jiba on
URL: http://owlready.306.s1.nabble.com/Ontology-tree-tp1178p1182.html

Hi,

2) You can use Thing.subclasses() to get direct subclasses of Thing.

Finding classes that have NO superclass, even not Thing, is much much harder... (if a class is not declared as a class and has no instance and no subclass, how can we guess that it is a class?).

Then, the presence of children can be tested by calling subclasses() on the resulting classes.

3) use Class.is_a, .ancestors(), .subclasses() and .descendants()
The parameter include_self = False can be used to avoid returning the class itself in ancestors() and descendants().

4) get_class_properties() is what you need.

Jiba