W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

ORA-FO-253-Q: Suggest changing fn:distinct-values signature back to fn:distinct-values($arg as item()*) as item()*

From: Stephen Buxton <Stephen.Buxton@oracle.com>
Date: 17 Feb 04 12:57:59
Message-Id: <200402172057.i1HKvxG27191@rgmgw5.us.oracle.com>
To: public-qt-comments@w3.org
Cc:

SECTION 15.1.9: fn:distinct-values

The rewritten XQuery use case 1.1.9.4 Q4 is very complicated. It traverses the children of <author> node and applies distinct-values to each of them. 
If this extra complexity is an unavoidable result of the change to
the signature of fn:distinct-values, then we should consider
reverting to:
fn:distinct-values($arg as item()*) as item()*

Q4 (original)
=============
<results>
  {
    for $a in distinct-values(document("bib.xml")//author)
    return
        <result>
            { $a }
            {
                for $b in document("bib.xml")/bib/book
                where some $ba in $b/author satisfies deep-equal($ba,$a)
                return $b/title
            }
        </result>
  }
</results>

Q4 (current)
============
<results>
  {
    let $a := doc("http://bstore1.example.com/bib/bib.xml")//author
    for $last in distinct-values($a/last),
        $first in distinct-values($a[last=$last]/first)
    order by $last, $first
    return
        <result>
            <author>
               <last>{ $last }</last>
               <first>{ $first }</first>
            </author>
            {
                for $b in doc("http://bstore1.example.com/bib.xml")/bib/book
                where some $ba in $b/author 
                      satisfies ($ba/last = $last and $ba/first=$first)
                return $b/title
            }
        </result>
  }
</results> 


- Steve B.
Received on Tuesday, 17 February 2004 15:58:04 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:57 UTC