Bugs item #1637554, was opened at 2007-01-17 11:36
Message generated for change (Comment added) made by mvankeulen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1637554&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PF general
Group: Pathfinder CVS Head
Status: Closed
Resolution: Invalid
Priority: 6
Private: No
Submitted By: Maurice van Keulen (mvankeulen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Duplicates in sequence lookup

Initial Comment:
(milprint_summer version on Suse 9)
The query below selects the first and third element from the sequence $all. On 
each iteration of $i, $all[$i] returns all four elements of $all instead of 
only one. If you replace the $num2 in the for with $num2, the result is correct.

<res>{
let $all:=(<a/>,<b/>,<c/>,<d/>)
   ,$nums1:=(1,3)
   ,$nums:=<nums><num i="1"/><num i="3"/></nums>
   ,$nums2:=$nums/num/@i
for $i in $nums2
return <elem num="{$i}">{$all[$i]}</elem>
}</res>

Intended result:
<res>
  <elem num="1">
    <a/>
  </elem>
  <elem num="3">
    <c/>
  </elem>
</res>

Computed result:
<res>
  <elem num="1">
    <a/>
    <b/>
    <c/>
    <d/>
  </elem>
  <elem num="3">
    <a/>
    <b/>
    <c/>
    <d/>
  </elem>
</res>


----------------------------------------------------------------------

>Comment By: Maurice van Keulen (mvankeulen)
Date: 2007-01-17 14:09

Message:
Logged In: YES 
user_id=654674
Originator: YES

Hmmm ... I should have noticed this. This behaviour of predicates is
awkward. Even "$all[data($i)]" does not work (apparently the effective
Boolean value of a string is also true). Only "$all[$i cast as
xs:integer]" seems to work. Any other (nicer) way to retrieve the integer
value of an attribute?

----------------------------------------------------------------------

Comment By: Torsten Grust (teggy)
Date: 2007-01-17 11:51

Message:
Logged In: YES 
user_id=642632
Originator: NO

Your result is correct in both cases.  Note that $num2 is bound to a
sequence of two *attribute nodes*, not to two xs:integer values.
As a result, in the for-loop $i will be bound to a node and the effective
Boolean value of $i will be 'true'.  That's why $all[$i] returns all nodes
in the $all sequence.

Cheers,
   --Teggy

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1637554&group_id=56967

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to