Hi Anupam,
here is one way..
let $db := 'project1' for $doc in db:open($db) let $name := replace(document-uri($doc), '^.*?/', '') where xs:integer($arr[4]) <= 4000 return db:delete($db, $name)
..here is another..
for $path in db:list('project1')[tokenize(., '/')[4] <= 4000] return db:delete('project1', $path)
Christian ___________________________
On Mon, Jun 4, 2012 at 10:37 AM, Anupam Bakshi bakshia@yahoo.com wrote:
Hello, As a workaround, I'm storing the date in the path itself (4th token). I need to delete some paths based on a condition, however, nothing gets deleted.
for $doc in collection('project1') return document-uri($doc)
project1/RESULT/SOURCEID2/1000/filename1 project1/RESULT/SOURCEID2/2000/filename1 project1/RESULT/SOURCEID3/3000/filename1 project1/RESULT/SOURCEID3/4000/filename2 project1/RESULT/SOURCEID3/5000/filename3 project1/RESULT/SOURCEID1/1000/filename1
for $doc in collection('project1') let $arr := tokenize(document-uri($doc), '/') where xs:integer($arr[4]) <= 4000 return delete node $doc (: db:delete('project1', document-uri($doc)) :)
I tried both "delete node" and "db:delete" but none seem to delete the paths. Can someone give me some pointer about what I might be doing wrong?
Thanks, Anupam
From: Christian Grün christian.gruen@gmail.com To: Anupam Bakshi bakshia@yahoo.com Cc: BaseX basex-talk@mailman.uni-konstanz.de Sent: Sunday, June 3, 2012 8:48 AM
Subject: Re: [basex-talk] Apparant discrepancy in collection and db:list
Hi Anupam,
It seems that db:list-details() shows the same "modified-date" attribute for all resources in a database which is same as the last-modified time of any of the paths.
this is because the modification time is currently not stored for each single resource. It may change in a future version (this could be aligned with the constraint that a document with a specific path can only be stored once).
Christian
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk