Hi Marijan,

I'm having an issue with union that I can't seem to see what's wrong. It
> always returns the entire result of both sets of XML but they are
> basically exactly the same.
>

See http://www.w3.org/TR/xquery/#combining_seq .

"All these operators [*including union*] eliminate duplicate nodes from
their result sequences based on node identity"

It means, that the following query returns two nodes:

let $a := <a id='1'/>
let $b := <b id='1'/>
return $a/@id union $b/@id

while:

let $a := <a id='1'/>
return $a/@id union $a/@id

returns one node.

Union operation in XQuery doesn't compare values of nodes (IDs in your
case). There is distinct-values function to remove duplicates by value:

let $l_UnionContent := distinct-values(($l_Content1, $l_Content2))
...

Another issue I found was that $l_Content2 even though sorted (when I
> view the result XML both $l_Content1 and $l_Content2 are ordered exactly
> the same) is out of order when I want to view just the IDs.
>

I've failed to reproduce this issue:

[shcheklein@dhcp-218-16-wifi ~/sedna-3.5.161/bin]$ ./se_term x
Welcome to term, the SEDNA Interactive Terminal. Type \? for help.

x> create collection "c_AlbumsIndividual"&
UPDATE is executed successfully

x> load "./test.xml" "albums" "c_AlbumsIndividual"&

                                                  Bulk load succeeded

x> CREATE INDEX "AlbumsByArtistCollection" ON
collection("c_AlbumsIndividual")/albums/album BY artists/artist/@artistID
AS xs:string&
      UPDATE is executed successfully

x> declare variable $p_Index2 as xs:string := "AlbumsByArtistCollection";

                                                  declare variable
$p_Value2 as xs:string := "artist_709";




       let $l_Content2 := for $l_ContentTemp2 in index-scan($p_Index2,

                                                          $p_Value2, "EQ")
order by number(substring-after($l_ContentTemp2/@id,

                                  'album_')) return $l_ContentTemp2




                                                          return


                                 $l_Content2/@id&

id="album_505"
id="album_506"
id="album_507"
id="album_508"
id="album_509"
id="album_982"
id="album_2476"
id="album_2591"
id="album_2596"
id="album_2599"
id="album_2874"

x> doc('$version')&
<sedna version="3.5" build="161"/>

Ivan Shcheklein,
Sedna Team
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to