From 3f952fbdffa3f562449a0a99b643a6b4bc22f914 Mon Sep 17 00:00:00 2001 From: David McKee Date: Thu, 2 Jan 2025 16:34:42 +0000 Subject: [PATCH] Add NCNs for press summaries and logging of empty citations --- corb2/README.md | 2 +- corb2/migrate-ncn.xqy | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/corb2/README.md b/corb2/README.md index df6e42a..ca4cdd2 100644 --- a/corb2/README.md +++ b/corb2/README.md @@ -4,4 +4,4 @@ Download corb2 from https://github.com/marklogic-community/corb2/releases Download xcc from https://repo1.maven.org/maven2/com/marklogic/marklogic-xcc/11.1.0/ or https://developer.marklogic.com/products/xcc-2/ (I used maven) (both into this directory) -`corb migrate-ncn` will run the code, `migrate-ncn.log` will show what it writes to the identifiers +`./corb migrate-ncn` will run the code, `migrate-ncn.log` will show what it writes to the identifiers diff --git a/corb2/migrate-ncn.xqy b/corb2/migrate-ncn.xqy index 35db7d7..46375e3 100644 --- a/corb2/migrate-ncn.xqy +++ b/corb2/migrate-ncn.xqy @@ -8,7 +8,10 @@ import module namespace sem = "http://marklogic.com/semantics" declare variable $URI external; -let $cite := fn:doc($URI)//uk:cite/text() +let $doc_cite := fn:doc($URI)//uk:cite/text() +let $summary_cite := fn:doc($URI)//uk:summaryOfCite/text() +let $cite := if ($doc_cite) then ($doc_cite) else ($summary_cite) + let $slug := fn:replace( fn:replace($URI, "\.xml$", "") , "^/", "") @@ -22,6 +25,9 @@ let $node := {$cite} {$slug} + +let $log := ($log, if ($cite) then () else "cite empty at " || $URI) + let $log := ($log, xdmp:quote($node)) let $log := ($log, if @@ -29,6 +35,6 @@ let $log := ($log, if then "ignored as failure/collision" else - "set property" || xdmp:document-set-property($URI, $node)) + "set property" || xdmp:document-set-property($URI, $node) ) return string-join($log, " ")