Thanks Dirk and Eliot,
Dirk's suggestion about the WRITEBACK option looks very promising, I'm gonna try it out but I guess it would fit my needs. Update: just tried it and it seems to work also on docs previously imported in a database and retrieved using db:open("DBname", "filename") so that's even better than providing the full path.
I was well aware of the bad performances caused by working outside the optimized basex data model (hard to beat a key-value optimized datastore) but performances are not an issue for my specific application.
Eliot's project sounds also very cool but I think it's a bit too much of an effort for the initial proof-of-concept tests that I have in mind.

Thanks for the great suggestions and timely support... that was FAST :)
Best,
Enea


2016-02-10 13:55 GMT+01:00 <basex-talk-request@mailman.uni-konstanz.de>:
Send BaseX-Talk mailing list submissions to
        basex-talk@mailman.uni-konstanz.de

To subscribe or unsubscribe via the World Wide Web, visit
        https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
or, via email, send a message with subject or body 'help' to
        basex-talk-request@mailman.uni-konstanz.de

You can reach the person managing the list at
        basex-talk-owner@mailman.uni-konstanz.de

When replying, please edit your Subject line so it is more specific
than "Re: Contents of BaseX-Talk digest..."


Today's Topics:

   1. BaseX and Git versioning of XML at the same time (Enea Parimbelli)
   2. Re: BaseX and Git versioning of XML at the same time
      (Dirk Kirsten)
   3. Re: BaseX and Git versioning of XML at the same time
      (Eliot Kimber)


----------------------------------------------------------------------

Message: 1
Date: Wed, 10 Feb 2016 13:33:58 +0100
From: Enea Parimbelli <enea.parimbelli@gmail.com>
To: basex-talk@mailman.uni-konstanz.de
Subject: [basex-talk] BaseX and Git versioning of XML at the same time
Message-ID:
        <CABz3M_P4mWEsG20tws+UiCXoTbzXTEQqzX7-Ew=+kJJq=pZsYg@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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)
1. I create a baseX database from these
2. 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:
1. 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
phone: +39-0382-985057 +39-0382-985981
http://www.labmedinfo.org/people/parimbelli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20160210/56dfd48e/attachment-0001.html>

------------------------------

Message: 2
Date: Wed, 10 Feb 2016 13:49:34 +0100
From: Dirk Kirsten <dk@basex.org>
To: Enea Parimbelli <enea.parimbelli@gmail.com>
Cc: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] BaseX and Git versioning of XML at the same
        time
Message-ID: <56BB31DE.9090302@basex.org>
Content-Type: text/plain; charset="utf-8"

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)
> 1. I create a baseX database from these
> 2. 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:
> 1. 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

--
Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Gesch?ftsf?hrer:
|   Dr. Christian Gr?n, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20160210/bdc2874e/attachment-0001.html>

------------------------------

Message: 3
Date: Wed, 10 Feb 2016 06:54:57 -0600
From: Eliot Kimber <ekimber@contrext.com>
To: <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] BaseX and Git versioning of XML at the same
        time
Message-ID: <D2E08D8B.82EAE%ekimber@contrext.com>
Content-Type: text/plain; charset="us-ascii"

I'm doing the reverse: using git hooks to reflect XML files managed in git
in BaseX, where BaseX serves as a read-only index over the docs.

However, it would be possible to use git's remote API (or the API of a git
server like GitLab or GitHub) to reflect changes made in BaseX back into
your git repo. You wouldn't do it directly from the file system.

My work is part of the DITA for Small Teams project,
http://dita-for-small-teams.org. I'll be speaking about it remotely on
Friday at the BaseX user meetup in advance of the XML Prague conference.

Cheers,

Eliot

----
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com

From:  <basex-talk-bounces@mailman.uni-konstanz.de> on behalf of Enea
Parimbelli <enea.parimbelli@gmail.com>
Date:  Wednesday, February 10, 2016 at 6:33 AM
To:  "basex-talk@mailman.uni-konstanz.de"
<basex-talk@mailman.uni-konstanz.de>
Subject:  [basex-talk] BaseX and Git versioning of XML at the same time

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)
1. I create a baseX database from these
2. 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:
1. 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
phone: +39-0382-985057 <tel:%2B39-0382-985057>  +39-0382-985981
<tel:%2B39-0382-985981>
http://www.labmedinfo.org/people/parimbelli


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20160210/afba6f4b/attachment.html>

End of BaseX-Talk Digest, Vol 74, Issue 14
******************************************