Refreshing a pre-loaded ontology

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Refreshing a pre-loaded ontology

TugGoat
I am trying to use the ontology to transfer data between simultaneous python processes, however if I update the ontology from process y, then process x does not recognise these changes, (I am deleting the ontology object and calling the load() function again)

Process y <---> Ontology <---> Process x

Any advice on this?
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing a pre-loaded ontology

Jiba
Administrator
Owlready2 uses a cache for loaded ontologies, so calling load() multiple times actually do not reload the ontology.

For reloading, I think you can use Worlds: the ontology cache is located in the World class, so creating a new World and then loading the ontology will reload it, for example :

world = World()
onto = world.get_ontology("http://IRI").load()

However, the objects and classes generated from the reloaded ontology will not be the same as those generated from the previously loaded one.