Closed bblfish closed 1 year ago
Hi @bblfish
That is expected. In the first case the header is invalid. In the second case not.
An empty header is invalid according to which spec?
I checked an csvw also seems to have difficulty with it, but there I can use {_row} as a counter for the row.
I don't really see why one could not just assume the column is named "", which is after all a String too...
Well, that's why CSVW was add to deal with this types of cases. So I can assume that you have a solution if you got it working with CSVW?
I got it to work with CSVW which I used beforehand using only CSVW tools. It was not yet clear to me that I could use that here too...
But csvw does not solve the problem either, as it only allows one to capture the number of the row, not the number in the first column of the first row, which could be useful for creating <#n{id}> urls to reference data later.
This is perhaps not a big deal. I was just wondering if you had a spec I could at a later date refer the folks producing the CSV data to so that they could change the column name, though we can probably also do that ourselves. (even so a justification for why we do that would be useful)
Normally you should be able to make that work with CSVW. @DylanVanAssche Could you have a look at this?
@pheyvaer AFAIK this is not possible, a column name is necessary for referencing. There's no way to refer to a certain column by number. I don't know how CSVW handles that.
The discussion is going on here: https://github.com/kg-construct/rml-questions/discussions/25
It looks like we established that the restriction does not stem from the CSV RFC at least.
I found a workaround . If I set the csvw:null
to be the string consisting of the ␀
character only (of course the string "null" would also do), then the empty column can be accessed.
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@base <http://example.org/> . ## see issue https://github.com/RMLio/rmlmapper-java/issues/178
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix csvw: <http://www.w3.org/ns/csvw#> .
<#allDataMap> a rr:TriplesMap;
rml:logicalSource [
rml:referenceFormulation ql:CSV ;
rml:source <#all_data.very_short.csv>;
] .
<#all_data.very_short.csv> a csvw:Table;
csvw:url "data/all_data.very_short.csv" ;
csvw:dialect [ a csvw:Dialect;
csvw:delimiter ","
];
csvw:null "␀".
$ rmlmapper -m awv.sources.ttl -s turtle -m column1.ttl | head
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
_:b1485 a sosa:Observation .
_:b1486 a sosa:Observation .
_:b2880 a sosa:Observation .
_:b2881 a sosa:Observation .
For more details still see https://github.com/kg-construct/rml-questions/discussions/25#discussioncomment-3282206
A workaround for this corner case has been found upstream, can we close this issue?
sure!
We have a table with the following structure
The name of the first column is missing. But the following does not work
It seems to work if one gives the column a one white space name and changes the template tline to
rr:template "http://data.example.com/all#m_{ }";
.