[Monetdb-developers] adding documents to Monetdb

Jens Teubner jens.teubner at in.tum.de
Thu Mar 16 10:31:17 CET 2006

On Thu, Mar 16, 2006 at 09:41:35AM +0100, Fabian Groffen wrote:

> I have been pointed at a possibility that I didn't know the existence
> of: the doc(url) function in XQuery.  This function, called from
> XQuery mode, should do the same like shred_doc() from the command
> line.  However, it wants an URL as argument, so it is impossible to
> load a string or stream from the client.

The XQuery fn:doc() function does almost the same as (the MIL procedure)

The MIL procedure shred_doc() is meant to *persistently* store XML
documents in the MonetDB repository and at the same time give them an
alias for easy reference via fn:doc() in XQuery expressions.

Whenever MonetDB/XQuery encounters an URI as the argument to fn:doc()
that is *not* an alias for a persistent document, it will shred that
document on the fly before the actual query execution starts.  Such
documents will be *cached* in the MonetDB repository for later re-use.
So if you reference an XML document with fn:doc() the first time, the
system might take some time to shred it.  A second call, however, will
re-use the cached version and start query execution immediately.

Both commands, shred_doc() and fn:doc(), by the way, accept URIs as
their input only.

There are basically two differences between cached and persistent

 o Only a limited amount of memory will be reserved for cached
   documents, and "older" documents will be removed from the cache if
   that memory is used up.

 o Upon each access to a cached document, MonetDB will try to figure out
   if the document has changed since caching it.  In particular, it
   verifies file size and timestamp for documents in the local
   filesystem.  (I don't know, actually, what the caching system does
   for documents from the network.)

Swati, I hope this helps for your needs.  As Fabian mentioned, a means
to shred XML documents via XQuery and/or JDBC is on our wishlist.  But
we cannot make any promises on when that wish will come true...



Jens Teubner
Technische Universitaet Muenchen, Department of Informatics
D-85748 Garching, Germany
Tel: +49 89 289-17259     Fax: +49 89 289-17263

Things are pretty mixed up, but I think the worst is over.
                         -- TeX Error Message

More information about the developers-list mailing list