Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Last active February 3, 2017 21:32
Show Gist options
  • Save CliffordAnderson/f164230af60f367285ef36651591bb12 to your computer and use it in GitHub Desktop.
Save CliffordAnderson/f164230af60f367285ef36651591bb12 to your computer and use it in GitHub Desktop.
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)
};
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
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/wordlist/en/registers=Rare;domains=Art" 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)
return $lookup-word("person")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment