Skip to content

Commit

Permalink
Merge branch 'rpb-140-spatialPaths' of https://github.com/hbz/rpb int…
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Jul 25, 2024
2 parents 63c9989 + daa60f2 commit 6a13373
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions app/SpatialToSkos.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import java.io.IOException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

import org.apache.commons.lang3.tuple.Pair;
import org.apache.jena.rdf.model.Model;
Expand All @@ -24,6 +26,7 @@
import com.fasterxml.jackson.databind.JsonNode;

import controllers.nwbib.Classification;
import controllers.nwbib.Lobid;

/**
* Generate a SKOS representation from the internal spatial classification data
Expand Down Expand Up @@ -97,8 +100,13 @@ private static void addHierarchy(Model model, Map<String, List<JsonNode>> hierar
sub.getValue().forEach(entry -> {
try {
String superSubject = sub.getKey();
addInSchemeAndPrefLabel(model, entry).addProperty(SKOS.broader,
model.createResource(superSubject));
Resource resource = addInSchemeAndPrefLabel(model, entry);
resource.addProperty(SKOS.broader, model.createResource(superSubject));
resource.addProperty(SKOS.definition,
Classification
.pathTo(entry.get("value").asText()).stream().map(uri -> String.format("%s (n%s)",
Lobid.facetLabel(Arrays.asList(uri), "", ""), Classification.shortId(uri)))
.collect(Collectors.joining(" > ")), "de");
} catch (Exception e) {
System.err.println("Error processing: " + entry);
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion app/views/tags/breadcrumb.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
} else {
@if(!rpbspatial.isEmpty && !rpbspatial.contains(",") && Seq(rpbsubject, person, name, subject, id, publisher, issued, medium, owner, t, location, word, corporation, raw).forall(_.isEmpty)){
@if(search){in <a href="@nwbib.routes.Application.spatial()"> Regionen</a> &gt;}
@if(!rpbspatial.isEmpty && !rpbspatial.startsWith("https://nwbib.de/spatial#Q")) {
@if(!rpbspatial.isEmpty && !rpbspatial.startsWith("https://rpb.lobid.org/spatial#n")) {
@labels(rpbspatial)
} else {
@defining(Classification.pathTo((if(!rpbsubject.isEmpty) rpbsubject else rpbspatial))) { path =>
Expand Down

0 comments on commit 6a13373

Please sign in to comment.