Last active
October 13, 2015 07:48
-
-
Save caschwartz/4163206 to your computer and use it in GitHub Desktop.
XQuery - Query to add documents to the Benson Collection (using MARCXML record for collection heading)
This file contains hidden or 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 "1.0-ml"; | |
| (: 9/5/12 Query to add documents to the Benson collection :) | |
| declare namespace ia = "http://my.local.namespace"; | |
| declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
| for $doc in xdmp:directory("/ia-xml/", "infinity") | |
| let $marcRecord := $doc/ia:doc/ia:metadata/ia:marc/m:record | |
| let $collectionTitles := $marcRecord/m:datafield[@tag = "730"] | |
| for $collectionTitle in $collectionTitles | |
| let $collectionTitleString := fn:normalize-space($collectionTitle) | |
| where fn:contains($collectionTitleString, "Benson collection") | |
| or fn:contains($collectionTitleString, "Benson Collection") | |
| return (xdmp:set-request-time-limit(3600), xdmp:document-add-collections(fn:base-uri($doc), "Benson")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment