Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
76cc540a
Commit
76cc540a
authored
Aug 29, 2018
by
Mathias Goebel
Browse files
get interwiki links
parent
be877020
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
modules/fontane/index-processor.xqm
View file @
76cc540a
...
...
@@ -225,7 +225,9 @@ declare function local:idno($idnos as element()*)
as element(xhtml:li)* {
for $idno in $idnos
let $str := string($idno)
let $wikipedia := if($idno/@type = "GND") then local:gnd-wikipedia($str) else ()
let $wikipedia :=
if($idno/@type = "GND") then local:gnd-wikipedia($str) else
if($idno/@type = "Wikidata") then local:wikidata-wikipedia($str) else ()
return
element xhtml:li {
attribute class {"idno"},
...
...
@@ -286,6 +288,21 @@ return
string($response//foaf:page/@rdf:resource)
};
declare function local:wikidata-wikipedia($wikidata-id as xs:string)
as xs:string?{
let $query := escape-uri("SELECT ?s WHERE{?s schema:about wd:" || $wikidata-id || ".}", true())
let $url := "https://query.wikidata.org/sparql?query=" || $query
let $persist := false()
let $request-headers := ()
let $uris := httpclient:get(xs:anyURI($url), $persist, $request-headers)//*:uri/string()
return (
$uris[matches(., "de\.wikipedia")],
$uris[matches(., "en\.wikipedia")],
$uris[matches(., "fr\.wikipedia")],
$uris[matches(., "it\.wikipedia")],
$uris[1])[1]
};
(:~
: transformation from tei:note to xhtml:li
: :)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment