[sc34wg3] TMQL: Operators "Not equal"
G. Ken Holman
gkholman at CraneSoftwrights.com
Fri Oct 26 13:23:13 EDT 2007
At 2007-10-26 17:22 +0200, Lars Heuer wrote:
>The current draft lacks of a not equal operator, like "!=". Is that
>A not equal operator is quite handy even if
> not(1.0 = 2.0)
Thinking about parallels in XSLT/XQuery, the two above are not
equivalent when dealing with the results of a query, and may be also
true when thinking about TMQL.
Consider $a being a node set that is non-empty, $b a node set that is
empty, and $c being a scalar value. The node set could be created by
any means, but say it is the result set of a query.
The result of a comparison involving node sets is initialized to
false and then the processor tests each member of the node set
against the other operand, and as long as the test evaluates to false
the checking continues. As soon as any comparison evaluates to true,
the return of the comparison is true.
The test "$a != $c" returns true if any value in $a is not equal to $c.
The test "not( $a = $c )" returns true only if none of the values of
$a are equal to $c.
The test "$b != $c" returns false because there are no nodes.
The test "not( $b = $c )" returns true because there are no nodes.
So, when dealing with sets, the assertion that "x!=y" is equivalent
to "not(x=y)" is not true whether or not the node sets are empty. I
suppose they would only be equivalent if the node set were a
singleton (which doesn't really make it a set).
I hope this is considered helpful ... I'm risking jumping into the
middle of a discussion not knowing its background because what I
skimmed this time raised a caution flag that I thought might be meaningful.
. . . . . . . . . . . . . Ken
Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/t/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/t/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
More information about the sc34wg3