[Monetdb-developers] trying to use monetdb pathfinder

Arjen P. de Vries Arjen.de.Vries at cwi.nl
Thu Feb 8 19:14:07 CET 2007


Hi all,

My real question is how to remove the added document from the system.
pf:delete-doc does not seem to exist (?)

My second question is how one could have known that the shred_doc interface is
deprecated? It is not mentioned on the web, and I cannot even find a test using pf:add-doc... maybe I am looking in the wrong place for documentation?

Cheers,

Arjen

| On Mon, Feb 05, 2007 at 09:08:59PM +0100, Martijn Faassen wrote:
| 
| > First, I was testing the xquery support. I tried to shred a document
| > like this:
| > 
| > shred_doc('/home/faassen/xml/shaks/hamlet.xml', 'hamlet')
| 
| shred_doc() is actually a deprecated interface to MonetDB/XQuery's
| document management.  In the meantime we integrated document management
| into the query language itself, so you will no longer need to work with
| MIL for the document management and XQuery for the queries.
| 
| The recommended way to load documents into MonetDB/XQuery is now the
| (XQuery) function pf:add-doc():
| 
|  pf:add-doc (URI, alias)    -> load document from URI and store it under
|                                the name alias (similar to shred_doc())
| 
|  pf:add-doc (URI, alias, coll) -> same, but add document to the
|                                   collection coll
| 
|  pf:add-doc (URI, alias, pct) -> leave pct % free space for future
|                                  updates
| 
| The latter two variants can have performance advantages depending on
| your scenario.
| 
| Note that if you want to use shred_doc() in MIL, you need to specify
| both arguments as MIL strings, i.e., in double quotes.
| 
| > doc('/home/faassen/xml/shaks/hamlet.xml')//FM
| > 
| > and this gets a step further (still wondering why the former didn't 
| > work, though):
| > 
| > MAPI  = monetdb at localhost:50000
| > QUERY = doc('/home/faassen/xml/shaks/hamlet.xml')//FM
| > ERROR = !ERROR: I/O warning : failed to load external entity "play.dtd"
| >          !ERROR: [shred_url]: 1 times inserted nil due to errors at 
| > [...]
| > 
| > The play.dtd is in the directory next to 'hamlet.xml', so don't know why 
| > that doesn't work either.
| 
| Sorry, I currently don't know what could have gone wrong here.  Anyone
| else on the list can give an answer?
| 
| MonetDB/XQuery, by the way, uses DTDs to know about ID and IDREF
| attributes.  The id() and idref() functions will only be supported if ID
| and IDREF attributes have been declared in the DTD.  (Also, an
| additional index will be created to efficiently back id() and idref().)
| 
| > Next, I was trying out the xquery update support. Not hindered by any 
| > knowledge on how it works, I went to the referenced W3C document and 
| > adapted the first insert statement I saw there into this:
| > 
| > do insert <year>2005</year>
| >    after fn:doc('/home/faassen/xml/shaks/hamlet2.xml')/PLAY/TITLE
| > 
| > This however gives me an error message I do not understand:
| > 
| > MAPI  = monetdb at localhost:50000
| > QUERY = do insert <year>2005</year>
| >            after fn:doc('/home/faassen/xml/shaks/hamlet2.xml')/PLAY/TITLE
| > ERROR = !type error: no variant of function upd:insertAfter accepts the 
| > given argument type(s): element TITLE { item* }*; (node* | node)*
| >          !type error: maybe you meant:
| >          !type error:   upd:insertAfter (node, node*) as stmt
| >          !type error: illegal arguments for function upd:insertAfter
| 
| The problem is that the expression `fn:doc(...)/PLAY/TITLE' could
| evaluate to a list of nodes.  The `do insert ... after ...' clause,
| however, is only allowed for single nodes as the target expression.
| 
| The Pathfinder XQuery compiler does static type checking.  And if your
| query is not type-safe it will be rejected.  If you are sure that your
| path evaluates to exactly one node, you can tell that to the compiler
| and it will (at least it should ;-)) accept your query:
| 
|   do insert ...  after exactly-one (fn:doc (...)/PLAY/TITLE)
| 
| Other way to make sure that the target expression evaluates to exactly
| one node include
| 
|   for $n in fn:doc (...)/PLAY/TITLE return
|     do insert ... after $n
| 
| I hope I could help you a bit.  Don't hesitate to ask again.
| 
| Jens
| 
| -- 
| Jens Teubner
| Technische Universitaet Muenchen, Department of Informatics
| D-85748 Garching, Germany
| Tel: +49 89 289-17259     Fax: +49 89 289-17263
| 
|                  XQuery processing at the speed of light: MonetDB/XQuery
|        http://www.monetdb-xquery.org/  http://www.pathfinder-xquery.org/
| 
| -------------------------------------------------------------------------
| Using Tomcat but need to do more? Need to support web services, security?
| Get stuff done quickly with pre-integrated technology to make your job easier.
| Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
| http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
| _______________________________________________
| Monetdb-developers mailing list
| Monetdb-developers at lists.sourceforge.net
| https://lists.sourceforge.net/lists/listinfo/monetdb-developers
| 




More information about the developers-list mailing list