SDM-TIB / SDM-RDFizer

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

Variable 'triples_map' unassigned for JSON input #96

Closed nicolastoira closed 1 year ago

nicolastoira commented 1 year ago

Describe the bug Exception is raised when trying to convert JSON data into RDF data

To Reproduce Steps to reproduce the behavior (and resources):

  1. Execute semantify() for JSON input file

rdfizer.semantify('rdfizer_config.txt') Semantifying OutputRDFkg-D1... Traceback (most recent call last): File "", line 1, in File "/home/nicola/workspace/venv/lib/python3.8/site-packages/rdfizer/init.py", line 4467, in semantify with open(str(triples_map.data_source), "r") as input_file_descriptor: UnboundLocalError: local variable 'triples_map' referenced before assignment

Configuration file (named rdfizer_config.txt)

[default]
main_directory: /home/nicola/workspace/sphn-connector/lib

[datasets]
number_of_datasets: 1
output_folder: ${default:main_directory}/graph
all_in_one_file: yes
remove_duplicate: yes
enrichment: no
ordered: no
name: OutputRDFkg1

[dataset1]
name: OutputRDFkg-D1
mapping: ${default:main_directory}/rml_generated_mapping.ttl

Expected behavior It shouldn't break. I think the variable is named wrongly or not yet defined for that case.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

eiglesias34 commented 1 year ago

Hello @nicolastoira,

First of all, thank you for using the SDM-RDFizer. I have found the issue and fixed it. The newest version of the library is ready for download.

Thank you again, Enrique Iglesias

nicolastoira commented 1 year ago

Hi, thank you for the quick response. The issue does not appear anymore, but I got a different one. I do have some mappings which specifies a JSON Path in the data which does not exist. Meaning it's not mandatory that that key is present in the JSON data. Is it expected? Is there a ways to apply the mapping and convert only the data present in the JSON file and do not fail if no match of the JSON Path is found?

dachafra commented 1 year ago

@nicolastoira please if you have another issue, close this and open a new one