Re: sqrt [was: Wishlist for SPARQL 1.2: Compatible query-hints, extra math operators]

On 31/07/13 18:19, Paul Gearon wrote:
>
>
> On Wed, Jul 31, 2013 at 5:06 AM, Andy Seaborne <andy@apache.org
> <mailto:andy@apache.org>> wrote:
>
>     On 30/07/13 15:05, Jerven Bolleman wrote:
>     ...
>
>         The second is an expansion of the basic math operators to include at
>         least (square)root. (square)root is very hard to implement using the
>         current SPARQL constructs yet is a very useful function. (even
>         if not
>         exact)
>
>
>     The SPARQL 1.1 library was decided mainly by taking the non-sequence
>     related functions from XQuery/XPath Functions and Operators (F&O),
>     sorting out a few details of RDF/SPARQL evaluation, and adding some
>     SPARQL specific functions (e.g. STRDT).
>
>     F&O is an excellent resource because it defines exactly what all the
>     operations do.  It is (oddly?) lacking on numeric operations like
>     sqrt and similar but there may be a good reason for that.
>
>     I agree it would be good to have sqrt.  Let's hope that
>     implementations add it as an URI-callable function.
>
>     If we implementers decide on the URI, then queries will be portable.
>
>     http://www.w3.org/ns/sparql is supposed to be populated with URIs
>     for every function with a keyword in SPARQL.  That action (389) got
>     lost.
>
>     So ...
>
>     prefix http://www.w3.org/ns/sparql#
>
>     sfn:sqrt(numeric) -> double.
>
>     What else (within reason!)?
>
>
> When it comes to function extensions for common operations like math, I
> usually adopted the XPath functions myself. For sqrt, this appears in
> the math: namespace.
>
> math: http://www.w3.org/2005/xpath-functions/math
>
> The list for XQuery/XPath Operators 3.0 includes:
>
> math:pi, math:exp, math:exp10, math:log, math:log10, math:pow,
> math:sqrt, math:sin, math:cos, math:tan, math:asin, math:acos,
> math:atan, math:atan2
>
> These are functions that are already defined by a W3C standard, and
> these standards should be compatible wherever possible. Why not use these?
>
> Paul

Yes - and I'd missed it is now stabilized as a CR:

http://www.w3.org/TR/xpath-functions-30/

 Andy

Received on Wednesday, 31 July 2013 17:54:12 UTC