help with recovering world from sqlite backend

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

help with recovering world from sqlite backend

isb0459
I want to start up a python process, import owlready2, and recover the default_world that was explicitly  saved when I closed my previous python session. I am assuming in the recovered world object I can access my ontology object. I'd like explicit instructions please. Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: help with recovering world from sqlite backend

Jiba
Administrator
Hi,

You need to define the SQLite file at the beginning of your program, as follows:

default_world.set_backend(filename = "your_file.sqlite3")

Then, you can save the current state with:

default_world.save()


To recover the state previously saved, just call again the default_world.set_backend(...) lines.
Then, you can get your ontologies as usual :

onto  = get_ontology("http://server.org/ontology_name.owl").load()

If already present in the quadstore, the ontology will be loaded from the quadstore, not from the IRI.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: help with recovering world from sqlite backend

isb0459
Hi. Should the recovery work as well with the URI of an RDF file? Thank you.
Regards,
  Ian

On Fri, Oct 30, 2020 at 12:14 PM Jiba [via Owlready] <[hidden email]> wrote:
Hi,

You need to define the SQLite file at the beginning of your program, as follows:

default_world.set_backend(filename = "your_file.sqlite3")

Then, you can save the current state with:

default_world.save()


To recover the state previously saved, just call again the default_world.set_backend(...) lines.
Then, you can get your ontologies as usual :

onto  = get_ontology("http://server.org/ontology_name.owl").load()

If already present in the quadstore, the ontology will be loaded from the quadstore, not from the IRI.

Jiba



If you reply to this email, your message will be added to the discussion below:
http://owlready.8326.n8.nabble.com/help-with-recovering-world-from-sqlite-backend-tp2075p2078.html
To unsubscribe from help with recovering world from sqlite backend, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: help with recovering world from sqlite backend

Jiba
Administrator
Hi,

The quadstore file used in set_backend() must be a SQLite3 file, either a new file or a file created previously with Owlready. You cannot use directly an IRI or an OWL or RDF file; you need to import the file previously in Owlready to create a valid quadstore.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: help with recovering world from sqlite backend

isb0459
You just said up above in your reply:
onto  = get_ontology("http://server.org/ontology_name.owl").load()
If already present in the quadstore, the ontology will be loaded from the quadstore, not from the IRI.

So, I'm just asking if it works the same with a URI ending ".rdf" instead of ".owl" ?
-- Ian


On Mon, Nov 2, 2020 at 4:34 AM Jiba [via Owlready] <[hidden email]> wrote:
Hi,

The quadstore file used in set_backend() must be a SQLite3 file, either a new file or a file created previously with Owlready. You cannot use directly an IRI or an OWL or RDF file; you need to import the file previously in Owlready to create a valid quadstore.

Jiba


If you reply to this email, your message will be added to the discussion below:
http://owlready.8326.n8.nabble.com/help-with-recovering-world-from-sqlite-backend-tp2075p2087.html
To unsubscribe from help with recovering world from sqlite backend, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: help with recovering world from sqlite backend

Jiba
Administrator
Yes, it will work with .rdf files, as long as they are in OWL/RDF format (e.g. not turtle).

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: help with recovering world from sqlite backend

isb0459
Thanks very much.
  -- Ian