SDM-TIB / SDM-RDFizer

An Efficient RML-Compliant Engine for Knowledge Graph Construction
https://doi.org/10.5281/zenodo.3872103
Apache License 2.0
108 stars 25 forks source link

UnboundLocalError: local variable 'rdf_type' referenced before assignment #20

Closed VladimirAlexiev closed 4 years ago

VladimirAlexiev commented 4 years ago

Thanks for fixing the bugs thus far! A new one:

$ python ../SDM-RDFizer/rdfizer/run_rdfizer.py config.ini
Semantifying...
Traceback (most recent call last):
  File "../SDM-RDFizer/rdfizer/run_rdfizer.py", line 3, in <module>
    semantify(str(sys.argv[1]))
  File "...SDM-RDFizer\rdfizer\rdfizer\semantify.py", line 3280, in semantify
    number_triple += executor.submit(semantify_postgres, row, row_headers, triples_map, triples_map_list, output_file_descriptor, wr, config[dataset_i]["name"],config[dataset_i]["user"], config[dataset_i]["password"], config[dataset_i]["db"], config[dataset_i]["host"]).result()
  File "...\Python\Python37\lib\concurrent\futures\_base.py", line 425, in result
    return self.__get_result()
  File "...\Python\Python37\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "...\Python\Python37\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "...SDM-RDFizer\rdfizer\rdfizer\semantify.py", line 2881, in semantify_postgres
    output_file_descriptor.write(rdf_type)
UnboundLocalError: local variable 'rdf_type' referenced before assignment

In addition to fixing the bug, please consider this: I assume this error doesn't happen on MySQL. But I can't imagine that rdf_type needs different handling on MySQL vs Postgres. This suggests that the code needs to be refactored into common functions, and only the specific database connection and access should be in separate functions.

eiglesias34 commented 4 years ago

I fixed the bug. Please test it out. The refactorization of the code is in our to-do list.