Re: rr:template value that would create invalid IRIs

On 27 Jun 2012, at 14:46, Souripriya Das wrote:
> In the TC, I saw examples of rr:template values like the following (see [1])
> [ rr:template "{\"FirstName\"} {\"LastName\"}"; rr:termType rr:Literal; ]
> However, what if we want to make it an rr:IRI (by default), just by removing "rr:termType rr:Literal":
> [ rr:template "{\"FirstName\"} {\"LastName\"}"; ]

The template with a space would always generate invalid IRIs. Invalid IRIs are data errors:

This doesn't make the mapping non-conforming. R2RML processors are allowed to answer queries over output datasets that contain data errors as long as the invalid IRI doesn't have to be returned as part of the query. However, the spec notes that R2RML processors SHOULD report data errors as early as possible, so it's certainly reasonable for a processor to generate a warning if a mapping contains such an IRI template, or even reject it.

(D2RQ generates a warning if an IRI template contains any character that with Unicode code point less than 0xA0 that is not in the following list: -_~.a-zA-Z0-9:/?#[]@!$&'()*+,;=% )

> My understanding is that that would generate invalid IRIs, and so the rr:template value has to be rewritten as follows:
> [ rr:template "{\"FirstName\"}%20{\"LastName\"}"; ]
> Could someone please confirm?

Replacing the space with a %20 is one way of enabling the template to produce valid IRIs.

Note however that %20 is *not* a “safe separator” in an IRI template:

So it would be even better to use a sub-delim character as the separator between the two column references, for example: "{\"FirstName\"};{\"LastName\"}"

The reason is that with “%20” as a separator, we can end up with an IRI <John%20Michael%20Doe> that cannot be unambiguously reversed. If we chose a safe separator like “;”, then we'd have <John%20Michael;Doe>, and it's unambiguous what part of that IRI is the FirstName column and what is the LastName.


> Thanks,
> - Souri.
> [1]

Received on Wednesday, 27 June 2012 14:13:16 UTC