Re: Substantial comments on the DM Mapping

On 8 Aug 2011, at 15:56, Eric Prud'hommeaux wrote:
>> A better way of conceptualising this:
>> 
>> “The input into the direct mapping is:
>> 1. a database
>> 2. a base IRI”
>> 
>> “All IRIs in the direct graph are obtained by concatenating to the base IRI.”
>> 
>> “The XYZ IRI is a concatenation of:
>> 1. the base IRI,
>> 2. a slash character “/”,
>> 3. …”
> 
> How about if we just change may to MUST in
>  "This graph is composed of relative IRIs that may be resolved against a base IRI"
> ?
> Specifying our own recipe seems like a recipe for trouble.
> 3986 gives us a resolution recipe implemented in every browser and web library:

But is it implemented as a function in every SQL dialect?

> http://tools.ietf.org/html/rfc3986#section-5.2
> and tells us how to find the base:
> http://tools.ietf.org/html/rfc3986#section-5.1

In R2RML there's a requirement that one be able to reconstruct the DB value from the generated RDF terms, in order to allow SPARQLing the output dataset. The RFC3986 algorithm isn't reversible as far as I can tell. Given a base "http://example.com/foo" and an absolute URI "http://example.com/bar", it's impossible to say whether the relative URI generated from the DB was "bar", "/bar", "http:bar", "foo/../bar" or whatever. Therefore, the RFC3986 algorithm can't be used in R2RML.

IRIs in the DM are much more easily reversed, so using RFC3986 would be possible in principle. But I think that this would make it impossible to implement the DM in R2RML. Therefore the DM should use simple concatenation too.

>> The examples should be written as Turtle that uses the @base directive, like:
>> 
>>    @base <http://data.example.com/>.
>>    <table1/id=1> <table1/name> "Bob".
> 
> A quick survey indicates that all complete examples have a base:
>  @base <http://foo.example/DB/>

Ok, great.

>> Here's what R2RML has to say about the base IRI:
>> 
>>>> The base IRI MUST be a valid IRI. It SHOULD end in a slash (“/”) character.
> 
> Note that step 2 above would produce <http://foo.example/DB//People/ID=7> which no browser would ever request.

Good catch. The concatenation shouldn't add another slash but directly append the table name after the base IRI.

>>>> Note: Resolution of relative IRIs in R2RML uses simple string concatenation instead of the more complex algorithm defined in RFC 3986. This ensures that the original database value can be reconstructed from the generated IRI.
>> 
>> I think that the exact same mechanism would make sense for the DM.
> 
> I agree that these should be the same, but believe we should rely on existing specs and libraries by using conventional relative URI resolution.

You can do that, if you're fine with making the DM unimplementable in pure SQL or stored procedures or R2RML. I wouldn't be thrilled about that.

Best,
Richard

Received on Monday, 8 August 2011 17:21:32 UTC