Commit 6f95fda0 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

Merge branch 'release/4.0.0'

parents 6ab1554e c2faacb7
......@@ -6,6 +6,7 @@
EXIST_DB: "eXist-db-4.3.1"
- build
- test
......@@ -12,6 +9,8 @@ build-develop:
- master
- tags
- develop
stage: build
- ant
......@@ -35,25 +34,27 @@ installation:
- tags
stage: test
- wget --quiet --output-document=${EXIST_DB}.tar.gz${EXIST_DB}.tar.gz
- tar -xzf ${EXIST_DB}.tar.gz; mkdir ${EXIST_DB}/lib/test
- ant dependencies
- cp build/*.xar ${EXIST_DB}/autodeploy
- bash ${EXIST_DB}/bin/ | tee output.log &
- ant test
- bash test/eXist-db-*/bin/ | tee output.log &
# wait for eXist
- while [ $(curl -I -s http://localhost:8080 | grep -c "200 OK") == 0 ]; do sleep 2s; done
# shutdown eXist
- bash ${EXIST_DB}/bin/
- bash test/eXist-db-*/bin/
- ls -al /tmp; mv /tmp/tests-* . || true
- output.log
- tests-*.xml
- ${EXIST_DB}/webapp/WEB-INF/logs/expath-repo.log
- test/tests-*.xml
- test/eXist-db-*/webapp/WEB-INF/logs/expath-repo.log
junit: test/tests-*.xml
- tags
- develop
- master
stage: deploy
- FILENAME=$(ls build/*.xar)
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
# About SADE
The Scalable Architecture for Digital Editions (SADE) tries to meet the requirement for an easy to use publication system for electronic resources and Digital Editions. It is an attempt to provide a modular concept for publishing scholarly editions in a digital medium, based on open standards. Furthermore it is a distribution of open source software tools for the easy publication of Digital Editions and digitized texts in general out of the box. SADE is a scalable system that can be adapted by different projects which follow the TEI guidelines or other XML based formats.
This is the modified version for Fontane Notizbücher.
# Fontane-Build
* call `ant sade-dist-build` to build the latest supported eXist db and all SADE packages
* run `./dist-utils/antbuild/build/sade/bin/`
* deploy the xar package from `SADE-Project-develop`
* deployment needs approx. 45 min due to republication of all the data. this is because the TEI documents needs to be stored from in memory, anything else will place whitespaces in the rendered xhtml output.
* there is fastdeploy build target that includes all non TEI-Data + Register and a single notebook (C07). deployment needs about 10 min.
* see http://localhost:8080/exist/apps/SADE/textgrid/index.html
## Tests
- [Markdown rendering](http://localhost:8080/exist/apps/SADE/textgrid/content.html?
- [Dokuwiki (w/o reload)](http://localhost:8080/exist/apps/SADE/textgrid/doku.html)
- [Dokuwiki (w reload)](http://localhost:8080/exist/apps/SADE/textgrid/doku.html?id=gesamtdokumentation_ii._tei-header)
- [Image reload](http://localhost:8080/exist/apps/SADE/textgrid/doku.html?id=gesamtdokumentation_iii.3.21&reload)
- [Search](http://localhost:8080/exist/apps/SADE/textgrid/results.html?q=luther)
- [Literaturverzeichnis](http://localhost:8080/exist/apps/SADE/textgrid/literaturvz.html)
- [Register](http://localhost:8080/exist/apps/SADE/textgrid/register.html)
- [Auth on develop (see cookie)](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=)
- [TEI rendering](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=1r)
- [Cover](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=)
- [TBLE](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=60v)
- [single page]()
- [XML-View](http://localhost:8080/exist/apps/SADE/textgrid/xml.html?id=/xml/data/16b00.xml)
- [REST](http://localhost:8080/exist/apps/SADE/textgrid/rest/data/16b00.xml)
This is the modified version for Fontane Notizbücher. It is used together with several other packages (see dependencies) in addition to the TextGrid system.
# Distribution
This package is available via the [DARIAH-DE eXist-repo]( There are two flavors available: «SADE-fontane» (for production) and «SADE-fontane-develop».
# Development
We follow the git-flow.
Find the git repo at [GWDG\`s GitLab](
Use the issue tracker at [GWDG\`s GitLab](
Go for local development with the ant tasks. In addition to the `*.xar` file containing this package all dependencies are loaded via `ant test`. This will place the version of eXist declared in `` and comes with all needed packages.
For a new up and running instance two commands are needed:
ant test &&
bash test/eXist-db-*/bin/
This will result in local instance at [localhost:8080](http://localhost:8080/exist/).
CAUTION: A new build will remove the instance!
# Build from source
`ant` is used as build tool. The standard target will place a `*.xar` file in the build directory.
......@@ -4,8 +4,8 @@ let $params :=
<param name="output" value="backup"/>
<param name="zip" value="no"/>
<param name="backup" value="yes"/>
<param name="incremental" value="yes"/>
<param name="backup" value="yes"/>
<param name="incremental" value="yes"/>
system:trigger-system-task("", $params)
project.title=[Fontane] SADE
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="SADE">
<property environment="env"/>
<property file=""/>
<property file=""/>
<property name="build.dir" value="build"/>
<xmlproperty file="expath-pkg.xml.tmpl"/>
<target name="xar">
<project default="xar" name="SADE" xmlns:xdb="">
<property environment="env"/>
<property name="build.dir" value="build"/>
<property file=""/>
<property file=""/>
<xmlproperty file="expath-pkg.xml.tmpl"/>
<target name="xar" depends="cleanup">
<copy file="expath-pkg.xml.tmpl" tofile="expath-pkg.xml" filtering="true" overwrite="true">
<filter token="project.version" value="${project.version}"/>
......@@ -14,17 +15,36 @@
<filter token="project.abbrev" value="${project.abbrev}"/>
<filter token="" value="${}"/>
<filter token="project.processorversion" value="${project.processorversion}"/>
<filter token="dependency.track" value="${dependency.track}"/>
<mkdir dir="${build.dir}"/>
<zip basedir="." destfile="${build.dir}/${project.abbrev}-${project.version}.xar"
<zip basedir="." destfile="${destfile}"
<target name="dependencies">
<get src=";processor=${project.processorversion}" dest="${build.dir}/codeview-latest.xar" verbose="on" ignoreerrors="true"/>
<get src=";processor=${project.processorversion}" dest="${build.dir}/markdown-latest.xar" verbose="on" ignoreerrors="true"/>
<get src=";processor=${project.processorversion}" dest="${build.dir}/monex-latest.xar" verbose="on" ignoreerrors="true"/>
<target name="cleanup">
<delete dir="${test.dir}"/>
<target name="test" depends="xar">
<get src="${project.processorversion}.tar.bz2" dest="${build.dir}/eXist-db-${project.processorversion}.tar.bz2" skipexisting="true" />
<untar src="${build.dir}/eXist-db-${project.processorversion}.tar.bz2" dest="${test.dir}" compression="bzip2" />
<get src="${dependency.track}&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/codeview-latest.xar" ignoreerrors="true"/>
<get src="${dependency.track}&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/tgconnect${dependency.track}-latest.xar" ignoreerrors="true"/>
<get src="${dependency.track}&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/fontane${dependency.track}-latest.xar" ignoreerrors="true"/>
<get src=";processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/fontane-lucene-latest.xar" ignoreerrors="true"/>
<get src="${dependency.track}&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/openapi${dependency.track}-latest.xar" ignoreerrors="true"/>
<get src=";processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/markdown-latest.xar" ignoreerrors="true"/>
<get src=";processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/xqjson-latest.xar" ignoreerrors="true"/>
<get src=";processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/fundocs-latest.xar" ignoreerrors="true"/>
<copy file="${destfile}" todir="${test.dir}/eXist-db-${project.processorversion}/autodeploy" />
<copy todir="${test.dir}/eXist-db-${project.processorversion}/tools/jetty/webapps/portal/public" preservelastmodified="true" failonerror="false">
<fileset dir="${basedir}/../static/public"/>
......@@ -24,7 +24,7 @@ if ($exist:path eq '') then
(: forward requests without project to the first project listed :)
else if (empty($project)) then
<dispatch xmlns="">
<dispatch xmlns="">
<redirect url="{config:list-projects()[1]}/index.html"/>
......@@ -77,7 +77,7 @@ else if (tokenize($exist:path, '/') = "get") then
case "trans.html" return
then serialize($doc/xhtml:body/xhtml:div/xhtml:div[not(@class="teixml")][not(@class="facs")])
=> replace("xhtml:", "") => replace('class="surface"', 'class="surface no-nesting"')
=> replace("xhtml:", "") => replace('class="surface', 'class="surface no-nesting')
=> replace("xhtml:", "")
......@@ -107,7 +107,7 @@ else if(
<dispatch xmlns="">
<redirect url="login.html?redirect={$exist:path => substring-after("textgrid/")}?{request:get-query-string()}"/>
else if (ends-with($exist:resource, ".html")) then
else if ( $exist:path = "/" || $project || "/" || $exist:resource ) then
let $doc-path := $config:projects-dir || $project || config:get("template") || $exist:resource
(: the html page is run through view.xql to expand templates :)
......@@ -131,6 +131,23 @@ else if (contains($exist:path, "/$shared/")) then
else if (contains($exist:path, "/api/")) then
let $api-call := substring-after($exist:path, '/api/')
let $query-string := request:get-query-string()
let $path := if($query-string) then $api-call || "?" || $query-string else $api-call
<dispatch xmlns="">
<redirect url="/exist/restxq/api/{$path}"/>
else if (contains($exist:path, "/openapi/")) then
<dispatch xmlns="">
<forward url="/openapi/{ $exist:path => substring-after("/openapi/") => replace("json", "xq") }" method="get">
<add-parameter name="target" value="{ substring-after($exist:root, "://") || $exist:controller }"/>
<add-parameter name="register" value="false"/>
(: check if the resource comes from the template or the data
we try to leave the template manipulation as minimal as
......@@ -7,5 +7,6 @@
<dependency processor="" semver-min="@project.processorversion@"/>
<dependency package=""/>
<dependency package=""/>
<dependency package=""/>
<dependency package=""/>
\ No newline at end of file
......@@ -30,7 +30,7 @@ declare variable $config:app-root :=
substring-before($modulePath, "/modules")
declare variable $config:data-root := $config:app-root || "/data";
declare variable $config:data-root := "/db/sade-projects/textgrid/data/xml";
declare variable $config:repo-descriptor := doc(concat($config:app-root, "/repo.xml"))/repo:meta;
......@@ -17,27 +17,30 @@ declare namespace xhtml="";
import module namespace rest="";
import module namespace config="" at "../config/config.xqm";
import module namespace ixp="" at "index-processor.xqm";
declare variable $index:dataPath := "/db/sade-projects/textgrid/data/xml/data";
: resolves and lists all references on a given page based on their index data
: @param $uri A valid TextGrid Base-URI without prefix
: @param $surface – a string to match a tei:surface/@n in the document
: @param $uri A valid TextGrid Base-URI without prefix
: @param $surface A string to match a tei:surface/@n in the document
: (use “-” as delimiter)
: @return a list with all entries
: @return xhtml list with all entries
: @see http://localhost:8080/exist/restxq/fontane/index/16b00/62v
: @see
: :)
%test:name("entities per page")
%test:args("16b00", "2v") (: return empty sequence on interleaf :)
%test:arg("uri", "16b00")
%test:arg("surface", "2v")
(: return empty sequence on interleaf :)
%test:args("", "") (: return custom error INDEX-API1 :)
......@@ -100,7 +103,7 @@ return
let $index := (collection($index:dataPath)/id($ref))[1]
let $name := string($index/*[1])
let $list := index:get-list-by-id($ref)
let $href := "register-" || $list || ".html?e=" || $ref
let $href := "register.html?e=" || $ref
order by $name
element xhtml:li {
......@@ -155,7 +158,7 @@ declare
function index:get-list-by-id($id as xs:string)
as xs:string {
let $entity := collection($index:dataPath)/id($id)
let $entity := collection($index:dataPath)/id($id)[ not(. instance of element(tei:handNote) ) ]
let $test := if($entity[2]) then error(QName("FONTANE", "INDEX-API3"), "Entity »" || $id || "« has more then one occurence." ) else ()
switch ( $entity/local-name() )
......@@ -176,11 +179,103 @@ return
$list/local-name() || "-" || string($list/@type)
declare function index:get-list-by-node($node as element(*))
as xs:string {
switch ( $node/local-name() )
case "event" return "listEvent"
case "org" return "listOrg"
case "place" return "listPlace"
case "person" return
then index:get-list-by-id( ($node/ancestor::tei:item)[last()]/string(@xml:id) )
else "listPerson"
case "personGrp" return
then index:get-list-by-id( ($node/ancestor::tei:item)[last()]/string(@xml:id) )
else "listPerson"
default return
let $list := ($node/ancestor::tei:list[@type])[last()]
$list/local-name() || "-" || string($list/@type)
%test:arg("id", "Storm")
function index:rendered-entity($id as xs:string)
as element(xhtml:li)? {
doc("/db/sade-projects/textgrid/data/xml/xhtml/index.xml")//xhtml:li[@id = $id]
as item()* {
let $node := collection($index:dataPath)/id($id)
let $type := $node/root()//tei:body/*[1]/local-name()
(: listEvent, listPlace, listOrg, listPerson or list :)
switch ($type)
case "listEvent" return
case "listOrg" return
case "listPerson" return
case "listPlace" return
case "list" return
switch ($node/local-name())
case "person" return ixp:prepare-person($node)
case "place" return ixp:prepare-place($node)
default return
default return
error(QName("FONTANE", "INDEX-API4"), "unknown node-name: " || $type)
(:~ Provides a simple API for searching the index entries. Used for autocompletion.
: Usually the query should be a simple string. No wildcards, nothing special,
: always case-insensitive.
: @param $query A string to search all index entries (names, label, etc.)
: @return $index A list of indices to query, defaults to all, oneOf: listEvent,listOrg,listPerson,listPlace,list-works,list-fontane,list-periodicals.
%rest:query-param("index", "{$index}", "listEvent,listOrg,listPerson,listPlace,list-works,list-fontane,list-periodicals")
%test:name("simple search")
%test:arg("query", "Dom Karlos")
%test:assertXPath("array:size($result) = 2")
function index:search($query as xs:string, $index)
as array(*) {
let $query := $query => xmldb:decode-uri()
return if(string-length($query) lt 2) then () else
let $prepare := tokenize($index, ",")
let $hits :=
collection($index:dataPath)//tei:person[contains(tei:persName, $query)],
collection($index:dataPath)//tei:personGrp[contains(tei:persName, $query)],
collection($index:dataPath)//tei:place[contains(tei:placeName, $query)],
collection($index:dataPath)//tei:org[contains(tei:orgName, $query)],
collection($index:dataPath)//tei:event[contains(tei:label, $query)],
collection($index:dataPath)//tei:item[contains(tei:name, $query)]
for $hit in $hits
let $id := string($hit/@xml:id)
let $target := if($id) then $id else
$hit/tei:note/tei:ptr/substring-after(@target, "#")
let $list := index:get-list-by-node($hit)
where $list = $prepare
where $id != ""
"name": string($hit/*[1]),
"id": $target,
"list": $list,
"type": $hit/local-name()
This diff is collapsed.
......@@ -5,10 +5,13 @@ xquery version "3.1";
: @version 1.0
: @see
module namespace f-indexviewer="";
module namespace ixv="";
import module namespace ixp="" at "index-processor.xqm";
import module namespace index="" at "index-api.xqm";
import module namespace f-indexproc="" at "index-processor.xqm";
import module namespace config="" at "../config/config.xqm";
import module namespace functx="";
declare namespace ore="";
declare namespace rdf="";
......@@ -16,40 +19,6 @@ declare namespace tei="";
declare namespace test="";
declare namespace xhtml="";
function f-indexviewer:setup() {
if( xmldb:collection-available("/db/sade-projects/textgrid") )
then true()
(: read test config :)
let $testconfig := doc("tests.xml")//testdata[@module="f-indexviewer"]
(: prepare the collections :)
let $prepare-collections :=
for $create in $testconfig//create/collection
xmldb:create-collection($create/@target, $create/@new)
(: prepare documents :)