basex:db doc inconsistency?
Wednesday, 11 August 2010 · 3 messages
HO
Hans-Peter Oeri11 Aug 2010 10:47 #
Hi!
Please bear with me if I begin asking 'irrelevant' questions again... just trying to learn ;)
AFAIK collections and databases are synonymous in basex.
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."
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...
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"?
Greets
HPOMS
Michael Seiferle11 Aug 2010 11:12 #
Hi Hans-Peter,
Quoted text · Hans-Peter Oeri · 5 lines
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 ;-)
Quoted text · Hans-Peter Oeri · 2 lines
> > 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.)
Quoted text · Hans-Peter Oeri · 8 lines
> > 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,
Quoted text · Hans-Peter Oeri · 5 lines
> > 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.
Quoted text · Hans-Peter Oeri · 4 lines
> > 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
Quoted text · Hans-Peter Oeri · 8 lines
> > Greets > HPO > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
HO
Hans-Peter Oeri11 Aug 2010 11:24 #
Hi!
Quoted text · Michael Seiferle · 3 lines
On 08/11/2010 11:12 AM, Michael Seiferle wrote: > The difference is subtle, in BaseX a collection is a database > containing more than one document node.
Aaaah, then there IS a difference between collections and databases ;)
Quoted text · Michael Seiferle · 1 line
> Thanks for your mail, hope this clarifies things a little.
Very much!
Thanks a lot
HP
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery