Wouter, thanks a lot, your link is very helpful. I changed my function to:
declare updating function foo:addQueueStat($docName as xs:string, $elem as element())
{
do insert $elem as first into doc($docName)/qflex:queueStats
};
Now I am getting !ERROR: updating read-only document
My guess is that documents added through Admin GUI are read-only by default.
Thanks.
Hello Max,
Have a look at the documentation and tutorial:
http://www.monetdb.nl/projects/monetdb/XQuery/QuickTour/index.html
This section of the documentation both provides examples for read-only
queries and for XQUF updates.
Wouter
2009/4/7 Max Fedorov <mfedorov@netflexity.com>:
> Thanks for your reply but this is not the problem.
> I removed my namespace declaration on purpose. Everything validates for me
> in xmlspy.
> Do you have a working example of "count" and "do insert"?
>
> On Mon, Apr 6, 2009 at 6:37 PM, Stefan Manegold <Stefan.Manegold@cwi.nl>
> wrote:
>>
>> Hi Max,
>>
>> I guess the error message explains itself:
>>
>> ========
>> $ cat /tmp/foo.xq
>> --------
>> module namespace foo = "xrpc-test-function";
>>
>> declare function foo:countQueueStats($docName as xs:string) as xs:integer
>> {
>> count(doc($docName)/qflex:queueStats/qflex:queueStat/qflex:queueName)
>> };
>>
>> declare function foo:addQueueStat($docName as xs:string, $myElement as
>> element())
>> {
>> do insert $myElement
>> as last into doc($docName)/queueStats
>> };
>> ========
>> $ pf /tmp/foo.xq
>> --------
>> bad usage of XML namespaces: at (6,60-6,74): unknown namespace in
>> qualified name qflex:queueName
>> # halted in
>> /ufs/manegold/_/scratch0/Monet/Testing/Stable/source/pathfinder/compiler/semantics/ns.c
>> (ns_resolve), line 783
>> ========
>>
>> I.e., namespace "qflex" is (obviously) not defined.
>>
>> Stefan
>>
>>
>> On Mon, Apr 06, 2009 at 04:59:52PM -0400, Max Fedorov wrote:
>> > Hello, please advise why these 2 queries do not work. Samples would be
>> > nice.
>> >
>> > module namespace foo = "xrpc-test-function";
>> >
>> > declare function foo:countQueueStats($docName as xs:string) as
>> > xs:integer
>> > {
>> >
>> > count(doc($docName)/qflex:queueStats/qflex:queueStat/qflex:queueName)
>> > };
>> >
>> > declare function foo:addQueueStat($docName as xs:string, $myElement as
>> > element())
>> > {
>> > do insert $myElement
>> > as last into doc($docName)/queueStats
>> > };
>> >
>> > Thank you!
>>
>> >
>> > ------------------------------------------------------------------------------
>> > This SF.net email is sponsored by:
>> > High Quality Requirements in a Collaborative Environment.
>> > Download a free trial of Rational Requirements Composer Now!
>> > http://p..sf.net/sfu/www-ibm-com
>> > _______________________________________________
>> > MonetDB-users mailing list
>> > MonetDB-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/monetdb-users
>>
>>
>> --
>> | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl |
>> | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ |
>> | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 |
>> | The Netherlands | Fax : +31 (20) 592-4312 |
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by:
>> High Quality Requirements in a Collaborative Environment.
>> Download a free trial of Rational Requirements Composer Now!
>> http://p.sf.net/sfu/www-ibm-com
>> _______________________________________________
>> MonetDB-users mailing list
>> MonetDB-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/monetdb-users
>
>
>
> --
> Max Fedorov
> Netflexity, Ltd.
> tel: 267-408-3699
> fax:888-201-7922
> www.netflexity.com
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> MonetDB-users mailing list
> MonetDB-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-users
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
MonetDB-users mailing list
MonetDB-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/monetdb-users