zazuko / xrm

A friendly language for mappings to RDF
MIT License
1 stars 0 forks source link

CSV: Headers with spaces and umlauts do not work #28

Closed ktk closed 5 years ago

ktk commented 5 years ago

It looks like the source specification for CSV files is quite strict, I can neither use quotes for headers with spaces or reference headers that use umlauts. So Länder will not be accepted and neither is "Something Withspace".

In reality both will happen so it should be supported in the DSL

mchlrch commented 5 years ago

It's possible to define an additional string value after the identifier. The generator will use the string value instead of the identifier.

The CSV headers can be declared like this:

logical-source airport {
    type csv
    source "http://www.example.com/Airport.csv"

    referenceables
        Laender "Länder"
        SomethingWithspace "Something Withspace"
}

This will result in the follwing R2RML:

rr:predicateObjectMap [
        rr:predicate transit:route ;
        rr:objectMap [
            rr:column "Länder" ;
        ];
    ];
    rr:predicateObjectMap [
        rr:predicate transit:route ;
        rr:objectMap [
            rr:column "Something Withspace" ;
        ];
    ]

There's a paragraph in the documentation about this: https://github.com/zazuko/rdf-mapping-dsl-user/blob/master/documentation/mapping-language.md#handling-invalid-identifiers

This can be done for referenceables, classes, properties and datatypes

ktk commented 5 years ago

Ah great tnx, will check it out