Re: Is it possible to produce multiple URLs from a cell value using "separator"?

> On Aug 10, 2016, at 12:46 PM, Niklas Lindström <lindstream@gmail.com> wrote:
> 
> Dear CSVW folks,
> 
> Firstly, thanks for the hard work on CSVW! Alas, I haven't had much time looking into it before.
> 
> Now to the question. Is it possible to produce multiple URLs from a cell value using "separator"? With the separator mechanism, an array of values can be produced from a single cell. But it seems that these values can only be in the form of literals. It does not seem possible to use a given "valueUrl" to produce URLs from each value in the array. Is this correct?

Hi Niklas, indeed, the algorithm Parsing Cells [2] does not seem to anticipate the effect of multiple cell values and valueUrl. There are many cases where a URI Template may take multi-valued variables (e.g., a template such as {/role*}), and it would be difficult to distinguish between the case where it should expand to multiple URLs vs a single URL using all parts of a variable.

To get what you want will likely require putting each role in a different row.

Although we didn’t seem to address this use case, you might imagine that a future version of CSVW might add support for this, given suitable metadata definitions. Ideally, the URI template spec would be the place to do this, so that a template that could map to multiple output URIs could be defined, otherwise, it requires a different metadata column attribute where the combination of “separator” and “valueUrl” would be interpreted as creating multiple URL values, expanding the template for each separated value.

You might consider filing an issue at https://github.com/w3c/csvw/issues for a future WG to consider. Other CGs are also looking at doing community updates (e.g. SPARQL) which might have some use prior to a future WG. I’m not sure if that’s something this CG would want to pursue at this point.

Gregg

> In the text explaining "EXAMPLE 12: table with compact URLs and micro syntax" (from "Metadata Vocabulary for Tabular Data", section "5.1.3 URI Template Properties" [1]), it is clear that the entire array is input to the URI template.
> 
> Thus, I cannot see any direct way of converting a cell value like:
> 
>     aut ill
> 
> into this set of values (shown as JSON-LD):
> 
>     [{"@id": "http://id.loc.gov/vocabulary/relators/aut <http://id.loc.gov/vocabulary/relators/aut>"}, {"@id": "http://id.loc.gov/vocabulary/relators/ill <http://id.loc.gov/vocabulary/relators/ill>"}]
> 
> When using a column definition like:
> 
>     {
>         "name"; "role",
>         "separator": " ",
>         "valueUrl": "http://id.loc.gov/vocabulary/relators/{role} <http://id.loc.gov/vocabulary/relators/%7Brole%7D>"
>     }
> 
> the result value would instead be the unwanted:
> 
>     {"@id": "http://id.loc.gov/vocabulary/relators/aut,ill <http://id.loc.gov/vocabulary/relators/aut,ill>"}
> 
> Even if adding `"ordered": true`, I expect the result to just become:
> 
>     {"@list": [{"@id": "http://id.loc.gov/vocabulary/relators/aut,ill <http://id.loc.gov/vocabulary/relators/aut,ill>"}]}
> 
> Am I missing something?
> 
> Best regards,
> Niklas
> 
> [1]: https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#uri-template-properties <https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#uri-template-properties>[2] http://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#parsing-cells

Received on Wednesday, 10 August 2016 20:25:51 UTC