Re: Column-valued and IRI term-type

Hi Tomasz

Thanks for your interest.

I forward a previous email from Richard when he suggested the test.

Mail:

In the call we discussed what happens when templates produce relative IRIs. So imagine a table:

 CREATE TABLE STUDENT (NAME VARCHAR(50));
 INSERT INTO STUDENT VALUES ("http://company.com/Alice");
 INSERT INTO STUDENT VALUES ("Bob");
 INSERT INTO STUDENT VALUES ("Bob/Charles");
 INSERT INTO STUDENT VALUES ("path/../Danny)";
 INSERT INTO STUDENT VALUES ("Emily Smith");

With a mapping that has:

 rr:template "{NAME}"; rr:termType rr:IRI;

and we run this with a base URI of

 <http://example.com/base/>

For the three different values, this would produce the following IRIs:

 <http://example.com/base/http%3A%2F%2Fcompany.com%2FAlice>
 <http://example.com/base/Bob>
 <http://example.com/base/Bob%2FCharles>
 <http://example.com/base/path%2F..%2FDanny>
 <http://example.com/base/Emily%20Smith>

Note that first %-encoding is applied, and then base IRI resolution happens if the result of the %-encoding is not a valid IRI (in other words, always).


On the other hand, if we had a mapping that uses rr:column instead of rr:template:

 rr:column "NAME"; rr:termType rr:IRI;

then we'd get:

 <http://company.com/Alice>
 <http://example.com/base/Bob>
 <http://example.com/base/Bob/Charles>
 <http://example.com/base/path/../Danny>
 (data error)

So, no %-encoding is applied to the column value in this case, and the base IRI is *not* prepended if the column already contains a valid IRI. But since we don't do %-encoding, the result can be an invalid IRI, leading to data errors whenever any of these values would have to be returned in a query.

Both for rr:template and rr:column, base IRI resolution is simple concatenation with the base IRI. Stuff like "../" doesn't get resolved.

Maybe the examples above are useful for creating additional test cases?

Received on Thursday, 16 August 2012 22:18:55 UTC