Hi Hans-Peter,
Am 11.08.2010 um 10:47 schrieb Hans-Peter Oeri:
Hi!
Please bear with me if I begin asking 'irrelevant' questions again... just trying to learn ;)
there are no irrelevant questions ;-) Anyway I hope my answer is of relevance to you/the list ;-)
AFAIK collections and databases are synonymous in basex.
The difference is subtle, in BaseX a collection is a database containing more than one document node. (Christian might correct me if I am wrong here.)
Now XQuery defines a function fn:collection which returns the WHOLE collection (or database within basex) and that one works fine with me.
In basex's documentation, however, there is an additional function basex:db that: "opens an existing database. An optional pre value can be added to choose a specific database node."
This is correct, it sets the current evaluation context to a specific (document)-node,
Without "pre value" that function does NOT return the WHOLE database, however. Instead it returns only the first document of the collection (at least in my test). So the "pre value" might be optional, but defaults to 1...
which is usually the first document-node inside the collection.
Doesn't this behaviour contradict the (minimal) documentation? One COULD be tempted to interpret the docs as "no pre value -> no node chosen -> whole database"?
This is indeed a little confusing, as I mentioned in another thread [1], there is no concept of files in the xquery data model. We are currently thinking of possibilities to make the db()/collection()/doc() commands a little more conform to what our users are expecting, so all kinds of feedback is very welcome!
Thanks for your mail, hope this clarifies things a little.
Michael
Greets HPO
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
[1] https://mailman.uni-konstanz.de/pipermail/basex-talk/2010-July/000495.html