Re: Production rules for satisfying the "prefix_only_IRI" turtle parser test

Hi Rob,

p: needs to satisfy either PNAME_LN or PNAME_NS:

[136s]	PrefixedName	::=	PNAME_LN | PNAME_NS

Best,
Richard



> On 19 Nov 2015, at 17:59, Rob Stewart <robstewart57@gmail.com> wrote:
> 
> There is a turtle parser test in the W3C unit tests labelled "prefix_only_IRI".
> 
> The RDF to be parsed is:
> 
> @prefix p: <http://a.example/s>.
> p: <http://a.example/p> <http://a.example/o> .
> 
> The RDF graph expected in memory is:
> 
> <http://a.example/s> <http://a.example/p> <http://a.example/o> .
> 
> Because p in p: has been expanded to http://a.example/s and what follows ":" is an empty string, so the expanded prefix for p is the URI for the subject.
> 
> My question is about how this conforms to the turtle grammar rules at http://www.w3.org/TR/turtle/#sec-grammar-grammar . The relevant production rules are:
> 
> [139s] PNAME_NS::= PN_PREFIX? ':'
> [140s] PNAME_LN::= PNAME_NS PN_LOCAL
> [168s] PN_LOCAL::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
> 
> The "p:" satisfies PNAME_NS, so now to satisfy PN_LOCAL in order to satisfy PNAME_LN. In the "prefix_only_IRI" test case, what follows the ":" is an empty string. I don't see how an empty string can be satisfied by PN_LOCAL, given the first component of PN_LOCAL is:
> 
> (PN_CHARS_U | ':' | [0-9] | PLX)
> 
> So, how does the "prefix_only_IRI" turtle parsing test conform to the grammar rules for turtle syntax?
> 
> Thanks,
> 
> --
> Rob Stewart 

Received on Thursday, 19 November 2015 23:10:56 UTC