RE: FW: DN-FO-09: 15.1.11 fn:distinct-values

For the record, I am in favour of distinct-values being defined to retain
the first occurrence of each set of of duplicates, and for the result to be
in "order of first appearance".

I think that making this implementation-defined will lead to
interoperability problems. People will discover that their favourite
implementation returns results in a predictable order, and they will come to
rely on it, which will give them problems moving to a different product.

Our data model provides sequences of values, not sets of values, and we
should therefore assume that by default, the order of the values is
significant. They can always wrap the result in a call to fn:unordered() if
they want a higher-performance implementation that doesn't retain order. 

Michael Kay


> -----Original Message-----
> From: Dimitre Novatchev [mailto:dnovatchev@yahoo.com] 
> Sent: 25 July 2003 22:34
> To: public-qt-comments@w3.org
> Cc: dnovatchev@europe.com
> Subject: Re: FW: DN-FO-09: 15.1.11 fn:distinct-values
> 
> 
> 
> > We have clarified the text to indicate that order of the output 
> > sequence if implementation dependent.  We have also changed the 
> > wording of the example as you suggested.
> 
> Thank you.
> 
> > 
> > If the user wants the output in a particular order, he can sort the 
> > values by document order by using $x/. or in any other 
> order by using 
> > the order-by clause.
> > 
> > Please let us know if this is satisfactory.
> 
> Document order is defined for nodes. We may want to preserve 
> the *sequence order* between the distinct elements that would 
> be returned. 
> 
> The example I gave before:
> 
> I have the following sequence of random numbers:
> 
> 3, 5, 2, 8, 6, 4, 9, 7, 1, 5, 2, 10, 9, 3
> 
> I want to get only the (first occuring) distinct numbers with 
> their ordering
> preserved:
> 
> 3, 5, 2, 8, 6, 4, 9, 7, 1, 10
> 
> This could be possible if the distinct-values() function was 
> defined with an additional argument "preserve-order" 
> (possibly with default value of false).
> 
> 
> fn:distinct-values($srcval as xs:anyAtomicType*,
>                    $preserve-order as xs:boolean? ) as 
> xs:anyAtomicType*
> 
> 
> Cheers,
> Dimitre Novatchev.
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design 
> software http://sitebuilder.yahoo.com
> 

Received on Monday, 4 August 2003 09:21:40 UTC