Skip to content

Commit

Permalink
Add NCNs for press summaries and logging of empty citations
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-dxw committed Jan 2, 2025
1 parent d8af395 commit cde27fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion corb2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 8 additions & 2 deletions corb2/migrate-ncn.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -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$", "")
, "^/", "")
Expand All @@ -22,13 +25,16 @@ let $node :=
<value>{$cite}</value>
<url_slug>{$slug}</url_slug>
</identifier></identifiers>

let $log := ($log, if ($cite) then () else "cite empty at " || $URI)

let $log := ($log, xdmp:quote($node))

let $log := ($log, if
(fn:starts-with($URI, "/failures/") or fn:starts-with($URI, "/collisions/"))
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, "&#10;")

0 comments on commit cde27fb

Please sign in to comment.