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

Incorrect Intersect and Except Output?

Wei, Alice J. ajwei at indiana.edu
Sun Mar 30 20:33:30 PST 2008


  Incorrect Intersect and Except Output?
Hi, Michael:

   Yes, I admit that I have not grasped this.
   According to what you said, are you implying that it is not even possible to even do an "outer-join" to produce the output from

  let $a := <a><b>1</b><b>2</b><b>3</b></a>,
      $b :=<c><b>What</b><b>2</b><b>3</b><b>4</b></c>
return
 <foo>{(($a/b union $b/b) except ($a/b except $b/b))}</foo>

to something like:

<foo>
<b>What</b>
<b>1</b>
<b>4</b>
</foo>?

Thanks a lot for your help.
======================================================
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
http://x-query.com/mailman/listinfo/talk
________________________________________
From: Michael Kay [http://x-query.com/mailman/listinfo/talk]
Sent: Sunday, March 30, 2008 7:23 PM
To: Wei, Alice J.; 'Jonathan Robie'
Cc: http://x-query.com/mailman/listinfo/talk
Subject: RE:  Incorrect Intersect and Except Output?

No, you haven't grasped it.

let $a1 := <a/>, $a2 := <a/> return count(($a1, $a2))

returns 2. Thats because the two <a/> nodes are DIFFERENT - they have
different identity because they were created separately. The same logic
applies to intersect and except.

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

> -----Original Message-----
> From: http://x-query.com/mailman/listinfo/talk
> [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of Wei, Alice J.
> Sent: 31 March 2008 00:09
> To: Jonathan Robie
> Cc: http://x-query.com/mailman/listinfo/talk
> Subject: RE:  Incorrect Intersect and Except Output?
>
> Hi, Jonathan:
>
>   I think I understand what you mean by having different
> nodes in the both sets I have indicated. However, since
> <b>2</b><b>3</b> are co-shared between the two sets, this
> means that I have to go around by doing something like
>
> let $a := <a><b>1</b><b>2</b><b>3</b></a>, $b :=
> <c><b>What</b><b>2</b><b>3</b><b>4</b></c>
> return
> <foo>{(($a/b union $b/b) except ($a/b except $b/b))}</foo>
>
> Output:
>
> <foo>
> <b>What</b>
> <b>2</b>
> <b>3</b>
> <b>4</b>
> </foo>
>
> This is not exactly what I desired, but are you saying that I
> have to use union joins and combine it with other operators
> for the output? And, how can I get rid of the
> <b>2</b><b>3</b> and switch it with <b>1</b>?
>
> Thanks for your help.
>
> Alice
> ======================================================
> Alice Wei
> MIS 2008
> School of Library and Information Science Indiana University
> Bloomington http://x-query.com/mailman/listinfo/talk ________________________________________
> From: Jonathan Robie [http://x-query.com/mailman/listinfo/talk]
> Sent: Sunday, March 30, 2008 1:45 PM
> To: Wei, Alice J.
> Cc: http://x-query.com/mailman/listinfo/talk
> Subject: Re:  Incorrect Intersect and Except Output?
>
> Wei, Alice J. wrote:
> > let $a := <a><b>1</b><b>2</b><b>3</b></a>, $b :=
> > <c><b>What</b><b>2</b><b>3</b><b>4</b></c>,
> > return
> > <foo>{$a except $b}</foo>
> >
> > brings
> >
> > <foo>
> > <a>
> > <b>1</b>
> > <b>2</b>
> > <b>3</b>
> > </a>
> > </foo>
> >
>
> Except tests for node identity (you seem to expect it to test
> the node values). If none of the nodes in $a are also in $b,
> then $a except $b is the same as $a.
>
> > If I use $a intersect $b, it brings me an empty node <foo/> Isn't
> > intersect supposed to bring back what is contained in $b and $a?
> >
>
> Yes, but there are no nodes in $b that are also in $a, and vice versa.
>
> Jonathan
>
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk




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.