Re: sparql test for order by and distinct

On Wed, 2005-07-27 at 11:58 +0100, Dave Beckett wrote:

A little later I work out that the blank nodes and ordering is not
significant here and the bug is testable as long as the query has
SELECT DISTINCT ?something and ORDER BY ?somethingelse with some
duplicates to remove.

So here is a testable data/query/result set:

data:
@prefix ex: <http://example.org/abc#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

ex:r1 ex:prop "value 1" .
ex:r2 ex:prop "value 3" .
ex:r3 ex:prop "value 3" .
ex:r4 ex:prop "value 4" .

query:
PREFIX ex: <http://example.org/abc#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?value
FROM <data.ttl>
WHERE {
  ?res ex:prop ?value .
}
ORDER BY ?res

result:
-------------
| value     |
=============
| "value 1" |
| "value 3" |
| "value 4" |
-------------

(and my code gives 4 answers values 1, 3, 3, 4)

Dave

Received on Wednesday, 27 July 2005 11:12:30 UTC