Skip to content
Snippets Groups Projects
Commit 5b926c10 authored by Martin Voelkle's avatar Martin Voelkle
Browse files

run hgv:update on installation

parent 32c3468e
No related branches found
Tags v0.0.6
No related merge requests found
......@@ -5,18 +5,21 @@ import module namespace g="http://grammateus.ch/global" at "modules/global.xql";
import module namespace console="http://exist-db.org/xquery/console";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
declare namespace hgv = "http://grammateus.ch/hgv";
for $doc in collection($g:papyri)//tei:TEI
declare function hgv:update() {
for $doc in collection($g:papyri)//tei:TEI
let $log := console:log($doc//tei:idno[@type eq "hgv"])
let $log := console:log($doc//tei:idno[@type eq "hgv"])
let $hgv := gramm:doc-expand-history($doc)
let $hgv := gramm:doc-expand-history($doc)
let $history := element { node-name($hgv)}
{attribute {'corresp'} {$doc//tei:history/@corresp/string()},
$hgv/@*,
$hgv/node() }
let $history := element { node-name($hgv)}
{attribute {'corresp'} {$doc//tei:history/@corresp/string()},
$hgv/@*,
$hgv/node() }
return
return update replace $doc//tei:history with $history
};
update replace $doc//tei:history with $history
hgv:update()
xquery version "3.0";
import module namespace xdb="http://exist-db.org/xquery/xmldb";
import module namespace hgv="http://grammateus.ch/hgv" at "database-update-HGV.xq";
(: The following external variables are set by the repo:deploy function :)
......@@ -27,9 +28,14 @@ declare function local:mkcol($collection, $path) {
local:mkcol-recursive($collection, tokenize($path, "/"))
};
(: update HGV :)
hgv:update(),
(: store the collection configuration :)
declare variable $system-config := "/db/system/config";
declare variable $data-papyri := "/data/papyri";
local:mkcol($system-config || $target, $data-papyri),
xdb:store-files-from-pattern($system-config || $target || $data-papyri, $dir || $data-papyri, "*.xconf"),
xdb:reindex($target || $data-papyri) or fn:error()
let $system-config := "/db/system/config"
let $data-papyri := "/data/papyri"
return (
local:mkcol($system-config || $target, $data-papyri),
xdb:store-files-from-pattern($system-config || $target || $data-papyri, $dir || $data-papyri, "*.xconf"),
xdb:reindex($target || $data-papyri) or fn:error()
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment