No module named pymedtermino2 and destroy RDF triples

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

Re: No module named pymedtermino2 and destroy RDF triples

Hamico
This post was updated on .
Hi Jiba,
I have seen the delete sparql query and on PyCharm I have the error "NameError: name 'self' is not defined" when I write "world = self.new_world()". On the word "self" there is "unresolved reference self".

I have solved the error with the creation of a class and of constructor self but I have another error:
AttributeError: 'cat' object has no attribute 'new_world'
where cat is a class

How can I do?


I hope I don't bother.
Many thanks.
Hamico
Reply | Threaded
Open this post in threaded view
|

Re: No module named pymedtermino2 and destroy RDF triples

Jiba
Administrator
In reply to this post by Hamico
Hi,

I finally found the initial problem. Python 3.6 has non-seekable Zip file, while Python 3.7 has seekable Zip file, and loading the UMLS data from Zip files (without unzipping) requires seekable files. I suppose you are using Python 3.6 ?

Could you try with Python 3.7, and pass to import_umls() the Zip file (not the directory)?

After importing, the quadstore can be used with Python 3.6 if you really need to : 3.7 is only required for importing.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: No module named pymedtermino2 and destroy RDF triples

Jiba
Administrator
In reply to this post by Hamico
Hi,

new_world() is a method that I have defined in regtest.py for testing purpose; it should not ne used outside tests (and actually is not vailable outside regtest.py).

If you want to create a new world, just use World().

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: No module named pymedtermino2

Hamico
This post was updated on .
In reply to this post by Jiba
Hi Jiba,
I have tried to use the script on python 3.7  . It loads a minute and then there is an error:

* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
Importing UMLS from Zip file 2018AB-full/2018ab-1-meta.nlm...
  Parsing 2018AB/META/MRRANK.RRF.gz as MRRANK...
  Parsing 2018AB/META/MRCONSO.RRF.aa.gz as MRCONSO...
Traceback (most recent call last):
  File "Script5.py", line 5, in <module>
    import_umls("umls-2018AB-full.zip", terminologies = ["ICD10", "SNOMEDCT_US", "CUI"])
  File "C:\Users\developer\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2-0.17-py3.7.egg\owlready2\pymedtermino2\umls.py", line 678, in import_umls
    remnants[table_name])
  File "C:\Users\developer\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2-0.17-py3.7.egg\owlready2\pymedtermino2\umls.py", line 79, in parse_mrconso
    for line in f:
  File "C:\Users\developer\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5439: character maps to <undefined>


How can I do?
Many thanks.
Best regards,
Hamico
Reply | Threaded
Open this post in threaded view
|

Re: Destroy RDF triples

Hamico
This post was updated on .
In reply to this post by Jiba
Hi Jiba,
The delete sparql query with default_world works.

Many thank.
Best regards,
Hamico
12