Commit 6ba94a97 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

remove dynamic lookup on Deutsche Biographie, set a static version

parent 8e09bfab
......@@ -34,11 +34,6 @@ declare variable $ixp:getNotebook := $ixp:targetStart || $ixp:notebookParam;
declare variable $ixp:dataPath := '/db/sade-projects/textgrid/data/xml/data/';
declare variable $ixp:dataCollection := collection($ixp:dataPath);
declare variable $ixp:BeaconMap := map:merge((
ixp:beacon-parser(xs:anyURI("http://www.historische-kommission-muenchen-editionen.de/beacon_db_register.txt")),
ixp:beacon-parser(xs:anyURI("http://www.historische-kommission-muenchen-editionen.de/beacon_ndb.txt")),
ixp:beacon-parser(xs:anyURI("http://www.historische-kommission-muenchen-editionen.de/beacon_adb.txt"))
));
(:~
: Helper function to collect all main nodes from the index files.
:)
......@@ -244,6 +239,7 @@ let $str := string($idno)
let $wikipedia :=
if($idno/@type = "GND") then ixp:gnd-wikipedia($str) else
if($idno/@type = "Wikidata") then ixp:wikidata-wikipedia($str) else ()
let $deutscheBiographie := collection($config:data-root)/id( "gnd"||$str )
return
element xhtml:li {
attribute class {"idno"},
......@@ -254,10 +250,10 @@ return
<xhtml:i title="Link zu externer Ressource" class="fa fa-external-link"></xhtml:i>
},
(: Deutsche Biografie :)
if($idno/parent::tei:person and $ixp:BeaconMap($str))
if($idno/parent::tei:person and $deutscheBiographie)
then
(",&#160;",
let $url := $ixp:BeaconMap($str)
let $url := string($deutscheBiographie/@db-url)
return
element xhtml:a {
attribute title {
......@@ -1485,22 +1481,3 @@ else
}
}
};
declare function ixp:beacon-parser($url as xs:anyURI)
as map(*) {
let
$persist := false(),
$request-headers := (),
$beacon := httpclient:get($url, $persist, $request-headers)//httpclient:body/node()
=> xmldb:decode() => tokenize("&#x0A;")
let $target := $beacon[starts-with(., "#TARGET:")] => substring-after(": ")
(: should return something like "http://www.deutsche-biographie.de/pnd{ID}.html#adbcontent"
: where «{ID}» is to be replaced by the GND ID :)
let $replacement := "\{ID\}"
return map:new(
for $i in $beacon[not(starts-with(., "#"))][. != ""]
return
map:entry($i, replace($target, $replacement, $i))
)
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment