SPARQL grammar W3C Working Draft 24 July 2012 - Feedback / questions to some rule definitions

Hello,

as I did not dive into the protocols and public archives, chances might be good that the questions and remarks in this mail have already been explained or resolved. If so, sorry for the inconvenience.


The following excerpt of the W3C Working Draft from 24th of July 2012 shows the definition of rule [83] PropertyListPathNotEmpty  of the SPARQL 1.1 Query Language:

[83]  	PropertyListPathNotEmpty	  ::=  	( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )*

My understanding of zero or more repetitions of ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )* this definition allows queries as shown below:

SELECT ?book ?title ?price
{
   ?book dc:title ?title ; ; ; ;
         ns:price ?price ; ; .
}

In case my first assumption is confirmed, should rule [83] therefore be rewritten as  
 
[83]  	PropertyListPathNotEmpty	  ::=  	( VerbPath | VerbSimple ) ObjectListPath ( ';' ( VerbPath | VerbSimple ) ObjectList )*


Chapter 19 Status of this document chapter in http://www.w3.org/TR/2012/WD-sparql11-query-20120724 lists the non-editorial changes since last publication. One of the items changed refers to PN_LOCAL tokens:
- Local part of prefix names can now include ":", in line with Turtle standization by the RDF Working Group.

[169]	PN_LOCAL	  ::=  	(PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX) )?
[170]	PLX	  ::=  	PERCENT | PN_LOCAL_ESC
[171]	PERCENT	  ::=  	'%' HEX HEX
[172]	HEX	  ::=  	[0-9] | [A-F] | [a-f]
[173]	PN_LOCAL_ESC	  ::=  	'\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )

Chapter 19 lists at risk features:
- Allow certain character escape sequences in the local part of prefixed names. These are the non-alphanumeric characters allowed in an IRI path. The characters are ~.-!$&'()*+,;=:/?#@%_.

Does that mean, that ':' will be removed from PN_LOCAL and shifted into PN_LOCAL_ESC ?
The test query from the dawg test suite will therefore fail with the current definition of the SPARQL syntax: 

PREFIX og: <http://ogp.me/ns#>
SELECT * 
WHERE {
   ?page og:audio\:title ?title
}


The following annotations are clearly subjective. They affect the readability of the SPARQL grammar only. 

Rule [41]

[41]  	Modify	  ::=  	( 'WITH' iri )? ( DeleteClause InsertClause? | InsertClause ) UsingClause* 'WHERE' GroupGraphPattern

should be equivalent written as

[41]  	Modify	  ::=  	( 'WITH' iri )? DeleteClause? InsertClause? UsingClause* 'WHERE' GroupGraphPattern

Rule [44]

[44]  	UsingClause	  ::=  	'USING' ( iri | 'NAMED' iri )

in my opinion is better understood when converted to:

[44]  	UsingClause	  ::=  	'USING' 'NAMED'? iri

The same pattern as in rule [44] goes for rule [92]

[92]  	PathEltOrInverse	  ::=  	PathElt | '^' PathElt

which can be simplified to

[92]  	PathEltOrInverse	  ::=  	'^'? PathElt

Rule [94] 

[94]  	PathPrimary	  ::=  	iri | 'a' | '!' PathNegatedPropertySet | '(' Path ')' | 'DISTINCT' '(' Path ')'

can be shortened to

[94]  	PathPrimary	  ::=  	iri | 'a' | '!' PathNegatedPropertySet | 'DISTINCT'? '(' Path ')'

This pattern also applies to rule [96] 

[96]  	PathOneInPropertySet	  ::=  	iri | 'a' | '^' ( iri | 'a' )

which results in

[96]  	PathOneInPropertySet	  ::=  	'^'? ( iri | 'a' )

Regarding rule [64] my conjecture is with NIL defined as 
[161]  	NIL	  ::=  	'(' WS* ')'

and WS defined as
[162]  	WS	  ::=  	#x20 | #x9 | #xD | #xA

and assuming that WS is skipped in the lexical part, rule [64]

[64]  	InlineDataFull	  ::=  	( NIL | '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' | NIL )* '}'

might be rewritten as follows

[64]  	InlineDataFull	  ::=  	( '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' )* '}'



Kind regards
Juergen Pfundt

Received on Tuesday, 4 September 2012 22:09:38 UTC