W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > August 2013

Possible Errata re CONCAT and COALESCE for SPARQL 1.1 Query

From: Rob Vesse <rvesse@dotnetrdf.org>
Date: Tue, 20 Aug 2013 15:42:01 -0700
To: <public-rdf-dawg-comments@w3.org>
CC: <public-sparql-dev@w3.org>
Message-ID: <CE393EC9.27715%rvesse@dotnetrdf.org>
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
> <http://www.w3.org/TR/xpath-functions/#func-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.

---

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.

Regards,

Rob Vesse
Received on Tuesday, 20 August 2013 23:13:29 UTC

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