Skip to content

Instantly share code, notes, and snippets.

View AdamSteffanick's full-sized avatar

Adam Steffanick AdamSteffanick

View GitHub Profile
@AdamSteffanick
AdamSteffanick / steve.json
Created September 24, 2018 17:56 — forked from baskaufs/steve.json
JSON-LD description of Steve Baskauf
{
"@context": "https://schema.org/",
"@id": "https://orcid.org/0000-0003-4365-3135",
"@type": "Person",
"name": [
"Steven J. Baskauf",
"Steve Baskauf",
"Steven James Baskauf"
],
"familyName": "Baskauf",
@AdamSteffanick
AdamSteffanick / music-data.xquery
Created April 21, 2017 17:41 — forked from cwulfman/music-data.xquery
For Vanderbilt XQuery group: sample XQuery to retrieve data about musical notation in Blue Mountain
xquery version "3.1";
(:~
: A query to retrieve interesting data about
: music publication in the Blue Mountain
: data set.
:
: @author Cliff Wulfman
: @version 1.0
: April 21, 2017
:)
@AdamSteffanick
AdamSteffanick / 01-clean-articles.xqy
Created April 14, 2017 20:53 — forked from CliffordAnderson/01-clean-articles.xqy
XQuery Blue Mountain Project - Part III
xquery version "3.1";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
let $old := fn:doc("/bluemountain-transcriptions/periodicals/bmtnaab/issues/1920/02_01/bmtnaab_1920-02_01.tei.xml")
return
copy $new := $old
modify (
delete node $new/tei:TEI/tei:facsimile,
delete node $new//@facs,
@AdamSteffanick
AdamSteffanick / post1900Music.xql
Created April 10, 2017 14:09 — forked from cwulfman/post1900Music.xql
Music constituents published after 1900
declare namespace tei = "http://www.tei-c.org/ns/1.0";
declare function local:w3cdtf-to-xsdate($d as xs:string) as xs:date
{
let $dstring :=
if ($d castable as xs:gYear) then $d || "-01-01"
else if ($d castable as xs:gYearMonth) then $d || "-01"
else if ($d castable as xs:date) then $d
else error($d, "not valid w3cdtf")
@AdamSteffanick
AdamSteffanick / 01-access-collection.xqy
Created March 24, 2017 21:13 — forked from CliffordAnderson/01-access-collection.xqy
XQuery Samples for Blue Mountain Project
xquery version "3.1";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
fn:collection("bluemountain-transcriptions")/tei:TEI
@AdamSteffanick
AdamSteffanick / antonyms-game.xqy
Created February 10, 2017 21:11 — forked from CliffordAnderson/antonyms-game.xqy
A little playful XQuery
xquery version "3.1";
declare function local:lookup-word($word as xs:string, $request as xs:string, $id as xs:string, $key as xs:string) {
let $request :=
<http:request href="https://od-api.oxforddictionaries.com/api/v1/entries/en/{$word}/{$request}" method="get">
<http:header name="app_key" value="{$key}"/>
<http:header name="app_id" value="{$id}"/>
</http:request>
return http:send-request($request)
};
@AdamSteffanick
AdamSteffanick / 01-dictionary-lookup.xqy
Created February 3, 2017 21:13 — forked from CliffordAnderson/01-dictionary-lookup.xqy
Oxford Dictionary API, Part III
xquery version "3.1";
declare function local:lookup-word($word as xs:string, $id as xs:string, $key as xs:string) {
let $request :=
<http:request href="https://od-api.oxforddictionaries.com/api/v1/entries/en/{$word}" method="get">
<http:header name="app_key" value="{$key}"/>
<http:header name="app_id" value="{$id}"/>
</http:request>
return http:send-request($request)
};
@AdamSteffanick
AdamSteffanick / 01-lookup-words.xquery
Last active January 24, 2017 02:56 — forked from CliffordAnderson/01-lookup-words
Looking up words in the OED with XQuery
xquery version "3.1";
let $word := "betake"
let $request :=
<http:request href="https://od-api.oxforddictionaries.com/api/v1/entries/en/{$word}" method="get">
<http:header name="app_key" value="###"/>
<http:header name="app_id" value="###"/>
</http:request>
return http:send-request($request)
@AdamSteffanick
AdamSteffanick / 01-contains.xqy
Created November 11, 2016 21:18 — forked from CliffordAnderson/01-contains.xqy
XQuery Full Text
xquery version "3.1";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
for $p in fn:collection("vwwp_tei")//tei:p
where fn:contains($p, "church")
return $p
for $doc in fn:collection("books")//book[@full-text eq "true"]
where fn:not($doc//subjects/subject = "Protected DAISY") (: existential quantification! :)
for $key in $doc/key/text()
let $data := fetch:text("https://openlibrary.org" || $key || ".json") => json:parse()
let $ocaid := $data//ocaid/text()
for $book in $ocaid
return fetch:text("https://archive.org/5/items/" || $book || "/" || $book || "_djvu.txt")