W3C home > Mailing lists > Public > public-sparql-dev@w3.org > July to September 2013

Re: Possible Errata re CONCAT and COALESCE for SPARQL 1.1 Query

From: Steve Harris <swh@ecs.soton.ac.uk>
Date: Wed, 21 Aug 2013 10:29:15 +0100
Cc: <public-rdf-dawg-comments@w3.org>, <public-sparql-dev@w3.org>
Message-ID: <EMEW3|c70698ce1143ca1a14df5c24ea86cf2ap7KAYK03swh|ecs.soton.ac.uk|0F4755F3-DA4E-432A-B925-55F24B14F6D0@ecs.soton.ac.uk>
To: Rob Vesse <rvesse@dotnetrdf.org>
On 20 Aug 2013, at 23:42, Rob Vesse <rvesse@dotnetrdf.org> wrote:

> I have some comments around the definitions of CONCAT and COALESCE that have originated from private discussions with a user and may lead to additional errata for the SPARQL 1.1 Query specification
> 
> ---
> 
> Starting with Section 17.4.3.12 CONCAT (http://www.w3.org/TR/sparql11-query/#func-concat) it states the following:
> 
>> The CONCAT function corresponds to the XPath fn:concat function. The function accepts string literals as arguments.
> 
> If you follow the link to the fn:concat definition it states the following:
> 
>> Accepts two or more xs:anyAtomicType arguments
> 
> However the grammar allows zero or more through use of the ExpressionList production and so various implementations (including my own) happily allow zero or one arguments to be used.
> 
> In this case the specification should really explicitly allow/disallow those cases.  If the intention was to fully align with fn:concat then a minimum or two arguments should be required, if zero/one should be permitted then the spec should note this deviation from the XPath definition.

Yes, agreed. My preference would be to allow zero or one - zero being an error(?), and one returning the string of the argument.

This may help code that generates queries.

> ---
> 
> Then we have Section 17.4.1.3 COALESCE (http://www.w3.org/TR/sparql11-query/#func-coalesce) where the function definition is given as follows:
>> The COALESCE function form returns the RDF term value of the first expression that evaluates without error. In SPARQL, evaluating an unbound variable raises an error.
>> 
>> If none of the arguments evaluates to an RDF term, an error is raised. If no expressions are evaluated without error, an error is raised.
>> 
> 
> Between this and the examples it is implied that COALESCE requires at least one argument yet again the grammar allows for zero arguments.
> 
> Obviously zero arguments means COALESCE will always give an error so it is a pointless expression to write yet legal per the grammar, so again it would be nice if the specification explicitly stated this as being allowed/disallowed.

I don't think this requires an erratum. As far as I remember, SPARQL doesn't really have a concept of "disallowing" expressions that can be written in the grammar, other than it being an error, and as you've seen it's clearly an error by the description of the function.

Cheers,
    Steve
Received on Wednesday, 21 August 2013 09:29:56 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:52 UTC