Dear Aleks,
thanks for your questions:
- What is the concept of the Context ? Do I need to create a new context for every database operation or same context should be used within open database ?
One Context instance should be used for all database operations. It contains a reference to the currently opened database. I would only recommend to create multiple Context instances if you need to open several databases at the same time.
- Is it true that I have to open and close database every time I run query or I can keep database open.
The database will be kept open until you send a Close command, or open another database. The following code snippet might give you some more hints:
http://www.inf.uni-konstanz.de/dbis/basex/code.php?code=DatabaseExample
- How does commit occur, with basex6 it seems like data being committed to disk with some delay?
All modified data is flushed to disk as soon as an XQuery Update expression has been completely processed, so no delays should occur.
Hope this helps, Christian