RMLio / yarrrml-parser

A YARRRML parser library and CLI in Javascript
MIT License
41 stars 17 forks source link

Target not mapped when it is declared using shortcuts #126

Open valentinoli opened 3 years ago

valentinoli commented 3 years ago

Issue type: :bug: Bug

Description

The target is not mapped when we have a mapping with one target using shortcuts

Steps

YARRRML:

mapping:
  person:
    subjects:
      - value: "http://example.org/{id}"
        targets: ["data/dump.ttl.gz~void", "turtle", "gzip"]

Output:

<prefixes skipped for brevity>

mex:rules_000 a <http://rdfs.org/ns/void#Dataset>.
mex:person a rr:TriplesMap;
    rdfs:label "person".
mex:s_000 a rr:SubjectMap.
mex:person rr:subjectMap mex:s_000.
mex:s_000 rr:constant "http://example.org/{id}".

However, the following works:

YARRRML:

mapping:
  person:
    subjects:
      - value: "http://example.org/{id}"
        targets:
          - ["data/dump.ttl.gz~void", "turtle", "gzip"]

Output:

<prefixes skipped for brevity>

mex:rules_000 a void:Dataset.
mex:target_000 a rmlt:LogicalTarget;
    rdfs:label "data/dump.ttl.gz-void-turtle-gzip";
    rmlt:serialization formats:Turtle;
    rmlt:compression comp:gzip;
    rmlt:target mex:void_000.
mex:void_000 a void:Dataset;
    void:dataDump <file://data/dump.ttl.gz>.
mex:person a rr:TriplesMap;
    rdfs:label "person".
mex:s_000 a rr:SubjectMap.
mex:person rr:subjectMap mex:s_000.
mex:s_000 rr:constant "http://example.org/{id}";
    rml:logicalTarget mex:target_000.

Environment

yarrrml-parser v1.3.0 (JS library)

pheyvaer commented 3 years ago

Hi @valentinoli

Thanks for the issue. This is normal behaviour. It works the same way for the sources. Main reason is that actually both cases are array (in YAML) and therefore it would be complicated (even unclear at some points) to distinguish between the two.

valentinoli commented 3 years ago

Ah, I understand. Perhaps the YARRRML spec should be updated if only this syntax is supported since there are examples of both.

pheyvaer commented 3 years ago

@valentinoli Ooh really? That should be updated then! @DylanVanAssche Can you have a look at the spec?

valentinoli commented 3 years ago

Examples of former (which yarrrml-parser does not support):

Example 26 Example 40