Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions whelktool/scripts/syslib/2026/KB-852-866-resave.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// MUST be run with --allow-loud

File bibids = new File(scriptDir, "KB_852_856.txt")
List<String> ProgramLines = bibids.readLines()

for (String operation : ProgramLines) {
String fuzzyID = operation.trim().toUpperCase()

if (fuzzyID.matches("[0-9X]{9,14}")) {
where = """id in
(select lb.id
from lddb lb
where lb.collection = 'bib' and
lb.data#>'{@graph,0,identifiedBy}' @> '[{\"@type\": \"LibrisIIINumber\", \"value\":\"$fuzzyID\"}]'
)"""
}
else {
where = """id in
(select lb.id
from lddb lb
where lb.collection = 'bib' and
lb.data#>>'{@graph,0,controlNumber}' = '${fuzzyID}'
)"""

}

selectBySqlWhere(where) { bib ->
bib.scheduleSave(loud: true)
}

}
Loading
Loading