Skip to content

Commit

Permalink
Abort when linked work
Browse files Browse the repository at this point in the history
  • Loading branch information
kwahlin committed Sep 13, 2023
1 parent 7fe5012 commit d85bebf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion librisworks/scripts/contributions-to-instance.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ clusters.each { c ->
def id = bib.doc.shortId
Map instance = bib.graph[1]
Map work = instance.instanceOf
work.contribution?.each { contrib ->
work?.contribution?.each { contrib ->
if (asList(contrib.role).contains(ill)) {
def agent = asList(contrib.agent).find()
if (!agent) return
Expand Down
4 changes: 2 additions & 2 deletions librisworks/scripts/elib-unspecified-contributor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Set<String> handled = new ConcurrentHashMap().newKeySet()
selectBySqlWhere(where) { bib ->
def id = bib.doc.shortId
def instance = bib.graph[1]
def summary = asList(instance['instanceOf']['summary']) + asList(bib.graph[1]['summary'])
def summary = asList(instance.instanceOf?.summary) + asList(instance.summary)

def nameToRoles = summary
.findResults { it['label'] }
Expand Down Expand Up @@ -99,7 +99,7 @@ selectBySqlWhere("collection = 'bib' AND data#>>'{@graph, 0, identifiedBy}' LIKE
return
}
def instance = bib.graph[1]
List workContribution = instance['instanceOf']['contribution']
List workContribution = instance.instanceOf?.contribution
if (!workContribution) {
return
}
Expand Down
6 changes: 5 additions & 1 deletion librisworks/scripts/language-in-work-title.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ selectByIds(ids) { bib ->
].collect {
langName(getAtPath(bib.graph, it, '')).toLowerCase()
}

def work = bib.graph[1].instanceOf

if (!work || work['@id']) return

boolean changed = DocumentUtil.traverse(bib.graph[1].instanceOf) { value, path ->
boolean changed = DocumentUtil.traverse(work) { value, path ->
if (path && 'mainTitle' in path && value instanceof String) {
for (lang in langs) {
String r = value.replaceAll(/(?i)\s*\(\(?\s*${lang}\s*\)\)?\s*$/, '')
Expand Down

0 comments on commit d85bebf

Please sign in to comment.