Re: Template as mechanism for CSV conversion.

On May 14, 2014, at 10:14 AM, Andy Seaborne <andy@apache.org> wrote:

> (from the telecon - JeniT asked for this to be made more visible on the list)
> 
> Gregg has suggested that if all the conversions are based around the
> template mechanism, then there could be one conversions document for all of RDF, JSON and XML.
> 
> That makes sense to me although I also think that someone arrives at the
> doc wanting, say, the details of JSON conversion, having them all in one place makes for a less focused document.
> 
> e.g. RDF:
> http://w3c.github.io/csvw/csv2rdf/#graph-template
> 
> The templating mechanism is text-based and does not require parsing of some variant of the output syntax ("variant" because of the need for template slots).  A processor may provide additional validation of the output but, at a minimum, it can generate output just by text processing (and potentially get illegal syntax due to the lightweight nature of the process).

We could handle this by publishing notes on CSV2RDF, CSV2JSON and CSV2XML which discuss the application of the spec to those specific formats, and reference the generic CSV template transformation.

> A starting point for templates is URI Templates
> 
>  http://tools.ietf.org/html/rfc6570
> 
> although there needs to be escaping per syntax support.

As it's not specifically intended for templating literal types, we may need to extend this for datatype-specific template requirements, and to define escape mechanisms that may need to be required.

> (*nix) Shell parameter expansion is a similar mechanism.
> 
> http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion (not the array bits)
> 
> ${parameter/pattern/string} is a regex replace, for example.

This can be quite powerful.

Gregg

> 	Andy
> 

Received on Wednesday, 14 May 2014 17:25:56 UTC