This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare %updating function local:persist($db as xs:string, $doc as element()) as empty-sequence() | |
| { | |
| let $book := element book {$doc/*} | |
| let $key := $book//key/text() | |
| return db:replace($db, $key, $book) | |
| }; | |
| let $db := "books" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| let $uri := "http://openlibrary.org/search.json?title=digital+humanities" | |
| let $json := fetch:text($uri) | |
| return $json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <compounds> | |
| <word>bookcase</word> | |
| <word>classmate</word> | |
| <word>bookmark</word> | |
| <word>newspaper</word> | |
| </compounds> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div lang="la" id="tei-document"> | |
| <p data-paragraph="1"> | |
| <span data-sentence="1">Lorem ipsum dolor sit amet, consectetur adipiscing <span class="quotes">‘elit’</span>.</span> | |
| <span data-sentence="2">Vestibulum nec lorem vitae dui varius <i>gravida</i>.</span> | |
| <span data-sentence="3">Cras eget tristique <b>eros</b>, id ultrices eros. Mauris nec turpis elit.</span> | |
| <span data-sentence="4">In tincidunt eget ante quis semper.</span> | |
| <span data-sentence="5">Praesent a mi et nisi ullamcorper feugiat nec non ipsum.</span> | |
| <span data-sentence="6">Ut malesuada finibus lorem nec gravida.</span> | |
| <span data-sentence="7">Praesent lobortis magna sed scelerisque molestie.</span> | |
| <span data-sentence="8">Aenean nec sapien quis quam commodo aliquam et et lorem.</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| let $old-words := | |
| <stopwords> | |
| <word>the</word> | |
| <word>a</word> | |
| <word>in</word> | |
| <word>of</word> | |
| <word>as</word> | |
| </stopwords> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare namespace tei = "http://www.tei-c.org/ns/1.0"; | |
| for $p in fn:collection("fleurs-du-mal")//tei:p/text() | |
| where $p contains text "fleurs" | |
| return $p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --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] | |