Last active
October 5, 2015 17:27
-
-
Save caschwartz/2843975 to your computer and use it in GitHub Desktop.
Use cts:uris to query 730 fields for local collection headings in MARCXML
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 "1.0-ml"; | |
(: 3/2/12 Use MarkLogic function cts:uris to query 730 fields for local collection headings in embedded MARCXML :) | |
declare namespace ia = "http://my.server/my.directory"; | |
declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
let $values := fn:distinct-values(let $uris := cts:uris((), "ascending") | |
for $uri in $uris [fn:position() = (50001 to fn:last())] | |
return for $doc in fn:doc($uri) | |
let $marc := $doc/ia:doc/ia:metadata/ia:marc/m:record | |
let $collections := $marc/m:datafield[@tag = "730"][@ind2 = " "] | |
return for $collection in $collections | |
where fn:contains($collection, "collection") | |
or fn:contains($collection, "Collection") | |
or fn:contains($collection, "library") | |
or fn:contains($collection, "Library") | |
return fn:normalize-space(fn:replace($collection, "\.", "", "i"))) | |
for $value in $values | |
order by $value | |
return $value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment