Skip to content

Instantly share code, notes, and snippets.

View Ramona2020's full-sized avatar

Ramona Ramona2020

View GitHub Profile
@Ramona2020
Ramona2020 / Multipoint.xq
Last active February 12, 2016 22:21
FeatureCollection - Collection points from api and output geojson
xquery version "3.1";
declare option output:method 'json';
map { "type": "FeatureCollection",
"features": array {
(let $doc := fetch:text("http://api.gbif.org/v1/occurrence/search?limit=300&offset=0scientificName=Quercus%20macrocarpa&decimalLatitude=35.81,36.45&decimalLongitude=-87.21,-86.27") => json:parse()
for $record in $doc//results/_
let $lat := xs:decimal($record/decimalLatitude/text())
let $long := xs:decimal($record/decimalLongitude/text())
@Ramona2020
Ramona2020 / 01-lookup-words
Created January 20, 2017 21:43 — forked from AdamSteffanick/01-lookup-words.xquery
Looking up words in the OED with XQuery
xquery version "3.1";
let $word := "person"
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)
<body>
<div type="book" n="John">
<div type="chapter" n="20">
<div type="verse" n="1">
<p>Early on the first day of the week, while it was still dark, <persName>Mary Magdalene</persName>
came to the tomb and saw that the stone had been removed from the tomb.</p>
</div>
<div type="verse" n="2">
<p> So she ran and went to Simon Peter and the other disciple, the one whom Jesus
loved, and said to them, “They have taken the Lord out of the tomb, and we do