- From: Howard Katz <howardk@fatdog.com>
- Date: Wed, 20 Apr 2005 19:53:05 -0700
- To: "Eric Prud'hommeaux" <eric@w3.org>
- Cc: <andy.seaborne@hp.com>, "RDF Data Access Working Group" <public-rdf-dawg@w3.org>
> -----Original Message----- > From: public-rdf-dawg-request@w3.org > [mailto:public-rdf-dawg-request@w3.org]On Behalf Of Eric Prud'hommeaux > Sent: Wednesday, April 20, 2005 5:16 PM > To: Howard Katz > Cc: andy.seaborne@hp.com; RDF Data Access Working Group > Subject: Re: XQuery value comparisons (Part I - numerics) > > > On Tue, Apr 19, 2005 at 10:24:55AM -0700, Howard Katz wrote: [ snip ... ] > > > Howard Katz wrote: > > However, > > in the case of the second query, restated as a general comparison: > > > > <e>123</e> = 123 > > > > the untypedAtomic 123 now gets converted to an integer (the type of the > > other operand), and we do an integer compare, instead of > failing as happened > > in the case of the corresponding value comparison. > > This is what scared me. How does it know what the other type is? For > instance, does > <e>123</e> = <e>123.0</e> > work? Neither has a type. Lexically they differ. How about > <e>123</e> = 123.0 I was imprecise. In the examples I was using, I said when one type was untyped, it gets "cast to the other type". More correctly: 1) it gets cast to xs:string if the other type is xs:string or untyped, and 2) it gets cast to double if the other type is numeric 3) else it gets cast to the dynamic type of the other operand So in your first example <e>123</e> = <e>123.0</e> untyped->string gets compared to untyped->string => false, and in <e>123</e> = 123.0 untyped->double gets compared to decimal->double => true Weird but wacky, heh? :-) Howard
Received on Thursday, 21 April 2005 02:53:13 UTC