Jacob, If you are concerned about conflicting updates, there is no reason for that with these three actions. Mike even once submitted a rename function that does basically these three things in one function:
http://markmail.org/message/2e5wu3sqgpiwnu5m Kind regards, Geert > drs. G.P.H. (Geert) Josten Consultant Daidalos BV Hoekeindsehof 1-4 2665 JZ Bleiswijk T +31 (0)10 850 1200 F +31 (0)10 850 1199 mailto:[email protected] http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit e-mailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Michael Blakeley > Sent: vrijdag 13 augustus 2010 22:32 > To: General Mark Logic Developer Discussion > Subject: Re: [MarkLogic Dev General] question about discrete > transactions > > Jakob, I'm curious: why separate transactions? When you first > described the use-case, I expected that you'd want all three > steps in a single transaction. > > thanks, > -- Mike > > On 2010-08-13 09:46, Jakob Fix wrote: > > Hi, > > > > I've created an xquery module called by a document-creation trigger > > that does the following: > > > > 1) copy the original document to another directory > > 2) remove the original document > > 3) add a property to the new document > > > > In order for this to work, I created a function for each task, and > > inside each function I did an xdmp:eval() to make sure that these > > actions are considered independent transactions. Can > someone confirm > > that this is the right approach? Judging from the documentation and > > the fact that it works this seems ok, but I'm kind of > hesitant to use > > eval() all over the place. > > > > Thanks, > > Jakob. > > > > Here's an example for the xdmp:document-insert wrapper function: > > > > declare function local:insert-document( $new-filename as xs:string, > > $doc as document-node() ) as item()* { > > xdmp:eval(" > > xquery version '1.0-ml'; > > declare variable $new-filename as xs:string external; > > declare variable $doc as document-node() external; > > xdmp:document-insert( $new-filename, $doc ) > > ", > > ( > > xs:QName("new-filename"), $new-filename, > > xs:QName("doc"), $doc > > ) > > ) > > }; > > _______________________________________________ > > General mailing list > > [email protected] > > http://developer.marklogic.com/mailman/listinfo/general > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
