pwin / owlready2

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

"AttributeError: 'SubGraph' object has no attribute 'create_parse_func'" when installing PyMedTermino2 #39

Closed Szlemens0 closed 1 year ago

Szlemens0 commented 1 year ago

When following the installation guide for PyMedTermino2 (https://owlready2.readthedocs.io/en/latest/pymedtermino2.html), Python gives me the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 1
----> 1 import_umls("umls-2022AB-metathesaurus-full.zip", terminologies=["ICD10", "SNOMEDCT_US"])

File /opt/conda/lib/python3.10/site-packages/owlready2/pymedtermino2/umls.py:647, in import_umls(umls_zip_filename, terminologies, langs, fts_index, extract_groups, extract_attributes, extract_relations, extract_definitions, remove_suppressed)
    643 default_world.save()
    645 #default_world.graph.set_indexed(False)
--> 647 importer = _Importer(PYM, terminologies, langs, extract_groups, extract_attributes, extract_relations, extract_definitions, remove_suppressed)
    649 parsers = [
    650   ("MRRANK",  parse_mrrank),
    651   ("MRCONSO", parse_mrconso),
    652 ]
    653 if extract_definitions: parsers.append(("MRDEF", parse_mrdef))

File /opt/conda/lib/python3.10/site-packages/owlready2/pymedtermino2/umls.py:531, in _Importer.__init__(self, PYM, terminologies, langs, extract_groups, extract_attributes, extract_relations, extract_definitions, remove_suppressed)
    528 self.indirect_props = Counter()
    529 self.direct_props   = Counter()
--> 531 self.objs, self.datas, self.on_prepare_obj, self.on_prepare_data, self.insert_objs, self.insert_datas, self.new_blank_node, self._abbreviate, self.on_finish = PYM.graph.create_parse_func(delete_existing_triples = False)
    533 if self.extract_cui:
    534   self.CUI = self._abbreviate("http://pym/SRC/CUI")

AttributeError: 'SubGraph' object has no attribute 'create_parse_func'

I am using owlready2-0.41, Python 3.10.8 and the umls-2022AB-metathesaurus-full.zip UMLS data.

Szlemens0 commented 1 year ago

Downgrading to owlready2-0.40 fixed the problem.