SDM-TIB / SDM-RDFizer

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

AttributeError: 'tuple' object has no attribute 'keys' #21

Closed VladimirAlexiev closed 4 years ago

VladimirAlexiev commented 4 years ago
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 3337, 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 2927, in semantify_postgres
    object = "\"" + string_substitution(predicate_object_map.object_map.value, "{(.+?)}", row, "object") + "\""
  File "...SDM-RDFizer\rdfizer\rdfizer\functions.py", line 198, in string_substitution
    if match in row.keys():
AttributeError: 'tuple' object has no attribute 'keys'
VladimirAlexiev commented 4 years ago

Perhaps because of the above, a subject like this:

<https://.../resource/degree/urlify(education_degree)!subj>
        a            rr:SubjectMap ;
        rr:class     :AcademicDegree ;
        rr:template  "https://.../resource/degree/urlify{education_degree}" .

causes an unchanged URL https://.../resource/degree/urlify{education_degree} to be emitted (no template substitution).

Furthermore, { is an invalid URL char, it needs to be escaped.

eiglesias34 commented 4 years ago

I fixed the problem. Please test it out.

eiglesias34 commented 4 years ago

I just notice that a parameter was missing in the string substitution call. I just fixed it.