Re: RDF's relative IRI resolution is ambiguous

My comments on the Gist probably didn’t make it out either; repeated here.

The reason my processor gets different results, is because the @base IRI is resolved against the document location, which causes dot segments to be normalized. As @base may have a relative IRI, it seems reasonable to always attempt to make it absolute by resolving it to the document location, yet this is at odds with your interpretation. Otherwise, it means conditionally resolving any IRIREF against the current base only if it's not already an absolute IRI. However, the fact that RFC3986 5.2.2 explicitly considers the fact that the IRI to be resolved has a scheme, and that it's dot segments are removed implies to me that this is the correct interpretation: when seeing an IRI, resolve it against the current base IRI:

if defined(R.scheme) then
     T.scheme    = R.scheme;
     T.authority = R.authority;
     T.path      = remove_dot_segments(R.path);
     T.query     = R.query;
  else
...

Thus all emitted IRIs will have dot segments removed. The rule that must be resolved for Turtle, and other formats, if if an IRIREF is unconditionally resolved against the base IRI using this algorithm, or if it is only resolved if it is not already an absolute IRI. The interpretation consistently used in RDF.rb is the former, as it is simpler.

More on the subject of @base resolution, imagine the following alternative:

# RFC3986 normal examples with ../ in the base IRI
@base <//a/bb/ccc/../d;p?q>.
...

Here the scheme is missing from @base, so it clearly needs to be resolved, but will yield different results from <http://a/bb/ccc/../d;p?q> (assuming file location/previous base used http scheme), which would be pretty odd. Always resolving IRIs against the active base is the only consistent method, IMHO.

Gregg Kellogg
gregg@greggkellogg.net

> On Sep 2, 2015, at 9:51 AM, Ruben Verborgh <ruben.verborgh@ugent.be> wrote:
> 
> Hi Greg,
> 
> Sorry, for some reason, the comments on the gist did not arrive in my mailbox.
> Without seeing the comments, I had made some changes to the gist two days ago.
> 
> I expect most things to be resolved; some of them were just errors on my side.
> I'll have a look at the remaining things soon (boarding a plane now).
> 
> Best,
> 
> Ruben

Received on Wednesday, 2 September 2015 17:40:56 UTC