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

Optional WHERE and WHERE {}

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Thu, 21 Apr 2005 16:27:37 +0100
To: "'RDF Data Access Working Group'" <public-rdf-dawg@w3.org>
Message-ID: <20050421162737.04f16c5e@hoth.ilrt.bris.ac.uk>

Question: Is the WHERE {...} structure optional in sparql?

The grammar says yes and lookin in the WD I can see it's given as an
example with ASK,

So whereas CONSTRUCT, DESCRIBE and SELECT are all given examples
requiring WHERE { .... },  ASK has the format ASK { ...} and no WHERE.
Possibly ASK WHERE { ... } would be more consistent.

So thinking further, what does WHERE with an empty graph pattern {}
mean?  I discussed this with EricP in Italy and we think it's the
same as query succeding and returning 1 result, and it's what Algae2
does.

Going through the query verbs:

1. SELECT * WHERE {}
  returns 1 result[row] with no bindings

2. CONSTRUCT { :a :b :c } WHERE {}
  returns the graph { :a :b :c}

3. ASK {}
  returns true

4. DESCRIBE <uri> WHERE {}
  Well nobody can tell what it returns :)
  but it's probably the same as DESCRIBE <uri> for all cases.

and if WHERE {} is the same as omitting it, then the queries below
return the same results as the above:

1a. SELECT *
2a. CONSTRUCT { :a :b :c }
3a. ASK
4a. DESCRIBE <uri>
  -- this one's already in the spec

Dave
Received on Thursday, 21 April 2005 15:31:06 GMT

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