|
Hi,
I am using owlready2 to process my ontology(loaded in.owl format) in python. I am facing a few difficulties as discussed below.
1. I want to get my class labels in the ontology as string. When I used onto.class() and after changing the rendering of entities, it returns the output as a class 'owlready2.entity.ThingClass', however, I am interested in getting output as a string type. Is there any way to access the labels as a string or a way to convert this to a string so that I can use it for my desired task which need string variable.
2. I know that we can access the class by onto.class and subclasses by onto.class.ancestors() or by onto.class.subclasses(), but for that, I need to know the class label. But in my case I just know the level of the hierarchy, for example, I want to know the class labels of classes at level 6 of hierarchy or last level or any other level. Can I do this using owlready2. I mean is there any method of indexing through which I can directly get access to a specific level of hierarchy/ontology.
3. Also, is there any way to print the hierarchy of classes since the list(onto.classes()) prints only the complete list of classes in ontology and ignores the hierarchy or hierarchical relationships between them.
I am using Owlready2 for the first time. Any kind of help is highly appreciated.
|