Skip to content

Commit

Permalink
Group volumes linking via RPB and lobid URIs (RPB-239)
Browse files Browse the repository at this point in the history
To show single "x zugehörige Bände" link in superordinate details
  • Loading branch information
fsteeg committed Jan 28, 2025
1 parent ed415fc commit 4cad979
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions app/views/tags/result_doc.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@
}
}

@subordinate(field:String, id:String, label:String, values:(String,String)) = {
@defining(Lobid.getTotalHits(field, id, CONFIG.getString("nwbib.filter")).get(Lobid.API_TIMEOUT)){ hits => @if(hits > 0) {
@subordinate(field:String, ids:Seq[String], label:String, values:(String,String)) = {
@defining(ids.map((id) => Lobid.getTotalHits(field, id, CONFIG.getString("nwbib.filter")).get(Lobid.API_TIMEOUT)).reduce((a, b) => a + b)){ hits => @if(hits > 0) {
@defining(if(hits==1){values._1} else {values._2}){ value =>
<tr><td>@label</td><td><a title="@value" href="@nwbib.routes.Application.search(raw=field+":\""+Lobid.escapeUri(id)+"\"")">@hits @value</a></td></tr>
<tr><td>@label</td><td><a title="@value" href="@nwbib.routes.Application.search(raw=ids.map((id)=>field+":\""+Lobid.escapeUri(id)+"\"").mkString(" OR "))">@hits @value</a></td></tr>
}}}
}

Expand Down Expand Up @@ -237,9 +237,9 @@
}
}

@subordinateSearchFor(id: String) = {
@subordinate("isPartOf.hasSuperordinate.id", id, "Bände", ("zugehöriger Band", "zugehörige Bände"))
@subordinate("containedIn.id", id, "Enthält", ("Beitrag", "Beiträge"))
@subordinateSearchFor(ids: Seq[String]) = {
@subordinate("isPartOf.hasSuperordinate.id", ids, "Bände", ("zugehöriger Band", "zugehörige Bände"))
@subordinate("containedIn.id", ids, "Enthält", ("Beitrag", "Beiträge"))
}

@table(){
Expand Down Expand Up @@ -267,10 +267,9 @@
@labelled("In", "containedIn")

@part_of("isPartOf", "hasSuperordinate")
@subordinateSearchFor(String.format("http://rpb.lobid.org/%s", (doc \ "rpbId").asOpt[String].getOrElse("")))
@subordinateSearchFor(String.format("http://lobid.org/resources/%s#!", (doc \ "hbzId").asOpt[String].getOrElse("")))
@subordinateSearchFor(String.format("https://lobid.org/resources/%s", (doc \ "rpbId").asOpt[String].getOrElse("")))
@subordinateSearchFor(String.format("http://lobid.org/resources/"+ZDB_PREFIX+"%s#!", (doc \ "zdbId").asOpt[String].getOrElse("")))
@subordinateSearchFor(Seq(String.format("http://rpb.lobid.org/%s", (doc \ "rpbId").asOpt[String].getOrElse("")), String.format("https://lobid.org/resources/%s", (doc \ "rpbId").asOpt[String].getOrElse(""))))
@subordinateSearchFor(Seq(String.format("http://lobid.org/resources/%s#!", (doc \ "hbzId").asOpt[String].getOrElse(""))))
@subordinateSearchFor(Seq(String.format("http://lobid.org/resources/"+ZDB_PREFIX+"%s#!", (doc \ "zdbId").asOpt[String].getOrElse(""))))
@parallelausgabe()
@raumsystematik("https://rpb.lobid.org/spatial")
@sachsystematik("http://purl.org/lobid/rpb")
Expand Down

0 comments on commit 4cad979

Please sign in to comment.