W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2011

Re: test agg-err-02

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Thu, 29 Sep 2011 08:22:34 +0100
Message-ID: <4E841CBA.3080607@epimorphics.com>
To: public-rdf-dawg@w3.org

On 29/09/11 00:25, Gregory Williams wrote:
> Looking at some of the recently added tests, I ran across what I
> think is an error. In test aggregates/manifest#agg-err-02, there's an
> aggregate  run on the following group of values:
> 1, _:b2, 3, 4
> The aggregate expression is:
> AVG(IF(isNumeric(?p), ?p, COALESCE(xsd:double(?p),0)))
> As a side note, I don't think the COALESCE is actually doing anything
> here, because the only non-numeric value in the data is the bnode for
> which the xsd:double cast will fail. If this test is supposed to be
> testing errors, this is really testing errors *with COALESCE*, not
> with aggregation.

isNumeric(?p) covers xsd:double(?p).  The xsd:double is presumable 
supposed to catch the case of a string in the data; there aren't any 
strings in the data.

Olivier - was that the intention? If so, should we change the data?
Greg - that work for you?

As a proposal, I've added agg-err-02.ttl which is -01 with strings.

@prefix : <http://example.com/data/#> .

:x :p 1, "2", 3, 4 .
:y :p 1, _:b2, 3, 4 .
:z :p 1.0, "2.0", 3.0, 4 .
and tweaked the manifest.

If this isn't the intention, just say so and I've revert the files.

> I believe the above data and aggregate reduces to Average({ 1, 0, 3,
> 4 }), which should result in a value of "2"^^xsd:decimal (decimal
> because the operands to the underlying division are both integers).
> However, the srx file suggests the average operation should yield
> "2"^^xsd:integer.

> Can somebody please take a look at the test and help me determine
> which of xsd:integer or xsd:decimal is the proper type for the
> result?
> thanks, .greg

The authority is:

As a special case, if the types of both $arg1 and $arg2 are xs:integer, 
then the return type is xs:decimal.

While I was tidying up - I've changed this as well.

Received on Thursday, 29 September 2011 07:23:05 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:01:04 UTC