- From: Steve Harris <steve.harris@garlik.com>
- Date: Tue, 2 Nov 2010 22:25:54 +0000
- To: Lee Feigenbaum <lee@thefigtrees.net>
- Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
It's not in XPath (as far as I can tell), but I'd like a RAND() function, it's incredibly useful, e.g.
SELECT ?s WHERE { ?s a <Foo> } ORDER BY RAND() LIMIT 10
SQL's RAND() returns a floating point number between 0 and 1, which works fine. You can also pass it a constant seed value as an argument, but that always struck me as a bit of a strange way of doing it.
- Steve
On 2010-11-02, at 21:16, Lee Feigenbaum wrote:
> (This email discharges my ACTION-305, http://www.w3.org/2009/sparql/track/actions/305)
>
> Two months ago we all agreed that we want to move forward with the function library work, and we agreed that we need two things:
>
> 1) A set of functions to include
> 2) URIs for these functions
>
> This email is to begin a discussion #1 above. AndyS already did much of this work on the wiki page, so I'm pretty much transplanting that here for discussion. Please reply with either concurrence, suggestions & reasons for things to remove or suggestions & reasons for additional things to include.
>
> This references functions from http://www.w3.org/TR/xpath-functions/ .
>
>
> Numeric functions:
>
> 6.4.1 fn:abs
> 6.4.2 fn:ceiling
> 6.4.3 fn:floor
> 6.4.4 fn:round
> 6.4.5 fn:round-half-to-even
>
> String functions:
>
> 7.3.2 fn:compare
> 7.4.1 fn:concat
> 7.4.3 fn:substring
> 7.4.4 fn:string-length
> 7.4.7 fn:upper-case
> 7.4.8 fn:lower-case
> 7.4.10 fn:encode-for-uri
> 7.5.1 fn:contains (collation form optional)
> 7.5.2 fn:starts-with
> 7.5.3 fn:ends-with
>
> DateTime functions:
>
> 10.4.6 op:dateTime-equal
> 10.4.7 op:dateTime-less-than
> 10.4.8 op:dateTime-greater-than
> 10.5.7 fn:year-from-dateTime
> 10.5.8 fn:month-from-dateTime
> 10.5.9 fn:day-from-dateTime
> 10.5.10 fn:hours-from-dateTime
> 10.5.11 fn:minutes-from-dateTime
> 10.5.12 fn:seconds-from-dateTime
> 10.5.13 fn:timezone-from-dateTime
>
> Misc functions:
>
> 3. fn:error
>
>
> Lee
>
>
>
--
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, 2 November 2010 22:26:30 UTC