Querying instances of one ontology through another.

Posted by emir on
URL: http://owlready.306.s1.nabble.com/Querying-instances-of-one-ontology-through-another-tp2492.html

Hello again!

Consider the following setting. We have two ontologies: ontology1 and ontology2; they have classes: entity1 and entity2 respectively. In entity2, we state equivalent_to = [ontology1.entity1].
We create instances only for entity1 and run sync_reasoner(). Then, we save each of the ontologies into their own file and also do world.save()

Question: Would it be possible to query instances of ontology1.entity1 by referring to ontology2.entity2?

In fact, it does retrieve instances of entity one if we run sync_reasoner() before world.sparql(query). But why doesn't it retrieve the same instances without syncing the reasoner every time before running the query? Since, I sync the reasoner before saving the world and it already must have the instances reparented.

Thank you! Let me know if the question is not clear enough!