pwin/owlready2

ontology import: classes of imported ontologies do not appear in target ontology class list

markdoerr opened this issue · 2 comments

When importing an additional

onto = get_ontology("my_ontology.owl").load()
list(onto.classes())
... classes of onto are listed
# check imported ontologies - should be empty
onto.imported_ontologies
>> []  

another_onto = get_ontology("my_other_ontology.owl").load()
list(onto.classes())
... classes of another_onto are listed

onto.imported_ontologies.append(another_onto)
# checking ontology import
onto.imported_ontologies
>>[get_ontology("my_other_ontology")]

list(onto.classes())
... still only classes of onto appear, but not of another_onto

Intuitive behavior would be: here all classes should appear.

I have the same question with you. And I have no idea how to solve it

I think the issue with the above may be that onto and another_onto have different namespaces, and because of the different namespaces they classes cannot be placed into the same ontology. I.e. if list(onto.classes()) is [namespace_1.class_1, namespace_1.class_2, etc], it makes sence that namespace_2.class_1, namespace_2.class_2 are not placed in the same list.

But then what is the supposed function of onto.imported_ontologies.append(another_onto)?