RMLio / yarrrml-parser

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

CSV source is interpreted as JDBC and does include undefined #173

Open TBoonX opened 2 years ago

TBoonX commented 2 years ago

Issue type: :bug: Bug

Description

When I define a source which is a csv file, the RML output has JDBC and undefined in the rml:source

Steps

transform the following yarrrml to RML:

prefixes:
  schema: "http://schema.org/"
sources:
  file:
    type: "localfile"
    access: "data.csv"
    referenceFormulation: "csv"
    delimiter: ";"
    iterator: "\n"
mappings:
  test:
    source:
      - file
    s: http://example.com/$(name)
    po:
      - [a, "schema:Person"]
      - ["schema:name", $(value)]

Result:

@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix map: <http://mapping.example.com/> .
@prefix ma: <http://www.w3.org/ns/ma-ont#> .
@prefix schema: <http://schema.org/> .

map:database_000 rdf:type <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#Database> ;
    <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#jdbcDSN> "data.csv" ;
    <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#jdbcDriver> "undefined" .

map:map_test_000 rml:logicalSource map:source_000 ;
    rdf:type rr:TriplesMap ;
    rdfs:label "test" ;
    rr:predicateObjectMap map:pom_000, map:pom_001 ;
    rr:subjectMap map:s_000 .

map:om_000 rdf:type rr:ObjectMap ;
    rr:constant "http://schema.org/Person" ;
    rr:termType rr:IRI .

map:om_001 rml:reference "value" ;
    rdf:type rr:ObjectMap ;
    rr:termType rr:Literal .

map:pm_000 rdf:type rr:PredicateMap ;
    rr:constant rdf:type .

map:pm_001 rdf:type rr:PredicateMap ;
    rr:constant schema:name .

map:pom_000 rdf:type rr:PredicateObjectMap ;
    rr:objectMap map:om_000 ;
    rr:predicateMap map:pm_000 .

map:pom_001 rdf:type rr:PredicateObjectMap ;
    rr:objectMap map:om_001 ;
    rr:predicateMap map:pm_001 .

map:rules_000 <http://rdfs.org/ns/void#exampleResource> map:map_test_000 ;
    rdf:type <http://rdfs.org/ns/void#Dataset> .

map:s_000 rdf:type rr:SubjectMap ;
    rr:template "http://example.com/{name}" .

map:source_000 rml:referenceFormulation ql:CSV ;
    rml:source map:database_000 ;
    rdf:type rml:LogicalSource ;
    rdfs:label "file" .

Environment

node -v v16.15.1

"@rmlio/yarrrml-parser": "^1.3.5"

pheyvaer commented 2 years ago

Hi @TBoonX

I think the bug is here. This also makes me think that if you remove type: "localfile" you get the expected RML rules.

TBoonX commented 2 years ago

@pheyvaer Removing this line works! Thanks for the hint!