Re: what functions should we include in SPARQL 1.1?

I'm happy to include pretty much any scalar function, so I have no
problems with anything that's in the list.

Perusing through Leigh Dodds's list of existing functions, I think
there are a several that may be useful. The overview is at:
  http://spreadsheets.google.com/pub?key=0AkNZYESXv3IndGwyRkRXZ2hES0RjM0c3MHhLa05vTmc&gid=6
(the functions are listed in the various tabs)


Date Functions
ARQ, TopQuadrant and Virtuoso have functions for creating a date,
date-time and/or time that represents "now".  I'm also interested in
constructing dates, both from strings and also from integers
(something like fn:date(2010, 11, 3)). Virtuoso also has some
interesting functions for date arithmetic. These could be calculated
through decomposition of the dates, but without a day-of-year function
it would be hard.

Strings
Most of the useful operations are already covered, but sha1sum and/or
md5sum would be useful, as they are very common in SQL systems. Also
given the prevalence of linked data, it would be great to have a
function to escape text for URIs:
  http://www.w3.org/2005/xpath-functions/#encode-for-uri

Math/Logic
Many of these are already covered, but I'd like to see:
  if(cond, true-expr, false-expr)
I believe this is already possible, but an if() function makes certain
tasks much easier. Normally I'd like to see an arithmetic system
capable of handling more math operations, and include constants like
pi, but I'm not sure it's useful here. Has anyone found functions like
exp, sin, cos, etc, to be useful in SPARQL?

Geo Functions
These are less common, but I know that a lot of people find them
important. Mulgara does them through inferred graphs, but AllegroGraph
does them with scalar functions. The functions that accept lat/long
(distance and pointInBoundingBox) look useful, though perhaps the
distance calculations are too much of a burden on implementors. I
thought I'd mention them anyway, given how much demand I see for this
functionality.


Regards,
Paul Gearon

On Tue, Nov 2, 2010 at 5:16 PM, Lee Feigenbaum <lee@thefigtrees.net> 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
>
>
>
>

Received on Wednesday, 3 November 2010 14:40:02 UTC