Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Created April 7, 2014 19:16
Show Gist options
  • Select an option

  • Save caschwartz/10033581 to your computer and use it in GitHub Desktop.

Select an option

Save caschwartz/10033581 to your computer and use it in GitHub Desktop.
XQuery - Query to add TYPE attributes for incomplete items
xquery version "1.0-ml";
(: 3/8/12 Query to add TYPE attributes for incomplete items in the kuyper-dl database :)
declare namespace mets = "http://www.loc.gov/METS/";
declare namespace dc = "http://purl.org/dc/elements/1.1/";
fn:distinct-values(
for $doc in fn:collection()
let $id := $doc//dc:identifier[1]
let $divs := $doc/mets:mets/mets:structMap//mets:div (: Will work with any div at any level in the hierarchy :)
for $div in $divs
where $div/@TYPE = "non-public-domain"
order by fn:base-uri($doc)
return fn:base-uri($doc))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment