pwin / owlready2

GNU Lesser General Public License v3.0
140 stars 23 forks source link

Cannot reload Pymedtermino2 Quadstore Non-Exclusively #9

Open davis-white opened 3 years ago

davis-white commented 3 years ago

Hello, I am working on a project where several processes need to use the Pymedtermino2 submodule concurrently and am having issues on both reloading the quadstore after the initial importation, and also non-exclusively accessing the reloaded quadstore.

When working with the first importation using the following code, everything works perfectly and I can access the database from multiple processes concurrently.

default_world.set_backend(filename = "pym.sqlite3", exclusive=False)
import_umls(umls_path, terminologies = ["ICD10", "SNOMEDCT_US", "CUI"])
default_world.save()
PYM = get_ontology("http://PYM/").load()

My problems start to arise when I am trying to reload the data from the quadstore saved in pym.sqlite3. If I am starting fresh and just imported everything, the following code can be run multiple times from different processes.

if not os.path.exists('pym.sqlite3'): try: default_world.set_backend(filename = "pym.sqlite3", exclusive=False) PYM = get_ontology("http://PYM/").load() default_world.save() except: PYM = World(filename= 'pym.sqlite3', exclusive=False).get_ontology('http://PYM").load()

The try block is placed there since upon the second time calling set_backend in a session, I recieve a ValueError: Cannot save existent quadstore in 'pym.sqlite3': File already exists! Use a new filename for saving quadstore or, for opening an already existent quadstore, do not create any triple before calling set_backend().

Additionally, I am getting many variations on OperationalError: database is locked whenever I try to access the database repeatedly.

Is there any guidance on what I am doing wrong or are there any possible bugs? Thanks for the help.

pseudomonas commented 3 years ago

I'm having the same issue. But this is apparently not the github repository of the package maintainer. The package mailing list is http://owlready.8326.n8.nabble.com but that's broken. https://bitbucket.org/jibalamy/owlready2/src/master/ is the primary package repository

ETA: aha, the forum URL has been updated on Bitbucket to http://owlready.306.s1.nabble.com (this has not yet propagated to readthedocs etc)

pseudomonas commented 3 years ago

Did you find any workaround for this issue?

pwin commented 3 years ago

Yes, this is just a fork of the original repo

On Mon, 30 Aug 2021 at 14:42, pseudomonas @.***> wrote:

I'm having the same issue. But this is apparently not the github repository of the package maintainer. The package mailing list is http://owlready.8326.n8.nabble.com but that's broken. https://bitbucket.org/jibalamy/owlready2/src/master/ is the primary package repository

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pwin/owlready2/issues/9#issuecomment-908353535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIFYTBSA3DMH274PRXEZSLT7ODCRANCNFSM475PWW6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.