2

I am trying to use exist-db for versioning purpose. Is there any way to list the differences?

I enabled versioning in exist-db and uploaded an json file and made some changes to the file. Now there are two versions of files available under versions. How can i get/list the difference between the two versions

nessy hamsa
  • 185
  • 1
  • 12
  • 1
    You didn’t provide any closer description of your scenario. Did you tried the [official documentation](http://exist-db.org/exist/apps/doc/versioning.xml)? – Honza Hejzl Feb 16 '16 at 10:19
  • 1
    I enabled versioning in exist-db and uploaded an json file and made some changes to the file. Now there are two versions of files available under versions. How can i get/list the difference between the two versions – nessy hamsa Feb 18 '16 at 09:31
  • 1
    In the documentation, under **Checking versions through the admin webapp**, there is stated: _This part of the documentation does not reflect the current state of the software. The old HTML admin interface has been removed meaning that the versioning panels mentioned in the documentention below are removed too._ It seems there could be an option how to do this but no one except devs knows how. I guess the new version of eXist will be released in a few days. Then we may see how this was rewritten (hope it will be clear then!). If no, I will try to ask devs directly. – Honza Hejzl Feb 18 '16 at 09:43
  • 1
    @Honza Hejzl thanks for the reply, I saw that old html interface is removed in the current version, but they did n't mentioned how to get the difference in the current version. – nessy hamsa Feb 18 '16 at 10:25

1 Answers1

1

There is an XQuery module in the "versioning" prefixed namespace that allows you to perform various queries over versions.

The versioning module was removed from the eXist codebase after eXist 2.2 as it was found to contain GPL licensed code, which is incompatible with eXist's LGPL license.

The code for the versioning module can now be found here: https://bitbucket.org/zwobit/versioning/src/7e177a5f3cf8ad6980a502eb5a0c20cf136e7a7c/src/main/java/org/exist/versioning/xquery/?at=develop

If you look at the versioning.xqm, DiffFunction.java and PatchFunction.java, you can see the functions that are available for you to call from XQuery.

As far as I recall though, you cannot get a diff between JSON documents as eXist only provides diffs for XML documents. Instead the versioning module treats the JSON documents as binary, and therefore immutable, each change to the document generates an entirely new document (which may be what you need).

There is nothing to stop you invoking GNU diff from XQuery (via the process module) and passing both JSON documents through it.

adamretter
  • 3,885
  • 2
  • 23
  • 43