kg-construct / rml-core

RML-Core: Main features for RDF generation with RML
https://w3id.org/rml/core/spec
Creative Commons Attribution 4.0 International
12 stars 9 forks source link

Issue in test case 10b-JSON #93

Closed chrdebru closed 7 months ago

chrdebru commented 7 months ago

A separate issue as this seems to be more profound: we should assume valid JSON Path expressions in templates and references when they contain spaces or special characters. The problem is this:

rml:subjectMap [ rml:template "http://example.com/{Country Code}" ];

The reference formulation is JSONPath, but the reference expression in the subject map is not valid in JSON Path (it should be ['Country Code']. Would we even allow this as this? What if you have x.foo bar.y[*]? R2RML has a whole section on valid column names for templates. This could be a slippery slope for simple references. I do not believe that you can transform these with string manipulation. For instance, would foo bar.yay become ['foo bar.yay'] or ['foo bar'].yay?

I therefore propose that the test case and the desired approach should be this:

rml:subjectMap [ rml:template "http://example.com/{['Country Code']}" ];

In other words, only accept a simple reference if it respects the JSON Path's dot notation.

This problem also holds for 10a-JSON and others.

pmaria commented 7 months ago

Yes, I raised this issue and a couple of others quite a while ago: https://github.com/kg-construct/rml-test-cases/issues/14

Seems like these haven't been fixed yet.

Also, all test cases with json path expressions should use expressions that match the latest JSONPath draft https://datatracker.ietf.org/doc/draft-ietf-jsonpath-base/

So in this case that would be:

rml:subjectMap [ rml:template "http://example.com/{$.['Country Code']}" ];
chrdebru commented 7 months ago

Apologies for not thinking of having a look at the other repository. We should rewrite alls the JSON mappings.

DylanVanAssche commented 7 months ago

Yes, the test-cases must be updated to follow now the JSONPath draft spec at IETF.