Hello,
There are 4 ways to access a class:
1) if you created the class locally, for example with:
class MyClass(Thing):
...
Then the class is available as "MyClass" as usual in Python.
Of course, classes defined in an OWL file but not created locally in Python are not available this way.
2) if the class is available in the ontology namespace, you can access it as:
onto.ClassName
This works only is the IRI of the class is the IRI of the ontology + the class name.
If the class is defined in another namespace (as common in OBO ontologies), this would not works as expected.
3) In this case, you need a namespace:
namespace = onto.get_namespace("
http://purl.obolibrary.org/obo/")
namespace.ClassName
4) You can also get the class from its full IRI:
IRIS["
http://test.org/test.owl#MyClass"]
Best regards,
Jean-Baptiste Lamy
MCF HDR, Laboratoire LIMICS, Université Paris 13