Skip to content

Instantly share code, notes, and snippets.


Joe Wicentowski joewiz

View GitHub Profile
joewiz / fib-exist.xq
Last active Oct 10, 2020 — forked from apb2006/fib.xq
XQuery tail recursive Fibonacci function, with timing, for eXist-db
View fib-exist.xq
xquery version "3.1";
(: forked from
: with tests returned in the style of :)
declare function local:fib($n as xs:integer, $a as xs:integer, $b as xs:integer){
switch ($n)
case 0 return $a
case 1 return $b
default return local:fib($n - 1, $b, $a + $b)
joewiz / data-composition.xqy
Last active Jun 4, 2019 — forked from xquery/data-composition.xqy
This works in BaseX and Saxon, but eXist returns an error: `exerr:ERROR cannot convert function(*)('') to a node set [at line 59, column 15]`
View data-composition.xqy
xquery version "3.0";
(: discovered via, updated with HTTP URL for data.xq :)
(: the power of algebraic data types in xquery
This example shows how we can composite up data models
which 'carry' their own operations along with them.
joewiz / functionSignatureTests.xquery
Last active Feb 4, 2018 — forked from dizzzz/functionSignatureTests.xquery
A script to generate function-signature-tests for xquery functions in eXist-db
View functionSignatureTests.xquery
xquery version "3.1";
module namespace xqfunctions="";
import module namespace inspect="" at "java:org.exist.xquery.functions.inspect.InspectionModule";
declare namespace test="";
declare function xqfunctions:cardinality($cardinality as xs:string) as xs:string {
View 01 return JSON from Open Library.xq
xquery version "3.1";
let $uri := ""
let $json := fetch:text($uri)
return $json
View test7.xql
xquery version "3.1";
declare namespace tei = "";
let $set-up-collections :=
xmldb:create-collection('/db', 'test'),
xmldb:create-collection('/db/system/config/db', 'test')
let $in-memory-node :=
joewiz / clean-excel-table.xq
Last active Aug 29, 2015 — forked from CliffordAnderson/build-ead.xqy
@CliffordAnderson's clean-excel-table.xqy, adapted for use with eXist 3.0 (develop branch)
View clean-excel-table.xq
xquery version "3.1";
declare namespace html=""; (: the version of HTML used by the URL below :)
declare namespace output=""; (: use XQuery 3.1's JSON serialization :)
import module namespace http=""; (: @see :)
declare option output:method "json";
declare option output:media-type "application/json";