Walid Maalej wrote:
> Dear RDF Data Access Working Group Members,
>
> In the last working draft of the 21st. of July 2005, changes have been done
> concerning the definition of the variable names within a SPARQL query.
> The syntax is specified under
> http://www.w3.org/TR/rdf-sparql-query/#rVARNAME .
> I'm wondering if there is any reason not to allow the underscore "_" at the
> Beginning of a variable name from the grammar point of view.
> This could be very useful for application that build SPARQL queries
> automatically and call the variables like the RDF:ID of the searched
> resource.
>
> Let's suppose we have the following data
> <http://example.org/book1> <http://properties.com/_title> "SPARQL Tutorial".
>
> A Generated query could look like:
>
> PREFIX exp: <http://example.org/>
> PREFIX pro: <http://properties.com/>
> SELECT $_title
> WHERE { exp:book1 pro:_title $title }
>
> In general, SPARQL based application developers should not care about
> calling the variables. It should be possible to just take over the RDF
> Property ID with a "?" as a prefix. Thus, I think that, the syntax of NCNAME
> http://www.w3.org/TR/rdf-sparql-query/rNCNAME should be equal to that of
> variable names.
>
> I would be very glad and thankful for your considerations and for any
> explanations or remarks.
>
> Best Regards
> --------------------------
> Walid Maalej
> Technical University of Munich
> Web: www.in.tum.de
Walid,
The working group has agreed the syntax issues for the SPARQL grammar. A
leading underscore is allowed in a variable name.
The relevant grammar productions are:
[86] NCCHAR1 ::= NCCHAR1p | '_'
[87] VARNAME ::= ( NCCHAR1 | [0-9] )
( NCCHAR1 | [0-9] | #x00B7 |
[#x0300-#x036F] | #x203F-#x2040] )*
http://www.w3.org/2001/sw/DataAccess/rq23/#grammar
Please let us know whether this response addresses your comment
to your satisfaction.
Andy