forcryingoutloud, i meant xdmp:document-rename … Begin forwarded message:
> From: Shannon <[email protected]> > Date: September 2, 2010 1:24:58 PM EDT > To: General Mark Logic Developer Discussion <[email protected]> > Subject: [MarkLogic Dev General] Fwd: local:document-rename > Reply-To: General Mark Logic Developer Discussion > <[email protected]> > > my colleague david just informed me about a correction: i mean to ask, why is > there _no_ xdmp:document-delete function? > > Begin forwarded message: > >> From: Shannon <[email protected]> >> Date: September 2, 2010 1:18:28 PM EDT >> To: General Mark Logic Developer Discussion <[email protected]> >> Subject: [MarkLogic Dev General] local:document-rename >> Reply-To: General Mark Logic Developer Discussion >> <[email protected]> >> >> Thank you, Michael Blakeley, for posting your function: >> >> declare function local:document-rename( >> $old-uri as xs:string, $new-uri as xs:string) >> as empty-sequence() >> { >> xdmp:document-delete($old-uri) >> , >> let $permissions := xdmp:document-get-permissions($old-uri) >> let $collections := xdmp:document-get-collections($old-uri) >> return xdmp:document-insert( >> $new-uri, doc($old-uri), >> if ($permissions) then $permissions >> else xdmp:default-permissions(), >> if ($collections) then $collections >> else xdmp:default-collections(), >> xdmp:document-get-quality($old-uri) >> ) >> , >> let $prop-ns := namespace-uri(<prop:properties/>) >> let $properties := >> xdmp:document-properties($old-uri)/node() >> [ namespace-uri(.) ne $prop-ns ] >> return xdmp:document-set-properties($new-uri, $properties) >> }; >> >> It helped me to reclaim some lost time when I inadvertently renamed all the >> documents in a modules database (warning to all: in OS X Finder, if you add >> a WebDAV-connected folder to the sidebar, and rename the sidebar entry, you >> actually end up renaming the source directory, i.e., all the documents in >> your database!, not the shortcut/alias, which is utterly unexpected >> behavior; to make matters worse, it prefixed "http://" to the URIs which is >> an invalid WebDAV pathname, so the documents appeared to be *deleted* at >> first glance, which was pretty unsettling). >> >> So, thanks, Mike, for helping me to get my app back, and I'm curious, why is >> there an xdmp:document-rename? >> >> Best regards, >> Shannon >> >> _______________________________________________ >> 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
