Hi everyone,


I'm new to MonetDB XQuery and have written a crude Cocoon generator for MonetDB using the example code for the JDBC client from the website.

I am using the latest Bug Fix Release of MonetDB as announced by Sjoerd Mullender on 24-10-2007. When I execute the following query I get an error:



---------------------------------------------------------
let $zz := doc('vogels.xml')//Vogels[data(Dwaalgast) = 'zeer zeldzaam']

return <vogeltjes>{$zz}</vogeltjes>
---------------------------------------------------------


throws:

java.sql.SQLException: ERROR:
ERROR: XML Generation: NULL BAT has a 4415 head, but tail is NULL.
ERROR:
ERROR: xquery_print_result_loop: operation failed.



However, when I change the XQuery to:


---------------------------------------------------------
let $zz := doc('vogels.xml')//Vogels[data(Dwaalgast) = 'zeer zeldzaam']

return <vogeltjes>{$zz}azaz</vogeltjes>
---------------------------------------------------------


everything's OK and I get the proper result. (The previous release threw the same error btw.)



Also, when I join the results from the above query with another table to resolve some codes to code-descriptions, the query takes from 8.5 up to 11 seconds to execute, vs. <1 second for a query without the join. The result is a little over 1Mb in size. The query I use is this:


---------------------------------------------------------
let $zz := doc('vogels.xml')//Vogels[Ecotoop_x0020_nest]

return <vogeltjes>
         {for $vogel in doc('vogels.xml')//Vogels[Ecotoop_x0020_nest],
                 $vc in doc('vogels-code.xml')//Vogels-code[data(Kolomnaam) = 'Ecotoop nest'][data(Code) = $vogel/Ecotoop_x0020_nest]/Codebeschrijving
                    return <vogel>
                                {$vogel/*}
                                {$vc}
                           </vogel>
         }
       </vogeltjes>
---------------------------------------------------------


The latest preview release of eXist handles the join in 3.1 seconds, any ideas on why this join takes almost three times as long?


I have a final question: how do I specify external variables using the JDBC client?


Regards,

Huib Verweij.