Skip to content

Instantly share code, notes, and snippets.

View AdamSteffanick's full-sized avatar

Adam Steffanick AdamSteffanick

View GitHub Profile
= Roosevelt Family Geneaology
:neo4j-version: 2.1.0
:author: Suellen Stringer-Hye
:twitter: @suellenshye
:tags: domain:education, use-case:geneaology
== Purpose of Graph
= Roosevelt Family Geneaology
:neo4j-version: 2.1.0
:author: Suellen Stringer-Hye
:twitter: @suellenshye
:tags: domain:education, use-case:geneaology
== Purpose of Graph
@AdamSteffanick
AdamSteffanick / convert.xqy
Last active August 29, 2015 14:25 — forked from CliffordAnderson/convert.xqy
XQuery Working Group Challenge
xquery version "3.1";
(: FUNCTION: Whether all the values in a sequence are distinct http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html :)
declare namespace functx = "http://www.functx.com";
declare function functx:are-distinct-values
($seq as xs:anyAtomicType* ) as xs:boolean {
count(distinct-values($seq)) = count($seq)};
(: Converts sentences into verses and returns verses containing duplicate lemmata :)
@AdamSteffanick
AdamSteffanick / books.csv
Last active October 16, 2015 19:10 — forked from CliffordAnderson/books.csv
Some books
Author Title ISBN Binding Year Published
Jeannette Walls The Glass Castle 074324754X Paperback 2006
James Surowiecki The Wisdom of Crowds 385721706 Paperback 2005
Lawrence Lessig The Future of Ideas 375726446 Paperback 2002
Larry Bossidy, Ram Charan, Charles Burck Execution 609610570 Hardcover 2002
Kurt Vonnegut Slaughterhouse-Five 385333846 Paperback 1999
Haruki Murakami After the Quake 375713271 Paperback 2003
Nassim Nicholas Taleb Fooled by Randomness 812975219 Paperback 2005
Robert A. Dahl On Democracy (Yale Nota Bene) 300084552 Paperback 2000
Daniel Defoe A Journal of the Plague Year 375757899 Paperback 2001
@AdamSteffanick
AdamSteffanick / multi_facets.xq
Created November 6, 2015 21:11 — forked from taoyou/multi_facets.xq
return list of multiple facets
xquery version "3.1";
declare function local:get_facet ($books as element()*, $path as xs:string, $facet_type as xs:string ) as element()?
{
<facet type="{$facet_type}">{
for $book in $books
let $fld := $book/*[name()=$path]
group by $f := $fld
order by $f descending
return element {$facet_type} {attribute v {$f}, attribute number {fn:count($book)} }
<terms>
<term>
<path>date</path>
<facet>date</facet>
</term>
</terms>
xquery version "3.1";
(: Thanks to Tao You!! :)
declare function local:get_facet ($books as element()*, $path as xs:string, $facet_type as xs:string ) as element()?
{
<facet type="{$facet_type}">{
for $book in $books
let $fld := $book/*[name()=$path]
group by $f := $fld
@AdamSteffanick
AdamSteffanick / eval.xqy
Created November 13, 2015 21:44 — forked from CliffordAnderson/eval.xqy
Eval example
xquery version "3.1";
declare namespace functx = "http://www.functx.com";
for $title in fn:collection("books")/record/Title
let $string-fun := "fn:upper-case"
return xquery:eval(
"declare variable $title external;" ||
$string-fun || "($title)",
map { 'title': $title } )
--reference implementation in Haskell
qsort' :: (Ord a) => [a] -> [a]
qsort' [] = []
qsort' (x:xs) = qsort' smaller ++ [x] ++ qsort' larger
where larger = [a | a <- xs, a > x]
smaller = [b | b <- xs, b <= x]
@AdamSteffanick
AdamSteffanick / gbif-api.txt
Created February 5, 2016 21:45 — forked from baskaufs/gbif-api.txt
Some test API calls to get JSON with geocoordinates from the Global Biodiversity Information Facility (GBIF)
See http://www.gbif.org/developer/summary for background.
Find the single occurrence with identifier http://bioimages.vanderbilt.edu/vanderbilt/7-314#2002-06-14
http://api.gbif.org/v1/occurrence/search?occurrenceID=http%3A%2F%2Fbioimages.vanderbilt.edu%2Fvanderbilt%2F7-314%232002-06-14
Note: the occurrenceID is URLencoded.
Find occurrences
- with scientificName=Quercus%20macrocarpa (bur oak, note: space between genus and species is URLencoded as "%20")
- with decimalLatitude between 35.81 and 36.45
- with decimalLongitude between -87.21 and -86.27