[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Deep-equal between sequences

Ronald Bourret rpbourret at rpbourret.com
Wed Jul 11 00:38:54 PDT 2007


  Deep-equal between sequences
Hello,

I have two sequences that I would like to compare. The sequences are 
composed of elements and the comparison is true if any member of the 
first sequence is deep-equal to any member of the second sequence. 
(Essentially, I want to do an = operation, but using deep-equal rather 
than atomic equality.)

Can anybody think of a way to do this comparison with the = operator? 
This would give the query engine the chance to optimize the comparison, 
or at least to end the comparison early if a match was found. The 
problem is somewhat simplified by the fact that the definition of the 
elements is <!ELEMENT A (A1, A2)>.

Note that the following is not sufficient:

    let $firstSeq := ...
    let $secondSeq := ...
    return
       if (($firstSeq/A1 = $secondSeq/A1) and
           ($firstSeq/A2 = $secondSeq/A2)
       then fn:true()
       else fn:false()

The problem with this is that it returns true if any pairs of A1 and A2 
match, while I require that an A1 and A2 with the same parent in the 
first sequence match an A1 and A2 with the same parent in the second 
sequence.

Barring use of the = operator, is there a simple solution to this 
problem that would allow the engine to stop processing on the first 
match, rather than performing n x m deep-equal comparisons and searching 
the resulting sequence for an instance of true?

Thanks in advance,

-- Ron



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.