Bugs item #1887055, was opened at 2008-02-05 15:52
Message generated for change (Settings changed) made by mvankeulen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1887055&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 0.22
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Maurice van Keulen (mvankeulen)
>Assigned to: Jan Rittinger (tsheyar)
Summary: [PF] for variable contains more than one element

Initial Comment:
The attached query fails with
ERROR = !ERROR: err:FORG0005: function fn:exactly-one expects exactly one value.

Lines 104 and 105 is where the error is triggered:
   for $w5 in $ctx4
   let $pw5 := data(exactly-one($w5)/@prob)

Note that the argument to exactly-one is $w5 which is bound by the for just 
above it. So, it should always contain just one element ... but apparently it 
doesn't.

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

Comment By: Maurice van Keulen (mvankeulen)
Date: 2008-02-08 10:24

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

I reduced the query to the one below. It returns a world-element with an
attribute count, which should always be 1 (because it counts the loop
variable). Inside the element is the loop-variable itself, i.e., should be
1 element. Expected result is 12 world elements with each a count of 1 and
inside one world-element, but I get one world with a count of 12 and inside
12 world-elements. Funny thing is that the algebra-version also gets this
one wrong, so perhaps the fault lies somewhere in the XQuery-code stages. 

let $doc := exactly-one(doc("p.xml")//movies)
let $ctx0 := <world prob="1"><nid>{pf:nid($doc)}</nid></world>
let $ctx1 :=
   for $w4 in $ctx0
   for $poss4 in $doc//poss[./director]
   return <world>{$poss4/@prob}</world>
return <bla>{
   for $w5 in $ctx1
   return <world count="{count($w5)}">{$w5}</world>
}</bla>

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

Comment By: Jan Rittinger (tsheyar)
Date: 2008-02-07 18:34

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

Here the for loop seems to be missing. It looks like $ctx4 is directly
bound to $w5.

Again (as in bug report #1886994) the query is too large to say something
useful.

Please provide a smaller example.

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

Comment By: Stefan Manegold (stmane)
Date: 2008-02-07 10:17

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

Jan,

could you please have a quick look, whether this one rings a bell with
you?
Feel free to re-/un-assign in case it's not "your business"...

Thanks!

Stefan


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

Comment By: Maurice van Keulen (mvankeulen)
Date: 2008-02-07 09:23

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

If $ctx is empth, then the for-loop would have no iterations at all. In a
for-loop, the loop variable, in this case $w5, is ALWAYS bound to
exactly-one value or element. I think this bug is related to or may even
have the same cause as my previous one (1886994). The behaviour I see if I
leave out the exactly-one is that $w5 seems to be bound to two elements ...
so I'm even more surprised that it works for you with zero-or-one().

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

Comment By: Stefan Manegold (stmane)
Date: 2008-02-06 19:29

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

Work for me with zero-or-one()!
Is $ctx4 and hence $w5 empty?
Or is "just" exactly-one() broken??


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

Comment By: Stefan Manegold (stmane)
Date: 2008-02-06 19:21

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

Maurice,

did/could you try whether it works with zero-or-one() instead of
exactly-one()?

Stefan


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

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to