Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into biblioVino
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Dec 27, 2024
2 parents 3fb22b9 + 3849672 commit 28b631e
Show file tree
Hide file tree
Showing 14 changed files with 44,878 additions and 123,766 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand Down
5 changes: 4 additions & 1 deletion app/rpb/ETL.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -47,7 +48,9 @@ public static void main(final String[] args) throws FileNotFoundException, Recog
}
vars.put(matcher.group(1), matcher.group(2));
}
FluxCompiler.compile(ResourceUtil.getStream(fluxFile), vars).start();
try (InputStream stream = ResourceUtil.getStream(fluxFile)) {
FluxCompiler.compile(stream, vars).start();
}
}
}
}
8 changes: 6 additions & 2 deletions app/views/TableRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,18 @@ public String process(JsonNode doc, String property, String param,
private String label(JsonNode doc, String value, List<String> properties) {
List<String> results = new ArrayList<>();
List<String> resultValues = labelsFor(doc, value, properties);
JsonNode labelNode = doc.get(properties.get(0)).iterator().next().get("label");
for (int i = 0; i < resultValues.size(); i++) {
String currentValue = resultValues.get(i);
String[] refAndLabel =
refAndLabel(properties.get(i), currentValue, Optional.empty());
String label = labelNode != null ? labelNode.textValue() : refAndLabel[1];
String result =
properties.get(i).equals("numbering") || value.equals("--")
? currentValue
: String.format(
"<a title=\"Titeldetails anzeigen\" href=\"%s\">%s</a>",
refAndLabel[0], refAndLabel[1]);
refAndLabel[0], label);
results.add(result.replace("Band", "").trim());
}
return results.stream().collect(Collectors.joining(", Band "));
Expand Down Expand Up @@ -215,7 +217,9 @@ String[] refAndLabel(String property, String value,
if ((property.equals("containedIn") || property.equals("hasPart")
|| property.equals("isPartOf") || property.equals("hasSuperordinate")
|| property.equals("bibliographicCitation")) && value.contains("lobid.org")) {
return new String[] { value, Lobid.resourceLabel(value) };
return new String[] { value.matches(".*?[as]\\d+.*|.*?\\d{3}[a-z]\\d+.*") // rpbId
? value.replace("https://lobid.org/resources/", "/")
: value, Lobid.resourceLabel(value) };
}
String label =
labels.isPresent() && labels.get().size() > 0 ? labels.get().get(0)
Expand Down
6 changes: 4 additions & 2 deletions app/views/tags/result_doc.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@

@part_of(field: String, subField: String) = {
@if(!(doc \ field).isInstanceOf[JsUndefined]){
@defining((doc \ field).as[Seq[JsValue]].sortBy((v: JsValue) => (v\"numbering").isInstanceOf[JsUndefined]).get(0)) { case (isPartOf) =>
@defining((doc \ field).as[Seq[JsValue]].sortBy((v: JsValue) => (v\"numbering").isInstanceOf[JsUndefined])) { case (isPartOfs) =>
@for((isPartOf) <- isPartOfs) {
@Html(TableRow.VALUES_MULTI.process(new com.fasterxml.jackson.databind.ObjectMapper().readTree(String.format("{\"%s\":[%s]}", field, isPartOf)),
field,
"q",
if((isPartOf \ "numbering").asOpt[String].isDefined) {"Erschienen als"} else {"Erschienen in"},
if(isPartOf == isPartOfs.head) { if((isPartOf \ "numbering").asOpt[String].isDefined) {"Erschienen als"} else {"Erschienen in"} } else {""},
Seq(((isPartOf \ subField)(0) \ "id").asOpt[String].getOrElse("--")),
Optional.of(Seq(subField, "numbering"))))
}
}
}
}
Expand Down
Loading

0 comments on commit 28b631e

Please sign in to comment.