Commit 765be049 authored by mrodzis's avatar mrodzis 🌿
Browse files

Merge branch 'feature/registerbilder' into 'develop'

add an API to test for available images for index data

See merge request !51
parents 5cc60823 051d2dda
......@@ -4,7 +4,7 @@ xquery version "3.1";
: given page.
:
: @author Mathias Göbel
: @version 1.0
: @version 1.1
: @since 2.5.6
: :)
......@@ -13,11 +13,12 @@ module namespace index="https://fontane-nb.dariah.eu/indexapi";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace test="http://exist-db.org/xquery/xqsuite";
declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
import module namespace rest="http://exquery.org/ns/restxq";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../config/config.xqm";
import module namespace ixp="http://fontane-nb.dariah.eu/index-processor" at "index-processor.xqm";
import module namespace rest="http://exquery.org/ns/restxq";
declare variable $index:dataPath := "/db/sade-projects/textgrid/data/xml/data";
......@@ -285,3 +286,28 @@ return
}
}
};
(:~
: Returns available image from TextGrid Repository
: @param $type the index to look up, one of: plc, wrk, psn, eve, org
: @param $id the xml:id of an entity in the database
: @return an array of URIs or an empty array
:)
declare
%rest:GET
%rest:path("/api/index/image/{$type}/{$id}")
%output:method("json")
%test:arg("id", "Arnoldi-Denkmal")
%test:arg("type", "plc")
%test:assertTrue
function index:rendered-entity($type as xs:string, $id as xs:string)
as item()* {
let $request :=
<hc:request
method="get"
href="https://textgridlab.org/1.0/tgsearch-public/search/?q=(title:%22{$type}:{$id}%22)" />
let $tgsearch := hc:send-request($request)[2]
return
[ $tgsearch//tgmd:textgridUri/string() ]
};
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