Last active
December 19, 2015 22:08
-
-
Save CliffordAnderson/6025035 to your computer and use it in GitHub Desktop.
Simple example of requesting items from the SRU gateway at the Library of Congress
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 Library of Congress in the specified metadata format :) | |
declare namespace mods = "http://www.loc.gov/mods/v3"; | |
declare namespace dc = "http://purl.org/dc/elements/1.1/"; | |
declare namespace marcxml = "http://www.loc.gov/MARC21/slim"; | |
declare namespace zs = "http://www.loc.gov/zing/srw/"; | |
(: change the lccn for different items :) | |
let $lccn := "2011005881" | |
(: change the requested format for different kinds of metadata - "dc", "marcxml", or "mods":) | |
let $metadata-format := "mods" | |
let $search := fn:concat("http://z3950.loc.gov:7090/voyager?operation=searchRetrieve&recordSchema=", $metadata-format, "&version=1.1&recordPacking=xml&query=bath.lccn=", $lccn, "&maximumRecords=1") | |
let $metadata := http:send-request(<http:request method='get' href="{$search}"/>) | |
return $metadata//zs:recordData/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy and paste into BaseX. Try experimenting with different lccn's and metadata formats.