Forked from CliffordAnderson/01-dictionary-lookup.xqy
Created
February 3, 2017 21:13
-
-
Save AdamSteffanick/8bcb816ab9bfffe6d862f601f5f044e6 to your computer and use it in GitHub Desktop.
Oxford Dictionary API, Part III
This file contains 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 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) | |
}; | |
let $word := "person" | |
let $id := "###" | |
let $key := "###" | |
let $lookup-word := local:lookup-word(?, $id, $key) | |
for $definition at $num in $lookup-word($word)//definitions/_/fn:data() | |
return $num || ". " || $definition |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment