Last active
October 25, 2016 18:49
-
-
Save caschwartz/2845492 to your computer and use it in GitHub Desktop.
XQuery - Query to create sequential journal article ids
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
(: 11/23/11 Cliff's Code - Sequential Article ID's :) | |
xquery version "1.0-ml"; | |
declare namespace mets = "http://www.loc.gov/METS/"; | |
for $doc in xdmp:directory("/METS/") | |
let $dmdSecs := | |
for $dmdSec in $doc/mets:mets/mets:dmdSec | |
where $dmdSec//*:type = "Article" | |
return $dmdSec | |
let $articles := fn:count($dmdSecs) | |
where fn:not(fn:contains(fn:base-uri($doc), "PSB")) | |
return | |
for $article in (1 to $articles) | |
return fn:concat(fn:base-uri($doc),$article) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment