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

Re: what functions should we include in SPARQL 1.1?

From: Steve Harris <steve.harris@garlik.com>
Date: Tue, 9 Nov 2010 01:15:46 +0000
Cc: Lee Feigenbaum <lee@thefigtrees.net>, Axel Polleres <axel.polleres@deri.org>, SPARQL Working Group <public-rdf-dawg@w3.org>
Message-Id: <5361E6AE-540F-4A2C-8DFC-50EB3A084A54@garlik.com>
To: Andy Seaborne <andy.seaborne@epimorphics.com>
On 2010-11-08, at 22:40, Andy Seaborne wrote:
> On 08/11/10 18:28, Steve Harris wrote:
>> On 2010-11-08, at 11:45, Andy Seaborne wrote:
>> snip
>>>>> Yes, I share this thought. I have no a priori objection to RAND() but had the same reaction that this particular example can be pretty misleading as to what the meaning of the same query without ORDER BY RAND() is.
>>>> Agreed, I think. I wouldn't advocate using that as an example in the document, just that it's a common real world requirement, which we can't satisfy currently.
>>> All seems like a good idea.
>>> Steve -
>>> Either we get someone to take an action to produce the content we can incorporate into the doc.
>>> Or are you going to take this action and write this into the doc?
>>> I can add RAND to the grammar as:
>>> RAND()
>>> RAND(expression)
>> I'm happy to take an action to describe RAND(), but I'm not sure about RAND(expression). The defn. in SQL is a little murky, and it's tricky to make use of.
> Like Paul, a way to make tests stable would be useful.
> Don't know what SQL defines it as but the way I'm used to seeing it is that RAND(seed) would produce the same sequence of random numbers each
> query.

In SQL RAND(n) always returns the same number, for any given n. I'm not quite sure if it sets the seed to be used by the next call to RAND() or not.

If RAND(12) always reseeds, it's rather tricky to use in SPARQL. If you have stored procedures then it's OK, but without I'm not sure how you'd use it.

Perhaps one could do something hair-raising with IF(), but I'm not quite sure what...

RAND(IF(RAND() = RAND(0), RAND(12), RAND())) is close, but doesn't seem acceptable.

- Steve

Steve Harris, CTO, 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 Tuesday, 9 November 2010 01:16:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:01:02 UTC