W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2005

[Fwd: SPARQL variable names syntax]

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Thu, 04 Aug 2005 11:55:33 +0100
Message-ID: <42F1F425.30406@hp.com>
To: RDF Data Access Working Group <public-rdf-dawg@w3.org>


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.

Allowing "_" as the first character of a VARNAME does not affect any approved 
tests and does not break the grammar in any way.  I have added it.

[Info: "_" is treated specially in teh grammar because it can't appear as the 
start of a qname prefix in SPARQL because that is a blank node].

To be tidy, I defined:

NCCHAR1p -- XML NCCHAR1 without "-" for prefixes (used to be SPARQL NCCHAR1)
NCCHAR1  -- "NCCHAR1p | '_'" -- now the same as XML NCCHAR1

Used NCCHAR1 where "NCCHAR1p | '_'" would appear.

 > 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.

NCNAME includes "-" and "." which do not commonly appear in variables names and 
"-" is used for unary and binary minus.  I don't think we could do this.

 > I would be very glad and thankful for your considerations and for any
 > explanations or remarks.
 > Best Regards


While clearing up, I found that
[37]    	GraphNode

was an unused rule so I removed it.


When reviewed and approved by the WG, I will reply to Walid on the comments list

Received on Thursday, 4 August 2005 10:56:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:00:36 UTC