Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caschwartz/5c494dba1668cd710ab4 to your computer and use it in GitHub Desktop.
Save caschwartz/5c494dba1668cd710ab4 to your computer and use it in GitHub Desktop.
Query newly imported Benson collection books for volume information
xquery version "1.0-ml";
(: 12/5/13 Query newly imported Benson collection books for volume information :)
declare namespace ia = "http://digital.library.ptsem.edu/ia";
declare namespace m = "http://www.loc.gov/MARC21/slim";
<hits>{
for $doc in fn:collection("Benson")[1 to 1000]
let $title := fn:normalize-space($doc/ia:doc/ia:metadata/ia:title)
let $when-imported := $doc/property::when-imported
let $volumeInfo := $doc/ia:doc/ia:metadata/ia:marc/m:record/m:datafield[@tag = "300"]/m:subfield[@code = "a"]
where fn:starts-with($when-imported, "2013-11-26")
and fn:not(fn:matches($volumeInfo, "^1 v."))
and fn:not(fn:matches($volumeInfo, "^1v."))
and fn:not(fn:matches($volumeInfo, "^1 vol."))
and fn:not(fn:contains($volumeInfo, "in 1"))
and (fn:contains($volumeInfo, "v.") or fn:contains($volumeInfo, "vol."))
order by $title ascending
return <hit>
<uri>{ fn:base-uri($doc) }</uri>
<properties>{ $when-imported }</properties>
</hit>
}</hits>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment