Verified Commit 98dd1ea2 authored by mrodzis's avatar mrodzis 💪
Browse files

Merge branch 'develop' into 252-context-missing

parents 02834ad4 41002924
Pipeline #332279 passed with stages
in 7 minutes and 23 seconds
......@@ -15,6 +15,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `@context` property for Collection Object where missing
## [7.9.2] - 20221109
### Fixed
- moved editor info for manifests from Metadata Object to Actor Object
## [7.9.1] - 20221026
### Changed
- add custom error types for HTTP 404 and 500
## [7.9.0] - 20220915
### Changed
......
......@@ -46,7 +46,7 @@ declare
function anno-rest:collection-rest($collection as xs:string)
as item()+ {
if (anno:are-resources-available($collection)) then
($commons:responseHeader200,
(commons:get-response-header(200),
anno:make-annotationCollection($collection, (), $anno-rest:server))
else
anno-rest:get-404-header($collection)
......@@ -71,7 +71,7 @@ function anno-rest:annotationPage-for-collection-rest($collection as xs:string,
$document as xs:string)
as item()+ {
if (anno:are-resources-available(($collection, $document))) then
($commons:responseHeader200,
(commons:get-response-header(200),
anno:make-annotationPage($collection, $document, $anno-rest:server))
else
......@@ -102,7 +102,7 @@ function anno-rest:manifest-rest($collection as xs:string,
$document as xs:string)
as item()+ {
if (anno:are-resources-available(($collection, $document))) then
($commons:responseHeader200,
(commons:get-response-header(200),
anno:make-annotationCollection($collection, $document, $anno-rest:server))
else
......@@ -135,7 +135,7 @@ function anno-rest:annotationCollection-for-manifest-rest($collection as xs:stri
$page as xs:string)
as item()+ {
if (anno:are-resources-available(($collection, $document))) then
($commons:responseHeader200,
(commons:get-response-header(200),
anno:make-annotationCollection-for-manifest($collection, $document, $page, $anno-rest:server))
else
......@@ -168,7 +168,7 @@ function anno-rest:annotationPage-for-manifest-rest($collection as xs:string,
$page as xs:string)
as item()+ {
if (anno:are-resources-available(($collection, $document))) then
($commons:responseHeader200,
(commons:get-response-header(200),
anno:make-annotationPage-for-manifest($collection, $document, $page, $anno-rest:server))
else
......
......@@ -34,13 +34,15 @@ declare variable $commons:server :=
declare variable $commons:ns := "http://ahikar.sub.uni-goettingen.de/ns/commons";
declare variable $commons:anno-ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations";
declare variable $commons:responseHeader200 :=
declare function commons:get-response-header($code as xs:integer)
as node() {
<rest:response>
<http:response xmlns:http="http://expath.org/ns/http-client" status="200">
<http:response xmlns:http="http://expath.org/ns/http-client" status="{$code}">
<http:header name="Access-Control-Allow-Origin" value="*"/>
</http:response>
</rest:response>;
</rest:response>
};
declare function commons:get-xml-uri($manifest-uri as xs:string)
as xs:string {
......@@ -384,19 +386,6 @@ as xs:dateTime {
$sorted-modifieds[1]
};
declare function commons:make-id-from-idno($TEI as element(tei:TEI))
as xs:string {
let $idno := $TEI//tei:sourceDesc//tei:msIdentifier/tei:idno
let $normalized :=
replace($idno, "\.", "")
=> replace("[\(\)=\[\]\\]", " ")
=> normalize-space()
=> replace(" |/", "_")
return
(: in some cases the idno doesn't start with a letter but a digit.
to get a uniform ID we prepend a prefix for all tokens. :)
"t_" || $normalized
};
(:~
: Returns all page break numbers for a given TEI resource.
......@@ -458,7 +447,7 @@ as xs:string* {
declare function commons:get-child-tei-uri($uri as xs:string)
as xs:string* {
for $aggregates in collection($commons:agg)
//rdf:Description[starts-with(@rdf:about, "textgrid:" || $uri)]
//rdf:Description[matches(@rdf:about, "textgrid:" || $uri || "\.[0-9]+")]
/ore:aggregates/substring-after(@rdf:resource, "textgrid:")
let $docUri := $commons:data || $aggregates || ".xml"
where doc-available($docUri) and exists(doc($docUri)/tei:TEI)
......@@ -488,3 +477,39 @@ as map(*){
commons:get-parent-uri($uri)
=> commons:get-resource-information()
};
declare function commons:validate-rest-input($collection-type as xs:string,
$manifest-uri as xs:string?, $page as xs:string?)
as item()? {
(: collections :)
if ($collection-type = ("syriac", "arabic-karshuni")) then
()
else
error(QName($commons:ns, "INPUT_VALIDATION_01"), "Unknown collection " || $collection-type),
(: manifests :)
if ($manifest-uri and doc-available($commons:agg || $manifest-uri || ".xml")) then
()
else if (not($manifest-uri)) then
()
else
error(QName($commons:ns, "INPUT_VALIDATION_02"), "Unknown manifest " || $manifest-uri),
(: items :)
(
if ($page) then
let $tei-uri := commons:get-child-tei-uri($manifest-uri)
=> commons:get-uri-from-anything()
let $pages-in-tei := commons:get-pages-in-TEI($tei-uri)
return
if (not($page)) then
()
else if( doc-available($commons:data || $tei-uri || ".xml")
and $page = $pages-in-tei) then
()
else
error(QName($commons:ns, "INPUT_VALIDATION_03"), "Unknown page " || $page || " for manifest " || $manifest-uri)
else
()
)
};
......@@ -117,7 +117,7 @@ as xs:string {
switch ($collection-type)
case "syriac" return "Syriac"
case "arabic-karshuni" return "Arabic/Karshuni"
default return error("D001", "Unknown collection type " || $collection-type)
default return error(QName($commons:ns, "COLLECTION01"), "Unknown collection type " || $collection-type)
};
......
......@@ -20,22 +20,24 @@ declare function tapi-item:get-json($collection-type as xs:string,
$manifest-uri as xs:string,
$page as xs:string,
$server as xs:string)
as map() {
map {
"textapi": "1.0.0",
"x-app-version": $commons:version/string(),
"title": tapi-item:make-title-object($manifest-uri),
"type": "page",
"n": $page,
"content": tapi-item:make-content-array($collection-type, $manifest-uri, $page, $server),
"lang": tapi-item:make-language-array($manifest-uri),
"langAlt": tapi-item:make-langAlt-array($manifest-uri),
"x-langString": tapi-item:get-language-string($manifest-uri),
"image": tapi-item:make-image-info($manifest-uri, $page, $server),
"annotationCollection":
$server || "/api/annotations/ahikar/" || $collection-type || "/" ||
$manifest-uri || "/" || $page || "/annotationCollection.json"
}
as map()? {
let $validate := commons:validate-rest-input($collection-type, $manifest-uri, $page)
return
map {
"textapi": "1.0.0",
"x-app-version": $commons:version/string(),
"title": tapi-item:make-title-object($manifest-uri),
"type": "page",
"n": $page,
"content": tapi-item:make-content-array($collection-type, $manifest-uri, $page, $server),
"lang": tapi-item:make-language-array($manifest-uri),
"langAlt": tapi-item:make-langAlt-array($manifest-uri),
"x-langString": tapi-item:get-language-string($manifest-uri),
"image": tapi-item:make-image-info($manifest-uri, $page, $server),
"annotationCollection":
$server || "/api/annotations/ahikar/" || $collection-type || "/" ||
$manifest-uri || "/" || $page || "/annotationCollection.json"
}
};
......
......@@ -18,6 +18,7 @@ declare function tapi-mani:get-json($collection-type as xs:string,
$manifest-uri as xs:string,
$server as xs:string)
as map() {
commons:validate-rest-input($collection-type, $manifest-uri, ()),
let $tei-xml := commons:get-tei-xml-for-manifest($manifest-uri)
return
map {
......@@ -35,7 +36,8 @@ as map() {
"support": tapi-mani:make-support-object($server),
"license": tapi-mani:get-license-info($tei-xml),
"annotationCollection": $server || "/api/annotations/ahikar/" || $collection-type || "/" || $manifest-uri || "/annotationCollection.json",
"sequence": array{ tapi-mani:make-sequences($collection-type, $manifest-uri, $server) }
"sequence": array{ tapi-mani:make-sequences($collection-type, $manifest-uri, $server) },
"actor": array{ tapi-mani:make-editors($tei-xml) }
}
};
......@@ -48,7 +50,6 @@ as xs:string {
declare function tapi-mani:make-metadata-objects($tei-xml as document-node(), $server as xs:string)
as map()+ {
tapi-mani:make-editors($tei-xml),
tapi-mani:make-creation-date($tei-xml),
tapi-mani:make-origin($tei-xml),
tapi-mani:make-current-location($tei-xml),
......@@ -80,12 +81,13 @@ as xs:string+ {
};
declare function tapi-mani:make-editors($tei-xml as document-node())
as map() {
as map()* {
let $editors := $tei-xml//tei:titleStmt//tei:editor
return
for $editor in $editors return
map {
"key": if (count($editors) gt 1) then "Editors" else "Editor",
"value": if (exists($editors)) then string-join($editors, ", ") else "none"
"@context": "https://gitlab.gwdg.de/subugoe/emo/text-api/-/raw/main/jsonld/actor.jsonld",
"role": "editor",
"name": $editor/string()
}
};
......@@ -191,7 +193,6 @@ as map(*)+ {
declare function tapi-mani:make-metadata-objects-for-Salhani($tei-xml as document-node(), $server as xs:string)
as map()+ {
tapi-mani:make-editors($tei-xml),
map {
"key": "Title of the edited chapter",
"value": $tei-xml//tei:biblStruct//tei:title[@level = "a"]/string()
......
......@@ -48,7 +48,7 @@ declare
%output:method("json")
function tapi:endpoint-info()
as item()+ {
$commons:responseHeader200,
commons:get-response-header(200),
tapi:info()
};
......@@ -99,8 +99,19 @@ declare
%output:method("json")
function tapi:endpoint-collection($collection-type as xs:string)
as item()+ {
$commons:responseHeader200,
tapi-coll:get-json($collection-type, $tapi:server)
try {
commons:get-response-header(200),
tapi-coll:get-json($collection-type, $tapi:server)
}
catch Q{http://ahikar.sub.uni-goettingen.de/ns/commons}INPUT_VALIDATION_01 {
commons:get-response-header(404),
$err:code || ": " || $err:description
}
catch * {
local:make-error-response($err:code, $err:description,
$err:line-number, $err:column-number,
"An error occurred while processing " || $collection-type)
}
};
......@@ -115,8 +126,20 @@ declare
function tapi:endpoint-manifest($collection-type as xs:string,
$manifest-uri as xs:string)
as item()+ {
$commons:responseHeader200,
tapi-mani:get-json($collection-type, $manifest-uri, $tapi:server)
try {
commons:get-response-header(200),
tapi-mani:get-json($collection-type, $manifest-uri, $tapi:server)
}
catch Q{http://ahikar.sub.uni-goettingen.de/ns/commons}INPUT_VALIDATION_01 |
Q{http://ahikar.sub.uni-goettingen.de/ns/commons}INPUT_VALIDATION_02 {
commons:get-response-header(404),
$err:code || ": " || $err:description
}
catch * {
local:make-error-response($err:code, $err:description,
$err:line-number, $err:column-number,
"An error occurred while processing " || $manifest-uri)
}
};
......@@ -143,8 +166,21 @@ function tapi:endpoint-item($collection-type as xs:string,
$manifest-uri as xs:string,
$page as xs:string)
as item()+ {
$commons:responseHeader200,
tapi-item:get-json($collection-type, $manifest-uri, $page, $tapi:server)
try {
commons:get-response-header(200),
tapi-item:get-json($collection-type, $manifest-uri, $page, $tapi:server)
}
catch Q{http://ahikar.sub.uni-goettingen.de/ns/commons}INPUT_VALIDATION_01 |
Q{http://ahikar.sub.uni-goettingen.de/ns/commons}INPUT_VALIDATION_02 |
Q{http://ahikar.sub.uni-goettingen.de/ns/commons}INPUT_VALIDATION_03 {
commons:get-response-header(404),
$err:code || ": " || $err:description
}
catch * {
local:make-error-response($err:code, $err:description,
$err:line-number, $err:column-number,
"An error occurred while processing " || $manifest-uri)
}
};
(:~
......@@ -171,8 +207,19 @@ function tapi:endpoint-html($tei-xml-uri as xs:string,
$text-type as xs:string,
$page as xs:string)
as item()+ {
$commons:responseHeader200,
doc($commons:html || $tei-xml-uri || "-" || commons:format-page-number($page) || "-" || $text-type || ".html")/*
let $doc-path := $commons:html || $tei-xml-uri || "-" || commons:format-page-number($page) || "-" || $text-type || ".html"
return
if (doc-available($doc-path)) then
(
commons:get-response-header(200),
doc($commons:html || $tei-xml-uri || "-" || commons:format-page-number($page) || "-" || $text-type || ".html")/*
)
else
(
commons:get-response-header(404),
"Couldn't find document " || $tei-xml-uri || ", page " || $page || " for text type " || $text-type
)
};
(:~
......@@ -236,14 +283,31 @@ declare
%rest:GET
%rest:HEAD
%rest:path("/content/ahikar-json.zip")
%output:method("binary")
function tapi:endpoint-json() as item()+ {
let $prepare :=
(tei2json:main(),
commons:compress-to-zip($commons:json))
return
$commons:responseHeader200,
util:binary-doc("/db/data/ahikar-json.zip")
try {
tei2json:main(),
try {
commons:compress-to-zip($commons:json),
if (util:binary-doc-available("/db/data/ahikar-json.zip")) then
(
commons:get-response-header(200),
util:binary-doc("/db/data/ahikar-json.zip")
)
else
(
commons:get-response-header(404),
"Unable to find ahikar-json.zip."
)
} catch * {
local:make-error-response($err:code, $err:description,
$err:line-number, $err:column-number,
"An error occurred while compressing the files to ZIP")
}
} catch * {
local:make-error-response($err:code, $err:description,
$err:line-number, $err:column-number,
"An error occurred while creating the JSON files for ZIP")
}
};
......@@ -251,11 +315,18 @@ declare
%rest:GET
%rest:HEAD
%rest:path("/content/{$font}.woff")
%output:method("binary")
%output:media-type("font/woff")
function tapi:endpoint-fonts($font as xs:string) as item()+ {
$commons:responseHeader200,
util:binary-doc(concat("/db/data/resources/fonts/", $font, ".woff"))
if (util:binary-doc-available(concat("/db/data/resources/fonts/", $font, ".woff"))) then
(
commons:get-response-header(200),
util:binary-doc(concat("/db/data/resources/fonts/", $font, ".woff"))
)
else
(
commons:get-response-header(404),
"Unable to find font " || $font || ".woff"
)
};
declare
......@@ -265,9 +336,17 @@ declare
%output:method("text")
%output:media-type("text/css")
function tapi:endpoint-css() as item()+ {
$commons:responseHeader200,
util:binary-doc("/db/data/resources/css/ahikar.css")
=> util:base64-decode()
if (util:binary-doc-available("/db/data/resources/css/ahikar.css")) then
(
commons:get-response-header(200),
util:binary-doc("/db/data/resources/css/ahikar.css")
=> util:base64-decode()
)
else
(
commons:get-response-header(404),
"Unable to find ahikar.css"
)
};
......@@ -300,7 +379,7 @@ as item()+ {
"/full"
return
(
$commons:responseHeader200,
commons:get-response-header(200),
try {
hc:send-request(
<hc:request method="GET"
......@@ -326,7 +405,7 @@ declare
%output:method("json")
function tapi:http-endpoint-collection()
as item()+ {
$commons:responseHeader200,
commons:get-response-header(200),
head:get-collection()
};
......@@ -337,7 +416,7 @@ declare
%output:method("json")
function tapi:http-endpoint-manifest()
as item()+ {
$commons:responseHeader200,
commons:get-response-header(200),
head:get-manifest()
};
......@@ -355,3 +434,11 @@ as item()+ {
</rest:response>,
"This is the end point for the status code " || $http-status
};
declare function local:make-error-response($code as xs:QName, $desc as xs:string,
$line as xs:integer, $column as xs:integer, $rest-message as xs:string?) {
commons:get-response-header(500),
$rest-message,
concat("[", $line, ": ", $column,
"] Error ", $code, ": ", $desc)
};
......@@ -125,8 +125,12 @@ as xs:string {
declare function tei2json:tokenize-teis()
as element(tei:TEI)+ {
let $teis := tei2json:get-teis()
for $tei in $teis return
tokenize:main($tei)
return
if ($teis) then
for $tei in $teis return
tokenize:main($tei)
else
error(QName($commons:ns, "TEI2JSON01"), "No TEIs found. Make sure you have some data in the database.")
};
......@@ -188,7 +192,7 @@ declare function tei2json:get-relevant-text($tokenized-teis as element(tei:TEI)+
as element(tei:text)* {
let $relevant-text :=
for $tei in $tokenized-teis return
let $idno := commons:make-id-from-idno($tei)
let $idno := tokenize:make-id-from-idno($tei)
return
if ($idno = "t_" || $id or matches($tei/descendant::tei:editor, "t_" || $id)) then
$tei
......@@ -259,7 +263,7 @@ as map() {
(: only the relevant next nodes have been tokenized and enclosed by a tei:w,
: so no need for filtering them again. :)
let $tokens := $chunk//tei:w
let $witness-id := commons:make-id-from-idno($text/ancestor::tei:TEI)
let $witness-id := tokenize:make-id-from-idno($text/ancestor::tei:TEI)
return
tei2json:make-map-per-witness($witness-id, $tokens)
};
......
......@@ -13,13 +13,11 @@ xquery version "3.1";
module namespace tokenize="http://ahikar.sub.uni-goettingen.de/ns/tokenize";
import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare function tokenize:main($TEI as element(tei:TEI))
as element(tei:TEI) {
let $id-prefix := commons:make-id-from-idno($TEI)
let $id-prefix := tokenize:make-id-from-idno($TEI)
let $enhanced-texts :=
for $text in $TEI//tei:group/tei:text return
tokenize:add-ids($text, $id-prefix)
......@@ -92,3 +90,17 @@ as element(tei:w)* {
$texts[$iii]
}
};
declare function tokenize:make-id-from-idno($TEI as element(tei:TEI))
as xs:string {
let $idno := $TEI//tei:sourceDesc//tei:msIdentifier/tei:idno
let $normalized :=
replace($idno, "\.", "")
=> replace("[\(\)=\[\]\\]", " ")
=> normalize-space()
=> replace(" |/", "_")
return
(: in some cases the idno doesn't start with a letter but a digit.
to get a uniform ID we prepend a prefix for all tokens. :)
"t_" || $normalized
};
......@@ -96,17 +96,6 @@ as document-node() {
commons:get-metadata-file($uri)
};
declare
%test:assertXPath("$result = 't_Add_2020'")
%test:assertXPath("$result = 't_Sachau_290_Sachau_339'")
%test:assertXPath("$result = 't_Mingana_ar_christ_93_84'")
function ct:make-id-from-idno()
as xs:string+ {
let $TEIs := (ct:create-and-store-test-data(), ct:create-and-store-test-data-1(), ct:create-and-store-test-data-2())
for $TEI in $TEIs return
commons:make-id-from-idno($TEI)
};
declare
%test:args("sample_teixml") %test:assertXPath("count($result) = 6")
%test:args("sample_teixml") %test:assertXPath("$result = '82a'")
......
......@@ -21,7 +21,7 @@ as xs:string+ {
declare
%test:args("syriac") %test:assertEquals("Syriac")
%test:args("arabic-karshuni") %test:assertEquals("Arabic/Karshuni")
%test:args("misc") %test:assertError("D001")
%test:args("misc") %test:assertError("commons:COLLECTION01")
function t:get-collection-string($collection-type as xs:string)
as xs:string {
tapi-coll:get-collection-string($collection-type)
......
......@@ -87,7 +87,7 @@ declare function titemt:create-and-store-test-data()
as xs:string+ {
let $agg-wo-tile :=
<rdf:RDF xmlns:ore="http://www.openarchives.org/ore/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:tei="http://www.tei-c.org/ns/1.0" rdf:about="textgrid:sample_edition.0">
<rdf:Description xmlns:tei="http://www.tei-c.org/ns/1.0" rdf:about="textgrid:sample_edition_test.0">
<ore:aggregates rdf:resource="textgrid:ahiqar_sample_2"/>
</rdf:Description>
</rdf:RDF>
......
......@@ -133,8 +133,8 @@ function tmt:_test-teardown() {
declare
%test:args("sample_main_edition", "sample_edition")
%test:assertXPath("matches(map:get($result[1], 'id'), '/api/textapi/ahikar/sample_main_edition/sample_edition-82a/latest/item.json')")
%test:args("arabic-karshuni", "sample_edition")
%test:assertXPath("matches(map:get($result[1], 'id'), '/api/textapi/ahikar/arabic-karshuni/sample_edition-82a/latest/item.json')")
function tmt:make-sequences($collection-uri as xs:string,
$manifest-uri as xs:string) {
tapi-mani:make-sequences($collection-uri, $manifest-uri, $tc:server)
......@@ -147,10 +147,10 @@ function tmt:get-valid-page-ids($manifest-uri as xs:string) {
};
declare
%test:args("sample_main_edition", "sample_edition")
%test:args("arabic-karshuni", "sample_edition")
%test:assertXPath("map:get($result, 'label') = 'Beispieldatei zum Testen'")
%test:assertXPath("matches(map:get($result, 'id'), '/api/textapi/ahikar/sample_main_edition/sample_edition/manifest.json')")
%test:assertXPath("matches(map:get($result, 'annotationCollection'), '/api/annotations/ahikar/sample_main_edition/sample_edition/annotationCollection.json') ")
%test:assertXPath("matches(map:get($result, 'id'), '/api/textapi/ahikar/arabic-karshuni/sample_edition/manifest.json')")
%test:assertXPath("matches(map:get($result, 'annotationCollection'), '/api/annotations/ahikar/arabic-karshuni/sample_edition/annotationCollection.json') ")
function tmt:get-json($collection-uri as xs:string,
$manifest-uri as xs:string) {
tapi-mani:get-json($collection-uri, $manifest-uri, $tc:server)
......@@ -163,7 +163,7 @@ function tmt:get-manifest-title($manifest-uri as xs:string) {
};
declare
%test:assertXPath("map:get($result, 'value') = 'Simon Birol, Aly Elrefaei'")
%test:assertXPath("map:get($result[1], 'name') = 'Simon Birol'")
function tmt:make-editors-present() {
let $tei-xml := commons:get-tei-xml-for-manifest("sample_edition")
return
......@@ -171,7 +171,7 @@ function tmt:make-editors-present() {
};
declare
%test:assertXPath("map:get($result, 'value') = 'none'")
%test:assertEmpty
function tmt:make-editors-not-present() {
let $tei-xml := commons:get-tei-xml-for-manifest("test-manifest1")
return
......@@ -292,10 +292,9 @@ as item()+ {
};
declare
%test:assertXPath("count($result) gt 3")
%test:assertXPath("map:get($result[1], 'value') = 'Simon Birol, Aly Elrefaei'")
%test:assertXPath("map:get($result[2], 'value') = 'Tale of Haiqar the wise, vizir of Sennachrieb the king and of his sister''s son Nadan'")
%test:assertXPath("map:get($result[3], 'value') = 'Salhani, Anton. Ṭarāʾif fukāhāt fī arbaʿ ḥikājāt (Contes Arabes). Beirut 1890, 1–20. Published by al-Maṭbaʿa al-kāṯūlīkīja li-l-āAbā al-jasūʿījīn.'")
%test:assertXPath("count($result) = 3")
%test:assertXPath("map:get($result[1], 'value') = 'Tale of Haiqar the wise, vizir of Sennachrieb the king and of his sister''s son Nadan'")
%test:assertXPath("map:get($result[2], 'value') = 'Salhani, Anton. Ṭarāʾif fukāhāt fī arbaʿ ḥikājāt (Contes Arabes). Beirut 1890, 1–20. Published by al-Maṭbaʿa al-kāṯūlīkīja li-l-āAbā al-jasūʿījīn.'")
function tmt:make-metadata-objects-for-Salhani() {
let $tei-xml := doc("/db/data/textgrid/data/salhani_header_sample_teixml.xml")
return
......
......@@ -54,6 +54,17 @@ as element(tei:w)+ {
tokenize:add-id-to-text($node/text(), $id-prefix)
};
declare
%test:assertXPath("$result = 't_Add_2020'")
%test:assertXPath("$result = 't_Sachau_290_Sachau_339'")
%test:assertXPath("$result = 't_Mingana_ar_christ_93_84'")
function t:make-id-from-idno()
as xs:string+ {
let $TEIs := (t:create-and-store-test-data(), t:create-and-store-test-data-1(), t:create-and-store-test-data-2())
for $TEI in $TEIs return
tokenize:make-id-from-idno($TEI)
};