W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2010

Re: SPARQL Grammar updated

From: Steve Harris <steve.harris@garlik.com>
Date: Mon, 26 Apr 2010 11:24:04 +0100
Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
Message-Id: <7229D6F8-E924-4B14-9242-E919AABEAD39@garlik.com>
To: Andy Seaborne <andy.seaborne@talis.com>
On 2010-04-25, at 18:11, Andy Seaborne wrote:

> 
> http://www.w3.org/2009/sparql/docs/sparql-grammar-11.html
> (the final layout will be tweaked when it's stable).
> 
> This is, I hope, complete for SPARQL 1.1 Query.
> Update is waiting for confirmation of the design.
> 
> The grammar is sufficiently large that it's likely not to necessarily be expressed the best way and also it's quite possible it has bugs in it.
> 
> So, I'd like to build the syntax test suite.
> 
> ** request
> 
> To do this, could you email examples of complete queries that you think are legal for SPARQL 1.1 (and not for SPARQL 1.0). I'd also like examples of bad syntax, for designs that are not legal.
> 
> The queries don't have to make sense.
> 
> Examples:
> 
> Good:
> SELECT (COUNT(*) AS ?C) {}
> 
> Bad:
> SELECT COUNT(*) {}

Some obvious ones:

[N.B. these were done by eye, as I don't have a complete parser yet so there may be typos in there, but I tried to be careful]

Good:

SELECT *
WHERE {
 ?x ?y ?z .
 MINUS { ?x <y> <z> . }
}

SELECT *
WHERE {
 ?x ?y ?z .
 FILTER(NOT EXISTS { ?x <y> <z> . })
}

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT (COALESCE(SAMPLE(?fullname), SAMPLE(?name), "?") AS ?aname)
WHERE {
 ?x a foaf:Person .
 OPTIONAL { ?x foaf:name ?fullname . }
 OPTIONAL { ?x foaf:givenName ?name . }
}

Bad:

SELECT *
WHERE {
 ?x ?y ?z .
 NOT EXISTS { ?x <y> <z> . }
}

SELECT (MIN(*) AS ?min)
WHERE {
  <x> <y> ?z .
}

- Steve

-- 
Steve Harris, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD
Received on Monday, 26 April 2010 10:24:33 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:42 GMT