Re: RDF's relative IRI resolution is ambiguous

> On Aug 27, 2015, at 3:01 PM, Ruben Verborgh <ruben.verborgh@ugent.be> wrote:
> 
>> That depends on if <> is interpreted as a relative URI. 
> 
> Upon closely reading RFC3986, an empty URI is a relative URI:
> relative-part = "//" authority path-abempty
>                    / path-absolute
>                    / path-noscheme
>                    / path-empty
> And Section 5.2.2 defines the behavior as:
>            if (R.path == "") then
>               T.path = Base.path;
> So <> necessarily equals the base IRI, without normalization.

5.2.1 says the following:

> Normalization of the base URI, as described in Sections 6.2.2 and 6.2.3, is optional.

So, it would seem that we need to be explicit about expected behavior. The Ruby Addressable library takes the position that the base URI is not normalized in this case, as you suggest. I’m actually surprised to see that my own implementation does the same thing, so the behavior of my own Turtle implementation now seems odd.

Special casing <> in Turtle would be unfortunate, as it is now, all of the RDF.rb parser implementations should be consistent in doing base.join(iri); this has implications for JSON-LD, RDF/XML, SPARQL, Turtle, TriG, … It’s important that we be consistent.

IMO, the best interpretation is that, when resolving relative IRIs, all IRIs are resolved relative the the document, or declared, base; no special-case for the empty relative IRI. In fact, as the declared base URI within the document, may itself be relative, it must be resolved against the document location to establish the base URI to use for resolving subsequent relative URIs.

A test suite should repurpose the same tests across different formats, IMO, to make sure we remain consistent; or such tests should be added to each of the relevant test suites.

Gregg

> I'm in the process of building an extensive list of test cases.
> Will share when ready.
> 
> Ruben

Received on Thursday, 27 August 2015 22:38:34 UTC