Hi Christian,
Thank u so much for the solution its working.
Thanks & Regards Sateesh.A
Christian Grün writes:
Thanks everyone for the feedback. Here�s one more solution:
let $dbname := 'db' let $doc := ( 'doc1.xml', 'doc2.xml' ) ! ($dbname || '/' || .) for $doc in collection($dbname)[document-uri() = $doc] return 'do something'
The $doc variable contains the list of documents, which will be prefixed with the name of the database ($dbname). In the subsequent loop, all documents will be skipped that don't equal the requested document uri.
Hope this helps, Christian ___________________________
On Sat, Sep 8, 2012 at 2:47 PM, Ben Companjen bencompanjen@gmail.com wrote:
Hi Sateesh,
If I understand correctly, the selection criteria are (1) that the name of the document is in a list of document names that you have and (2) that these documents are in a specific collection (in case not all documents in the list are in the collection, you want to check this too).
If your list of document names is also in XML, e.g.
<list> <doc>docname1.xml</doc> <doc>docname2.xml</doc> ... </list> you could use:
let $doclist := document {
<list> <doc>docname1.xml</doc> <doc>docname2.xml</doc> </list> } for $docname in $doclist/list/doc/text() intersect uri-collection("collection") let $doc := doc($docname) (: do something :) return concat("processing...",$docname)
Perhaps you need to make sure that the document names are of type xs:anyURI instead of string, but I suppose you can figure that out :)
Is that what you were thinking of?
Ben
On 8 September 2012 14:12, sateesh sateesh@intense.in wrote:
Hi Huib Verweij,
Thanks for the reply,but I have a small problem with your approach I don't have a criteria with which I can select my required docs with in collection,I get my required doc names from outside and with those names only I need to search the collection.
Thanks & regards Sateesh.A
-----Original Message----- From: Huib Verweij [mailto:hhv@home.nl] Sent: Saturday, September 08, 2012 5:06 PM To: sateesh Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Individual docs from collection
Hi Sateesh,
Op 8 sep. 2012, om 12:27 heeft sateesh het volgende geschreven:
I have created a collection with 10k xml files and now on that collection
I want to write query on few xml's only .could you please suggest how this functionality is achieved.
Thanks & Regards Sateesh.A
what I always do is use an XQuery that selects the documents by some criterium, then process them further, e.g.
for $doc in collection('foo')/rootelement[@type='selectedtype'] let $name := $doc/name (: f.i.: ) etc...
or if you want you can assign the docs to a variable (handy if you want to process the set multiple times f.i.):
let $docs := collection('foo')/rootelement[@type='selectedtype']
Hartelijke groet, Huib Verweij
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk