The syntax of the SELECT clause.

Deciding on syntax can be a painful matter because once the basic technical issues are dealt with it comes down to aesthetics.

We will have to come to a decision on the SELECT expression syntax sometime (it's not needed for FPWD) so I have taken a look at as many systems that have been mentioned or I can find.  In each case, I have tried to go back to the definitive grammar, or failing that, what I think is the definitive documentation.  As such, the survey is bias to open source.

References used are listed at the end of the message.

Dimension of the designs include:
* Does the term after AS include the ? or not.
* Does the AS appear inside or outside any ().
* Allowing optional commas. The examples below don't show that.

Please add systems to the list and make corrections on the wiki:
http://www.w3.org/2009/sparql/wiki/Design:Project_Expression#Survey_of_syntax_forms_in_deployed_systems


 Andy

* Glitter

SELECT ?x ?y (?x+?y AS ?z)

* ARQ

SELECT ?x ?y (?x+?y AS ?z)

* RDF::Query

SELECT ?x ?y (?x+?y AS ?z)

* Virtuoso

Optional commas
() required with AS

SELECT ?x ?y (?x+?y) AS ?z
SELECT ?x ?y (?x) AS ?z

* Redland:RASQAL

4Store uses RASQAL.
Optional commas
() required with AS

SELECT ?x ?y (?x+?y) AS z

* ARC

SELECT ?x ?y count(?a) AS ?z

AS only with aggregates.

* Sesame:
I found a contributed parser (due to Jeen?) with

SELECT ?x ?y datatype(?a) AS "z"

----
Steve has proposed mandating commas in a SELECT form when an expression or AS is used.

SELECT ?x ?y ?z
SELECT ?x , ?y , count(?a) AS ?z
----


References:

RDF::Query
http://cpansearch.perl.org/src/GWILLIAMS/RDF-Query-2.200/lib/RDF/Query/Parser/SPARQLP.pm


Glitter:
http://svn.openanzo.org/svn/openanzo/openanzo/trunk/org.openanzo.rdf/grammar/sparql.jj


ARQ:
http://jena.svn.sourceforge.net/viewvc/jena/ARQ/trunk/Grammar/arq.jj


RASQAL:
http://svn.librdf.org/view/*checkout*/rasqal/trunk/src/sparql_parser.y


ARC2:
http://code.semsol.org/source/arc/parsers/ARC2_SPARQLPlusParser.php


Virtuoso:
http://docs.openlinksw.com/virtuoso/rdfsparqlimplementationextent.html


Sesame:
http://repo.aduna-software.org/svn/org.openrdf/sesame-ext/sparqlplus/trunk/src/main/java/org/openrdf/query/parser/sparqlplus/ast/sparql+.jjt

Received on Monday, 14 September 2009 11:26:54 UTC