Hi all, I've got this strange issue with xdmp:node-delete with a node in the database with Marklogic 8.0-6.3. First when I use xdmp:node-delete on the target node with the above basic script, it works: ------------------------------------------------------------------------ xquery version "1.0-ml"; declare namespace html = "http://www.w3.org/1999/xhtml"; declare namespace l="http://www.oecd.org/ns/lambda/schema/"; import module namespace db = "http://www.oecd.org/ns/lambda/app/lib/db" at "/app/lib/db/db.xqm"; import module namespace exportlib = " http://www.oecd.org/ns/lambda/app/lib/export" at "/app/lib/export/export.xqm"; declare variable $keyName-parent-toc-info as xs:string := 'parent-toc-info'; let $rid := 'urn:oecd.org:publications:id:expression:g2g12781' let $doc := fn:doc(db:get-uri-by-rid($rid))/l:expression return ( (: display parent node before child node deletion :) $doc/l:exportChannels/l:exportChannel[@href = $exportlib:channel-rid-i2])/l:precomputedValues ,xdmp:node-delete($doc/l:exportChannels/l:exportChannel[@href = $exportlib:channel-rid-i2])/l:precomputedValues/l:precomputedValue[@key = $keyName-parent-toc-info] ) ------------------------------------------------------------------------ The node 'l:precomputedValues[l:precomputedValue[@key = $keyName-parent-toc-info]]' is removed from document in database
But if I try to do it in the following script (the real script), it does not work: 1- I populate a map $mapA with ids of eligible documents based on a sem:sparql query using a sem:store constructor 2- I populate a map $mapB with ids of larger set of documents based on a sem:sparql query using a sem:store constructor with a cts:element-attribute-value-query on the element to be deleted (cts:element-attribute-value-query (xs:QName('l:precomputedValue'),xs:QName('key'), $keyName-parent-toc-info)) among other cts:query constructor 3- Then I create a 3rd map based on the difference of the two maps ($mapB - $mapA) 4- I loop over this map of ids to get the uri of the document, then the document with fn:doc(), then I get the element l:precomputedValues to be deleted with an Xpath (the same as in the basic script) 5- It never works on Oxygen using an xdbc connection on ML db or event in Qconsole. There is no error, it takes a while and I've got nothing in the error log (even with the finest setting). When I launch the profiler on Qconsole, here the message I get at the end : [1.0-ml] XDMP-CAST: (err:FORG0001) xs:unsignedLong($d div xs:dayTimeDuration("PT0.000001S")) -- Invalid cast: -178609914.9 cast as xs:unsignedLong I confirm: - the node to be deleted is in the db not an on-the-fly constructed node - the id used in the first successful script comes from the final map in second script. This final map is populated with correct and real document ids. Any help is appreciated Lanz
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general