oeg-upm / gtfs-bench

GTFS-Madrid-Bench: A Benchmark for Knowledge Graph Construction Engines
https://doi.org/10.5281/zenodo.3574492
Apache License 2.0
17 stars 12 forks source link

Change YARRRML translator to yatter #142

Open Aklakan opened 1 year ago

Aklakan commented 1 year ago

First of all, thanks for the work of providing this excellent resource.

Describe the bug

The mapping files such as https://github.com/oeg-upm/gtfs-bench/blob/ad19b9bc6b75a754f2bd323cddbd076fd38c749a/mappings/gtfs-csv.rml.ttl#L35 includes combinations of properties/values that seem to be in violation of the R2RML spec:

:om_0 a rr:ObjectMap;
    rr:constant "http://vocab.gtfs.org/terms#StopTime";
    rr:termType rr:IRI.

7.1 Constant RDF Terms states:

The constant value of a constant-valued term map is the RDF term that is the value of its rr:constant property.

7.4 IRIs, Literal, Blank Nodes states:

The term type of a column-valued term map or template-valued term map determines the kind of generated RDF term (IRIs, blank nodes or literals).

Note that it does not mention constant-valued term maps. My interpretation is therefore that that rr:termType is not intended to alter the value of an rr:constant.

Obviously, the mapping can be simply written as

:om_0 a rr:ObjectMap;
    rr:constant <http://vocab.gtfs.org/terms#StopTime>.

I am raising this issue because we stated evaluation of another R(2R)ML system which complained about some of the mapping files for the described reason.

dachafra commented 1 year ago

Thanks for using the benchmark and also pointing this!

Indeed, it's a bug during the translation from YARRRML to RML with YARRRML-parser. See this issue.

I took the gtfs-csv.yaml and translate it with our new translator https://github.com/oeg-upm/yatter. Can you take a look and see if it resolves your current problem? mapping.txt

dachafra commented 1 year ago

Assuming the issue has been solved... Let's change mappings to be translated with YATTER

Aklakan commented 1 year ago

We just used a simple sparql update statement to fix it. I just tested with your mapping.txt file and it looks fine. If with yatter in the future the mappings work out of the box then just the better :)

For reference, this was our quick fix:

# Uses jena's update 
update --data mapping.json.nt --dump "prefix rr: <http://www.w3.org/ns/r2rml#> DELETE {?s rr:constant ?c ; rr:termType rr:IRI} INSERT {?s rr:constant ?uri} WHERE {?s rr:constant ?c ; rr:termType rr:IRI filter(isliteral(?c)) BIND(URI(?c) AS ?uri) }" > fixed.ttl
dachafra commented 1 year ago

Great! Thanks for using the benchmark :-)