Hi Enea,
I think your best fit is to use the WRITEBACK option (see http://docs.basex.org/wiki/Options#WRITEBACK). Instead of creating BaseX databases you then should simply query the files within your filesystem (e.g. by using doc()) - So basically want you propose yourself in question 4.
There is no connection in the way you propose in question 3, incoming data should not be connecting to a database in the way you describe here.
One option might be to use BaseX WebDAV capabilities and sync the XML files, but I guess the filesystem option is more convenient. But please note: Of course operations will be significantly slower on the file system than on importet database documents, as the storage format BaseX uses internally is highly optimized for performance.
Cheers Dirk
On 02/10/2016 01:33 PM, Enea Parimbelli wrote:
Dear all, I'm Enea from Italy (working at the university of Pavia) and this is my first email to this list and I hope you'll forgive my dumb question. For one of my projects I was planning to use BaseX to be able to run Xqueries to manipulate a bunch of XMLs that I have on my filesystem (i.e. to take advantage of what XQuery can do vs manual editing of the xml files). At the same time I would like to have a version control system (Git in my case) control my files to be able to diff, branch, revert changes etc. However the way BaseX internally stores files is preventing me from doing this easily.
Here is an example of what I have in mind: 0. I have a bunch of xmls in a folder (versioned with a git repo)
- I create a baseX database from these
- Run a bunch of updates/edits on the files using Xquery processor
from basex 3. move back to git to diff what I've accomplished, commit, etc. 4. (possibly more advanced, not sure if I really need this) I want to be able to checkout a previous version of the files and have basex do the same (i.e. if I run a query now I want it to run on the version of the xmls that I have currently checked-out in my filesystem)
Here are the (dumb) questions:
- Is there a way for basex (maybe some config settings when I create
the database?) to work keeping on the plain xml files? In a way that every update query would actually change the original xml files (which I can view with a plain text editor even "outside" the basex environment)? 2. Is the only way of immediately seeing the changes I made to the xml files to export the database after every update? 3. (assuming 1 is doable) Would it be possible to have baseX recognize the changes made to the xml files using an external editor (i.e. not through xqueries run in basex)? 4. From your experience is BaseX the proper tool for my purposes? It feels to me that I merely want to use its xquery processor capabilities (and I don't need the full-fledged database) while keeping the files plainly stored in my filesystem... any suggestion on alternative options if baseX doesn't sound like the right one?
Thanks in advance for the help, and congratulations on the great work (I used basex in the past in a more orthodox way and was impressed by the numerous nice features... including being the nice GUI and the hassle-free integration with tomcat!)
Best regards, Enea Parimbelli
-- Dr. Enea Parimbelli Post-doctoral research fellow Laboratory for Biomedical Informatics "Mario Stefanelli" Department of Electrical, Computer and Biomedical Engineering University of Pavia, Italy e-mail: enea.parimbelli@gmail.com mailto:enea.parimbelli@gmail.com phone: +39-0382-985057 tel:%2B39-0382-985057 +39-0382-985981 tel:%2B39-0382-985981 http://www.labmedinfo.org/people/parimbelli