[xquery-talk] Grouping without Duplicates Issues

Wei, Alice J. ajwei at indiana.edu
Mon Jan 28 16:42:51 PST 2008

Hi, David:

   I am guessing you are referring to John Snelson's code. I have no issues using that to implement the rest of my code snippets, but I want to extract some more information with the code.
   Without $head in $doc/title added into the picture, I have all my results back, accurately. When I do add this snippet in, which is a small portion of what I wanted to do (I intend to retrieve results that have several contain() or other constraints into my query), I get this error:

Error while evaluating expression: [.......]
 cannot convert value of type xdt:untypedAtomic to a node set [at line 115, column 21] In call to function: sandbox:exec-query(xs:string) [129:10]

The revised query:

let $addresses := fn:collection("xmldb:exist://db/book")//booklist
let $sorted_result:=
   for $doc in distinct-values($addresses),
        $head in $doc/title
   where contains ($title, 'XQuery')
   order by $doc ascending
   return $doc
for $r at $count in $sorted_result
let $nodes := $addresses[. = $r]
       Showing Result: {$count} / {count($sorted_result)}

I had been using this code for a while, which it works, but I think I am having some issues with subqueries. This is why I revised the code to the one you saw in my post, so that it could retrieve something back.
Is this not even a subquery at all?

Thanks for your help.
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei at indiana.edu

More information about the talk mailing list