Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Created July 18, 2013 20:29
Show Gist options
  • Save CliffordAnderson/6032792 to your computer and use it in GitHub Desktop.
Save CliffordAnderson/6032792 to your computer and use it in GitHub Desktop.
Simple example of retrieving a record in EAD (or Dublin Core) from the Archives Hub using SRU
xquery version "3.0";
(: Look ups records at the Archives Hub (http://archiveshub.ac.uk/) in the specified metadata format :)
declare namespace sru = "http://www.loc.gov/zing/srw/";
(: change keyword for different documents :)
let $keyword := "castle"
(: change the requested format for different kinds of metadata - "ead", "srw_dc", or "oai_dc":)
let $metadata-format := "ead"
let $search := fn:concat("http://archiveshub.ac.uk/api/sru/hub?operation=searchRetrieve&recordSchema=", $metadata-format, "&version=1.1&recordPacking=xml&query=", $keyword, "&maximumRecords=1")
let $metadata := http:send-request(<http:request method='get' href="{$search}"/>)
return $metadata//sru:recordData/*
@CliffordAnderson
Copy link
Author

Try it out in BaseX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment