Skip to content

Instantly share code, notes, and snippets.

View tuurma's full-sized avatar

Magdalena Turska tuurma

  • eXist solutions
  • United Kingdom
View GitHub Profile
@tuurma
tuurma / namespaces.xq
Created January 19, 2021 09:11
Namespace tricks
(: create an element in a particular namespace :)
element { QName("http://www.w3.org/1999/xhtml", local-name($node)) } {
$node/@*,
$node/node()
}
@tuurma
tuurma / i18n.xq
Last active July 8, 2020 20:26
synchronise Crowdin language files to pb-components
xquery version "3.1";
(:Bulgarian, Czech, Dutch, French, German, Greek, Italian, Norwegian, Polish, Portuguese, Romanian, Slovenian, Spanish, Swedish, Turkish, Ukrainian, Russian, Georgian:)
(:Cymru, Finnish, Hebrew, Hungarian, Japan:)
let $collection := '/db/apps/lang'
let $temp-target := '/db/apps/i18n/temp'
let $final-target := '/db/apps/i18n/common'
let $languages := ('bg', 'cs', 'nl', 'fr', 'de', 'el', 'it', 'no', 'pl', 'pt', 'ro', 'sl', 'es', 'sv', 'tr', 'uk', 'cy', 'fi', 'he', 'hu', 'ja', 'zh_CN', 'zh_TW', 'ka', 'ru')
return
@tuurma
tuurma / gist:d18b703e87ebb81af8e5a9de322759f9
Created June 6, 2019 11:14
extract individual images from pdf
convert -density 150 -antialias "49548.pdf" -resize 1024x -quality 100 "49548.png"
@tuurma
tuurma / setup.xq
Created April 12, 2019 12:34
moving from xmldb:change-user to sm
xquery version "3.1";
sm:create-group('boys'),
sm:create-group('girls'),
sm:create-group('existsol'),
(: create 3 accounts with personal groups and additional group :)
sm:create-account('magda', 'm-pass', ('girls', 'existsol')),
sm:create-account('lars', 'l-pass', ('boys', 'existsol')),
sm:create-account('joern', 'l-pass', ('boys', 'existsol')),
@tuurma
tuurma / ports.md
Last active February 11, 2019 10:53
exist contributions

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

@tuurma
tuurma / transform.xq
Created September 3, 2018 12:07
basic xquery typeswitch example, assumes play is encoded in TEI like http://firstfolio.bodleian.ox.ac.uk/download/xml/F-tem.xml
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";
@tuurma
tuurma / chown-collection.xquery
Created July 16, 2018 20:03
change owner, group an permissions for subcollections
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)
)
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")
@tuurma
tuurma / move.xquery
Created November 23, 2017 20:46
move all documents from collection to another
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))
@tuurma
tuurma / openIneXide.xq
Created November 3, 2017 12:33
Open file in eXide link
http://localhost:8080/exist/apps/eXide/index.html?open=/db/apps/data/names/Agaios.xml