Instantly share code, notes, and snippets.

Magdalena Turska tuurma

  • University of Oxford
  • United Kingdom
View GitHub Profile
View ports.md

sync develop branch with upstream by rebasing

git checkout develop
git fetch upstream develop
git rebase upstream/develop

check log to confirm commits correspond with the ones for exist/develop

View transform.xq
xquery version "3.1";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "html5";
declare option output:media-type "text/html";
View chown-collection.xquery
xquery version "3.1";
declare function local:change-user($collection, $user, $group) {
if (xmldb:collection-available($collection)) then
(
for $child in xmldb:get-child-collections($collection)
let $path := concat($collection, '/', $child)
return
xmldb:set-collection-permissions($path, $user, $group, 493)
)
View deploy.xqm
repo:undeploy("http://history.state.gov/ns/site/hsg"),
repo:remove("http://history.state.gov/ns/site/hsg"),
repo:install-and-deploy-from-db("/db/system/repo/hsg-shell-0.2.xar")
View move.xquery
xquery version "3.1";
for $i in collection('/db/apps/data/a')/*
return
xmldb:move('/db/apps/data/a', '/db/apps/data/a/b/', util:document-name($i))
View openIneXide.xq
http://localhost:8080/exist/apps/eXide/index.html?open=/db/apps/data/names/Agaios.xml
View check.xql
xquery version "3.0";
declare namespace col = "http://exist-db.org/collection-config/1.0";
(: retrieve all .xconf documents in /db/apps :)
let $dbapps := collection('/db/apps')//col:collection
(: retrieve all /db/apps related .xconf documents in /db/system :)
let $dbsystemapps := for $doc in collection('/db/system/config/db/apps')//col:collection return document-uri(root($doc))
View update.xql
(: insert attribute :)
for $i in collection('/db/apps/my-data')//nym[not(@cert)]
return
update insert attribute cert {'high'} into $i
(: replace text content of an element :)
declare namespace tei="http://www.tei-c.org/ns/1.0";
for $i in collection("/db/apps/my-data")//tei:m[@n="3"][.="τ"]
return update replace $i/text() with '(V)τ'
View gist:8d240c834ac4c6ae48b7c37378e627b3
sm:create-group('shcusers')),
sm:create-group('shcadmins')),
sm:create-account('shcuser', 'pa$$wd', 'shcusers', '', 'First Last Name', 'SHC project member'),
sm:create-account('tuurma', 'pa$$wd', 'shcusers', '', 'Magdalena Turska', 'SHC project member'),
sm:add-group-member('shcadmins', 'tuurma'),
sm:remove-account('tuurma')
View gist:7e20dc0dfcb5a3afcfa408a3897282b1
xquery version "3.0";
import module namespace repair="http://exist-db.org/xquery/repo/repair"
at "resource:org/exist/xquery/modules/expathrepo/repair.xql";
repair:clean-all(),
repair:repair()