Unable to load saved UMLS PYM ontology - could use only once after import

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

Unable to load saved UMLS PYM ontology - could use only once after import

Alex Mikhalev
Hello all,
I am trying to import UMLS ontology as defined in doc:
```
from owlready2 import *
from owlready2.pymedtermino2 import *
from owlready2.pymedtermino2.umls import *

default_world.set_backend(filename = "pym.sqlite3")
PYM = get_ontology("http://PYM/").load()
CUI = PYM["CUI"]
concept = CUI["C0085580"]
print(concept.name)
print(concept.label)
```
while pym.sqlite3 exists and populated it doesn't load and script fails with

```
python test_onto_import.py
* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
Traceback (most recent call last):
  File "test_onto_import.py", line 8, in <module>
    concept = CUI["C0085580"]
TypeError: 'NoneType' object is not subscriptable
```
I only managed to run it once after load.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to load saved UMLS PYM ontology - could use only once after import

Jiba
Administrator
Hi,

I tested your code, and it works with my pym.sqlite3.

Could you try the following line of code :

print(PYM, PYM.__class__)

just after creating PYM, and send me the result?

Are you sure you imported CUI from UMLS (by including "CUI" in the terminologies arg)?

Jiba