[Bug 9757] New: Group By Clause: Equivalence: "atomic" is incorrect

http://www.w3.org/Bugs/Public/show_bug.cgi?id=9757

           Summary: Group By Clause: Equivalence: "atomic" is incorrect
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 1.1
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: jmdyck@ibiblio.org
         QAContact: public-qt-comments@w3.org


[Reiterates point #1 from
http://lists.w3.org/Archives/Member/w3c-xsl-query/2009Nov/0075.html (Members
only)]

The definition of "equivalence" begins:
     "Equivalence of two atomic values V1 and V2 is defined..."
However, the word "atomic" is incorrect, because either value might be an empty
sequence, which is not an atomic value.

(I don't think we have a term for "an atomic value or empty sequence".)

(a)
We could simply delete the word "atomic" from the definition. The procedure
would then appear to apply to any two values. (So, e.g. it would say that (1,2)
is not equivalent to itself.) Of course, it would still only be "invoked" with
atomic-or-empty values.

(b)
In addition to deleting "atomic", we could add:
     "where each value is an atomic value or an empty sequence"
to the beginning of the definition.

(c)
Another possibility would be to expand the definition to actually handle any
two values. Note that in both uses of the procedure (in 'group by' clauses and
switch statements), the two values are the result of atomization. So we could
say something like:

     Equivalence of two values V1 and V2 is defined by the following process:
     1. Atomize each value.
     2. If either resulting value is more than one item, error.
     3. [proceed with existing rules]

This would then lead to somewhat briefer wording at the "call points".

(d)
One other possibility (mutually exclusive with (c), I think) occurred to me
when I noticed that the rules for equivalence have a similar shape to those for
'greater-than' in [Order By Clause]. We could possibly merge the two into one
procedure that, given two atomic-or-empty values V1 and V2, returns one of four
findings:
     V1 is-greater-than V2
     V1 is-less-than V2
     V1 is-equivalent-to V2
     V1 is-not-comparable-to V2

It would be nice if XQuery 1.1 didn't have to add yet another way to 
compare two values.
     Value Comparison (involving fn:compare)
     General Comparison (involving "magnitude relationship")
     fn:distinct-values
     fn:deep-equal
     "greater-than" (for order by)
     and now "equivalence" (for group by and switch)
Did I miss any?

[This last bit is similar to Bug 8222, but that suggests merging 'equivalence'
with distinct-values(), whereas this suggests merging 'equivalence' with
'greater-than'.]

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 18 May 2010 07:00:29 UTC