This repository holds the for the eXist-db XQuery Versioning extension module.
Building requires that you have Java JDK version 8 and Maven 3 installed.
$ https://www.github.com/exist-db/xquery-versioning-module.git
$ mvn package
You will then find a file named similar to target/xquery-versioning-module-1.0.xar
.
<collection xmlns="http:https://exist-db.org/collection-config/1.0">
<triggers>
<trigger event="create,update,delete"
class="org.exist.versioning.VersioningTrigger">
<parameter name="overwrite" value="no"/>
</trigger>
</triggers>
</collection>
Namespace URI: http:https://exist-db.org/xquery/versioning
Namespace Prefix: versioning
Class: org.exist.versioning.xquery.VersioningModule
-
To find the differences between two nodes:
versioning:diff($a as node(), $b as node()) as node()
-
To apply a patch to a node:
versioning:patch($node as node(), $patch as node()) as item()
-
To annotate a node:
versioning:annotate($node as node(), $patch as node()) as item()
Namespace URI: http:https://exist-db.org/versioning
Namespace Prefix: v
file: versioning.xqm
-
Return all revisions of the specified document as a sequence of xs:integer revision numbers in ascending order:
v:revisions($doc as node()) as xs:integer*
-
Return all version docs, including the full diff, for the specified document:
v:versions($doc as node()) as element(v:version)*
-
Restore a certain revision of a document by applying a sequence of diffs and return it as an in-memory node:
v:doc($doc as node(), $rev as xs:integer?) as node()*
-
Apply a given patch on a document:
v:apply-patch($doc as node(), $diffs as element(v:version)*)
-
For the document passed as first argument, retrieve the revision specified in the second argument. Generate a diff between both version, i.e. HEAD and the given revision:
v:diff($doc as node(), $rev as xs:integer) as element(v:version)?
-
Return an XML document in which all changes between
$rev` and
$rev - 1` are annotated.v:annotate($doc as node(), $rev as xs:integer)
-
Check if there are any revisions in the database which are newer than the version identified by the specified base revision and key:
v:find-newer-revision($doc as node(), $base as xs:integer, $key as xs:string) as element(v:version)?
-
Returns an XML fragment showing the version history of the document to which the specified node belongs. All revisions are listed with date and user, but without the detailed diff:
v:history($doc as node()) as element(v:history)