Skip to content

Commit

Permalink
origin:elib removal and viewer script
Browse files Browse the repository at this point in the history
  • Loading branch information
kaipoykio committed Dec 4, 2024
1 parent 48265d6 commit 32fdaf5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
23 changes: 23 additions & 0 deletions whelktool/scripts/cleanups/2024/11/elib_sigel_holds.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//241204 KP, holds for 'sigel' with 'origin:Elib'
// add -Dsigel=SIGEL to command line

def sigel = System.getProperty("sigel")

if ( sigel == null ) {
println('set sigel with -Dsigel=SIGEL')
System.exit(0)
}

def sigel_elib_holds = """
collection = 'hold'
and data#>>'{@graph,1,heldBy,@id}' = 'https://libris.kb.se/library/${sigel}'
and data#>'{@graph,1,cataloguersNote}' @> '["origin:Elib"]'::jsonb
and deleted = false
"""

selectBySqlWhere(sigel_elib_holds) { d ->
def hold = d.getGraph()
def id = hold[0].'@id'
println('I: ' + id)
//println(hold)
}
24 changes: 24 additions & 0 deletions whelktool/scripts/cleanups/2024/11/remove_elib_sigel_holds.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//241204 KP, removes all holds for 'sigel' with 'origin:Elib'
// add -Dsigel=SIGEL to command line

def sigel = System.getProperty("sigel")

if ( sigel == null ) {
println('set sigel with -Dsigel=SIGEL')
System.exit(0)
}

def sigel_elib_holds = """
collection = 'hold'
and data#>>'{@graph,1,heldBy,@id}' = 'https://libris.kb.se/library/${sigel}'
and data#>'{@graph,1,cataloguersNote}' @> '["origin:Elib"]'::jsonb
and deleted = false
"""

selectBySqlWhere(sigel_elib_holds) { d ->
//def hold = d.getGraph()
//def id = hold[0].'@id'
//println('I: ' + id)
//println(hold)
d.scheduleDelete(loud: true)
}

0 comments on commit 32fdaf5

Please sign in to comment.