Skip to content

Commit

Permalink
Skip nodes without id or label when creating connections (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Jun 6, 2023
1 parent fffdd2b commit a8ef908
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/AuthorityResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ private void addGroupingNodes(List<Map<String, Object>> result) {

private void addGndEntityNodes(List<Map<String, Object>> result) {
result.add(ImmutableMap.of("id", getId(), "label", wrapped(preferredName), "shape", "box"));
gndNodes().stream().flatMap(pair -> pair.getRight().stream()).distinct().forEach(node -> {
gndNodes().stream().flatMap(pair -> pair.getRight().stream()).distinct()
.filter(node -> node.get("id") != null && node.get("label") != null).forEach(node -> {
String id = node.get("id").asText().substring(GND_PREFIX.length());
String label = wrapped(node.get("label").asText());
String title = "Details zu " + label + " öffnen";
Expand All @@ -206,7 +207,7 @@ private void addGroupedConnections(List<Map<String, Object>> result) {
String rel = pair.getLeft();
String label = wrapped(GndOntology.label(rel));
result.add(ImmutableMap.of("from", getId(), "to", rel));
pair.getRight().forEach(node -> {
pair.getRight().stream().filter(node -> node.get("id") != null).forEach(node -> {
String to = node.get("id").asText().substring(GND_PREFIX.length());
String title = String.format("Einträge mit %s '%s' suchen", label, GndOntology.label(GND_PREFIX + to));
String id = rel + "_" + to;
Expand Down

0 comments on commit a8ef908

Please sign in to comment.