Hey,

Thanks for the quick reply!

I decided to do a simple query using basex:db(), and its results are... odd. Simply performing:
for $doc in basex:db('yourdb')
return $doc
only returns the first document in my database.  I thought maybe the database was corrupt or something, so I tried:
for $doc in /my_root_node
return $doc
And that returned the entire structure of all documents in the database.

Is that the normal functionality of basex:db()?  If so, then I can not iterate through it as per your examples, since it will only see the first document.

--
Ryan Lewis '09
Clarkson University


On Thu, Jul 29, 2010 at 10:42 AM, Michael Seiferle <michael.seiferle@uni-konstanz.de> wrote:
Hi there, 

the most convenient way to identify documents inside collections might be restricting the the query to a single document or a group of documents via matching the document-uri()
for $doc in basex:db('yourdb')
where matches(document-uri($doc),'test.xml')
return $doc
Please note that the document-uri() function only evaluates document-nodes, to test against inner nodes you should use
base-uri($node) instead of document-uri():

for $node in basex:db('yourdb')//child
where matches(base-uri($node),'test.xml')
return $node

As there is no standardized way of handling collections of XML documents we are still looking forward to feedback regarding this issue.

Hope this helps, feel free to ask more otherwise.

Kind regards
Michael

Am 29.07.2010 um 16:29 schrieb cosmotron+basex@gmail.com:

If I add two documents to a BaseX DB, let's say normal.xml and normal2.xml, is there a way to refer to each one individually?

I know about the doc() function, but it looks at the filesystem for their location, rather than in the database itself.

For instance, if I query with this: doc("normal.xml")/name , then I will get an error about normal.xml not being found.

I also tried: basex:db("my-db-name")/doc("normal.xml")/name and received the same error.

Thanks for any help!

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk