In XQuery,
("foo", "bar") = ("foo", "bar")
yields the value true. That seems obvious. But I noticed that
("foo", "bar") != ("foo", "bar")
also yields true, which I found rather surprising. I know that I can negate = with not($x = $y) and I’ve noticed that = has some kind of set intersection semantics, but can anyone explains the semantics of !=, and/or provide a reference for it?
This can be found in the documentation for XQuery under section “3.5.2 General Comparisons”.
Reading into the reasoning, it reads to me as if the rules of Atomization are to blame here. If the elements are untypedAtomic, then the parser is free to “guess” at how the comparison should be made which allows for the difference in operations based on the elements themselves rather than on any operator behavior.