Dear Swaminathan,
On Thu, Jan 28, 2010 at 8:48 AM, Swaminathan S swami2@gmail.com wrote:
Hi Christian,
I am will be using BaseX for multiple xml files that are about 1GB size (few million lines of in the file). I will be doing transactions on these BaseX databases in any sequence (For example: an update on databaseA, an update on databaseB, few Queries on databaseC, few updates on databaseB ...).
Could you please give your reply on the following questions:
My questions:
Question 1) Does creating a Collection object (see example below) a costly operation in terms of memory utilization? Also, let Collection collection = database_.getCollection("basex://localhost:1984/databaseName", null, null)
I guess you are using the XML:DB API? Creating a collection should be very cheap (i.e., not take longer than some milliseconds).
Question 2) Suppose I do the following steps in the order given below:
a) create a Collection on the database b) create a XPathQueryService object as below: service = (XPathQueryService) collection.getService( "XPathQueryService", "1.0" ); c) Run Xquery Updates on the database using "Xquery" object of BaseX. d) query the collection created in step a) as follows: ResourceSet resourceSet = service.query("< my query>")
Will my "query" in step d) be able to see the "updates" made in step c) ? Could you please let me know briefly if there are some concept of "Collection" I need to know.
All database updates will be reflected by subsequent queries. I'm not 100% sure, however, what you refer to with the "Xquery" object? The usual approach to perform queries with the XML:DB API is to call the query() method:
XPathQueryService.query(query);
..see also
http://basex.org/code.php?code=XMLDBQuery
Question 3) When I do an Xquery on an invalid xpath (or do xPathQueryService.query() on an invalid xpath), BaseX is not throwing an exception. Our application would need this functionality. Could you please give your comments on this?
Well, it depends on what you call "invalid". As long as an XPath query is correct, according to the language specification, no errors will be thrown. If you use tag names in your location path that do not occur in the original XML document, the query processor cannot guess that this was done by mistake.
Question 4) I have two choices to run queries on BaseX database a) using Xquery object b) using XPathQueryService on a Collection. Could you please let me know which is better and in which scenarios?
So you talk about using our own API vs. the XML:DB API? In general, I would recommend to stick to one single API and not mix them up. Next, we observe that most users end up using our own API and discard XQJ and XML:DB, as these APIs do not come up to all expectations – at least in their current stage.
Hope this helps, Christian
fyi: I've forwarded your e-mail to the basex-talk mailing list.
basex-talk@mailman.uni-konstanz.de