[Monetdb-developers] Data type of the text() nodes

Ying Zhang Y.Zhang at cwi.nl
Fri Jun 1 17:14:46 CEST 2007


Hello,

I'm having a problem with the data type of text() nodes in XRPC
implementation.  

---------------------------
module function definition:
---------------------------
module namespace foo = "xrpc-test-function";

declare function foo:q2($strs as xs:string*) as node()*
{
    for $s in $strs
    return <bar>{$s}</bar>
};

-----------
test query:
-----------
import module namespace test = "xrpc-test-function"
                at "/ufs/zhang/max-nr-params/xrpc-mod.xq";

let $hello := <hello>
                <lang>en</lang>
                <lang>nl</lang>
              </hello>
let $lang := $hello/lang/text()
return execute at {"localhost"} {test:q2($lang)}
-------------------------------------------------------------

I got the error "function could not be resolved" when I run the
XRPC query above.  The reason is that all items in the sequence $lang
have the type U_A (xs:untypedAtomic), and they are marshalled in the
XRPC req. msg as, for example:
    <xrpc:atomic-value xsi:type="xs:untypedAtomic">en</xrpc:atomic-value>

At the server side, the values are unmarshalled and assigned the type
U_A again.  So far, the values are handled correctly, IMHO.

But then problem happens, namely, when the server calls the function
'xquery_sig_match' (in pathfinder.mx), it concludes that
xs:untypedAtomic is not a sub-type of xs:string, hence, the function
signature can not be resolved.

This error does not occur if the function 'q2' is called without XRPC.
So, what is the trick of pathfinder to match the signature?   Is
xs:untypedAtomic just treated the same as xs:string?

The easiest solution of my problem is to just marshall an
xs:untypedAtomic as an xs:string, but if someone has better suggestions,
I would like to know.

Thanks a lot!

Regards,

Jennie




More information about the developers-list mailing list