Re: [Turtle] Misc initial thoughts

On 28/02/11 21:14, Nathan wrote:
> Andy Seaborne wrote:
>>
>>
>> On 28/02/11 20:51, Nathan wrote:
>>>> (e.g. what's allowed in a prefixed name).
>>>
>>> ... and is the colon part of it?
>>
>> Yes -
>> SPARQL 1.0:
>> http://www.w3.org/TR/rdf-sparql-query/#rPrefixedName
>>
>> A prefixed name has exactly one colon. This distinguishes it from a
>> keyword. That's a bit of nuisance for working with URNs and
>> (hindsight) requiring WS to separate would be more useful.
>
> but do you create a prefix uri mapping from PN_PREFIX (no colon) or
> PNAME_NS (colon required) to the URI?

These are syntax elements, not a processing mechanism.

There is a thing called a prefixed name.
It has two parts, a prefix part and a local name.
They are separated by a colon in the syntax.
It is turned into a IRI by using a prefix declaration to find the IRI 
declared for prefix part and applying concatentation.

You can implement the resolution with or without the colon. 
Implementation choice.

Checking ... ARQ gets the token PNAME_NS, strips the ":" and uses the 
colon-less form as the key in a map.  But that is for compatibility with 
prefix handling throughout Jena which is itself driven by (RDF/)XML 
where <local/> occurs.  No colon.

Defining PrefixedName as
   PNAME_LN | PNAME_NS
is a syntax idiom so the the rule for prefix declaration can rule out a 
non-empty local part and the prefixed name can allow it and also empty 
local part.

[4]    PrefixDecl  ::=    'PREFIX' PNAME_NS IRI_REF

[71]    PNAME_NS    ::=    PN_PREFIX? ':'
[72]    PNAME_LN    ::=    PNAME_NS PN_LOCAL

[100]   PN_LOCAL  ::=    ( PN_CHARS_U | [0-9] ) ....

so [71] is ":", "ex:" -- ends with a colon.
and [72] is the longer form which requires a non-empty local part ":abc" 
and "ex:abc".

A prefixed name is either.
A declaration must be a PNAME_NS

and remember longest token wins.

> if the former, this is at odds with CURIEs, if the later how do you map
> ":"?

Prefixed names predates CURIEs.

In SPARQL "abc" isn't a prefixed name.

":" as a prefixed name is an (empty string, empty string) pair
or a declaration of the empty-string prefix.

The token is PNAME_NS.

Can occur in a declaration or used as a prefix name.

PREFIX : <> SELECT * { : : : }

is a valid SPARQL query string.

 Andy

Received on Monday, 28 February 2011 22:27:08 UTC