Skip to content

Commit

Permalink
Don't intersect with empty
Browse files Browse the repository at this point in the history
  • Loading branch information
kwahlin committed Nov 20, 2024
1 parent 1b39f63 commit caa9c28
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ Set<String> ids = [] as Set
def (linked, blank) = removeSubdivision.split { it[ID_KEY] }
linked.each { l ->
selectByIds(linked.collect { it[ID_KEY] }) {
ids = ids.intersect(it.getDependers()) as Set<String>
def dependers = it.getDependers() as Set<String>
if (ids.isEmpty()) {
ids.addAll(it.getDependers())
} else {
ids = ids.intersect(dependers)
}
}
}
if (!blank.isEmpty()) {
Expand All @@ -84,7 +89,13 @@ if (!blank.isEmpty()) {
*/
blank.collect { whelk.sparqlQueryClient.queryIdsByPattern(toTurtleData((Map) it, whelk.jsonld.context)) }
.min { it.size() }
.with { ids = ids.intersect(it) }
.with {
if (ids.isEmpty()) {
ids.addAll(it)
} else {
ids = ids.intersect(it)
}
}
}

selectByIds(ids) {
Expand Down

0 comments on commit caa9c28

Please sign in to comment.