I have 2 ontologies:
- Ontology 1 contains a class A with property has_title and the individual 'a' 'has_title' 'title1'.
- Ontology 2 (with different base IRI) contains class B with property has_title and individual 'b' 'has_title' 'title2'.
If I load Ontology1 and then print the individual value, I get:
print(onto1.a.has_title) -> 'title1' (correct)
Now, if after loading Ontology1, I load Ontology2 (which contains a has_title property with different base IRI), I get:
Both ontologies 1 and 2 have a "has_title" property, there is thus a name clash here. Owlready uses the last loaded property. Consequently, after loading ontology 2, "onto1.a.has_title" actually refer to has_title from ontology 2 and no longer from ontology 1.
To prevent name clash, you can either :
1) use the alternate syntax "onto1.has_title[onto1.a]"
2) give a different name in Python to the properties, e.g. :