- From: Andy Seaborne <andy@apache.org>
- Date: Wed, 26 Mar 2014 19:04:47 +0000
- To: Gregg Kellogg <gregg@greggkellogg.net>, CSV on the Web Working Group <public-csv-wg@w3.org>
On 26/03/14 18:26, Gregg Kellogg wrote:
> If a CSV had no header, then that fact would either need to be described
> in the metadata file, or passed as a processing option for a direct map.
>
> I think the way to handle both of these. Within CSV-LD I envision using
> header names within templates, but this could be extended to use other
> field identifiers. For example:
>
> For example:
>
> "{:rowno}" might expand to the the current row number
> "{:colno=1}" might reference the contents of the first column (1-based)
> "{foo:colno}" might expand to the column number of the field with header
> "foo"
>
> A direct mapping for a CSV without a header row could then be
> automatically created using these patterns to generate something similar
> to what Andy provided:
>
> {
> "@context: {
> "@vocab": "http://w3c/future-csv-vocab/",
> "@base": "http://host/data.csv",
> },
> "row": {"@value": "{:rowno}", "@type": "xsd:integer"},
> "col1": "{:colno=1}",
> "col2": "{:colno=2}",
> ...
> }
>
> Applied to Andy's example without the header row, this would create the
> following Turtle:
>
> @prefix : <http://w3c/future-csv-vocab/>
> [ :row 1; :col1 "Southton", "123000" ] .
> [ :row 2; :col1 "Northville", "654000" ] .
@prefix : <http://w3c/future-csv-vocab/>
[ :row 1; :col1 "Southton" ; :col2 "123000" ] .
[ :row 2; :col1 "Northville" ; :col2 "654000" ] .
Andy
Received on Wednesday, 26 March 2014 19:05:16 UTC