Created
July 18, 2013 20:29
-
-
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
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.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/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try it out in BaseX.