Using OWlready2 in realtime

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

Using OWlready2 in realtime

Taha
Hi Jiba, I'm using owlready2 in the callback functions, that means that this function can be executed every 1 sec.

So, in this function i loaded the ontology then run the pellet reasoner to get some inferred entities, it works well,
but if any update occurred to the ontology during the execution, ex, adding more individuals,  i can't see the updates i made.

So any help?

Thanks in advance,
Taha
Reply | Threaded
Open this post in threaded view
|

Re: Using OWlready2 in realtime

Cosmin
Are the individuals added in the owl file?

Owlready2 loads an owl file only one time from the disk and keeps it in memory.
When trying to load the same owl file again it will see it's already in memory and and just return it from there.
That's why you don't see any new modification that were made in the owl file on disk.
You can check how to avoid that here: https://owlready2.readthedocs.io/en/latest/world.html

Hope this helps!
Reply | Threaded
Open this post in threaded view
|

Re: Using OWlready2 in realtime

Taha
Thanks cosmin, Thats exactly what i was looking for

working with worlds reload the ontology each time i call it inside the callback function.

One more question, does it cost extra memory?
Reply | Threaded
Open this post in threaded view
|

Re: Using OWlready2 in realtime

Jiba
Administrator
Hi,

It can cost extra memory if you keep the previous worlds in memory. If you don't, they will be destroyed from memory by Python, and it will not cost extra memory.

By default, Owlready does not maintain worlds in memory, so if you don't do it from your side, it will be ok.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Using OWlready2 in realtime

Taha
Thanks Jiba