I am contemplating using BaseX from a web application using the Java API. I plan to use it, among other things, to store some information on the users of the site. Someone coming in to the application would be asked to identify themselves, probably with an email address. Based on the address, I would find a record stored in BaseX and possibly edit the record.
So my question is: would it be better to have a collection of small XML documents, one to each user; or does BaseX provide the concurrent access control to allow me to have one document with any number of user records?
Second question: I seen in the Java API examples how to create a new database, but I don't see an easy way to check if a database exists. Does that mean, then, that I should create the databases beforehand and then assume they exist inside my application?
My apologies in advance, since I am sure these question have been asked before. The list archive search function on the BaseX site is not working.
Dear Garey,
would it be better to have a collection of small XML
documents, one to each user; or does BaseX provide the concurrent access control to allow me to have one document with any number of user records?
the transaction management of BaseX will ensure that there won't be any conflicts while performing updates, no matter how many collections/databases you use for your data. Size matters, however: if a single collection is expected to occupy several gigabytes, it's often wise to split it up into several database instances to speed up querying and indexing.
Second question: I seen in the Java API examples how to create a new
database, but I don't see an easy way to check if a database exists. Does that mean, then, that I should create the databases beforehand and then assume they exist inside my application?
Exactly; as most XQuery functions assume that the processed databases already exist, the usual approach is to first create databases and access them after that. If you want to check if a database exist, you can e.g. use the LIST command, db:list(), or db:open(), surrrounded by a try/catch statement in XQuery.
My apologies in advance, since I am sure these question have been asked
before. The list archive search function on the BaseX site is not working.
No problem, your questions are always welcome. I've updated the mailing list links to point to the Mail Archive, which will be frequently updated [1].
Christian
[1] http://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/
Christian -
Thank you for your kind response, although I remain uncertain about the first question. Suppose that I had the requirements that a database needed to allow concurrent access of many users for read/update. For this purpose, would it be better to have a collection of small XML documents or would one large XML document work?
In other words, how does the concurrent update of one large XML document perform?
Garey
On 9/24/2012 6:27 PM, Christian Grün wrote:
Dear Garey,
would it be better to have a collection of small XML
documents, one to each user; or does BaseX provide the concurrent access control to allow me to have one document with any number of user records?
the transaction management of BaseX will ensure that there won't be any conflicts while performing updates, no matter how many collections/databases you use for your data. Size matters, however: if a single collection is expected to occupy several gigabytes, it's often wise to split it up into several database instances to speed up querying and indexing.
Second question: I seen in the Java API examples how to create a new
database, but I don't see an easy way to check if a database exists. Does that mean, then, that I should create the databases beforehand and then assume they exist inside my application?
Exactly; as most XQuery functions assume that the processed databases already exist, the usual approach is to first create databases and access them after that. If you want to check if a database exist, you can e.g. use the LIST command, db:list(), or db:open(), surrrounded by a try/catch statement in XQuery.
My apologies in advance, since I am sure these question have been asked
before. The list archive search function on the BaseX site is not working.
No problem, your questions are always welcome. I've updated the mailing list links to point to the Mail Archive, which will be frequently updated [1].
Christian
[1] http://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/
Thank you for your kind response, although I remain uncertain about the
first question. Suppose that I had the requirements that a database needed to allow concurrent access of many users for read/update. For this purpose, would it be better to have a collection of small XML documents or would one large XML document work?
Currently, all write operations in BaseX are performed one after another, no matter where the data will be stored. We are working on a database-wide locking solution – which is a little bit tricky, because a single XQuery expression can be used to address one or more databases at the same time.
Some more details on our transaction management are found in our documentation:
http://docs.basex.org/wiki/Transaction_Management
Hope this helps; feel free to ask for more, Christian
On 9/24/2012 6:27 PM, Christian Grün wrote:
Dear Garey,
would it be better to have a collection of small XML
documents, one to each user; or does BaseX provide the concurrent access control to allow me to have one document with any number of user records?
the transaction management of BaseX will ensure that there won't be any conflicts while performing updates, no matter how many collections/databases you use for your data. Size matters, however: if a single collection is expected to occupy several gigabytes, it's often wise to split it up into several database instances to speed up querying and indexing.
Second question: I seen in the Java API examples how to create a new
database, but I don't see an easy way to check if a database exists. Does that mean, then, that I should create the databases beforehand and then assume they exist inside my application?
Exactly; as most XQuery functions assume that the processed databases already exist, the usual approach is to first create databases and access them after that. If you want to check if a database exist, you can e.g. use the LIST command, db:list(), or db:open(), surrrounded by a try/catch statement in XQuery.
My apologies in advance, since I am sure these question have been
asked before. The list archive search function on the BaseX site is not working.
No problem, your questions are always welcome. I've updated the mailing list links to point to the Mail Archive, which will be frequently updated [1].
Christian
[1] http://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/
-- Garey Mills Library Systems Office UC Berkeley
basex-talk@mailman.uni-konstanz.de