Instantly share code, notes, and snippets.

Joe Wicentowski joewiz

View GitHub Profile



  1. add package
    • receive uploaded xar(s)
    • store upload(s) in "temp" folder
    • for each new package:
      • extract package metadata
      • validate package metadata
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.
View CompareTools.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
<plist version="1.0">
<string>Diff Directories</string>
View 01-levenshtein-distance.xq
xquery version "3.1";
Calculate Levenshtein Distance, using XQuery
@author Guillaume Mella
declare function local:levenshtein-distance($string1 as xs:string?, $string2 as xs:string?)
as xs:integer
View adaptive-serialization.xq
xquery version "3.1";
declare namespace output="";
declare option output:method "adaptive";
declare option output:indent "yes";
map { "reference": xs:anyURI("") }
View date-parser.xqm
xquery version "3.1";
Various Date String Parser
- Parses various flavors of date strings, returns as xs:dateTime or xs:date
- Key functions: dates:parseDateTime() and dates:parseDate()
- Adapted by Joe Wicentowski from
- Adapted to standard XQuery (instead of the MarkLogic 0.9-ml flavor)
- TODO: test against
View create-travels-tsv.xq
xquery version "3.1";
(: Generate a TSV of Travels of President and Secretary of State.
: Assumes has been installed.
: A function for constructing a TSV (tab-separated value) file
: @param A sequence of column headings
View entities.xql
xquery version "3.1";
(:~ A module containing a lookup table, in the form of a map, for HTML entities
: that aren't defined in XML, and a function for converting HTML entities in
: strings to the appropriate characters. Look up characters via map lookup:
: $entities:entities?ograve?character => ò
: @author Joe Wicentowski
: @see
View gaps-between-principals-appointments.xq
xquery version "3.1";
declare namespace output = "";
declare option output:method "html5";
declare option output:media-type "text/html";
let $title := "Gaps between appointments of Principal Officers"
let $min-gap := xs:dayTimeDuration("P30D")
let $positions := collection("/db/apps/pocom/positions-principals")/principal-position[not(id = ("ambassador-at-large", "career-ambassador"))]
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 {