deleting and updating nodes

Wednesday, 3 October 2012 · 1 message
CM
Cerstin Elisabeth Mahlow3 Oct 2012 19:00 #
Hi, I encountered strange behavior in the GUI (version from September 30 of 7.5 beta): In my database of collected node-ids ('collect'), I had to remove some thousands, because the documents the nodes where referring to in the main database ('DB') had to be removed as well. So I had a database ('remove') with the documents like this:
<list>
<item>abc.xml</item>
<item>def.xml</item>
</list>
And then I used this for the 'collect' database:
for $i in //entry
 let $n := $i/node
 let $d := replace(db:open-id('DB', $n)/base-uri(), 'DB/', '')
 where db:open('remove')//item[text() = $d]
return delete node $i
I tested it (it removed the correct nodes) and then applied it to the whole thing and everything worked fine. In a second step, I deleted the respective texts from the original DB (to be precise, I created a new one without some texts and with whitespace chopping OFF, because the whitespace problem was another issue). And then I have to change the node-ids in my 'collect' database, so I tried this:
for $node in //entry/node
 let $id := data($node)
 let $path := replace(db:open-id('DB', $id)/path(), 'Q\{.*?\}', '*:')
 let $base := replace(base-uri(db:open-id('DB', $id)), 'DB', 'newDB')
 let $newid := xquery:eval(concat('db:node-id(doc("', $base, '")', $path, ')'))
return replace value of node $node with $newid
It worked OKish on my test data: I removed irrelevant nodes first, made a copy and than applied the node-changing. But I got an error message, that some resources would not exist -- the ones I wanted to remove and thus the ones for which no node should be in 'collect' anymore. I created new test data, removed the nodes and immediately applied the changing, and then it worked. For the whole data, I successfully removed the nodes, I thought. And then regardless of using this database or making a copy and using this, I get an error message that a resource would not exist. How can I find out (in the GUI) where exactly the error occurs, i.e., for which $node? In the query info I only see "Stopped at line 1, column 14 in ...xq" Somehow, nodes that should have been deleted seem to still be there. The names of the files I created 'DB' from in the first place included special characters and spaces. The file I list the documents to be removed is a UTF-8 file where the file names appear also with special characters and spaces. Maybe the error is in there: One file name is "Brontë,-Charlotte.xml". Apparently, matching doesn't work. When I list the base-uri the node-ids belong to, I get Brontë,-Charlotte.xml, but the node will not be deleted, so it doesn't match the respective entry in the corresponding list. So how do I deal with this? Best regards Cerstin
-- Dr. phil. Cerstin Mahlow Universität Basel Departement Sprach- und Literaturwissenschaften Fachbereich Deutsche Sprach- und Literaturwissenschaft Nadelberg 4 4051 Basel Schweiz Tel: +41 61 267 07 65 Fax: +41 61 267 34 40 Mail: cerstin.mahlow at unibas.ch Web: http://www.oldphras.net

⚡Generated with XQuery