- From: Ashok Malhotra <ashokma@microsoft.com>
- Date: Fri, 30 May 2003 07:41:54 -0700
- To: <public-qt-comments@w3.org>
Resending. Failed to appear in the archive. All the best, Ashok > -----Original Message----- > From: Ashok Malhotra > Sent: Thursday, May 29, 2003 4:53 AM > To: 'Michael Brundage'; public-qt-comments@w3.org > Subject: RE: [F&O May 2] distinct-values > > Michael: > The current definition of fn:distinct-values does not require a total > order. Please take a look. > > 15.1.11 fn:distinct-values > fn:distinct-values($arg as xdt:anyAtomicType*) as xdt:anyAtomicType* > fn:distinct-values( $arg as xdt:anyAtomicType*, > $collationLiteral as xs:string) as xdt:anyAtomicType* > > Returns the sequence that results from removing from $arg all but one of a > set of values that are eq to one other. All the values must be of a single > type or one if its subtypes (for numeric values, the numeric promotion > rules defined in 6.2 Operators on Numeric Values are used to promote all > values to a single common type). The type returned is a sequence of values > of the same type as $arg. Equality must be defined for the type. If this > condition is not satisfied, an error is raised ("Type does not have > equality defined"). For detailed semantics see section 6.2.2 of [XQuery > 1.0 and XPath 2.0 Formal Semantics]. > > The collation used by the invocation of this function is determined > according to the rules in 7.3 Equality and Comparison of Strings. > > If $collationLiteral does not represent a valid collation, an error is > raised ("Invalid collation argument to fn:distinct-values()"). > > If $arg is the empty sequence, the empty sequence is returned. > > For xs:float and xs:double values, NaN is considered to be equal to itself > and 0.0 is equal to -0.0. > > If an xs:dateTime, xs:date or xs:time value does not have a timezone, an > implicit timezone is provided by the evaluation context. The normalized > value is adjusted using this implicit timezone if necessary. The adjusted > normalized value is used to compute distinctness. If multiple adjusted > normalized values compare equal but the accompanying timezones are > different, it is *implementation dependent* which value is returned. > > Equality of string values is determined according to the collation that is > used. Which value of a set of values that compare equal is returned as > well as the order in which values returned is *implementation dependent*. > If the type of the items in $arg is not xs:string and $collationLiteral is > specified, the collation is ignored. > > > > All the best, Ashok > > -----Original Message----- > > From: Michael Brundage [mailto:xquery@attbi.com] > > Sent: Wednesday, May 28, 2003 6:44 PM > > To: public-qt-comments@w3.org; Ashok Malhotra > > Subject: [F&O May 2] distinct-values > > > > The distinct-values function requires that the type be totally ordered - > - > > why? It only needs equality. > > > > Also, the current definition allowing subtypes means that not only is > the > > order of the result implementation-dependent, but so is the (dynamic) > type > > and contents of the result. For example, > > > > distinct-values(1, 1.0) => 1 or 1.0 (implementation-dependent) > > distinct-values("x", xs:token("x")) => "x" or xs:token("x") > > (implementation-dependent) > > > > Etc. > > > > > > > > Michael Brundage > > Writing as > > Author, "XQuery: The XML Query Language" (Addison-Wesley, to appear > 2003) > > Co-author, "Professional XML Databases" (Wrox Press, 2000) > > > > not as > > Technical Lead > > Common Query Runtime/XML Query Processing > > WebData XML Team > > Microsoft > >
Received on Friday, 30 May 2003 10:42:03 UTC