From e7bb134a97ad67a76c8ecb6705f0b8c6ac2f3d46 Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Fri, 13 Sep 2024 16:49:31 +0200 Subject: [PATCH] Set up separate config values for host.main and host.reconcile --- app/controllers/HomeController.java | 4 ++-- app/controllers/Reconcile.java | 4 ++-- app/views/preview.scala.html | 4 ++-- app/views/reconcile.scala.html | 12 ++++++------ conf/application.conf | 5 ++++- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/controllers/HomeController.java b/app/controllers/HomeController.java index 911afcc..1feeb1b 100644 --- a/app/controllers/HomeController.java +++ b/app/controllers/HomeController.java @@ -467,8 +467,8 @@ static String returnAsJson(String q, SearchResponse queryResponse) { List> hits = Arrays.asList(queryResponse.getHits().getHits()).stream() .map(hit -> hit.getSource()).collect(Collectors.toList()); ObjectNode object = Json.newObject(); - object.put("@context", config("host") + routes.HomeController.context()); - object.put("id", config("host") + request().uri()); + object.put("@context", config("host.main") + routes.HomeController.context()); + object.put("id", config("host.main") + request().uri()); object.put("totalItems", queryResponse.getHits().getTotalHits()); object.set("member", Json.toJson(hits)); diff --git a/app/controllers/Reconcile.java b/app/controllers/Reconcile.java index 73801dc..bea17bb 100644 --- a/app/controllers/Reconcile.java +++ b/app/controllers/Reconcile.java @@ -104,7 +104,7 @@ public Result main(String callback, String queries, String extend) { } private ObjectNode metadata() { - final String host = HomeController.config("host"); + final String host = HomeController.configNested("host", "reconcile"); ObjectNode result = Json.newObject(); result.putArray("versions").add("0.1").add("0.2"); result.put("name", "GND reconciliation for OpenRefine"); @@ -151,7 +151,7 @@ private ObjectNode metadata() { private ObjectNode suggestService(String suggest) { return Json.newObject()// - .put("service_url", HomeController.config("host") + "/gnd/reconcile")// + .put("service_url", HomeController.configNested("host", "reconcile"))// .put("service_path", "/suggest/" + suggest)// .put("flyout_service_path", "/flyout/" + suggest + "?id=${id}"); } diff --git a/app/views/preview.scala.html b/app/views/preview.scala.html index ccf02db..ce1e24a 100644 --- a/app/views/preview.scala.html +++ b/app/views/preview.scala.html @@ -3,7 +3,7 @@ @(resource: String) @import play.api.libs.json._ -@import controllers.HomeController.CONFIG +@import controllers.HomeController.configNested @@ -16,7 +16,7 @@ details = elems.tail.mkString(" | "); fullId <- (json \ "id").asOpt[String]; shortId = fullId.split("/").last; - url = CONFIG.getString("host") + routes.HomeController.authority(shortId,null); + url = configNested("host", "reconcile") + routes.HomeController.authority(shortId,null); cat <- (json \ "category").asOpt[String]; image = (json \ "image").asOpt[String]) { @for(img <- image){ diff --git a/app/views/reconcile.scala.html b/app/views/reconcile.scala.html index 224b01f..a951572 100644 --- a/app/views/reconcile.scala.html +++ b/app/views/reconcile.scala.html @@ -20,7 +20,7 @@

GND Reconciliation

Dieser Dienst ermöglicht den Abgleich eigener Daten mit der Gemeinsamen Normdatei, insbesondere mit OpenRefine, einem nicht nur im Bibliotheksbereich weitverbreiteten Werkzeug. OpenRefine bietet zahlreiche Funktionalitäten zur Bereinigung und Transformation von Daten, sowie zum Abgleich (Reconciliation) mit externen Datenquellen und zur Anreicherung auf Basis der abgeglichenen Daten. Dieser Dienst stellt die GND als eine solche Datenquelle in OpenRefine bereit. Der Dienst kann zugleich auch in anderen Anwendungen verwendet werden, z. B. im Bibliotheksmanagementsystem Alma über Alma Refine (s. weitere Clients).

-

Service-URL: @controllers.HomeController.config("host")

+

Service-URL: @controllers.HomeController.configNested("host", "reconcile")

Daten und Werkzeuge

@@ -50,11 +50,11 @@

API

Allgemeine API (spec)

Service
- curl @controllers.HomeController.config("host") + curl @controllers.HomeController.configNested("host", "reconcile")

JSONP-callback
- curl @controllers.HomeController.config("host")?callback=jsonp + curl @controllers.HomeController.configNested("host", "reconcile")?callback=jsonp

CORS-header
- curl --head @controllers.HomeController.config("host") | grep Access-Control-Allow-Origin + curl --head @controllers.HomeController.configNested("host", "reconcile") | grep Access-Control-Allow-Origin

View-API

@@ -66,7 +66,7 @@

Query-API (Query: POST
- curl --data 'queries={"q1":{"query":"Twain, Mark"}}' @controllers.HomeController.config("host")

+ curl --data 'queries={"q1":{"query":"Twain, Mark"}}' @controllers.HomeController.configNested("host", "reconcile")

Suggest-API (spec)

@@ -82,6 +82,6 @@

Data-extension-API

@desc("Property-proposals (spec)", routes.Reconcile.properties("","Work","")) @desc("Extend: GET (spec)", routes.Reconcile.main(extend="{\"ids\":[\"1081942517\",\"4791358-7\"],\"properties\":[{\"id\":\"preferredName\"},{\"id\":\"firstAuthor\"}]}"))

Extend: POST
- curl --data 'extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}' @controllers.HomeController.config("host")

+ curl --data 'extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}' @controllers.HomeController.configNested("host", "reconcile")

} diff --git a/conf/application.conf b/conf/application.conf index e251758..3f38570 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -1,7 +1,10 @@ # This is the main configuration file for the application. # https://www.playframework.com/documentation/latest/ConfigFile -host : "https://reconcile.lobid.org" +host { + main: "https://lobid.org" + reconcile: "https://reconcile.gnd.network" +} dontShowOnMainPage: ["1012979-0"]