From 8332afa96c161a4b90c31cdb5a8a4cda33a3069c Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 22 Jan 2024 23:12:02 +0100 Subject: [PATCH 1/4] replace external Beacon service --- catalogues/options.xml | 2 -- modules/app.xqm | 7 +++-- modules/external-requests.xqm | 48 +++++++++++++++++++---------------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/catalogues/options.xml b/catalogues/options.xml index 299639db4..5c4ef46ec 100644 --- a/catalogues/options.xml +++ b/catalogues/options.xml @@ -36,8 +36,6 @@ https://stadtmuseum.bayerische-landesbibliothek-online.de/pnd/ http://tools.wmflabs.org/persondata/redirect/gnd/ws-adb/ http://d-nb.info/gnd/ - http://beacon.findbuch.de/seealso/pnd-aks?format=seealso&id= - http://beacon.findbuch.de/seemore/gnd-aks?format=seealso&id=
http://www.historische-kommission-muenchen-editionen.de/beacon_adb.txt diff --git a/modules/app.xqm b/modules/app.xqm index 62e7d5837..0b3fc529a 100644 --- a/modules/app.xqm +++ b/modules/app.xqm @@ -894,11 +894,10 @@ declare else map {} return map { 'beaconLinks': - for $i in map:keys($beaconMap) - order by $beaconMap($i)[2] + for $i in $beaconMap?* + order by $i?text => lower-case() collation "?lang=de;strength=primary" return - (: replacement in @href for invalid links from www.sbn.it :) - {$beaconMap($i)[2]} + {$i?text} } }; diff --git a/modules/external-requests.xqm b/modules/external-requests.xqm index 65f66f314..56fb2a193 100644 --- a/modules/external-requests.xqm +++ b/modules/external-requests.xqm @@ -338,29 +338,33 @@ declare function er:translate-authority-id($idno as element(), $to as xs:string) ) ! str:normalize-space(.) }; +(:~ + : Fetch linked resources from a Beacon aggregator service for a given GND + : At present https://data.deutsche-biographie.de/beta/beacon-open/ is used + : + : @param $gnd a GND identifier + : @param $docType the document type (e.g., letters, writings, persons) + : @return a map object like { "providerA": {"link": $link, "text": $text }, "providerB": {"link": $link, "text": $text } } + :) declare function er:beacon-map($gnd as xs:string, $docType as xs:string) as map(*) { - let $findbuchResponse := - switch($docType) - case 'persons' return er:grabExternalResource('beacon', $gnd, 'de') - default return er:grabExternalResource('gnd-beacon', $gnd, 'de') - (:let $log := util:log-system-out($gnd):) - let $jxml := - if(exists($findbuchResponse)) then - if($findbuchResponse/er:body/@encoding = 'Base64Encoded') then parse-json(util:binary-to-string($findbuchResponse)) - else parse-json($findbuchResponse) - else () - return - if(exists($jxml)) then - map:merge( - for $i in 1 to array:size($jxml?2) - let $link := str:normalize-space($jxml?4?($i)) - let $title := str:normalize-space($jxml?3?($i)) - let $text := str:normalize-space($jxml?2?($i)) - return - if(matches($link,"weber-gesamtausgabe.de")) then () - else map:entry($title, ($link, $text)) - ) - else map {} + let $fileName := $gnd || '.xml' + let $localFilePath := str:join-path-elements(($config:tmp-collection-path, 'beacon', $fileName)) + let $uri := 'https://data.deutsche-biographie.de/rest/bd/gnd/' || $gnd || '/alle_de' + let $response as element(er:response)? := + if(er:bot-present() or not($gnd)) + then map {} + else er:cached-external-request($uri, $localFilePath) + return + map:merge( + for $item in $response//item[ref] + let $link := str:normalize-space($item/ref/@target) + let $title := str:normalize-space($item/@type) + let $text := str:normalize-space($item/ref) + return + if(matches($link, "weber-gesamtausgabe.de|#adbcontent") or not(starts-with($link, "http"))) + then () + else map { $title: map {"link": $link, "text": $text }} + ) }; (:~ From 933231e71e386df37d50f99a7fca24b8a6f82111 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 22 Jan 2024 23:12:49 +0100 Subject: [PATCH 2/4] comment out GND Beacon tab for works since the current Beacon aggregator service only supports persons --- templates/work.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/templates/work.html b/templates/work.html index 4dc75ee37..86e14af56 100644 --- a/templates/work.html +++ b/templates/work.html @@ -104,22 +104,24 @@

documents

@@ -162,9 +164,11 @@

Wikipedia

GND

+

XML

From 7fde7608a03afcd7d76de8d2da05ee4f860ac7c2 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 22 Jan 2024 23:27:14 +0100 Subject: [PATCH 3/4] update expected results --- testing/expected-results/works/A020002.html | 3 --- testing/expected-results/works/A020010.html | 3 --- testing/expected-results/works/A020034.html | 6 ------ testing/expected-results/works/A020072.html | 3 --- testing/expected-results/works/A020081.html | 6 ------ testing/expected-results/works/A020209.html | 6 ------ testing/expected-results/works/A020456.html | 3 --- testing/expected-results/works/A020467.html | 6 ------ testing/expected-results/works/A020557.html | 6 ------ testing/expected-results/works/A020772.html | 6 ------ testing/expected-results/works/A021059.html | 3 --- testing/expected-results/works/A021447.html | 3 --- testing/expected-results/works/A021531.html | 3 --- testing/expected-results/works/A021539.html | 3 --- 14 files changed, 60 deletions(-) diff --git a/testing/expected-results/works/A020002.html b/testing/expected-results/works/A020002.html index bb46f132d..2c8eeba9e 100644 --- a/testing/expected-results/works/A020002.html +++ b/testing/expected-results/works/A020002.html @@ -378,9 +378,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020010.html b/testing/expected-results/works/A020010.html index e4343eb13..2ccf8dd1f 100644 --- a/testing/expected-results/works/A020010.html +++ b/testing/expected-results/works/A020010.html @@ -381,9 +381,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020034.html b/testing/expected-results/works/A020034.html index 3d9749ef4..4b9c901a7 100644 --- a/testing/expected-results/works/A020034.html +++ b/testing/expected-results/works/A020034.html @@ -337,9 +337,6 @@

Dokumente

- @@ -380,9 +377,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020072.html b/testing/expected-results/works/A020072.html index 403f23013..0a59aa78b 100644 --- a/testing/expected-results/works/A020072.html +++ b/testing/expected-results/works/A020072.html @@ -381,9 +381,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020081.html b/testing/expected-results/works/A020081.html index d26564fe7..259c0d2bb 100644 --- a/testing/expected-results/works/A020081.html +++ b/testing/expected-results/works/A020081.html @@ -341,9 +341,6 @@

Dokumente

- @@ -381,9 +378,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020209.html b/testing/expected-results/works/A020209.html index 655c5fb02..dc947c0c4 100644 --- a/testing/expected-results/works/A020209.html +++ b/testing/expected-results/works/A020209.html @@ -340,9 +340,6 @@

Dokumente

- @@ -381,9 +378,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020456.html b/testing/expected-results/works/A020456.html index 142d1d6b5..1baf5157b 100644 --- a/testing/expected-results/works/A020456.html +++ b/testing/expected-results/works/A020456.html @@ -360,9 +360,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020467.html b/testing/expected-results/works/A020467.html index de8ebeba3..916dca096 100644 --- a/testing/expected-results/works/A020467.html +++ b/testing/expected-results/works/A020467.html @@ -339,9 +339,6 @@

Dokumente

- @@ -395,9 +392,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020557.html b/testing/expected-results/works/A020557.html index 95f08a5b8..8b460909f 100644 --- a/testing/expected-results/works/A020557.html +++ b/testing/expected-results/works/A020557.html @@ -339,9 +339,6 @@

Dokumente

- @@ -387,9 +384,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A020772.html b/testing/expected-results/works/A020772.html index c8dfb622a..a89abc6e9 100644 --- a/testing/expected-results/works/A020772.html +++ b/testing/expected-results/works/A020772.html @@ -331,9 +331,6 @@

Dokumente

- @@ -373,9 +370,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A021059.html b/testing/expected-results/works/A021059.html index 39afac75d..4bc6f2719 100644 --- a/testing/expected-results/works/A021059.html +++ b/testing/expected-results/works/A021059.html @@ -370,9 +370,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A021447.html b/testing/expected-results/works/A021447.html index 678d70cfe..a42ac237d 100644 --- a/testing/expected-results/works/A021447.html +++ b/testing/expected-results/works/A021447.html @@ -382,9 +382,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A021531.html b/testing/expected-results/works/A021531.html index 5ef729155..35f31fb2d 100644 --- a/testing/expected-results/works/A021531.html +++ b/testing/expected-results/works/A021531.html @@ -373,9 +373,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

diff --git a/testing/expected-results/works/A021539.html b/testing/expected-results/works/A021539.html index fa378b190..1999a69de 100644 --- a/testing/expected-results/works/A021539.html +++ b/testing/expected-results/works/A021539.html @@ -368,9 +368,6 @@

Wikipedia

GND

-
-

GND Beacon Links

-

XML

From ad8669673df1cce96104aa0dbfff0a3be1a031c6 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Tue, 23 Jan 2024 10:28:47 +0100 Subject: [PATCH 4/4] update expected results --- testing/expected-results/works/A020002.html | 3 --- testing/expected-results/works/A020010.html | 3 --- testing/expected-results/works/A020072.html | 3 --- testing/expected-results/works/A020456.html | 3 --- testing/expected-results/works/A021059.html | 3 --- testing/expected-results/works/A021447.html | 3 --- testing/expected-results/works/A021531.html | 3 --- testing/expected-results/works/A021539.html | 3 --- 8 files changed, 24 deletions(-) diff --git a/testing/expected-results/works/A020002.html b/testing/expected-results/works/A020002.html index 2c8eeba9e..0b08e0930 100644 --- a/testing/expected-results/works/A020002.html +++ b/testing/expected-results/works/A020002.html @@ -337,9 +337,6 @@

Dokumente

- diff --git a/testing/expected-results/works/A020010.html b/testing/expected-results/works/A020010.html index 2ccf8dd1f..9f6692eca 100644 --- a/testing/expected-results/works/A020010.html +++ b/testing/expected-results/works/A020010.html @@ -334,9 +334,6 @@

Dokumente

- diff --git a/testing/expected-results/works/A020072.html b/testing/expected-results/works/A020072.html index 0a59aa78b..71963cbe3 100644 --- a/testing/expected-results/works/A020072.html +++ b/testing/expected-results/works/A020072.html @@ -341,9 +341,6 @@

Dokumente

- diff --git a/testing/expected-results/works/A020456.html b/testing/expected-results/works/A020456.html index 1baf5157b..f49e0848c 100644 --- a/testing/expected-results/works/A020456.html +++ b/testing/expected-results/works/A020456.html @@ -327,9 +327,6 @@

Dokumente

- diff --git a/testing/expected-results/works/A021059.html b/testing/expected-results/works/A021059.html index 4bc6f2719..f92bd8bc5 100644 --- a/testing/expected-results/works/A021059.html +++ b/testing/expected-results/works/A021059.html @@ -330,9 +330,6 @@

Dokumente

- diff --git a/testing/expected-results/works/A021447.html b/testing/expected-results/works/A021447.html index a42ac237d..3f330d12e 100644 --- a/testing/expected-results/works/A021447.html +++ b/testing/expected-results/works/A021447.html @@ -329,9 +329,6 @@

Dokumente

- diff --git a/testing/expected-results/works/A021531.html b/testing/expected-results/works/A021531.html index 35f31fb2d..aea088208 100644 --- a/testing/expected-results/works/A021531.html +++ b/testing/expected-results/works/A021531.html @@ -327,9 +327,6 @@

Dokumente

- diff --git a/testing/expected-results/works/A021539.html b/testing/expected-results/works/A021539.html index 1999a69de..754153def 100644 --- a/testing/expected-results/works/A021539.html +++ b/testing/expected-results/works/A021539.html @@ -327,9 +327,6 @@

Dokumente

-