Re: Turtle and CURIES

On Mon, May 23, 2011 at 10:57 AM, Andy Seaborne <
andy.seaborne@epimorphics.com> wrote:

>
>
> On 23/05/11 14:53, David Wood wrote:
>
>> Hi all,
>>
>> The TAG (or rather, the  AWWSW Task Group of the TAG) is (still |
>> again) actively discussing http-range-14 and its relation to the
>> definitions of URIs. [1]
>>
>
> Thanks for pointing it out.
>
>
>
>> Section 5.2 of that document [2] states:
>>
>> [[ A null fragid precludes the use of qnames to abbreviate such URIs.
>> (In particular it would not be possible to use them as predicate
>> names in RDF/XML.) However, SPARQL, Turtle, and RDFa are being
>> extended to admit CURIEs that include #, making this a newly
>> attractive option. ]]
>>
>
> I can read this in two ways: the IRI that the CURIE represents can include
> a #, including null fragid, and so does not have the RDF/XML problem.
>
> prefix ex: <http://example/ns#>
> ...
> { ex: ex: ex: }
>
> Or that the syntax of CURIE can include a #. SPARQL is not being changed to
> include these - this area has not changed since SPARQL 1.0.
>
> prefix ex: <http://example/>
>
> { ex:abc#def ex:ns# ex:#a }
>
> which is illegal.
>
>
I was confused on this point as well.  Since SPARQL and Turtle syntax both
permit empty local parts in prefixed names, you can represent any arbitrary
IRI as a pname by stuffing any illegal local-name characters into the
namespace part, and so you avoid the RDF/XML problem.

But, they seem to be suggesting a naming scheme where the local names 'a',
'b', 'c', ... become the IRIs <http://example.com/a#>, <
http://example.com/b#>, <http://example.com/c#>, ...  To make that legal
Turtle, you have to allocate a new namespace for each local name, e.g.:

@prefix a: <http://example.com/a#>
@prefix b: <http://example.com/b#>
@prefix c: <http://example.com/c#>

{ a: b: c: }

That's just not feasible for documents with large numbers of local names.


>
>
> # is the comment character in SPARQL and Turtle.  (Could be changed to
> "<WS>#".)
>
>
>  I have advised Jonathan Rees, the editor, that the RDF WG is leaning
>> toward minimal changes in Turtle, but some form of Quartle may (or
>> may not) follow.
>>
>
> SPARQL 1.1 Last Call is unchanged from SPARQL 1.0 in this area.
>
>
>  If anyone thinks this changes their mind in relation to CURIE support
>> in a standardized Turtle, this would be a good time to say so.
>>
>
> A CURIE is:
>
> safe_curie  :=   '[' curie ']'
> curie       :=   [ [ prefix ] ':' ] reference
> prefix      :=   NCName
> reference   :=   irelative-ref (as defined in IRI)
>
> so Turtle's 'a' would match as would '123'
>
> irelative-ref includes "?" and "@" and ":" (the last two via ipchar)
>
> And '['  ']' have been used.
>
> CURIE permits further restrictions - while Turtle may in spirit have
> CURIEs, we need to restrict in some way anyway.
>

Seems the difficulty lies in the fact that CURIE allows a bare IRI
(relative) reference to be used as a CURIE, which matches too many existing
language elements in Turtle.  A reasonable restriction might be to only
accept CURIEs which contain a ':' character since those are already prefixed
names, and relaxing the rules of the local-name part to allow relative IRI
references there.  A relative IRI reference by itself would still need to be
enclosed in <> brackets.  That would support the null fragid naming
convention mentioned above.

-Alex



>
>        Andy
>
>
>
>> Regards, Dave
>>
>> [1]  http://www.w3.org/2001/tag/awwsw/issue57/latest/ [2]
>> http://www.w3.org/2001/tag/awwsw/issue57/latest/#suffix
>>
>
>        Andy
>
>

Received on Monday, 23 May 2011 15:22:43 UTC