Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Created December 10, 2014 16:31
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/7355018722763e369327 to your computer and use it in GitHub Desktop.
Save caschwartz/7355018722763e369327 to your computer and use it in GitHub Desktop.
Query to create zip files for the MODS documents in the dcweb database
xquery version "1.0-ml";
let $directory := "/theocom/"
let $uris := cts:uris("","document",cts:directory-query($directory,"infinity"))[70001 to 80000]
let $parts := (for $i in $uris let $x := fn:doc($i) return $x)
let $manifest := <parts xmlns="xdmp:zip">
{
for $i in $uris
let $file := fn:substring-after($i,$directory)
let $part := <part>{$file}</part>
return $part
}
</parts>
let $pkg := xdmp:zip-create($manifest, ($parts))
return xdmp:save("C:\temp\Summon\theocom8.zip", $pkg,
<options xmlns="xdmp:save">
<encoding>utf8</encoding>
</options>)
@caschwartz
Copy link
Author

Used this query to create batches of 10,000 MODS records for ProQuest Summon deliverables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment