Skip to content

Instantly share code, notes, and snippets.

View joewiz's full-sized avatar

Joe Wicentowski joewiz

  • Arlington, Virginia
View GitHub Profile
@CliffordAnderson
CliffordAnderson / cities.xqy
Last active August 29, 2015 14:14
IE-TN Data
xquery version "3.0";
<cities>{
let $names :=
"Adelaide
Adelaide
Adelaide and Windsor
Adelaide Station
Agangarrive Hill
Aghadovey
Aghadowey
@wsalesky
wsalesky / facets.xqm
Created February 6, 2015 18:49
XQuery Facets POC
xquery version "3.0";
(:~
: A facet library module
:
: Builds facets from nodes passed by search or browse modules.
: Uses group by
: Built for use with eXistdb, if using with eXistdb be sure to define your range
: indexes in your collectio.xconf file for best performance.
:
: @author Winona Salesky
@CliffordAnderson
CliffordAnderson / comp.R
Last active August 29, 2015 14:17
Compare the annual GDP growth in China and the United States
# Load libraries
library(ggplot2)
library(Quandl)
# Load datasets from Quandl
USA <- Quandl("WORLDBANK/USA_NY_GDP_MKTP_KD_ZG", authcode="[TOKEN")
China <- Quandl("WORLDBANK/CHN_NY_GDP_MKTP_KD_ZG", authcode="[TOKEN")
# Merge datasets into single table
Comp <- China
@jeffreycwitt
jeffreycwitt / gist:cb4ab709db98f1317d4b
Created May 16, 2015 20:57
A ruby script to auto load git repos into webdav mounted exist volume
#!/usr/bin/env ruby
require 'bundler/setup'
require 'lbp'
puts "welcome to the scta index loader"
puts "i'm going to help you load git repos into the existdb database"
local_load_dir = "/Volumes/db-1/apps/scta/"
remote_load_dir = "/Volumes/db/apps/scta/"
use_load_dir = remote_load_dir
@derickson
derickson / map.xqy
Created January 10, 2012 05:47
XQuery Choropleth complete
xquery version "1.0-ml";
import module namespace search="http://marklogic.com/appservices/search"
at "/MarkLogic/appservices/search/search.xqy";
declare namespace kml = "http://www.opengis.net/kml/2.2";
(:White to red color scale in BBGGRR format :)
declare variable $COLOR_SCALE :=
@grantmacken
grantmacken / gist:6528369
Created September 11, 2013 19:12
My ant build target for building and uploading xar from project folder.
<target name="xar-build-upload" >
<buildnumber file="build.version"/>
<property name="project.version" value="${version.major}.${build.number}"/>
<property name="xar-location" value="${dir.project}/${dir.build}/${project.abbrev}-${project.version}.xar"/>
<property name="repo.url" value="http://${host.local}:8080/exist/apps/public-repo/public/"/>
<property name="repo.update" value="http://${host.local}:8080/exist/apps/public-repo/modules/update.xql"/>
<property name="xar-file" value="${project.abbrev}-${project.version}.xar"/>
<echo>project.version: ${project.version}</echo>
<antcall target="deployment-folder"/>
@CliffordAnderson
CliffordAnderson / simple-dpla-with-params-xml.xqy
Last active March 21, 2016 13:41
Just a quick example of searching the DPLA API using XQuery and returning a simple webpage.
module namespace page = 'http://library.vanderbilt.edu/dpla';
(: Just a quick example of searching the DPLA API
and returning a simple webpage. :)
declare
%rest:path("dpla/{$search}")
%rest:query-param("key", "{$key}")
%output:method("html")
function page:html($search as xs:string, $key as xs:string)
@timathom
timathom / basex-async.xq
Last active March 21, 2016 13:41
Anonymous inline function with asynchronous evaluation in BaseX
(:~
: Anonymous inline function with asynchronous evaluation in BaseX 8.4.1 beta
:
: @param $query Asynchronously evaluated query
: @return XQuery expression, followed by result of async HTTP request.
:
: BaseX Async Module:
: http://docs.basex.org/wiki/Async_Module
:
: Dimitre Novatchev on recursion with anonymous inline functions in XPath 3.0:
@tonyahowe
tonyahowe / tei2html.xql
Created August 16, 2016 20:32
working xql transform file 8/16/2016
module namespace tei2="http://exist-db.org/xquery/app/tei2html";
import module namespace console="http://exist-db.org/xquery/console";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare function tei2:tei2html($nodes as node()*) {
for $node in $nodes
return
typeswitch ($node)
case text() return
@CliffordAnderson
CliffordAnderson / milliseconds-since-epoch.xqy
Last active August 29, 2016 20:32
Milliseconds since Unix Epoch
declare function local:milliseconds-since-epoch($dateTime as xs:dateTime) as xs:integer
{
let $epoch := xs:dateTime("1970-01-01T00:00:00Z")
let $duration := xs:duration($dateTime - $epoch)
let $days := fn:days-from-duration($duration) * 8.64e+7
let $hours := fn:hours-from-duration($duration) * 3.6e+6
let $minutes := fn:minutes-from-duration($duration) * 60000
let $seconds := fn:seconds-from-duration($duration) * 1000
return xs:integer($days + $hours + $minutes + $seconds)
};