Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Last active December 18, 2015 22:09
Show Gist options
  • Save caschwartz/5852546 to your computer and use it in GitHub Desktop.
Save caschwartz/5852546 to your computer and use it in GitHub Desktop.
XQuery - Query to find and correct problem names in the theocom database
xquery version "1.0-ml";
(: 5/1/13 This query find and corrects problem names in the theocom database :)
declare namespace ia = "http://digital.library.ptsem.edu/ia";
for $doc in xdmp:directory("/ia-xml/h/hi/his/", "infinity")
let $name := $doc/ia:doc/ia:metadata/ia:name
let $newNameNode := <name xmlns="http://digital.library.ptsem.edu/ia">Goodspeed, Edgar J. (Edgar Johnson), 1871–1962</name>
where fn:contains($name, "Young, Edward J.")
return xdmp:node-replace($name, $newNameNode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment