Re: [Use cases] More issues

At 12:38 PM 10/10/2003, Alberto Massari wrote:
>Hi everybody,
>
>1) in the R use cases, a user defined function is introduced:
>
>declare function local:dec-max($i as item()*)
>  as xs:decimal
>{
>     max( for $j in $i return xs:decimal($j) )
>};
>
>In a couple of cases (Q2 and Q6) the list of items provided to the 
>function is empty, so "max" returns an empty sequence too. In this case, 
>an error is raised, because an xs:decimal cannot be constructed from an 
>empty sequence.
>In my opinion, the return value should be changed into an xs:decimal?

Yes ... but we have now changed the definition of aggregate functions so 
that untyped data is cast to double for fn:max(), so I just deleted the 
function throughout and used fn:max() instead in the version to be published.

>Note: we are not sure that constructing an xs:decimal from an empty 
>sequence is not allowed; can you confirm this is true? It would seem so, 
>as the result for the Q2 query shows "<high_bid></high_bid>" instead of 
>"<high_bid>0</high_bid>", implying that the local:dec-max function returns 
>an empty sequence.

Nice catch. Since an empty sequence is not a valid instance of xs:decimal, 
I think this should raise an error. It's no longer an issue for this use 
case now.

>2) the XMP-Q4 use case has been modified in this version to sort the 
>authors by last and first name
>
><results>
>   {
>     let $a := doc("http://bstore1.example.com/bib/bib.xml")//author
>     for $last in distinct-values($a/last),
>         $first in distinct-values($a[last=$last]/first)
>     order by $last, $first
>     ...
>
>but the result still lists Stevens W. as the first one (it should be the 
>third)

OK. Fixed now.

Jonathan

Received on Monday, 27 October 2003 22:30:47 UTC