pwin / owlready2

GNU Lesser General Public License v3.0
137 stars 22 forks source link

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

Open markdoerr opened 2 years ago

markdoerr commented 2 years ago

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.

code-gamer commented 1 year ago

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

anna-kay commented 5 months ago

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)?