[xquery-talk] Where Clause and XDT:Untyped Issues

Wei, Alice J. ajwei at indiana.edu
Sun Feb 3 17:50:49 PST 2008


Hi, Michael:

   To make sure I am on the same page as you are, are you talking about the compare() function in XQuery? If I use this, would this not mean that I have to know the exact head element to call when I am executing the XQuery?

   As for the error you raised, I tried running the XQuery by using declare boundary-space strip at the prolog section of the XQuery, but it returned me with still two of the same result for every single set that it has found. For the minor differences, could there be others other than whitespace differences within the source?

Thanks for your help.
======================================================
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei at indiana.edu
________________________________________
From: Michael Kay [mike at saxonica.com]
Sent: Saturday, February 02, 2008 7:48 PM
To: Wei, Alice J.; 'Torsten Grust'
Cc: talk at x-query.com
Subject: RE: [xquery-talk] Where Clause and XDT:Untyped Issues

You sent me a sample of the source document off-list, I assume you meant it
to go to the list:

<pb n="29" xml:id="010003-031"/>
        <ad><head><emph rend="bold deepink">Hostess</emph> is back with new
Baseball Cards...to
                    collect and trade with your friends.</head>
        <p><emph rend="bold orange">3 Free Baseball Cards</emph>
        <emph rend="bold">on specially marked boxes of HostessR Snack
                    Cakes.</emph></p>
        <p>A total of 150 cards. Full of facts. Collect 'em. Trade 'em.</p>
        <p>3 full-color cards printed on the bottom of every specially
marked box of
                        Twinkies<emph rend="sup">R</emph>, Cup Cakes, Suzy
Q's <emph rend="sup">R</emph>, and other mmmmmmmm-delicious Hostess<emph
rend="sup">R</emph>  Snacks. </p>
        <note>RHostess. Twinkies and Suzy Q's are registered trademarks of
ITT   Continental Baking Co.
<lb/> Offer expires August 31, 1976</note> </ad>

With this kind of data, I strongly suspect that the reason your attempt to
eliminate duplicates isn't working is that the apparent duplicate ads are
actually different in some minor detail.

Try selecting two ads that you believe to be duplicates and comparing them
using eq.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Wei, Alice J. [mailto:ajwei at indiana.edu]
> Sent: 02 February 2008 22:12
> To: Michael Kay; 'Torsten Grust'
> Cc: talk at x-query.com
> Subject: RE: [xquery-talk] Where Clause and XDT:Untyped Issues
>
> Hi, Michael:
>
>   Thanks, I did not realize that my <head type="main"> and
> <head type="sub"> can bring so many of these relevant errors.
>
>    I have fixed up the code to as follows:
>
> let $ad := fn:collection("xmldb:exist://db/my")//ad
> let $sorted_result:=
> for $doc in distinct-values($ad)
> where contains($ad/head[@type='sub'],'Baseball')
> order by $doc
> return $doc
> for $r at $count in $sorted_result
> let $nodes := $ad[. = $r]
> return
> <ad>
> <statistics>
> Showing Result: {$count} / {count($sorted_result)}
> </statistics> {$nodes} </ad>
>
> This produces no type error issues, but neither does it bring
> back results.
>
> If I  change the where clause to where
> contains($doc,'Baseball'), it brings back something like the
> one in the following:
>
> <ad>
...
> </ad>
> <!--Another duplicate of the <ad>  -->
> </ad>
>




More information about the talk mailing list