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

SDM-RDFizer crashes on XPath KeyError #99

Closed DylanVanAssche closed 1 year ago

DylanVanAssche commented 1 year ago

Describe the bug XML cannot be transformed into RDF as the SDM-RDFizer crashes on ql:XPath

Crash log:

ERROR: Traceback (most recent call last):
ERROR: File "//sdm-rdfizer/rdfizer/run_rdfizer.py", line 3, in <module>
ERROR: semantify(str(sys.argv[1]))
ERROR: Semantifying sdmrdfizer_xml...
ERROR: File "/sdm-rdfizer/rdfizer/rdfizer/semantify.py", line 4568, in semantify
ERROR: for source in order_list[source_type]:
ERROR: KeyError: 'XPath'

Note, the ERROR: is from my log handler locally, the output after : is from the SDM-RDFizer.

Mappings:

@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex: <http://example.com/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .

@base <http://example.com/base/> .

<TriplesMap1>
  a rr:TriplesMap;

  rml:logicalSource [ 
    rml:source "/data/shared/student.xml";
    rml:referenceFormulation ql:XPath;
    rml:iterator "/people/person"
  ];

  rr:subjectMap [ 
    rr:template "http://example.com/{name}" 
  ]; 

  rr:predicateObjectMap [ 
    rr:predicate foaf:name; 
    rr:objectMap [
      rml:reference "name"
    ]
  ]

Data:

<?xml version="1.0" encoding="ISO-8859-1"?>
<people>
    <person>
        <name age="21">Jefke</name>
    </person>
    <person>
        <name age="22">Maria</name>
    </person>
    <person>
        <name age="23">Jos</name>
    </person>
</people>

Same mapping & data works fine with other engines.

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

  1. Run mapping for XML
  2. Crash :)

Expected behavior XML works like JSON and CSV.

Desktop (please complete the following information):

eiglesias34 commented 1 year ago

Hi @DylanVanAssche,

Happy new year. Are you sure that the mapping you sent is the one with the issue? I just ran it (beyond the fact that it is missing the "." at the end of the triples map) and it ran with no problem. Here is the result:

<http://example.com/Jefke> <http://xmlns.com/foaf/0.1/name> "Jefke".
<http://example.com/Maria> <http://xmlns.com/foaf/0.1/name> "Maria".
<http://example.com/Jos> <http://xmlns.com/foaf/0.1/name> "Jos".

I think the issue is that I'm running a different configuration than you.

Sincerely, Enrique

eiglesias34 commented 1 year ago

Hi again,

I was able to reproduce the problem. I was running a different configuration. I found the problem and fixed it. I updated everything.

Sincerely, Enrique

DylanVanAssche commented 1 year ago

Hi @eiglesias34

Happy new year to you too! I wish I had a better present for the new year than opening another issue :)

Thanks for fixing it, will test it with the next release.

DylanVanAssche commented 1 year ago

I tried to last version 4.6.6.5 but I still have the issue. The commit addressed some line before where the issue occurs, but it seems the code is duplicated so the fixes need to be in all the duplicates?

eiglesias34 commented 1 year ago

Hi again,

Now the problem is fixed. I tested all the combinations for the configuration file. The library also works.

Cheers, Enrique

eiglesias34 commented 1 year ago

Hi @DylanVanAssche,

Are you still having problems? If not, I am going to close this issue on Monday.

eiglesias34 commented 1 year ago

Given the lack of activity on this issue, I will assume that the problem is solved and close it.

DylanVanAssche commented 1 year ago

Yes it is solved, the issue got lost in my emails. Thanks!