definition of DISTINCT

Looking at the definition for DISTINCT in light of the INDISTINCT
proposal, I reallized that I wasn't sure whether
  {(X=<a>, Y=<b>)
   (X=<b>, Y=<a>)} had a duplicate. Also, "duplicates" wasn't really
defined. I expanded the section to make it more clear what the default
was and how DISTINCT acted.

PROPOSED, replace 9.3 DISTINCT with this text:

9.3 DISTINCT

The solution sequence with no DISTINCT or INDISTINCT modifier is
defined by the SPARQL algebra in 12 Definition of SPARQL:

  @prefix  foaf:  <http://xmlns.com/foaf/0.1/> .

  _:x    foaf:name   "Alice" .
  _:x    foaf:mbox   <mailto:alice@example.com> .

  _:y    foaf:name   "Alice" .
  _:y    foaf:mbox   <mailto:asmith@example.com> .

  _:z    foaf:name   "Alice" .
  _:z    foaf:mbox   <mailto:alice.smith@example.com> .

  PREFIX foaf:    <http://xmlns.com/foaf/0.1/>
  SELECT ?name WHERE { ?x foaf:name ?name }

  name
  "Alice"
  "Alice"
  "Alice"

The DISTINCT solution modifier eliminates duplicate solutions.
Specifically, each solution that binds the same variables to the same
RDF terms as another solution is eliminated from the solution set.

  PREFIX foaf:    <http://xmlns.com/foaf/0.1/>
  SELECT DISTINCT ?name WHERE { ?x foaf:name ?name }

  name
  "Alice"

If DISTINCT and LIMIT or OFFSET are specified, then duplicates are
eliminated before the limit or offset is applied.
-- 
-eric

office: +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

Received on Friday, 16 March 2007 16:18:59 UTC