[Monetdb-developers] [XQ] Mixing update/docmgmt/query

Keulen, M. van (Maurice) m.vankeulen at utwente.nl
Tue Mar 18 14:43:56 CET 2008


Hi,

I know that the XQUF prohibits it, but for writing robust functions, it 
is often necessary to mix query and update/docmgmt functionality. Some 
examples:

    * Expression that queries/updates document, but if the document does
      not exist, adds an empty version of it:
      let $name := "foo.xml"
      let $emptydoc := <root/>
      let $doc := if (empty(pf:documents()[.=$name])) then
      (put($emptydoc,$name),$emptydoc) else doc("foo.xml")
      return $doc//bar
    * Expression that adds to a log-file:
      let $log := doc("log.xml")
      let $expr := ...some expression...
      return (do insert <entry>...{$expr}...<entry> as last into $log,$expr)

Each of these patterns gives you a "!type error: err:XUST0101: illegal 
mix of updating and non-updating expressions" error.

Isn't is possible to somehow allow such expressions? It is against the 
standard, so it probably requires some server configuration parameter, 
but it would be really really useful to have it. Mixing queries with 
update/docmgmt is known to cause many semantical problems, but only if 
these updates are visible within the query. Looking at the 
implementation based on pending update lists, then each of these 
patterns is harmless. If you declare that no updates are visible within 
the transaction (which is against the standard), then allowing these 
queries is I guess not hard: it simply means that with updating 
expressions and document management expressions you do return a result.

Another thing I've been thinking about in this context: If I send two 
SOAP-messages to a server on its XRPC-port, am I guaranteed that they 
are served in the same order? I could perhaps, with a lot of duplication 
of code, separate update/docmgmt from a query, i.e., implement these 
things with two requests to the server. I really dislike such a 
solution, though.

Looking forward to comments :-)

Maurice.

-- 
----------------------------------------------------------------------
Dr.Ir. M. van Keulen - Assistant Professor, Data Management Technology
Univ. of Twente, Dept of EEMCS, POBox 217, 7500 AE Enschede, Netherlands
Email: m.vankeulen at utwente.nl, Phone: +31 534893688, Fax: +31 534892927
Room: ZI 3039, WWW: http://www.cs.utwente.nl/~keulen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20080318/1c0d7c53/attachment.html>


More information about the developers-list mailing list