From 7f17d2ab24dcc8a3466ffe1be94ef7e92974dca5 Mon Sep 17 00:00:00 2001 From: Mathias Goebel Date: Wed, 14 Oct 2020 13:48:59 +0200 Subject: [PATCH 001/155] Bugfix/#49 pw protection --- .gitlab-ci.yml | 2 +- CHANGELOG.md | 6 ++++++ exist-app/build.properties | 2 +- exist-app/post-install.xq | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15cf117..a695ea6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ stages: - chmod 700 ~/.ssh .env: &env -- echo $SECRETS >> docker/ahikar.env +- echo $SECRETS | sed "s#\s#\n#g" >> docker/ahikar.env - sh docker/set-env-for-docker-compose.sh # used for develop and master, see test for all other cases! diff --git a/CHANGELOG.md b/CHANGELOG.md index 01499f9..49cf6cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.13.0] - 2020-10-13 + +### Added + +- exist application sets admin password from env var (optionally) + ## [1.12.0] - 2020-10-01 ### Added diff --git a/exist-app/build.properties b/exist-app/build.properties index 1daf5a4..b11b27f 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=1.11.0 +project.version=1.13.0 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index fda6e1b..9cb4d11 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -24,6 +24,11 @@ declare function local:move-and-rename($filename as xs:string) as item()* { xmldb:move($data-file-path, $target-agg-collection, $filename) }; +(: set admin password on deployment. Convert to string + so local development will not fail because of missing + env var. :) +sm:passwd("admin", string(environment-variable("EXIST_ADMIN_PW"))), + ( (: register REST APIs :) for $uri at $pos in (collection($target)/base-uri())[ends-with(., ".xqm")] -- GitLab From 3ff40fb883596522281e53309dcb1ee6d3d7f716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 19:55:12 +0100 Subject: [PATCH 002/155] fix: requestr not available for test suite --- exist-app/modules/annotations.xqm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index c53e5d7..50484e4 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -26,7 +26,14 @@ import module namespace rest="http://exquery.org/ns/restxq"; import module namespace tapi="http://ahikar.sub.uni-goettingen.de/ns/tapi" at "tapi.xqm"; declare variable $anno:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations"; -declare variable $anno:server := if(requestr:hostname() = "existdb") then doc("../expath-pkg.xml")/*/@name => replace("/$", "") else "http://localhost:8094/exist/restxq"; +declare variable $anno:server := + if(try { + requestr:hostname() = "existdb" +} catch * { + true() +}) + then doc("../expath-pkg.xml")/*/@name => replace("/$", "") + else "http://localhost:8094/exist/restxq"; declare variable $anno:annotationElements := ( -- GitLab From 6672ec37a4ebf8675948999fbc90f326a11a8af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 20:11:17 +0100 Subject: [PATCH 003/155] fix: add return type --- exist-app/modules/annotations.xqm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 50484e4..a767df5 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -952,7 +952,8 @@ $page as xs:string) as xs:integer { }; -declare function anno:get-document($uri as xs:string, $type as xs:string) { +declare function anno:get-document($uri as xs:string, $type as xs:string) +as document-node() { let $collection := switch ($type) case "agg" return $commons:agg -- GitLab From 878cbfde785df4dafba561e25762c1e9444d2e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 20:11:56 +0100 Subject: [PATCH 004/155] docs: add minor code doc --- exist-app/modules/annotations.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index a767df5..5936a1f 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -43,7 +43,7 @@ declare variable $anno:annotationElements := (: this variable holds a map with the complete project structure (excluding images) :) declare variable $anno:uris := - let $main-collection := "3r132" + let $main-collection := "3r132" (: main textgrid edition object :) let $language-aggs := anno:get-uris($main-collection) return map { $main-collection: -- GitLab From 6fc2c1f43343f9ffca2b331ef7de3a70248479a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 20:13:52 +0100 Subject: [PATCH 005/155] fix: REST path --- exist-app/modules/annotations.xqm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 5936a1f..5ab4451 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -234,7 +234,7 @@ declare function anno:get-creator($uri as xs:string) as xs:string { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}/annotationPage.json") + %rest:path("/textapi/ahikar/{$collection}/{$document}/annotationPage.json") %output:method("json") function anno:annotationPage-for-collection-rest($collection as xs:string, $document as xs:string) { @@ -311,7 +311,7 @@ $document as xs:string, $server as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}/annotationCollection.json") + %rest:path("/textapi/ahikar/{$collection}/{$document}/annotationCollection.json") %output:method("json") function anno:manifest-rest($collection as xs:string, $document as xs:string) { -- GitLab From 7e633c8c2cf1f6d8613fe0b04f6b2c20ff9909d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 20:16:53 +0100 Subject: [PATCH 006/155] fix: reuse IDs from HTML serialization this will ensure that IDs are identical and we do not want to repeat our selfs --- exist-app/modules/annotations.xqm | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 5ab4451..dc9d84f 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -24,6 +24,8 @@ import module namespace functx = "http://www.functx.com"; import module namespace requestr="http://exquery.org/ns/request"; import module namespace rest="http://exquery.org/ns/restxq"; import module namespace tapi="http://ahikar.sub.uni-goettingen.de/ns/tapi" at "tapi.xqm"; +import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; + declare variable $anno:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations"; declare variable $anno:server := @@ -492,7 +494,7 @@ declare function anno:get-annotations($documentURI as xs:string, $page as xs:str $pageChunk//*[name(.) = $name] for $annotation in $annotation-elements return - let $id := generate-id($annotation) + let $id := string( $annotation/@id ) return map { "id": $anno:ns || "/" || $documentURI || "/annotation-" || $id, @@ -511,26 +513,9 @@ declare function anno:get-annotations($documentURI as xs:string, $page as xs:str : @param $page The page to be returned as tei:pb/@n/string() :) declare function anno:get-page-fragment($documentURI as xs:string, $page as xs:string) { - let $node :=anno:get-document($documentURI, "data"), - $start-node := $node//tei:pb[@n = $page and @facs], - $end-node := - let $followingPb := $node//tei:pb[@n = $page and @facs]/following::tei:pb[1][@facs] - return - if($followingPb) - then $followingPb - else $node//tei:pb[@n = $page and @facs]/following::tei:ab[last()], - $wrap-in-first-common-ancestor-only := false(), - $include-start-and-end-nodes := false(), - $empty-ancestor-elements-to-include := ("") - + let $nodeURI :=anno:get-document($documentURI, "data")/base-uri() return - fragment:get-fragment-from-doc( - $node, - $start-node, - $end-node, - $wrap-in-first-common-ancestor-only, - $include-start-and-end-nodes, - $empty-ancestor-elements-to-include) + tapi-html:get-page-fragment($nodeURI, $page) }; -- GitLab From 7eefb321dac7e398db0b461e0da5a4ceb10dab58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 20:18:07 +0100 Subject: [PATCH 007/155] docs: add inline code doc --- exist-app/modules/annotations.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index dc9d84f..42e88b7 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -494,7 +494,7 @@ declare function anno:get-annotations($documentURI as xs:string, $page as xs:str $pageChunk//*[name(.) = $name] for $annotation in $annotation-elements return - let $id := string( $annotation/@id ) + let $id := string( $annotation/@id ) (: get the predefined ID from the in-memory TEI with IDs :) return map { "id": $anno:ns || "/" || $documentURI || "/annotation-" || $id, -- GitLab From 89dcfa1a6ee4275c228eeea6985334e47928f414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 20:31:27 +0100 Subject: [PATCH 008/155] feature: move annotations to own REST paths --- exist-app/modules/annotations.xqm | 34 +++++++++++---------------- exist-app/modules/tapi-collection.xqm | 2 +- exist-app/modules/tapi-item.xqm | 2 +- exist-app/modules/tapi-manifest.xqm | 2 +- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 42e88b7..82b5f40 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -80,7 +80,7 @@ declare variable $anno:uris := : it has mainly been designed for Ahikar's main collection, 3r132. : : For retrieving annotation information about other collections cf. the endpoint - : /textapi/ahikar/{$collection}/{$document}/annotationCollection.json + : /textapi/ahikar/annotation/collection/{$collection}/{$document}/annotationCollection.json : : @param $collection The URI of the collection, e.g. '3r132' : @return An Annotation Collecion for the given collection @@ -88,7 +88,7 @@ declare variable $anno:uris := declare %rest:GET %rest:HEAD - %rest:path("/textapi/ahikar/{$collection}/annotationCollection.json") + %rest:path("/textapi/ahikar/annotation/collection/{$collection}/annotationCollection.json") %output:method("json") function anno:collection-rest($collection as xs:string) { if (anno:are-resources-available($collection)) then @@ -115,8 +115,8 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum at this point it is relevant if $document is actually a manifest or a collection. we have to create different paths containing $first and $last for the two of them, namely - $server || "/textapi/ahikar/" || $document || "/" || $first || "/annotationPage.json" for $document being a collection - $server || "/textapi/ahikar/" || $collection || "/" || $document || "-" || $first || "/annotationPage.json" for $document being a manifest :) + $server || "/textapi/ahikar/annotation/page/" || $document || "/" || $first || "/annotationPage.json" for $document being a collection + $server || "/textapi/ahikar/annotation/page/" || $collection || "/" || $document || "-" || $first || "/annotationPage.json" for $document being a manifest :) if ($document and anno:find-in-map($anno:uris, $document) instance of map()) then anno:get-information-for-collection-object($document, $server) @@ -126,8 +126,8 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum let $tei := anno:find-in-map($anno:uris, $document) let $pages := anno:get-pages-in-TEI($tei) let $title := anno:get-metadata-title($document) - let $first-entry := $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $pages[1] || "/annotationPage.json" - let $last-entry := $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $pages[last()] || "/annotationPage.json" + let $first-entry := $server || "/api/textapi/ahikar/annotation/page/" || $collection || "/" || $document || "/" || $pages[1] || "/annotationPage.json" + let $last-entry := $server || "/api/textapi/ahikar/annotation/page/" || $collection || "/" || $document || "/" || $pages[last()] || "/annotationPage.json" return anno:make-annotationCollection-map($document, $title, $first-entry, $last-entry) @@ -153,8 +153,8 @@ declare function anno:get-information-for-collection-object($collectionURI as xs let $first := $child-keys[1] let $last := $child-keys[last()] let $title := anno:get-metadata-title($collectionURI) - let $first-entry := $server || "/api/textapi/ahikar/" || $collectionURI || "/" || $first || "/annotationPage.json" - let $last-entry := $server || "/api/textapi/ahikar/" || $collectionURI || "/" || $last || "/annotationPage.json" + let $first-entry := $server || "/api/textapi/ahikar/annotation/page/" || $collectionURI || "/" || $first || "/annotationPage.json" + let $last-entry := $server || "/api/textapi/ahikar/annotation/page/" || $collectionURI || "/" || $last || "/annotationPage.json" return anno:make-annotationCollection-map($collectionURI, $title, $first-entry, $last-entry) @@ -236,7 +236,7 @@ declare function anno:get-creator($uri as xs:string) as xs:string { declare %rest:GET %rest:HEAD - %rest:path("/textapi/ahikar/{$collection}/{$document}/annotationPage.json") + %rest:path("/textapi/ahikar/annotation/page/{$collection}/{$document}/annotationPage.json") %output:method("json") function anno:annotationPage-for-collection-rest($collection as xs:string, $document as xs:string) { @@ -313,7 +313,7 @@ $document as xs:string, $server as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/textapi/ahikar/{$collection}/{$document}/annotationCollection.json") + %rest:path("/textapi/ahikar/annotation/collection/{$collection}/{$document}/annotationCollection.json") %output:method("json") function anno:manifest-rest($collection as xs:string, $document as xs:string) { @@ -344,7 +344,7 @@ $document as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}-{$page}/annotationCollection.json") + %rest:path("/textapi/ahikar/annotation/collection/{$collection}/{$document}/{$page}/annotationCollection.json") %output:method("json") function anno:annotationCollection-for-manifest-rest($collection as xs:string, $document as xs:string, $page as xs:string) { @@ -387,7 +387,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) { "label": "Ahikar annotations for textgrid:" || $document || ": " || $title || ", page " || $page, "x-creator": anno:get-creator($document), "total": anno:get-total-no-of-annotations($page), - "first": $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $page || "/annotationPage.json" + "first": $server || "/api/textapi/ahikar/annotation/page/" || $collection || "/" || $document || "/" || $page || "/annotationPage.json" } } }; @@ -412,7 +412,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}-{$page}/annotationPage.json") + %rest:path("/textapi/ahikar/annotation/page/{$collection}/{$document}/{$page}/annotationPage.json") %output:method("json") function anno:annotationPage-for-manifest-rest($collection as xs:string, $document as xs:string, $page as xs:string) { @@ -705,14 +705,8 @@ $document as xs:string, $type as xs:string) { declare function anno:get-prev-or-next-annotationPage-url($collection as xs:string, $document as xs:string?, $page as xs:string?, $server as xs:string) { - let $pageSuffix := - if ($page) then - "-" || $page - else - () - return if ($document) then - $server || "/api/textapi/ahikar/" || $collection|| "/" || $document || $pageSuffix || "/annotationPage.json" + $server || "/api/textapi/ahikar/annotation/page/" || $collection || "/" || $document || "/" || $page || "/annotationPage.json" else () }; diff --git a/exist-app/modules/tapi-collection.xqm b/exist-app/modules/tapi-collection.xqm index e372b8e..e9a02e5 100644 --- a/exist-app/modules/tapi-collection.xqm +++ b/exist-app/modules/tapi-collection.xqm @@ -141,5 +141,5 @@ as xs:string { declare function tapi-coll:make-annotationCollection-uri($server as xs:string, $collection-uri as xs:string) as xs:string { - $server || "/api/textapi/ahikar/" || $collection-uri || "/annotationCollection.json" + $server || "/api/textapi/ahikar/annotation/collection/" || $collection-uri || "/annotationCollection.json" }; diff --git a/exist-app/modules/tapi-item.xqm b/exist-app/modules/tapi-item.xqm index f38fb7e..b9f3db6 100644 --- a/exist-app/modules/tapi-item.xqm +++ b/exist-app/modules/tapi-item.xqm @@ -30,7 +30,7 @@ as element(object) { {tapi-item:make-facsimile-id($manifest-uri, $page, $server)} - {$server}/api/textapi/ahikar/{$collection-uri}/{$manifest-uri}-{$page}/annotationCollection.json + {$server}/api/textapi/ahikar/annotation/collection/{$collection-uri}/{$manifest-uri}/{$page}/annotationCollection.json }; diff --git a/exist-app/modules/tapi-manifest.xqm b/exist-app/modules/tapi-manifest.xqm index 6a3205a..7297c62 100644 --- a/exist-app/modules/tapi-manifest.xqm +++ b/exist-app/modules/tapi-manifest.xqm @@ -29,7 +29,7 @@ as element(object) { tapi-mani:make-current-location($manifest-uri) } CC0-1.0 - {$server}/api/textapi/ahikar/{$collection-uri}/{$manifest-uri}/annotationCollection.json + {$server}/api/textapi/ahikar/annotation/collection/{$collection-uri}/{$manifest-uri}/annotationCollection.json {tapi-mani:make-sequences($collection-uri, $manifest-uri, $server)} }; -- GitLab From 59d0a423d0282ed9991f62c2a82180b41a63d205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 26 Oct 2020 21:04:38 +0100 Subject: [PATCH 009/155] feature: custom error on doc not found --- exist-app/modules/annotations.xqm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 82b5f40..467f7c2 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -939,6 +939,9 @@ as document-node() { case "data" return $commons:tg-collection || "/data/" case "meta" return $commons:meta default return error(QName($anno:ns, "ANNO02"), "Unknown type " || $type) + let $document-uri := $collection || $uri || ".xml" return - doc($collection || $uri || ".xml") + if(doc-available($document-uri)) + then doc($document-uri) + else error(QName($anno:ns, "ANNO03"), "Document not found: " || $document-uri) }; \ No newline at end of file -- GitLab From fdd49371462dab6c8d28aefc868dc52598d20a6e Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 5 Nov 2020 11:43:34 +0100 Subject: [PATCH 010/155] ci: check if test API is available --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90c956e..1c6b868 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,6 +40,10 @@ test_exist_app: - ant -f exist-app/build.xml test - bash exist-app/test/bin/startup.sh | tee output.log & - while [ $(curl --head --silent http://localhost:8080 | grep -c "200 OK") == 0 ]; do sleep 1s; done + - header=$(curl --head -s http://localhost:8080/exist/restxq/trigger-tests) + - status=$(echo $header | head -n 1 | cut -d" " -f 2) + - echo "Current HTTP status is $status." + - if [[ "$status" == "200" ]]; then ; else exit 1; fi - curl http://localhost:8080/exist/restxq/trigger-tests - sleep 60 - bash exist-app/test/bin/shutdown.sh -- GitLab From 05a5631f6b7e157733b89db85d27ebc2d94e99b2 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 5 Nov 2020 13:39:03 +0100 Subject: [PATCH 011/155] fix: remove faulty pw setting --- exist-app/post-install.xq | 5 ----- 1 file changed, 5 deletions(-) diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index 9cb4d11..fda6e1b 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -24,11 +24,6 @@ declare function local:move-and-rename($filename as xs:string) as item()* { xmldb:move($data-file-path, $target-agg-collection, $filename) }; -(: set admin password on deployment. Convert to string - so local development will not fail because of missing - env var. :) -sm:passwd("admin", string(environment-variable("EXIST_ADMIN_PW"))), - ( (: register REST APIs :) for $uri at $pos in (collection($target)/base-uri())[ends-with(., ".xqm")] -- GitLab From 96a28576305699e90e63e3e5ee4690749420cca5 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 5 Nov 2020 13:39:27 +0100 Subject: [PATCH 012/155] fix: remove surplus module imports --- exist-app/modules/testtrigger.xqm | 3 --- 1 file changed, 3 deletions(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 96fbbe5..70f2ddc 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -14,12 +14,10 @@ module namespace testtrigger="http://ahikar.sub.uni-goettingen.de/ns/testtrigger import module namespace rest="http://exquery.org/ns/restxq"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -import module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests" at "../tests/collate-tests.xqm"; import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "../tests/tapi-txt-tests.xqm"; -import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm"; import module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" at "../tests/tapi-collection-tests.xqm"; import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" at "../tests/tapi-html-tests.xqm"; import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "../tests/tapi-item-tests.xqm"; @@ -46,7 +44,6 @@ as item()? { let $tests := ( test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/coll-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), -- GitLab From 3706c9aea59896ca4f2827a20fc42b4e0b55ccb2 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 5 Nov 2020 13:40:57 +0100 Subject: [PATCH 013/155] ci: insert check if test trigger is available --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1c6b868..57d33ad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ test_exist_app: - header=$(curl --head -s http://localhost:8080/exist/restxq/trigger-tests) - status=$(echo $header | head -n 1 | cut -d" " -f 2) - echo "Current HTTP status is $status." - - if [[ "$status" == "200" ]]; then ; else exit 1; fi + - if [[ "$status" != "200" ]]; then exit 1; fi - curl http://localhost:8080/exist/restxq/trigger-tests - sleep 60 - bash exist-app/test/bin/shutdown.sh -- GitLab From f0717b1e418d00a12a98ccbb48f30c651a98879f Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 5 Nov 2020 15:07:41 +0100 Subject: [PATCH 014/155] fix: add HEAD --- exist-app/modules/testtrigger.xqm | 1 + 1 file changed, 1 insertion(+) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 70f2ddc..d8b8867 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -33,6 +33,7 @@ import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" a :) declare %rest:GET + %rest:HEAD %rest:path("/trigger-tests") %rest:query-param("token", "{$token}") function testtrigger:trigger($token) -- GitLab From 53aec7fb9332e87f5949fd36e9127e74b44afdde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 5 Nov 2020 15:22:17 +0100 Subject: [PATCH 015/155] fix: update pw on autodeploy stage --- exist-app/post-install.xq | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index 9cb4d11..b8e8e62 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -27,7 +27,16 @@ declare function local:move-and-rename($filename as xs:string) as item()* { (: set admin password on deployment. Convert to string so local development will not fail because of missing env var. :) -sm:passwd("admin", string(environment-variable("EXIST_ADMIN_PW"))), + +( + if(environment-variable("EXIST_ADMIN_PW_RIPEMD160")) + then + (update replace doc('/db/system/security/exist/accounts/admin.xml')//*:password/text() with text{ string(environment-variable("EXIST_ADMIN_PW_RIPEMD160")) }, + update replace doc('/db/system/security/exist/accounts/admin.xml')//*:digestPassword/text() with text{ string(environment-variable("EXIST_ADMIN_PW_DIGEST")) }) + else (: we do not have the env vars available, so we leave the configuration as it is :) + true() + +), ( (: register REST APIs :) -- GitLab From ba6ddd76d1a745cb6d3fab4896ae889ef88ab20f Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 6 Nov 2020 09:48:31 +0100 Subject: [PATCH 016/155] fix: remove merge fragments --- exist-app/post-install.xq | 3 --- 1 file changed, 3 deletions(-) diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index e037250..b8e8e62 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -24,8 +24,6 @@ declare function local:move-and-rename($filename as xs:string) as item()* { xmldb:move($data-file-path, $target-agg-collection, $filename) }; -<<<<<<< HEAD -======= (: set admin password on deployment. Convert to string so local development will not fail because of missing env var. :) @@ -40,7 +38,6 @@ declare function local:move-and-rename($filename as xs:string) as item()* { ), ->>>>>>> develop ( (: register REST APIs :) for $uri at $pos in (collection($target)/base-uri())[ends-with(., ".xqm")] -- GitLab From c21ca1229455f6a94caaa94798b570b848f9c832 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 6 Nov 2020 09:49:20 +0100 Subject: [PATCH 017/155] chore: update test result file name --- exist-app/modules/testtrigger.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index d8b8867..0624295 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -60,7 +60,7 @@ as item()? { let $testWrap := { $tests } - let $filename := $system-path || "test-results.xml" + let $filename := $system-path || "ahikar-test-results.xml" let $file := file:serialize($testWrap, $filename, ()) return -- GitLab From 25e43b671135e7ce8a1adeafc9b4d03a5d4addfc Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 6 Nov 2020 10:00:36 +0100 Subject: [PATCH 018/155] ci: update file name; check if result XML exists --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57d33ad..3bdd583 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,12 +49,12 @@ test_exist_app: - bash exist-app/test/bin/shutdown.sh - failures=$(./get-unit-test-failures-and-errors.sh) - echo -e "\033[1;33mThere is/are currently $failures failures or errors.\033[0m" - - if [[ "$failures" -gt 0 ]]; then exit 1; else exit 0; fi + - if [[ "$failures" -gt 0 || ! -f "exist-app/test/ahikar-test-results.xml" ]]; then exit 1; else exit 0; fi artifacts: paths: - - exist-app/test/test-results.xml + - exist-app/test/ahikar-test-results.xml reports: - junit: exist-app/test/test-results.xml + junit: exist-app/test/ahikar-test-results.xml build_exist_app-all: image: docker.gitlab.gwdg.de/fontane-notizbuecher/build:latest -- GitLab From 07e20a4c5d825fa40032d91ff7188876fc338beb Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 6 Nov 2020 10:00:46 +0100 Subject: [PATCH 019/155] chore: update file name --- get-unit-test-failures-and-errors.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/get-unit-test-failures-and-errors.sh b/get-unit-test-failures-and-errors.sh index ee76a04..60b48dc 100755 --- a/get-unit-test-failures-and-errors.sh +++ b/get-unit-test-failures-and-errors.sh @@ -1,7 +1,7 @@ #!/bin/bash -failures=$(xmllint --xpath '/tests/testsuites/testsuite/@failures' exist-app/test/test-results.xml | egrep -o "[0-9]+") -errors=$(xmllint --xpath '/tests/testsuites/testsuite/@errors' exist-app/test/test-results.xml | egrep -o "[0-9]+") +failures=$(xmllint --xpath '/tests/testsuites/testsuite/@failures' exist-app/test/ahikar-test-results.xml | egrep -o "[0-9]+") +errors=$(xmllint --xpath '/tests/testsuites/testsuite/@errors' exist-app/test/ahikar-test-results.xml | egrep -o "[0-9]+") problem_sum=0 -- GitLab From db29d94d1a535670322971e09785859212678d87 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 6 Nov 2020 10:09:43 +0100 Subject: [PATCH 020/155] docs: CHANGELOG, version number --- CHANGELOG.md | 10 ++++++++++ exist-app/build.properties | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49cf6cf..789e37d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.13.1] - 2020-10-06 + +### Fixed + +- Unit tests are executed again. + +### Changed + +- The CI tests if 1. the unit test API is available and 2. the XML file resulting from the test exists. + ## [1.13.0] - 2020-10-13 ### Added diff --git a/exist-app/build.properties b/exist-app/build.properties index b11b27f..011fd63 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=1.13.0 +project.version=1.13.1 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From c22ad637bb8c2ab70ae9aab04cd952cf4b6d2e56 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 6 Nov 2020 10:42:38 +0100 Subject: [PATCH 021/155] feat: change endpoint of AnnotationAPI --- CHANGELOG.md | 6 +++++ exist-app/build.properties | 2 +- exist-app/modules/annotations.xqm | 30 +++++++++++------------ exist-app/modules/tapi-collection.xqm | 2 +- exist-app/modules/tapi-item.xqm | 2 +- exist-app/modules/tapi-manifest.xqm | 4 +-- exist-app/tests/tapi-collection-tests.xqm | 2 +- exist-app/tests/tapi-item-tests.xqm | 3 ++- exist-app/tests/tapi-manifest-tests.xqm | 7 +++--- 9 files changed, 33 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49cf6cf..335ad7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.0] - 2020-11-06 + +### Changed + +- The AnnotationAPI is now served at `/api/annotations` instead of `/api/textapi`. + ## [1.13.0] - 2020-10-13 ### Added diff --git a/exist-app/build.properties b/exist-app/build.properties index b11b27f..6a89d1e 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=1.13.0 +project.version=2.0.0 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index c53e5d7..0ab0667 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -71,7 +71,7 @@ declare variable $anno:uris := : it has mainly been designed for Ahikar's main collection, 3r132. : : For retrieving annotation information about other collections cf. the endpoint - : /textapi/ahikar/{$collection}/{$document}/annotationCollection.json + : /annotations/ahikar/{$collection}/{$document}/annotationCollection.json : : @param $collection The URI of the collection, e.g. '3r132' : @return An Annotation Collecion for the given collection @@ -79,7 +79,7 @@ declare variable $anno:uris := declare %rest:GET %rest:HEAD - %rest:path("/textapi/ahikar/{$collection}/annotationCollection.json") + %rest:path("/annotations/ahikar/{$collection}/annotationCollection.json") %output:method("json") function anno:collection-rest($collection as xs:string) { if (anno:are-resources-available($collection)) then @@ -106,8 +106,8 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum at this point it is relevant if $document is actually a manifest or a collection. we have to create different paths containing $first and $last for the two of them, namely - $server || "/textapi/ahikar/" || $document || "/" || $first || "/annotationPage.json" for $document being a collection - $server || "/textapi/ahikar/" || $collection || "/" || $document || "-" || $first || "/annotationPage.json" for $document being a manifest :) + $server || "/annotations/ahikar/" || $document || "/" || $first || "/annotationPage.json" for $document being a collection + $server || "/annotations/ahikar/" || $collection || "/" || $document || "-" || $first || "/annotationPage.json" for $document being a manifest :) if ($document and anno:find-in-map($anno:uris, $document) instance of map()) then anno:get-information-for-collection-object($document, $server) @@ -117,8 +117,8 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum let $tei := anno:find-in-map($anno:uris, $document) let $pages := anno:get-pages-in-TEI($tei) let $title := anno:get-metadata-title($document) - let $first-entry := $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $pages[1] || "/annotationPage.json" - let $last-entry := $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $pages[last()] || "/annotationPage.json" + let $first-entry := $server || "/api/annotations/ahikar/" || $collection || "/" || $document || "-" || $pages[1] || "/annotationPage.json" + let $last-entry := $server || "/api/annotations/ahikar/" || $collection || "/" || $document || "-" || $pages[last()] || "/annotationPage.json" return anno:make-annotationCollection-map($document, $title, $first-entry, $last-entry) @@ -144,8 +144,8 @@ declare function anno:get-information-for-collection-object($collectionURI as xs let $first := $child-keys[1] let $last := $child-keys[last()] let $title := anno:get-metadata-title($collectionURI) - let $first-entry := $server || "/api/textapi/ahikar/" || $collectionURI || "/" || $first || "/annotationPage.json" - let $last-entry := $server || "/api/textapi/ahikar/" || $collectionURI || "/" || $last || "/annotationPage.json" + let $first-entry := $server || "/api/annotations/ahikar/" || $collectionURI || "/" || $first || "/annotationPage.json" + let $last-entry := $server || "/api/annotations/ahikar/" || $collectionURI || "/" || $last || "/annotationPage.json" return anno:make-annotationCollection-map($collectionURI, $title, $first-entry, $last-entry) @@ -227,7 +227,7 @@ declare function anno:get-creator($uri as xs:string) as xs:string { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}/annotationPage.json") + %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationPage.json") %output:method("json") function anno:annotationPage-for-collection-rest($collection as xs:string, $document as xs:string) { @@ -304,7 +304,7 @@ $document as xs:string, $server as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}/annotationCollection.json") + %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationCollection.json") %output:method("json") function anno:manifest-rest($collection as xs:string, $document as xs:string) { @@ -335,7 +335,7 @@ $document as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}-{$page}/annotationCollection.json") + %rest:path("/api/annotations/ahikar/{$collection}/{$document}-{$page}/annotationCollection.json") %output:method("json") function anno:annotationCollection-for-manifest-rest($collection as xs:string, $document as xs:string, $page as xs:string) { @@ -378,7 +378,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) { "label": "Ahikar annotations for textgrid:" || $document || ": " || $title || ", page " || $page, "x-creator": anno:get-creator($document), "total": anno:get-total-no-of-annotations($page), - "first": $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $page || "/annotationPage.json" + "first": $server || "/api/annotations/ahikar/" || $collection || "/" || $document || "-" || $page || "/annotationPage.json" } } }; @@ -403,7 +403,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/textapi/ahikar/{$collection}/{$document}-{$page}/annotationPage.json") + %rest:path("/api/annotations/ahikar/{$collection}/{$document}-{$page}/annotationPage.json") %output:method("json") function anno:annotationPage-for-manifest-rest($collection as xs:string, $document as xs:string, $page as xs:string) { @@ -720,7 +720,7 @@ $document as xs:string?, $page as xs:string?, $server as xs:string) { () return if ($document) then - $server || "/api/textapi/ahikar/" || $collection|| "/" || $document || $pageSuffix || "/annotationPage.json" + $server || "/api/annotations/ahikar/" || $collection|| "/" || $document || $pageSuffix || "/annotationPage.json" else () }; @@ -954,4 +954,4 @@ declare function anno:get-document($uri as xs:string, $type as xs:string) { default return error(QName($anno:ns, "ANNO02"), "Unknown type " || $type) return doc($collection || $uri || ".xml") -}; \ No newline at end of file +}; diff --git a/exist-app/modules/tapi-collection.xqm b/exist-app/modules/tapi-collection.xqm index e372b8e..b4ee2e8 100644 --- a/exist-app/modules/tapi-collection.xqm +++ b/exist-app/modules/tapi-collection.xqm @@ -141,5 +141,5 @@ as xs:string { declare function tapi-coll:make-annotationCollection-uri($server as xs:string, $collection-uri as xs:string) as xs:string { - $server || "/api/textapi/ahikar/" || $collection-uri || "/annotationCollection.json" + $server || "/api/annotations/ahikar/" || $collection-uri || "/annotationCollection.json" }; diff --git a/exist-app/modules/tapi-item.xqm b/exist-app/modules/tapi-item.xqm index f38fb7e..cd1a52c 100644 --- a/exist-app/modules/tapi-item.xqm +++ b/exist-app/modules/tapi-item.xqm @@ -30,7 +30,7 @@ as element(object) { {tapi-item:make-facsimile-id($manifest-uri, $page, $server)} - {$server}/api/textapi/ahikar/{$collection-uri}/{$manifest-uri}-{$page}/annotationCollection.json + {$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}-{$page}/annotationCollection.json }; diff --git a/exist-app/modules/tapi-manifest.xqm b/exist-app/modules/tapi-manifest.xqm index 6a3205a..d6d5c8f 100644 --- a/exist-app/modules/tapi-manifest.xqm +++ b/exist-app/modules/tapi-manifest.xqm @@ -29,7 +29,7 @@ as element(object) { tapi-mani:make-current-location($manifest-uri) } CC0-1.0 - {$server}/api/textapi/ahikar/{$collection-uri}/{$manifest-uri}/annotationCollection.json + {$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}/annotationCollection.json {tapi-mani:make-sequences($collection-uri, $manifest-uri, $server)} }; @@ -139,4 +139,4 @@ element(x-location) { return {$string} -}; \ No newline at end of file +}; diff --git a/exist-app/tests/tapi-collection-tests.xqm b/exist-app/tests/tapi-collection-tests.xqm index 594e835..82b61b2 100644 --- a/exist-app/tests/tapi-collection-tests.xqm +++ b/exist-app/tests/tapi-collection-tests.xqm @@ -198,7 +198,7 @@ function tct:make-sequence($collection-uri as xs:string) { }; declare - %test:args("ahiqar_collection") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/ahiqar_collection/annotationCollection.json") + %test:args("ahiqar_collection") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/annotationCollection.json") function tct:make-annotationCollection-uri($collection-uri as xs:string) as xs:string { tapi-coll:make-annotationCollection-uri($tc:server, $collection-uri) diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index cba6349..21c8e71 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -57,6 +57,7 @@ declare %test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/ahiqar_sample-82a.html' ") (: checks if images connected to underlying pages are identified :) %test:assertXPath("$result//*[local-name(.) = 'id'] = 'http://0.0.0.0:8080/exist/restxq/api/images/3r1nz' ") + %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/ahiqar_agg-82a/annotationCollection.json' ") function titemt:get-json($collection as xs:string, $document as xs:string, $page as xs:string) @@ -71,4 +72,4 @@ declare %test:args("ahiqar_agg") %test:assertXPath("count($result[local-name(.) = 'lang']) = 2") function titemt:make-language-elements($manifest-uri as xs:string) { tapi-item:make-language-elements($manifest-uri) -}; \ No newline at end of file +}; diff --git a/exist-app/tests/tapi-manifest-tests.xqm b/exist-app/tests/tapi-manifest-tests.xqm index 1142ebf..d2d828b 100644 --- a/exist-app/tests/tapi-manifest-tests.xqm +++ b/exist-app/tests/tapi-manifest-tests.xqm @@ -150,8 +150,10 @@ function tmt:get-valid-page-ids($manifest-uri as xs:string) { }; declare - %test:args("ahiqar_collection", "ahiqar_agg") %test:assertXPath("$result//label = 'Beispieldatei zum Testen'") - %test:args("ahiqar_collection", "ahiqar_agg") %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json')]") + %test:args("ahiqar_collection", "ahiqar_agg") + %test:assertXPath("$result//label = 'Beispieldatei zum Testen'") + %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json')]") + %test:assertXPath("$result//annotationCollection[matches(., '/api/annotations/ahikar/ahiqar_collection/ahiqar_agg-82a/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) @@ -203,4 +205,3 @@ function tmt:get-json($collection-uri as xs:string, $manifest-uri as xs:string) { tapi-mani:get-json($collection-uri, $manifest-uri, $tc:server) }; - -- GitLab From 13f5a3fad4e344f8c3a0fdf68f557dfd0b72bde1 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 13:48:03 +0100 Subject: [PATCH 022/155] feat: add TILE sample data --- exist-app/data/ahiqar_agg.xml | 1 + exist-app/data/ahiqar_tile.xml | 38 +++++++++++++++++++++++++++++ exist-app/data/ahiqar_tile_meta.xml | 14 +++++++++++ exist-app/post-install.xq | 35 +++++++++++++++++--------- 4 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 exist-app/data/ahiqar_tile.xml create mode 100644 exist-app/data/ahiqar_tile_meta.xml diff --git a/exist-app/data/ahiqar_agg.xml b/exist-app/data/ahiqar_agg.xml index 67a6389..6df113d 100644 --- a/exist-app/data/ahiqar_agg.xml +++ b/exist-app/data/ahiqar_agg.xml @@ -1,5 +1,6 @@ + diff --git a/exist-app/data/ahiqar_tile.xml b/exist-app/data/ahiqar_tile.xml new file mode 100644 index 0000000..c844199 --- /dev/null +++ b/exist-app/data/ahiqar_tile.xml @@ -0,0 +1,38 @@ + + + + + Text-Image-Link Object + + +

+ + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/exist-app/data/ahiqar_tile_meta.xml b/exist-app/data/ahiqar_tile_meta.xml new file mode 100644 index 0000000..bd7e7bb --- /dev/null +++ b/exist-app/data/ahiqar_tile_meta.xml @@ -0,0 +1,14 @@ + + + + + Ahiqar TILE Sample + text/linkeditorlinkedfile + + + 2020-11-09T09:03:45.740+01:00 + 2020-11-09T09:07:14.863+01:00 + + + + \ No newline at end of file diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index b8e8e62..084da56 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -1,4 +1,7 @@ xquery version "3.1"; + +import module namespace functx="http://www.functx.com"; + (: the target collection into which the app is deployed :) declare variable $target external; declare variable $ahikar-base := "/db/apps/ahikar"; @@ -9,18 +12,26 @@ declare function local:move-and-rename($filename as xs:string) as item()* { let $target-data-collection := $tg-base || "/data/" let $target-meta-collection := $tg-base || "/meta/" let $target-agg-collection := $tg-base || "/agg/" + let $target-tile-collection := $tg-base || "/tile/" + + let $file-type := functx:substring-after-last($filename, "_") + => substring-before(".xml") + return - if(matches($filename, "meta")) then - let $new-filename := substring-before($filename, "_meta") || ".xml" - return - ( - xmldb:move($data-file-path, $target-meta-collection, $filename), - xmldb:rename($target-meta-collection, $filename, $new-filename) - ) - else - if (matches($filename, "sample")) then + + switch ($file-type) + case "meta" return + let $new-filename := substring-before($filename, "_meta") || ".xml" + return + ( + xmldb:move($data-file-path, $target-meta-collection, $filename), + xmldb:rename($target-meta-collection, $filename, $new-filename) + ) + case "tile" return + xmldb:move($data-file-path, $target-tile-collection, $filename) + case "sample" return xmldb:move($data-file-path, $target-data-collection, $filename) - else + default return xmldb:move($data-file-path, $target-agg-collection, $filename) }; @@ -71,7 +82,9 @@ return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), "ahiqar_images.xml", "ahiqar_images_meta.xml", "ahiqar_collection.xml", - "ahiqar_collection_meta.xml") + "ahiqar_collection_meta.xml", + "ahiqar_tile.xml", + "ahiqar_tile_meta.xml") return ( for $file in $files return -- GitLab From 3f7b8e46f08dea11a22ac18a116050896ce1c6f3 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 15:00:09 +0100 Subject: [PATCH 023/155] refactor: generic function for metadata retrieval --- exist-app/modules/commons.xqm | 5 +++++ exist-app/modules/tapi-collection.xqm | 9 ++------- exist-app/modules/tapi-manifest.xqm | 7 +------ exist-app/tests/commons-tests.xqm | 7 +++++++ exist-app/tests/tapi-collection-tests.xqm | 8 +------- exist-app/tests/tapi-manifest-tests.xqm | 7 ------- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index 77c61d9..f0fc0dd 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -43,4 +43,9 @@ as document-node() { declare function commons:open-tei-xml($tei-xml-uri as xs:string) as document-node() { doc($commons:data || $tei-xml-uri || ".xml") +}; + +declare function commons:get-metadata-file($uri as xs:string) +as document-node() { + doc($commons:meta || $uri || ".xml") }; \ No newline at end of file diff --git a/exist-app/modules/tapi-collection.xqm b/exist-app/modules/tapi-collection.xqm index b4ee2e8..8ca2ebe 100644 --- a/exist-app/modules/tapi-collection.xqm +++ b/exist-app/modules/tapi-collection.xqm @@ -30,7 +30,7 @@ import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" declare function tapi-coll:get-json($collection-uri as xs:string, $server as xs:string) as item()+ { - let $metadata-file := tapi-coll:get-metadata-file($collection-uri) + let $metadata-file := commons:get-metadata-file($collection-uri) let $format-type := tapi-coll:get-format-type($metadata-file) let $sequence := tapi-coll:make-sequence($collection-uri, $server) let $annotationCollection-uri := tapi-coll:make-annotationCollection-uri($server, $collection-uri) @@ -95,11 +95,6 @@ as xs:string { replace($uri, "textgrid:", "") }; -declare function tapi-coll:get-metadata-file($uri as xs:string) -as document-node() { - doc($commons:meta || $uri || ".xml") -}; - declare function tapi-coll:make-sequence($collection-uri as xs:string, $server as xs:string) as element(sequence)+ { @@ -107,7 +102,7 @@ as element(sequence)+ { let $allowed-manifest-uris := tapi-coll:get-allowed-manifest-uris($aggregation/*) for $manifest-uri in $allowed-manifest-uris return - let $manifest-metadata := tapi-coll:get-metadata-file($manifest-uri) + let $manifest-metadata := commons:get-metadata-file($manifest-uri) let $id := tapi-coll:make-id($server, $collection-uri, $manifest-uri) let $type := tapi-coll:make-format-type($manifest-metadata) return diff --git a/exist-app/modules/tapi-manifest.xqm b/exist-app/modules/tapi-manifest.xqm index d6d5c8f..ea5fe07 100644 --- a/exist-app/modules/tapi-manifest.xqm +++ b/exist-app/modules/tapi-manifest.xqm @@ -59,16 +59,11 @@ as xs:string+ { declare function tapi-mani:get-manifest-title($manifest-uri as xs:string) as xs:string { - let $metadata-file := tapi-mani:get-metadata-file($manifest-uri) + let $metadata-file := commons:get-metadata-file($manifest-uri) return $metadata-file//tgmd:title/string() }; -declare function tapi-mani:get-metadata-file($manifest-uri as xs:string) -as document-node() { - doc($commons:tg-collection || "/meta/" || $manifest-uri || ".xml") -}; - declare function tapi-mani:make-editors($manifest-uri as xs:string) as element(x-editor)+ { diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index 1fd6839..46972cb 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -38,3 +38,10 @@ function ct:open-tei-xml($tei-xml-uri as xs:string) as document-node() { commons:open-tei-xml($tei-xml-uri) }; + +declare + %test:args("ahiqar_sample") %test:assertXPath("$result//*[local-name(.) = 'title'] = 'Beispieldatei zum Testen'") +function ct:get-metadata-file($uri as xs:string) +as document-node() { + commons:get-metadata-file($uri) +}; \ No newline at end of file diff --git a/exist-app/tests/tapi-collection-tests.xqm b/exist-app/tests/tapi-collection-tests.xqm index 82b61b2..7eea9c2 100644 --- a/exist-app/tests/tapi-collection-tests.xqm +++ b/exist-app/tests/tapi-collection-tests.xqm @@ -157,12 +157,6 @@ function tct:get-allowed-manifest-uris-sample-input() { tapi-coll:get-allowed-manifest-uris($collection-metadata) }; -declare - %test:args("ahiqar_collection") %test:assertXPath("$result[self::document-node()]") -function tct:get-metadata-file($uri as xs:string) { - tapi-coll:get-metadata-file($uri) -}; - declare %test:args("textgrid:1234") %test:assertEquals("1234") @@ -182,7 +176,7 @@ function tct:make-format-type($tgmd-format as xs:string) { declare %test:assertEquals("manifest") function tct:get-format-type() { - let $metadata := tapi-coll:get-metadata-file("ahiqar_agg") + let $metadata := commons:get-metadata-file("ahiqar_agg") return tapi-coll:get-format-type($metadata) }; diff --git a/exist-app/tests/tapi-manifest-tests.xqm b/exist-app/tests/tapi-manifest-tests.xqm index d2d828b..8a615da 100644 --- a/exist-app/tests/tapi-manifest-tests.xqm +++ b/exist-app/tests/tapi-manifest-tests.xqm @@ -129,13 +129,6 @@ function tmt:_test-teardown() { xmldb:remove($commons:data, $tmt:tei3-uri) }; -declare - %test:args("ahiqar_agg") %test:assertXPath("$result//* = 'textgrid:ahiqar_agg.0'") -function tmt:get-metadata-file($manifest-uri) { - tapi-mani:get-metadata-file($manifest-uri) -}; - - declare %test:args("ahiqar_collection", "ahiqar_agg") %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/ahiqar_collection/ahiqar_agg-82a/latest/item.json')]") function tmt:make-sequences($collection-uri as xs:string, -- GitLab From 0f8ae8f54d1b21dca7a43ccd64cb226688c5d6d6 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 15:00:31 +0100 Subject: [PATCH 024/155] feat: add basic structure for image module --- exist-app/modules/tapi-img.xqm | 38 ++++++++++++++++++++++++++++++ exist-app/tests/tapi-img-tests.xqm | 24 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 exist-app/modules/tapi-img.xqm create mode 100644 exist-app/tests/tapi-img-tests.xqm diff --git a/exist-app/modules/tapi-img.xqm b/exist-app/modules/tapi-img.xqm new file mode 100644 index 0000000..f4cd84c --- /dev/null +++ b/exist-app/modules/tapi-img.xqm @@ -0,0 +1,38 @@ +xquery version "3.1"; + +(: + : + :) + +module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images"; + +declare namespace tei="http://www.tei-c.org/ns/1.0"; +declare namespace ore="http://www.openarchives.org/ore/terms/"; +declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; +declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; + +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; +import module namespace functx="http://www.functx.com"; + +declare function tapi-img:has-manifest-tile($manifest-uri as xs:string) +as xs:boolean { + let $manifest-doc := commons:get-aggregation($manifest-uri) + let $aggregated := $manifest-doc//ore:aggregates + let $is-tile := + for $element in $aggregated return + let $stripped-uri := substring-after($element/@rdf:resource/string(), "textgrid:") + return + tapi-img:is-resource-tile($stripped-uri) + return + if (functx:is-value-in-sequence(true(), $is-tile)) then + true() + else + false() +}; + +declare function tapi-img:is-resource-tile($uri) +as xs:boolean { + let $metadata := commons:get-metadata-file($uri) + return + $metadata//tgmd:format = "text/linkeditorlinkedfile" +}; \ No newline at end of file diff --git a/exist-app/tests/tapi-img-tests.xqm b/exist-app/tests/tapi-img-tests.xqm new file mode 100644 index 0000000..4110882 --- /dev/null +++ b/exist-app/tests/tapi-img-tests.xqm @@ -0,0 +1,24 @@ +xquery version "3.1"; + +module namespace timgt="http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests"; + +declare namespace http = "http://expath.org/ns/http-client"; +declare namespace tei="http://www.tei-c.org/ns/1.0"; + +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; +import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; +import module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images" at "../modules/tapi-img.xqm"; + +declare + %test:args("ahiqar_agg") + %test:assertTrue +function timgt:has-manifest-tile($manifest-uri) as xs:boolean { + tapi-img:has-manifest-tile($manifest-uri) +}; + +declare + %test:args("ahiqar_sample") %test:assertFalse + %test:args("ahiqar_tile") %test:assertTrue +function timgt:is-resource-tile($uri) as xs:boolean { + tapi-img:is-resource-tile($uri) +}; \ No newline at end of file -- GitLab From 0e431396f7f7be8ef993640c1b7ed36f3d374739 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 15:34:19 +0100 Subject: [PATCH 025/155] feat: add global variable for TILE --- exist-app/modules/commons.xqm | 1 + 1 file changed, 1 insertion(+) diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index f0fc0dd..87b8898 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -11,6 +11,7 @@ declare variable $commons:tg-collection := "/db/apps/sade/textgrid"; declare variable $commons:data := $commons:tg-collection || "/data/"; declare variable $commons:meta := $commons:tg-collection || "/meta/"; declare variable $commons:agg := $commons:tg-collection || "/agg/"; +declare variable $commons:tile := $commons:tg-collection || "/tile/"; declare variable $commons:appHome := "/db/apps/ahikar"; declare variable $commons:responseHeader200 := -- GitLab From dbd071e02204982d1f2a9043fb6a148e218dff89 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 15:34:55 +0100 Subject: [PATCH 026/155] feat: add functions for returnig a TILE object --- exist-app/modules/tapi-img.xqm | 55 +++++++++++++++++++++--------- exist-app/tests/tapi-img-tests.xqm | 30 +++++++++++++--- 2 files changed, 64 insertions(+), 21 deletions(-) diff --git a/exist-app/modules/tapi-img.xqm b/exist-app/modules/tapi-img.xqm index f4cd84c..6bd5919 100644 --- a/exist-app/modules/tapi-img.xqm +++ b/exist-app/modules/tapi-img.xqm @@ -1,7 +1,11 @@ xquery version "3.1"; (: - : + : This module handles the correct selection of an image path for an item. + : + : The Ahiqar project has both single- and double-sided images. While the former works + : without further ado, the latter needs a different URL in order to display to proper + : image section. :) module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images"; @@ -12,27 +16,46 @@ declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; -import module namespace functx="http://www.functx.com"; declare function tapi-img:has-manifest-tile($manifest-uri as xs:string) as xs:boolean { - let $manifest-doc := commons:get-aggregation($manifest-uri) - let $aggregated := $manifest-doc//ore:aggregates - let $is-tile := - for $element in $aggregated return - let $stripped-uri := substring-after($element/@rdf:resource/string(), "textgrid:") - return - tapi-img:is-resource-tile($stripped-uri) - return - if (functx:is-value-in-sequence(true(), $is-tile)) then - true() - else - false() + exists(tapi-img:get-tile-uris($manifest-uri)) }; -declare function tapi-img:is-resource-tile($uri) +declare function tapi-img:is-resource-tile($uri as xs:string) as xs:boolean { let $metadata := commons:get-metadata-file($uri) return $metadata//tgmd:format = "text/linkeditorlinkedfile" -}; \ No newline at end of file +}; + +declare function tapi-img:is-tile-available($uri as xs:string) +as xs:boolean { + exists(doc($commons:tile || $uri || ".xml")) +}; + +declare function tapi-img:get-tile-uris($manifest-uri as xs:string) +as xs:string* { + let $manifest-doc := commons:get-aggregation($manifest-uri) + let $aggregated := $manifest-doc//ore:aggregates + for $element in $aggregated return + let $stripped-uri := substring-after($element/@rdf:resource/string(), "textgrid:") + return + if (tapi-img:is-resource-tile($stripped-uri)) then + $stripped-uri + else + () +}; + +declare function tapi-img:get-tile($uri as xs:string) +as document-node()? { + if (tapi-img:is-tile-available($uri)) then + tapi-img:open-tile($uri) + else + () +}; + +declare function tapi-img:open-tile($uri as xs:string) +as document-node() { + doc($commons:tile || $uri || ".xml") +}; diff --git a/exist-app/tests/tapi-img-tests.xqm b/exist-app/tests/tapi-img-tests.xqm index 4110882..6cd621a 100644 --- a/exist-app/tests/tapi-img-tests.xqm +++ b/exist-app/tests/tapi-img-tests.xqm @@ -1,24 +1,44 @@ xquery version "3.1"; -module namespace timgt="http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests"; +module namespace t="http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests"; declare namespace http = "http://expath.org/ns/http-client"; -declare namespace tei="http://www.tei-c.org/ns/1.0"; -import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images" at "../modules/tapi-img.xqm"; declare %test:args("ahiqar_agg") %test:assertTrue -function timgt:has-manifest-tile($manifest-uri) as xs:boolean { +function t:has-manifest-tile($manifest-uri) as xs:boolean { tapi-img:has-manifest-tile($manifest-uri) }; declare %test:args("ahiqar_sample") %test:assertFalse %test:args("ahiqar_tile") %test:assertTrue -function timgt:is-resource-tile($uri) as xs:boolean { +function t:is-resource-tile($uri) as xs:boolean { tapi-img:is-resource-tile($uri) +}; + +declare + %test:args("ahiqar_tile") %test:assertTrue + %test:args("ahiqar_tile-non-existent") %test:assertFalse +function t:is-tile-available($tile-uri as xs:string) +as xs:boolean { + tapi-img:is-tile-available($tile-uri) +}; + +declare + %test:args("ahiqar_agg") %test:assertEquals("ahiqar_tile") +function t:get-tile-uris($manifest-uri as xs:string) +as xs:string { + tapi-img:get-tile-uris($manifest-uri) +}; + +declare + %test:args("ahiqar_tile") %test:assertXPath("$result//*[local-name(.) = 'rect']") +function t:get-tile($uri as xs:string) +as document-node() { + tapi-img:get-tile($uri) }; \ No newline at end of file -- GitLab From dc97c5d3c7b6186cd393c648253d0b750a98e947 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 15:35:19 +0100 Subject: [PATCH 027/155] chore: remove unused modules, add return value --- exist-app/tests/tapi-item-tests.xqm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 21c8e71..40cf359 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -3,10 +3,7 @@ xquery version "3.1"; module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests"; declare namespace http = "http://expath.org/ns/http-client"; -declare namespace tei="http://www.tei-c.org/ns/1.0"; -import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; -import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item" at "../modules/tapi-item.xqm"; @@ -70,6 +67,7 @@ declare %test:args("ahiqar_agg") %test:assertXPath("count($result) = 5") %test:args("ahiqar_agg") %test:assertXPath("$result[local-name(.) = ('lang', 'langAlt')]") %test:args("ahiqar_agg") %test:assertXPath("count($result[local-name(.) = 'lang']) = 2") -function titemt:make-language-elements($manifest-uri as xs:string) { +function titemt:make-language-elements($manifest-uri as xs:string) +as element()+ { tapi-item:make-language-elements($manifest-uri) }; -- GitLab From 3fb8517b1453edc55735efc45650974f9c377dcf Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 15:40:26 +0100 Subject: [PATCH 028/155] tests: update tests according to new edition content --- exist-app/tests/tapi-txt-tests.xqm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index eb82e33..c330807 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -466,8 +466,12 @@ function ttt:get-tei-xml-uri-from-edition($document as xs:string) { declare - %test:args("ahiqar_agg") %test:assertEquals("ahiqar_sample") -function ttt:get-edition-aggregates-without-uri-namespace($document as xs:string) { + %test:args("ahiqar_agg") + %test:assertXPath("count($result) = 2") + %test:assertXPath("$result = 'ahiqar_sample'") + %test:assertXPath("$result = 'ahiqar_tile'") +function ttt:get-edition-aggregates-without-uri-namespace($document as xs:string) +as xs:string+ { tapi-txt:get-edition-aggregates-without-uri-namespace($document) }; -- GitLab From 9c1477b715061e37743f0c9c172fed964f0ac7e7 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 10 Nov 2020 15:41:27 +0100 Subject: [PATCH 029/155] tests: update test triggers --- exist-app/modules/testtrigger.xqm | 4 +++- exist-app/tests/tests-runner.xq | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 0624295..d3dd5aa 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -23,6 +23,7 @@ import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "../tests/tapi-item-tests.xqm"; import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "../tests/tapi-manifest-tests.xqm"; import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "../tests/tapi-tests.xqm"; +import module namespace timgt="http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests" at "../tests/tapi-img-tests.xqm"; (:~ : Triggers the tests for the Ahikar backend. Called by the CI. @@ -52,7 +53,8 @@ as item()? { test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests")) ) let $fileSeparator := util:system-property("file.separator") diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index 60ab7ac..161c58e 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -15,6 +15,7 @@ import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifes import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; +import module namespace timgt="http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests" at "tapi-img-tests.xqm"; let $test-results := @@ -27,7 +28,8 @@ let $test-results := test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests")) ) for $result in $test-results return -- GitLab From fc82e165a7a9e26ad4692cbf66dbaf064cc3432c Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 11 Nov 2020 09:26:14 +0100 Subject: [PATCH 030/155] feat: consider TILE for endpoint creation --- exist-app/data/ahiqar_sample.xml | 4 +- exist-app/modules/tapi-img.xqm | 81 ++++++++++++++++++++++++++--- exist-app/modules/tapi-item.xqm | 26 ++++++--- exist-app/tests/tapi-img-tests.xqm | 68 +++++++++++++++++++++--- exist-app/tests/tapi-item-tests.xqm | 61 ++++++++++++++++++---- 5 files changed, 205 insertions(+), 35 deletions(-) diff --git a/exist-app/data/ahiqar_sample.xml b/exist-app/data/ahiqar_sample.xml index 83e35c3..1431506 100644 --- a/exist-app/data/ahiqar_sample.xml +++ b/exist-app/data/ahiqar_sample.xml @@ -351,7 +351,7 @@ Ideas (or parts of ideas) that have bee marked with LC refer to the Leiden Conve - + - + ܐܠܟܠܐܝܩ ܟܠܗܐ. كان كذلك ، لذا لم يكن كذلك. diff --git a/exist-app/modules/tapi-img.xqm b/exist-app/modules/tapi-img.xqm index 6bd5919..be5c807 100644 --- a/exist-app/modules/tapi-img.xqm +++ b/exist-app/modules/tapi-img.xqm @@ -13,13 +13,15 @@ module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images"; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace ore="http://www.openarchives.org/ore/terms/"; declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; +declare namespace svg="http://www.w3.org/2000/svg"; declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; +import module namespace functx="http://www.functx.com"; declare function tapi-img:has-manifest-tile($manifest-uri as xs:string) as xs:boolean { - exists(tapi-img:get-tile-uris($manifest-uri)) + exists(tapi-img:get-tile-uri($manifest-uri)) }; declare function tapi-img:is-resource-tile($uri as xs:string) @@ -34,28 +36,91 @@ as xs:boolean { exists(doc($commons:tile || $uri || ".xml")) }; -declare function tapi-img:get-tile-uris($manifest-uri as xs:string) +declare function tapi-img:get-tile-uri($manifest-uri as xs:string) as xs:string* { let $manifest-doc := commons:get-aggregation($manifest-uri) let $aggregated := $manifest-doc//ore:aggregates for $element in $aggregated return let $stripped-uri := substring-after($element/@rdf:resource/string(), "textgrid:") return - if (tapi-img:is-resource-tile($stripped-uri)) then + if (tapi-img:is-resource-tile($stripped-uri) + and tapi-img:is-tile-available($stripped-uri)) then $stripped-uri else () }; -declare function tapi-img:get-tile($uri as xs:string) +declare function tapi-img:get-tile($manifest-uri as xs:string) as document-node()? { - if (tapi-img:is-tile-available($uri)) then - tapi-img:open-tile($uri) - else - () + tapi-img:get-tile-uri($manifest-uri) + => tapi-img:open-tile() }; declare function tapi-img:open-tile($uri as xs:string) as document-node() { doc($commons:tile || $uri || ".xml") }; + +declare function tapi-img:get-facsimile-uri-for-page($manifest-uri as xs:string, + $page as xs:string) +as xs:string { + let $tei-xml := commons:get-tei-xml-for-manifest($manifest-uri) + return + $tei-xml//tei:pb[@n = $page]/@facs + => substring-after("textgrid:") +}; + +declare function tapi-img:get-xml-id-for-page($manifest-uri as xs:string, + $page as xs:string) +as xs:string { + let $tei-xml := commons:get-tei-xml-for-manifest($manifest-uri) + return + $tei-xml//tei:pb[@n = $page]/@xml:id/string() +}; + +declare function tapi-img:get-shape-id($manifest-uri as xs:string, + $page-id as xs:string) +as xs:string { + let $tile := tapi-img:get-tile($manifest-uri) + let $link-element := $tile//tei:link[ends-with(@targets, $page-id)] + return + (:@targets has the following form: + #shape-1 textgrid:ahiqar_sample.3#a1 :) + tokenize($link-element/@targets, " ")[1] + => replace("#", "") +}; + +declare function tapi-img:get-svg-rect($tile as document-node(), + $shape-id as xs:string) +as element(svg:rect) { + $tile//svg:rect[@id = $shape-id] +}; + +declare function tapi-img:get-svg-section-dimensions-as-string($svg as element(svg:rect)) +as xs:string { + let $x-offset := local:truncate($svg/@x) + let $y-offset := local:truncate($svg/@y) + let $width := local:truncate($svg/@width) + let $height := local:truncate($svg/@height) + return + string-join(($x-offset, $y-offset, $width, $height), ",") +}; + +declare function local:truncate($number-as-string as attribute()) +as xs:string { + if (matches($number-as-string, "\.")) then + functx:get-matches($number-as-string, "\d+\.\d{1}") + else + $number-as-string/string() +}; + +declare function tapi-img:get-relevant-image-section($manifest-uri as xs:string, + $page-uri as xs:string) +as xs:string { + let $page-id := tapi-img:get-xml-id-for-page($manifest-uri, $page-uri) + let $shape-id := tapi-img:get-shape-id($manifest-uri, $page-id) + let $tile := tapi-img:get-tile($manifest-uri) + let $svg := tapi-img:get-svg-rect($tile, $shape-id) + return + tapi-img:get-svg-section-dimensions-as-string($svg) +}; diff --git a/exist-app/modules/tapi-item.xqm b/exist-app/modules/tapi-item.xqm index cd1a52c..7869d51 100644 --- a/exist-app/modules/tapi-item.xqm +++ b/exist-app/modules/tapi-item.xqm @@ -11,6 +11,7 @@ module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item"; declare namespace tei="http://www.tei-c.org/ns/1.0"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; +import module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images" at "tapi-img.xqm"; declare function tapi-item:get-json($collection-uri as xs:string, @@ -35,7 +36,7 @@ as element(object) { }; -declare function tapi-item:make-title($manifest-uri) +declare function tapi-item:make-title($manifest-uri as xs:string) as xs:string { let $tei-xml := commons:get-tei-xml-for-manifest($manifest-uri) return @@ -72,17 +73,26 @@ declare function tapi-item:make-facsimile-id($manifest-uri as xs:string, $page as xs:string, $server as xs:string) as xs:string { - let $image-uri := tapi-item:get-facsimile-uri-for-page($manifest-uri, $page) + let $facsimile-uri := tapi-img:get-facsimile-uri-for-page($manifest-uri, $page) return - $server || "/api/images/" || $image-uri + if (tapi-img:has-manifest-tile($manifest-uri)) then + tapi-item:make-url-for-double-page-image($facsimile-uri, $manifest-uri, $page, $server) + else + tapi-item:make-url-for-single-page-image($facsimile-uri, $server) }; +declare function tapi-item:make-url-for-single-page-image($facsimile-uri as xs:string, + $server as xs:string) +as xs:string { + $server || "/api/images/" || $facsimile-uri +}; -declare function tapi-item:get-facsimile-uri-for-page($manifest-uri as xs:string, - $page as xs:string) +declare function tapi-item:make-url-for-double-page-image($facsimile-uri as xs:string, + $manifest-uri as xs:string, + $page as xs:string, + $server as xs:string) as xs:string { - let $tei-xml := commons:get-tei-xml-for-manifest($manifest-uri) + let $image-section := tapi-img:get-relevant-image-section($manifest-uri, $page) return - $tei-xml//tei:pb[@n = $page]/@facs - => substring-after("textgrid:") + $server || "/api/images/" || $facsimile-uri || "/" || $image-section }; diff --git a/exist-app/tests/tapi-img-tests.xqm b/exist-app/tests/tapi-img-tests.xqm index 6cd621a..afab48c 100644 --- a/exist-app/tests/tapi-img-tests.xqm +++ b/exist-app/tests/tapi-img-tests.xqm @@ -31,14 +31,70 @@ as xs:boolean { declare %test:args("ahiqar_agg") %test:assertEquals("ahiqar_tile") -function t:get-tile-uris($manifest-uri as xs:string) +function t:get-tile-uri($manifest-uri as xs:string) as xs:string { - tapi-img:get-tile-uris($manifest-uri) + tapi-img:get-tile-uri($manifest-uri) }; + declare - %test:args("ahiqar_tile") %test:assertXPath("$result//*[local-name(.) = 'rect']") -function t:get-tile($uri as xs:string) + %test:args("ahiqar_agg") %test:assertXPath("$result//*[local-name(.) = 'rect']") +function t:get-tile($manifest-uri as xs:string) as document-node() { - tapi-img:get-tile($uri) -}; \ No newline at end of file + tapi-img:get-tile($manifest-uri) +}; + + +declare + %test:args("ahiqar_agg", "82a") %test:assertEquals("3r1nz") + %test:args("ahiqar_agg_wo_tile", "82b") %test:assertEquals("3r1p0") +function t:get-facsimile-uri-for-page($manifest-uri as xs:string, + $page as xs:string) +as xs:string { + tapi-img:get-facsimile-uri-for-page($manifest-uri, $page) +}; + +declare + %test:args("ahiqar_agg", "82a") %test:assertEquals("a1") +function t:get-xml-id-for-page($manifest-uri as xs:string, + $page as xs:string) +as xs:string { + tapi-img:get-xml-id-for-page($manifest-uri, $page) +}; + +declare + %test:args("ahiqar_agg", "a1") %test:assertEquals("shape-1") +function t:get-shape-id($manifest-uri as xs:string, + $page-id as xs:string) +as xs:string { + tapi-img:get-shape-id($manifest-uri, $page-id) +}; + +declare + %test:args("shape-1") %test:assertXPath("$result[@id = 'shape-1']") +function t:get-svg-rect($shape-id as xs:string) +as element() { + let $tile := tapi-img:get-tile("ahiqar_agg") + return + tapi-img:get-svg-rect($tile, $shape-id) +}; + +declare + %test:assertEquals("50.0,0.4,49.8,100.0") +function t:get-svg-section-dimensions-as-string() +as xs:string { + let $manifest-uri := "ahiqar_agg" + let $shape-id := "shape-1" + let $tile := tapi-img:get-tile($manifest-uri) + let $svg := tapi-img:get-svg-rect($tile, $shape-id) + return + tapi-img:get-svg-section-dimensions-as-string($svg) +}; + +declare + %test:args("ahiqar_agg", "82a") %test:assertEquals("50.0,0.4,49.8,100.0") +function t:get-relevant-image-section($manifest-uri as xs:string, + $page-uri as xs:string) +as xs:string { + tapi-img:get-relevant-image-section($manifest-uri, $page-uri) +}; diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 40cf359..1041259 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -4,17 +4,16 @@ module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" declare namespace http = "http://expath.org/ns/http-client"; +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item" at "../modules/tapi-item.xqm"; declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("3r1nz") -function titemt:get-facsimile-uri-for-page($manifest-uri as xs:string, - $page as xs:string) -as xs:string { - tapi-item:get-facsimile-uri-for-page($manifest-uri, $page) + %test:setUp +function titemt:_test-setup() { + local:create-and-store-test-data() }; declare @@ -25,7 +24,8 @@ as xs:string { }; declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") + %test:args("ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.0,0.4,49.8,100.0") + %test:args("ahiqar_agg_wo_tile", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") function titemt:make-facsimile-id($manifest-uri as xs:string, $page as xs:string) as xs:string { @@ -42,7 +42,7 @@ as xs:string { declare - %test:args("ahiqar_collection", "ahiqar_agg", "82a") + %test:args("ahiqar_collection", "ahiqar_agg_wo_tile", "82a") (: checks if the correct file has been opened :) %test:assertXPath("$result//*[local-name(.) = 'title'] = 'The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, king of Assyria and Nineveh' ") @@ -51,10 +51,10 @@ declare %test:assertXPath("$result//*[local-name(.) = 'langAlt'] = 'karshuni' ") %test:assertXPath("$result//*[local-name(.) = 'x-langString'][matches(., 'Classical Syriac')]") (: checks if underlying pages are identified :) - %test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/ahiqar_sample-82a.html' ") + %test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/ahiqar_sample_2-82a.html' ") (: checks if images connected to underlying pages are identified :) %test:assertXPath("$result//*[local-name(.) = 'id'] = 'http://0.0.0.0:8080/exist/restxq/api/images/3r1nz' ") - %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/ahiqar_agg-82a/annotationCollection.json' ") + %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/ahiqar_agg_wo_tile-82a/annotationCollection.json' ") function titemt:get-json($collection as xs:string, $document as xs:string, $page as xs:string) @@ -67,7 +67,46 @@ declare %test:args("ahiqar_agg") %test:assertXPath("count($result) = 5") %test:args("ahiqar_agg") %test:assertXPath("$result[local-name(.) = ('lang', 'langAlt')]") %test:args("ahiqar_agg") %test:assertXPath("count($result[local-name(.) = 'lang']) = 2") -function titemt:make-language-elements($manifest-uri as xs:string) -as element()+ { +function titemt:make-language-elements($manifest-uri as xs:string) { tapi-item:make-language-elements($manifest-uri) }; + + +declare + %test:args("3r1nz") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") +function titemt:make-url-for-single-page-image($facsimile-uri as xs:string) +as xs:string { + tapi-item:make-url-for-single-page-image($facsimile-uri, $tc:server) +}; + +declare + %test:args("3r1nz", "ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.0,0.4,49.8,100.0") +function titemt:make-url-for-double-page-image($facsimile-uri as xs:string, + $manifest-uri as xs:string, + $page as xs:string) +as xs:string { + tapi-item:make-url-for-double-page-image($facsimile-uri, $manifest-uri, $page, $tc:server) +}; + + +declare function local:create-and-store-test-data() +as xs:string+ { + let $agg-wo-tile := + + + + + + let $agg-wo-tile-meta := commons:get-metadata-file("ahiqar_agg") + + let $sample-xml-2 := commons:open-tei-xml("ahiqar_sample") + let $sample-xml-2-meta := commons:get-metadata-file("ahiqar_sample") + + return + ( + xmldb:store("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), + xmldb:store("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), + xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta), + xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta) + ) +}; -- GitLab From da88e3da9f01779e35707a59e2d264f1f962bdd7 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 11 Nov 2020 09:52:19 +0100 Subject: [PATCH 031/155] feat: introduce new endpoint for double pages --- exist-app/modules/tapi.xqm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/exist-app/modules/tapi.xqm b/exist-app/modules/tapi.xqm index e9805bb..f1227ce 100644 --- a/exist-app/modules/tapi.xqm +++ b/exist-app/modules/tapi.xqm @@ -198,6 +198,37 @@ as item()+ { )[2] => xs:base64Binary() }; +(:~ + : Returns an image section belonging to a given URI as defined by the $image-section + : paramater. + : This function doesn't work locally unless you have all necessary login + : information filled in at ahikar.env. + : + : Since the images of the Ahikar project aren't publicly available, this + : function cannot be tested by unit tests. + : + : @param $uri The unprefixed TextGrid URI of an image, e.g. '3r1pr' + : @param $image-section Indicated the image section in percentage to be retured as defined by + : the IIIF Image API + : @return The image as binary + :) +declare + %rest:GET + %rest:HEAD + %rest:path("/images/{$uri}/{$image-section}") + %rest:produces("image/jpeg") + %output:method("binary") +function tapi:endpoint-image($uri as xs:string, + $image-section as xs:string) +as item()+ { + $commons:responseHeader200, + hc:send-request( + + )[2] => xs:base64Binary() +}; + (:~ : Endpoint to deliver a single plain text version of the -- GitLab From b7745bca11d0ef4131a8c3195101e4d2ab089436 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 11 Nov 2020 14:01:22 +0100 Subject: [PATCH 032/155] feat: re-establish old files for collation --- exist-app/modules/collate.xqm | 231 ++++++++++++++++ exist-app/modules/testtrigger.xqm | 2 + exist-app/tests/collate-tests.xqm | 424 ++++++++++++++++++++++++++++++ exist-app/tests/tests-runner.xq | 4 +- 4 files changed, 660 insertions(+), 1 deletion(-) create mode 100644 exist-app/modules/collate.xqm create mode 100644 exist-app/tests/collate-tests.xqm diff --git a/exist-app/modules/collate.xqm b/exist-app/modules/collate.xqm new file mode 100644 index 0000000..635010e --- /dev/null +++ b/exist-app/modules/collate.xqm @@ -0,0 +1,231 @@ +xquery version "3.1"; + +(:~ + : This module extracts the chunks marked as important for the collation from + : the TEI files and uses them as an input for the plain text creation. These + : serve as a basis for the collation with CollateX in the project's CI/CD + : pipelines. + :) + +module namespace coll="http://ahikar.sub.uni-goettingen.de/ns/collate"; + +declare namespace tei="http://www.tei-c.org/ns/1.0"; +declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; + +import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milestone-chunk.xquery" at "fragment.xqm"; + +declare variable $coll:textgrid := "/db/apps/sade/textgrid"; +declare variable $coll:data := $coll:textgrid || "/data"; +declare variable $coll:txt := $coll:textgrid || "/txt"; + + +declare function coll:main() +as xs:string+ { + coll:create-txt-collection-if-not-available(), + for $text in coll:get-transcriptions-and-transliterations() return + let $relevant-text := coll:get-relevant-text($text) + let $file-name := coll:make-file-name($text) + return + xmldb:store($coll:txt, $file-name, $relevant-text, "text/plain") +}; + +declare function coll:create-txt-collection-if-not-available() +as xs:string? { + if (xmldb:collection-available($coll:txt)) then + () + else + xmldb:create-collection($coll:textgrid, "txt") +}; + +declare function coll:get-transcriptions-and-transliterations() +as element(tei:text)+ { + collection($coll:data)//tei:text[@type = ("transcription", "transliteration")] + [coll:has-text-milestone(.)] +}; + +declare function coll:has-text-milestone($text as element(tei:text)) +as xs:boolean { + if ($text//tei:milestone) then + true() + else + false() +}; + +(:~ + : An example for the file name is + : syriac-Brit_Lib_Add_7200-3r131-transcription.txt + :) +declare function coll:make-file-name($text as element(tei:text)) +as xs:string { + let $lang-prefix := coll:get-language-prefix($text) + let $title-from-metadata := coll:create-metadata-title-for-file-name($text) + let $uri-plus-text-type := coll:make-file-name-suffix($text) + return + $lang-prefix || "-" || $title-from-metadata || "-" || $uri-plus-text-type +}; + +declare function coll:get-language-prefix($text as element(tei:text)) +as xs:string? { + switch ($text/@type) + case "transcription" return + switch ($text/@xml:lang) + case "karshuni" return "karshuni" + case "ara" return "arabic" + case "syc" return "syriac" + default return () + + (: although the transliteration may have another language than + the transcription, the latter remains decisive for the prefix :) + case "transliteration" return + switch ($text/root()//tei:text[@type = "transcription"]/@xml:lang) + case "ara" return "arabic" + case "karshuni" return "karshuni" + case "syc" return "syriac" + default return () + default return () +}; + +declare function coll:create-metadata-title-for-file-name($text as element(tei:text)) +as xs:string { + let $base-uri := coll:get-base-uri($text) + let $metadata := doc($base-uri => replace("/data/", "/meta/")) + return + $metadata//tgmd:title + => replace("[^a-zA-Z0-9]", "_") + => replace("[_]+", "_") +}; + +declare function coll:get-base-uri($text as element(tei:text)) +as xs:string{ + base-uri($text) +}; + +declare function coll:make-file-name-suffix($text as element(tei:text)) +as xs:string { + let $base-uri := coll:get-base-uri($text) + let $file-name := coll:get-file-name($base-uri) + let $type := $text/@type + return + $file-name || "-" || $type || ".txt" +}; + +declare function coll:get-file-name($base-uri as xs:string) +as xs:string { + tokenize($base-uri, "/")[last()] + => substring-before(".xml") +}; + +declare function coll:get-relevant-text($text as element(tei:text)) +as xs:string { + let $milestones := coll:get-milestones-in-text($text) + let $chunks := coll:get-chunks($milestones) + let $texts := coll:get-relevant-text-from-chunks($chunks) + return + string-join($texts, " ") +}; + +declare function coll:get-milestones-in-text($text as element(tei:text)) +as element(tei:milestone)+ { + $text//tei:milestone +}; + +declare function coll:get-chunks($milestones as element(tei:milestone)+) +as element(tei:TEI)+ { + for $milestone in $milestones return + coll:get-chunk($milestone) +}; + +declare function coll:get-chunk($milestone as element(tei:milestone)) +as element(tei:TEI) { + let $root := $milestone/root() + let $end-of-chunk := coll:get-end-of-chunk($milestone) + return + fragment:get-fragment-from-doc( + $root, + $milestone, + $end-of-chunk, + false(), + true(), + ("")) +}; + +declare function coll:get-end-of-chunk($milestone as element(tei:milestone)) +as node() { + if (coll:has-following-milestone($milestone)) then + coll:get-next-milestone($milestone) + else + $milestone/ancestor::tei:text[1]/tei:body/child::*[last()] +}; + +declare function coll:has-following-milestone($milestone as element(tei:milestone)) +as xs:boolean { + if ($milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) then + true() + else + false() +}; + +declare function coll:get-next-milestone($milestone as element(tei:milestone)) +as element(tei:milestone)? { + $milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]][1] +}; + +declare function coll:get-relevant-text-from-chunks($chunks as element(tei:TEI)+) +as xs:string { + let $texts := + for $chunk in $chunks return + coll:make-plain-text-from-chunk($chunk) + return + string-join($texts, " ") + => normalize-space() +}; + +declare function coll:make-plain-text-from-chunk($chunk as element(tei:TEI)) +as xs:string { + let $texts := coll:get-relevant-text-nodes($chunk) + let $prepared-texts := + for $text in $texts return + coll:prepare-plain-text-creation($text) + return + coll:format-and-normalize-string($prepared-texts) +}; + +(:~ + : The following nodes shouldn't be considered for the plain text creation: + : * sic (wrong text) + : * surplus (surplus text) + : * supplied (supplied by modern editors) + : * colophons + : * glyphs + : * unclear (text unclear) + : * catchwords (they simply serve to bind the books correctly and reduplicate text) + : * note (they have been added later by another scribe) + :) +declare function coll:get-relevant-text-nodes($chunk as element(tei:TEI)) +as text()+ { + (($chunk//text() + [not(parent::tei:sic)] + [not(parent::tei:surplus)]) + [not(parent::tei:supplied)]) + [not(parent::tei:*[@type = "colophon"])] + [not(parent::tei:g)] + [not(parent::tei:unclear)] + [not(parent::tei:catchwords)] + [not(parent::tei:note)] +}; + +declare function coll:prepare-plain-text-creation($text as text()) +as xs:string { + if ($text/preceding-sibling::*[1][self::tei:lb[@break = "no"]]) then + "@" || $text + else + $text +}; + +declare function coll:format-and-normalize-string($strings as xs:string+) +as xs:string { + string-join($strings, " ") + => replace(" @", "") + => replace("[\p{P}\n+]", "") + => replace("\s+", " ") +}; diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 0624295..10e7ee7 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -14,6 +14,7 @@ module namespace testtrigger="http://ahikar.sub.uni-goettingen.de/ns/testtrigger import module namespace rest="http://exquery.org/ns/restxq"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; +import module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests" at "../tests/collate-tests.xqm"; import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; @@ -45,6 +46,7 @@ as item()? { let $tests := ( test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/coll-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), diff --git a/exist-app/tests/collate-tests.xqm b/exist-app/tests/collate-tests.xqm new file mode 100644 index 0000000..b29b316 --- /dev/null +++ b/exist-app/tests/collate-tests.xqm @@ -0,0 +1,424 @@ +xquery version "3.1"; + +module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests"; + +declare namespace tei="http://www.tei-c.org/ns/1.0"; + +import module namespace coll="http://ahikar.sub.uni-goettingen.de/ns/collate" at "../modules/collate.xqm"; +import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; + +declare variable $coll-tests:sample-file := local:open-file("ahiqar_sample"); +declare variable $coll-tests:sample-transliteration := $coll-tests:sample-file//tei:text[@type = "transliteration"]; +declare variable $coll-tests:sample-transcription := $coll-tests:sample-file//tei:text[@type = "transcription"]; + +declare + %test:args("ahiqar_sample") %test:assertExists + %test:args("1234") %test:assertError("org.exist.xquery.XPathException") +function coll-tests:open-file($uri as xs:string) as document-node() { + local:open-file($uri) +}; + +declare + %test:assertXPath("count($result) = 2") +function coll-tests:get-milestones-in-text() +as element(tei:milestone)* { + coll:get-milestones-in-text($coll-tests:sample-transliteration) +}; + +declare + %test:assertExists +function coll-tests:get-next-milestone-succecss() +as element(tei:milestone)? { + let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] + return + coll:get-next-milestone($milestone) +}; + +declare + %test:assertEmpty +function coll-tests:get-next-milestone-fail() +as element(tei:milestone)? { + let $milestone := $coll-tests:sample-transliteration//tei:milestone[2] + return + coll:get-next-milestone($milestone) +}; + +declare + %test:assertExists + %test:assertXPath("$result//*[local-name(.) = 'ab']") +function coll-tests:get-chunk() +as element(tei:TEI) { + let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] + return + coll:get-chunk($milestone) +}; + + +declare + %test:assertEquals("some text that should be used display some text without a space") +function coll-tests:make-plain-text-from-chunk() +as xs:string { + let $chunk := + + + + + + some text that should + + + + be used + + + no display + display + + no display + no display + no display + [ + no display + no displayno display + no display + + some text with + out a space + + + + + + return + coll:make-plain-text-from-chunk($chunk) +}; + + +declare + %test:assertEquals("some text with") +function coll-tests:prepare-plain-text-creation-no-lb() +as xs:string { + let $chunk := + + + + + + some text with + + + + + + let $text := $chunk//tei:ab/text() + return + coll:prepare-plain-text-creation($text) +}; + +declare + %test:assertEquals("@out a space.") +function coll-tests:prepare-plain-text-creation-lb() +as xs:string { + let $chunk := + + + + + + out a space. + + + + + + let $text := $chunk//tei:ab/text() + return + coll:prepare-plain-text-creation($text) +}; + +declare + %test:assertXPath("count($result) = 6") +function coll-tests:get-relevant-text-nodes() +as text()+ { + let $chunk := + + + + + + some text that should + + + + be used + + + no display + display + + no display + no display + no display + [ + no display + no displayno display + no display + + some text with + out a space + + + + + + return + coll:get-relevant-text-nodes($chunk) +}; + +declare + %test:args(" @test") %test:assertEquals("test") + %test:args("interpunction.") %test:assertEquals("interpunction") + %test:args("white spaces") %test:assertEquals("white spaces") + %test:args("some + + new lines") %test:assertEquals("some new lines") +function coll-tests:format-and-normalize-string($string as xs:string) +as xs:string { + coll:format-and-normalize-string($string) +}; + +declare + %test:assertTrue +function coll-tests:create-txt-collection-if-not-available() { + let $create-collection := coll:create-txt-collection-if-not-available() + return + if (xmldb:collection-available("/db/apps/sade/textgrid/txt/")) then + true() + else + false() +}; + +declare + %test:assertXPath("count($result) gt 0") +function coll-tests:get-transcriptions-and-transliterations() +as element(tei:text)+ { + coll:get-transcriptions-and-transliterations() +}; + +declare + %test:args("ara") %test:assertEquals("arabic") + %test:args("karshuni") %test:assertEquals("karshuni") + %test:args("syc") %test:assertEquals("syriac") +function coll-tests:get-language-prefix-transcriptions($lang as xs:string) +as xs:string { + let $text := + + return + coll:get-language-prefix($text) +}; + +declare + %test:args("ara", "ara") %test:assertEquals("arabic") + %test:args("ara", "karshuni") %test:assertEquals("karshuni") + %test:args("ara", "syc") %test:assertEquals("syriac") + %test:args("karshuni", "ara") %test:assertEquals("arabic") + %test:args("karshuni", "karshuni") %test:assertEquals("karshuni") + %test:args("karshuni", "syc") %test:assertEquals("syriac") + %test:args("syriac", "ara") %test:assertEquals("arabic") + %test:args("syriac", "karshuni") %test:assertEquals("karshuni") + %test:args("syriac", "syc") %test:assertEquals("syriac") +function coll-tests:get-language-prefix-transliteration($lang-transliteration as xs:string, +$lang-transcription as xs:string) +as xs:string { + let $TEI := + + + + + let $text := $TEI/tei:text[1] + return + coll:get-language-prefix($text) +}; + +declare + %test:assertEquals("/db/apps/sade/textgrid/data/ahiqar_sample.xml") +function coll-tests:get-base-uri() +as xs:string { + coll:get-base-uri($coll-tests:sample-transcription) +}; + +declare + %test:assertEquals("Beispieldatei_zum_Testen") +function coll-tests:create-metadata-title-for-file-name() +as xs:string { + coll:create-metadata-title-for-file-name($coll-tests:sample-transcription) +}; + +declare + %test:assertEquals("karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription.txt") +function coll-tests:make-file-name() +as xs:string { + coll:make-file-name($coll-tests:sample-transcription) +}; + +declare + %test:assertEquals("ahiqar_sample-transcription.txt") +function coll-tests:make-file-name-suffix() +as xs:string { + coll:make-file-name-suffix($coll-tests:sample-transcription) +}; + +declare + %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml") %test:assertEquals("ahiqar_sample") +function coll-tests:get-file-name($base-uri as xs:string) +as xs:string { + coll:get-file-name($base-uri) +}; + +declare + %test:assertEquals("text of the first narrative section some sayings") +function coll-tests:get-relevant-text() { + let $TEI := + + + + some ignored text + + text of the first narrative section + + some sayings + + + + return + coll:get-relevant-text($TEI/tei:text) +}; + +declare + %test:assertXPath("count($result) = 2") +function coll-tests:get-chunks() { + let $milestones := coll:get-milestones-in-text($coll-tests:sample-transliteration) + return + coll:get-chunks($milestones) +}; + +declare + %test:assertXPath("$result[self::*[local-name(.) = 'milestone']]") +function coll-tests:get-end-of-chunk-milestone() { + let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[1] + return + coll:get-end-of-chunk($milestone) +}; + +declare + %test:assertXPath("$result[self::*[local-name(.) = 'ab']]") +function coll-tests:get-end-of-chunk-end-of-text() { + let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[2] + return + coll:get-end-of-chunk($milestone) +}; + + +declare + %test:assertXPath("$result[self::*/string() = 'the end text']") +function coll-tests:get-end-of-chunk-end-of-text-2() { + let $TEI := + + + + + + some text more text + the end text + + + + + some text2 more text + another end text + + + + + + let $milestone := $TEI//tei:text[@type = "transliteration"]//tei:milestone + + return + coll:get-end-of-chunk($milestone) +}; + +declare + %test:assertTrue +function coll-tests:has-following-milestone-true() +as xs:boolean { + let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[1] + return + coll:has-following-milestone($milestone) +}; + +declare + %test:assertFalse +function coll-tests:has-following-milestone-false() +as xs:boolean { + let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[2] + return + coll:has-following-milestone($milestone) +}; + +declare + %test:assertEquals("chunk1 relevant text more relevant text chunk2 relevant text more relevant text") +function coll-tests:get-relevant-text-from-chunks() +as xs:string { + let $chunk1 := + + + + chunk1: relevant text + more relevant text irrelevant. + + + + let $chunk2 := + + + + chunk2: relevant text + more relevant text irrelevant + + + + return + coll:get-relevant-text-from-chunks(($chunk1, $chunk2)) +}; + +declare + %test:assertTrue +function coll-tests:has-text-milestone-succcess() { + let $text:= + + + some text + + + return + coll:has-text-milestone($text) +}; + +declare + %test:assertFalse +function coll-tests:has-text-milestones-fail() { + let $text:= + + + some text + + + return + coll:has-text-milestone($text) +}; + +declare function local:open-file($uri as xs:string) +as document-node() { + doc($coll:data || "/" || $uri || ".xml") +}; diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index 60ab7ac..3e8d253 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -15,6 +15,7 @@ import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifes import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; +import module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests" at "collate-tests.xqm"; let $test-results := @@ -27,7 +28,8 @@ let $test-results := test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/coll-tests")) ) for $result in $test-results return -- GitLab From 9b2a3e8387bc4b568390b6138cb46d9067998729 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 11 Nov 2020 14:45:25 +0100 Subject: [PATCH 033/155] feat: add file names according to milestone type --- exist-app/modules/collate.xqm | 37 +++++++++++++++++-------------- exist-app/tests/collate-tests.xqm | 8 +++---- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/exist-app/modules/collate.xqm b/exist-app/modules/collate.xqm index 635010e..b0dbd2a 100644 --- a/exist-app/modules/collate.xqm +++ b/exist-app/modules/collate.xqm @@ -17,16 +17,23 @@ import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milesto declare variable $coll:textgrid := "/db/apps/sade/textgrid"; declare variable $coll:data := $coll:textgrid || "/data"; declare variable $coll:txt := $coll:textgrid || "/txt"; +declare variable $coll:milestone-types := + ("first_narrative_section", + "sayings", + "second_narrative_section", + "parables", + "third_narrative_section"); declare function coll:main() as xs:string+ { coll:create-txt-collection-if-not-available(), for $text in coll:get-transcriptions-and-transliterations() return - let $relevant-text := coll:get-relevant-text($text) - let $file-name := coll:make-file-name($text) - return - xmldb:store($coll:txt, $file-name, $relevant-text, "text/plain") + for $milestone-type in $coll:milestone-types return + let $relevant-text := coll:get-relevant-text($text) + let $file-name := coll:make-file-name($text, $milestone-type) + return + xmldb:store($coll:txt, $file-name, $relevant-text, "text/plain") }; declare function coll:create-txt-collection-if-not-available() @@ -45,23 +52,21 @@ as element(tei:text)+ { declare function coll:has-text-milestone($text as element(tei:text)) as xs:boolean { - if ($text//tei:milestone) then - true() - else - false() + exists($text//tei:milestone) }; (:~ : An example for the file name is : syriac-Brit_Lib_Add_7200-3r131-transcription.txt :) -declare function coll:make-file-name($text as element(tei:text)) +declare function coll:make-file-name($text as element(tei:text), + $milestone-type as xs:string) as xs:string { let $lang-prefix := coll:get-language-prefix($text) let $title-from-metadata := coll:create-metadata-title-for-file-name($text) - let $uri-plus-text-type := coll:make-file-name-suffix($text) + let $uri-text-type-milestone := coll:make-file-name-suffix($text, $milestone-type) return - $lang-prefix || "-" || $title-from-metadata || "-" || $uri-plus-text-type + $lang-prefix || "-" || $title-from-metadata || "-" || $uri-text-type-milestone }; declare function coll:get-language-prefix($text as element(tei:text)) @@ -100,13 +105,14 @@ as xs:string{ base-uri($text) }; -declare function coll:make-file-name-suffix($text as element(tei:text)) +declare function coll:make-file-name-suffix($text as element(tei:text), + $milestone-type as xs:string) as xs:string { let $base-uri := coll:get-base-uri($text) let $file-name := coll:get-file-name($base-uri) let $type := $text/@type return - $file-name || "-" || $type || ".txt" + $file-name || "-" || $type || "-" || $milestone-type || ".txt" }; declare function coll:get-file-name($base-uri as xs:string) @@ -159,10 +165,7 @@ as node() { declare function coll:has-following-milestone($milestone as element(tei:milestone)) as xs:boolean { - if ($milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) then - true() - else - false() + exists($milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) }; declare function coll:get-next-milestone($milestone as element(tei:milestone)) diff --git a/exist-app/tests/collate-tests.xqm b/exist-app/tests/collate-tests.xqm index b29b316..ed38111 100644 --- a/exist-app/tests/collate-tests.xqm +++ b/exist-app/tests/collate-tests.xqm @@ -256,17 +256,17 @@ as xs:string { }; declare - %test:assertEquals("karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription.txt") + %test:assertEquals("karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-first_narrative_section.txt") function coll-tests:make-file-name() as xs:string { - coll:make-file-name($coll-tests:sample-transcription) + coll:make-file-name($coll-tests:sample-transcription, "first_narrative_section") }; declare - %test:assertEquals("ahiqar_sample-transcription.txt") + %test:assertEquals("ahiqar_sample-transcription-first_narrative_section.txt") function coll-tests:make-file-name-suffix() as xs:string { - coll:make-file-name-suffix($coll-tests:sample-transcription) + coll:make-file-name-suffix($coll-tests:sample-transcription, "first_narrative_section") }; declare -- GitLab From 32954ba8fbe8192d804f211a619a9c9458c89cc3 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 11 Nov 2020 15:02:01 +0100 Subject: [PATCH 034/155] feat: only consider milestones that exist --- exist-app/modules/collate.xqm | 7 ++++++- exist-app/tests/collate-tests.xqm | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/collate.xqm b/exist-app/modules/collate.xqm index b0dbd2a..1e6fdfe 100644 --- a/exist-app/modules/collate.xqm +++ b/exist-app/modules/collate.xqm @@ -29,13 +29,18 @@ declare function coll:main() as xs:string+ { coll:create-txt-collection-if-not-available(), for $text in coll:get-transcriptions-and-transliterations() return - for $milestone-type in $coll:milestone-types return + for $milestone-type in coll:get-milestone-types-per-text($text) return let $relevant-text := coll:get-relevant-text($text) let $file-name := coll:make-file-name($text, $milestone-type) return xmldb:store($coll:txt, $file-name, $relevant-text, "text/plain") }; +declare function coll:get-milestone-types-per-text($text as element(tei:text)) +as xs:string+ { + $text//tei:milestone/@unit[./string() = $coll:milestone-types]/string() +}; + declare function coll:create-txt-collection-if-not-available() as xs:string? { if (xmldb:collection-available($coll:txt)) then diff --git a/exist-app/tests/collate-tests.xqm b/exist-app/tests/collate-tests.xqm index ed38111..956755b 100644 --- a/exist-app/tests/collate-tests.xqm +++ b/exist-app/tests/collate-tests.xqm @@ -418,6 +418,15 @@ function coll-tests:has-text-milestones-fail() { coll:has-text-milestone($text) }; + +declare + %test:assertXPath("$result = 'first_narrative_section'") + %test:assertXPath("$result = 'second_narrative_section'") +function coll-tests:get-milestone-types-per-text() +as xs:string+ { + coll:get-milestone-types-per-text($coll-tests:sample-transliteration) +}; + declare function local:open-file($uri as xs:string) as document-node() { doc($coll:data || "/" || $uri || ".xml") -- GitLab From 6a0a8befce297e49e64993ba642a2fa237d76948 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 11 Nov 2020 15:23:22 +0100 Subject: [PATCH 035/155] feat: save text of milestone chunks in separate files --- exist-app/modules/collate.xqm | 29 +++++++++---------------- exist-app/tests/collate-tests.xqm | 36 ++++++++++--------------------- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/exist-app/modules/collate.xqm b/exist-app/modules/collate.xqm index 1e6fdfe..7bb520d 100644 --- a/exist-app/modules/collate.xqm +++ b/exist-app/modules/collate.xqm @@ -30,7 +30,7 @@ as xs:string+ { coll:create-txt-collection-if-not-available(), for $text in coll:get-transcriptions-and-transliterations() return for $milestone-type in coll:get-milestone-types-per-text($text) return - let $relevant-text := coll:get-relevant-text($text) + let $relevant-text := coll:get-relevant-text($text, $milestone-type) let $file-name := coll:make-file-name($text, $milestone-type) return xmldb:store($coll:txt, $file-name, $relevant-text, "text/plain") @@ -126,29 +126,20 @@ as xs:string { => substring-before(".xml") }; -declare function coll:get-relevant-text($text as element(tei:text)) +declare function coll:get-relevant-text($text as element(tei:text), + $milestone-type as xs:string) as xs:string { - let $milestones := coll:get-milestones-in-text($text) - let $chunks := coll:get-chunks($milestones) - let $texts := coll:get-relevant-text-from-chunks($chunks) + let $chunk := coll:get-chunk($text, $milestone-type) + let $bla := console:log($chunk) return - string-join($texts, " ") -}; - -declare function coll:get-milestones-in-text($text as element(tei:text)) -as element(tei:milestone)+ { - $text//tei:milestone + coll:get-relevant-text-from-chunks($chunk) }; -declare function coll:get-chunks($milestones as element(tei:milestone)+) -as element(tei:TEI)+ { - for $milestone in $milestones return - coll:get-chunk($milestone) -}; - -declare function coll:get-chunk($milestone as element(tei:milestone)) +declare function coll:get-chunk($text as element(tei:text), + $milestone-type as xs:string) as element(tei:TEI) { - let $root := $milestone/root() + let $root := $text/root() + let $milestone := $text//tei:milestone[@unit = $milestone-type] let $end-of-chunk := coll:get-end-of-chunk($milestone) return fragment:get-fragment-from-doc( diff --git a/exist-app/tests/collate-tests.xqm b/exist-app/tests/collate-tests.xqm index 956755b..891ceef 100644 --- a/exist-app/tests/collate-tests.xqm +++ b/exist-app/tests/collate-tests.xqm @@ -18,13 +18,6 @@ function coll-tests:open-file($uri as xs:string) as document-node() { local:open-file($uri) }; -declare - %test:assertXPath("count($result) = 2") -function coll-tests:get-milestones-in-text() -as element(tei:milestone)* { - coll:get-milestones-in-text($coll-tests:sample-transliteration) -}; - declare %test:assertExists function coll-tests:get-next-milestone-succecss() @@ -48,9 +41,9 @@ declare %test:assertXPath("$result//*[local-name(.) = 'ab']") function coll-tests:get-chunk() as element(tei:TEI) { - let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] + let $milestone-type := "first_narrative_section" return - coll:get-chunk($milestone) + coll:get-chunk($coll-tests:sample-transliteration, $milestone-type) }; @@ -277,8 +270,9 @@ as xs:string { }; declare - %test:assertEquals("text of the first narrative section some sayings") -function coll-tests:get-relevant-text() { + %test:args("first_narrative_section") %test:assertEquals("text of the first narrative section") + %test:args("sayings") %test:assertEquals("some sayings") +function coll-tests:get-relevant-text($milestone-type as xs:string) { let $TEI := @@ -286,27 +280,19 @@ function coll-tests:get-relevant-text() { some ignored text text of the first narrative section - + some sayings return - coll:get-relevant-text($TEI/tei:text) -}; - -declare - %test:assertXPath("count($result) = 2") -function coll-tests:get-chunks() { - let $milestones := coll:get-milestones-in-text($coll-tests:sample-transliteration) - return - coll:get-chunks($milestones) + coll:get-relevant-text($TEI/tei:text, $milestone-type) }; declare %test:assertXPath("$result[self::*[local-name(.) = 'milestone']]") function coll-tests:get-end-of-chunk-milestone() { - let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[1] + let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] return coll:get-end-of-chunk($milestone) }; @@ -314,7 +300,7 @@ function coll-tests:get-end-of-chunk-milestone() { declare %test:assertXPath("$result[self::*[local-name(.) = 'ab']]") function coll-tests:get-end-of-chunk-end-of-text() { - let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[2] + let $milestone := $coll-tests:sample-transliteration//tei:milestone[2] return coll:get-end-of-chunk($milestone) }; @@ -352,7 +338,7 @@ declare %test:assertTrue function coll-tests:has-following-milestone-true() as xs:boolean { - let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[1] + let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] return coll:has-following-milestone($milestone) }; @@ -361,7 +347,7 @@ declare %test:assertFalse function coll-tests:has-following-milestone-false() as xs:boolean { - let $milestone := coll:get-milestones-in-text($coll-tests:sample-transliteration)[2] + let $milestone := $coll-tests:sample-transliteration//tei:milestone[2] return coll:has-following-milestone($milestone) }; -- GitLab From cc49dc4f7304f6650a340209302933af922e33ec Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 11 Nov 2020 15:29:07 +0100 Subject: [PATCH 036/155] fix: remove logging --- exist-app/modules/collate.xqm | 1 - 1 file changed, 1 deletion(-) diff --git a/exist-app/modules/collate.xqm b/exist-app/modules/collate.xqm index 7bb520d..35b67eb 100644 --- a/exist-app/modules/collate.xqm +++ b/exist-app/modules/collate.xqm @@ -130,7 +130,6 @@ declare function coll:get-relevant-text($text as element(tei:text), $milestone-type as xs:string) as xs:string { let $chunk := coll:get-chunk($text, $milestone-type) - let $bla := console:log($chunk) return coll:get-relevant-text-from-chunks($chunk) }; -- GitLab From abcecd575fa7e6c3c9f862bda6318e13e79d68d4 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 08:10:39 +0100 Subject: [PATCH 037/155] fix: ensure files contain text --- exist-app/modules/collate.xqm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exist-app/modules/collate.xqm b/exist-app/modules/collate.xqm index 35b67eb..29fd73e 100644 --- a/exist-app/modules/collate.xqm +++ b/exist-app/modules/collate.xqm @@ -31,9 +31,11 @@ as xs:string+ { for $text in coll:get-transcriptions-and-transliterations() return for $milestone-type in coll:get-milestone-types-per-text($text) return let $relevant-text := coll:get-relevant-text($text, $milestone-type) - let $file-name := coll:make-file-name($text, $milestone-type) return - xmldb:store($coll:txt, $file-name, $relevant-text, "text/plain") + if (matches($relevant-text, "\w")) then + xmldb:store($coll:txt, coll:make-file-name($text, $milestone-type), $relevant-text, "text/plain") + else + () }; declare function coll:get-milestone-types-per-text($text as element(tei:text)) @@ -57,7 +59,7 @@ as element(tei:text)+ { declare function coll:has-text-milestone($text as element(tei:text)) as xs:boolean { - exists($text//tei:milestone) + exists($text//tei:milestone[@unit = $coll:milestone-types]) }; (:~ -- GitLab From da6f26d6b944822ec14f4dfb0d260a781e872ccb Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 08:35:08 +0100 Subject: [PATCH 038/155] feat: switch to collation module --- exist-app/modules/tapi.xqm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/tapi.xqm b/exist-app/modules/tapi.xqm index e9805bb..c996c91 100644 --- a/exist-app/modules/tapi.xqm +++ b/exist-app/modules/tapi.xqm @@ -27,6 +27,7 @@ import module namespace requestr="http://exquery.org/ns/request"; import module namespace rest="http://exquery.org/ns/restxq"; import module namespace tei2html="http://ahikar.sub.uni-goettingen.de/ns/tei2html" at "tei2html.xqm"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; +import module namespace coll="http://ahikar.sub.uni-goettingen.de/ns/collate" at "collate.xqm"; declare variable $tapi:server := if(requestr:hostname() = "existdb") then @@ -240,7 +241,7 @@ declare %rest:path("/content/ahikar-plain-text.zip") %output:method("binary") function tapi:endpoint-zip() as item()+ { - let $prepare := tapi-txt:main() + let $prepare := coll:main() return $commons:responseHeader200, tapi-txt:compress-to-zip() -- GitLab From d317f8dead7756c42255201303061f5c90378b2b Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 08:53:39 +0100 Subject: [PATCH 039/155] refactor: integrate collation module in tapi-txt --- exist-app/modules/tapi-txt.xqm | 74 +++++++++++++++--------------- exist-app/modules/tapi.xqm | 3 +- exist-app/modules/testtrigger.xqm | 4 +- exist-app/tests/tapi-txt-tests.xqm | 60 ++++++++++-------------- exist-app/tests/tests-runner.xq | 6 +-- 5 files changed, 65 insertions(+), 82 deletions(-) diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index 6dd2652..8d0f337 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -20,16 +20,32 @@ import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milesto declare variable $tapi-txt:textgrid := "/db/apps/sade/textgrid"; declare variable $tapi-txt:data := $tapi-txt:textgrid || "/data"; declare variable $tapi-txt:txt := $tapi-txt:textgrid || "/txt"; +declare variable $tapi-txt:milestone-types := + ("first_narrative_section", + "sayings", + "second_narrative_section", + "parables", + "parables_1", + "parables_2", + "third_narrative_section"); declare function tapi-txt:main() as xs:string+ { tapi-txt:create-txt-collection-if-not-available(), for $text in tapi-txt:get-transcriptions-and-transliterations() return - let $relevant-text := tapi-txt:get-relevant-text($text) - let $file-name := tapi-txt:make-file-name($text) - return - xmldb:store($tapi-txt:txt, $file-name, $relevant-text, "text/plain") + for $milestone-type in tapi-txt:get-milestone-types-per-text($text) return + let $relevant-text := tapi-txt:get-relevant-text($text, $milestone-type) + return + if (matches($relevant-text, "\w")) then + xmldb:store($tapi-txt:txt, tapi-txt:make-file-name($text, $milestone-type), $relevant-text, "text/plain") + else + () +}; + +declare function tapi-txt:get-milestone-types-per-text($text as element(tei:text)) +as xs:string+ { + $text//tei:milestone/@unit[./string() = $tapi-txt:milestone-types]/string() }; declare function tapi-txt:create-txt-collection-if-not-available() @@ -48,23 +64,21 @@ as element(tei:text)+ { declare function tapi-txt:has-text-milestone($text as element(tei:text)) as xs:boolean { - if ($text//tei:milestone) then - true() - else - false() + exists($text//tei:milestone[@unit = $tapi-txt:milestone-types]) }; (:~ : An example for the file name is : syriac-Brit_Lib_Add_7200-3r131-transcription.txt :) -declare function tapi-txt:make-file-name($text as element(tei:text)) +declare function tapi-txt:make-file-name($text as element(tei:text), + $milestone-type as xs:string) as xs:string { let $lang-prefix := tapi-txt:get-language-prefix($text) let $title-from-metadata := tapi-txt:create-metadata-title-for-file-name($text) - let $uri-plus-text-type := tapi-txt:make-file-name-suffix($text) + let $uri-text-type-milestone := tapi-txt:make-file-name-suffix($text, $milestone-type) return - $lang-prefix || "-" || $title-from-metadata || "-" || $uri-plus-text-type + $lang-prefix || "-" || $title-from-metadata || "-" || $uri-text-type-milestone }; declare function tapi-txt:get-language-prefix($text as element(tei:text)) @@ -103,13 +117,14 @@ as xs:string{ base-uri($text) }; -declare function tapi-txt:make-file-name-suffix($text as element(tei:text)) +declare function tapi-txt:make-file-name-suffix($text as element(tei:text), + $milestone-type as xs:string) as xs:string { let $base-uri := tapi-txt:get-base-uri($text) let $file-name := tapi-txt:get-file-name($base-uri) let $type := $text/@type return - $file-name || "-" || $type || ".txt" + $file-name || "-" || $type || "-" || $milestone-type || ".txt" }; declare function tapi-txt:get-file-name($base-uri as xs:string) @@ -118,29 +133,19 @@ as xs:string { => substring-before(".xml") }; -declare function tapi-txt:get-relevant-text($text as element(tei:text)) +declare function tapi-txt:get-relevant-text($text as element(tei:text), + $milestone-type as xs:string) as xs:string { - let $milestones := tapi-txt:get-milestones-in-text($text) - let $chunks := tapi-txt:get-chunks($milestones) - let $texts := tapi-txt:get-relevant-text-from-chunks($chunks) + let $chunk := tapi-txt:get-chunk($text, $milestone-type) return - string-join($texts, " ") + tapi-txt:get-relevant-text-from-chunks($chunk) }; -declare function tapi-txt:get-milestones-in-text($text as element(tei:text)) -as element(tei:milestone)+ { - $text//tei:milestone -}; - -declare function tapi-txt:get-chunks($milestones as element(tei:milestone)+) -as element(tei:TEI)+ { - for $milestone in $milestones return - tapi-txt:get-chunk($milestone) -}; - -declare function tapi-txt:get-chunk($milestone as element(tei:milestone)) +declare function tapi-txt:get-chunk($text as element(tei:text), + $milestone-type as xs:string) as element(tei:TEI) { - let $root := $milestone/root() + let $root := $text/root() + let $milestone := $text//tei:milestone[@unit = $milestone-type] let $end-of-chunk := tapi-txt:get-end-of-chunk($milestone) return fragment:get-fragment-from-doc( @@ -162,10 +167,7 @@ as node() { declare function tapi-txt:has-following-milestone($milestone as element(tei:milestone)) as xs:boolean { - if ($milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) then - true() - else - false() + exists($milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) }; declare function tapi-txt:get-next-milestone($milestone as element(tei:milestone)) @@ -313,4 +315,4 @@ as element(tei:text) { declare function tapi-txt:compress-to-zip() as xs:base64Binary* { compression:zip(xs:anyURI($commons:tg-collection || "/txt/"), false()) -}; \ No newline at end of file +}; diff --git a/exist-app/modules/tapi.xqm b/exist-app/modules/tapi.xqm index c996c91..e9805bb 100644 --- a/exist-app/modules/tapi.xqm +++ b/exist-app/modules/tapi.xqm @@ -27,7 +27,6 @@ import module namespace requestr="http://exquery.org/ns/request"; import module namespace rest="http://exquery.org/ns/restxq"; import module namespace tei2html="http://ahikar.sub.uni-goettingen.de/ns/tei2html" at "tei2html.xqm"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; -import module namespace coll="http://ahikar.sub.uni-goettingen.de/ns/collate" at "collate.xqm"; declare variable $tapi:server := if(requestr:hostname() = "existdb") then @@ -241,7 +240,7 @@ declare %rest:path("/content/ahikar-plain-text.zip") %output:method("binary") function tapi:endpoint-zip() as item()+ { - let $prepare := coll:main() + let $prepare := tapi-txt:main() return $commons:responseHeader200, tapi-txt:compress-to-zip() diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 10e7ee7..bd6aee1 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -14,7 +14,6 @@ module namespace testtrigger="http://ahikar.sub.uni-goettingen.de/ns/testtrigger import module namespace rest="http://exquery.org/ns/restxq"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -import module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests" at "../tests/collate-tests.xqm"; import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; @@ -46,7 +45,6 @@ as item()? { let $tests := ( test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/coll-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), @@ -67,4 +65,4 @@ as item()? { return util:log-system-out("Tests complete. See " || $filename) -}; \ No newline at end of file +}; diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index eb82e33..c3e30e7 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -11,14 +11,6 @@ declare variable $ttt:sample-file := local:open-file("ahiqar_sample"); declare variable $ttt:sample-transliteration := $ttt:sample-file//tei:text[@type = "transliteration"]; declare variable $ttt:sample-transcription := $ttt:sample-file//tei:text[@type = "transcription"]; -declare - %test:setUp -function ttt:_test-setup() -as xs:string+ { - tapi-txt:main() -}; - - declare %test:args("ahiqar_sample") %test:assertExists %test:args("1234") %test:assertError("org.exist.xquery.XPathException") @@ -26,13 +18,6 @@ function ttt:open-file($uri as xs:string) as document-node() { local:open-file($uri) }; -declare - %test:assertXPath("count($result) = 2") -function ttt:get-milestones-in-text() -as element(tei:milestone)* { - tapi-txt:get-milestones-in-text($ttt:sample-transliteration) -}; - declare %test:assertExists function ttt:get-next-milestone-succecss() @@ -56,9 +41,9 @@ declare %test:assertXPath("$result//*[local-name(.) = 'ab']") function ttt:get-chunk() as element(tei:TEI) { - let $milestone := $ttt:sample-transliteration//tei:milestone[1] + let $milestone-type := "first_narrative_section" return - tapi-txt:get-chunk($milestone) + tapi-txt:get-chunk($ttt:sample-transliteration, $milestone-type) }; @@ -264,17 +249,17 @@ as xs:string { }; declare - %test:assertEquals("karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription.txt") + %test:assertEquals("karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-first_narrative_section.txt") function ttt:make-file-name() as xs:string { - tapi-txt:make-file-name($ttt:sample-transcription) + tapi-txt:make-file-name($ttt:sample-transcription, "first_narrative_section") }; declare - %test:assertEquals("ahiqar_sample-transcription.txt") + %test:assertEquals("ahiqar_sample-transcription-first_narrative_section.txt") function ttt:make-file-name-suffix() as xs:string { - tapi-txt:make-file-name-suffix($ttt:sample-transcription) + tapi-txt:make-file-name-suffix($ttt:sample-transcription, "first_narrative_section") }; declare @@ -285,8 +270,9 @@ as xs:string { }; declare - %test:assertEquals("text of the first narrative section some sayings") -function ttt:get-relevant-text() { + %test:args("first_narrative_section") %test:assertEquals("text of the first narrative section") + %test:args("sayings") %test:assertEquals("some sayings") +function ttt:get-relevant-text($milestone-type as xs:string) { let $TEI := @@ -294,27 +280,19 @@ function ttt:get-relevant-text() { some ignored text text of the first narrative section - + some sayings return - tapi-txt:get-relevant-text($TEI/tei:text) -}; - -declare - %test:assertXPath("count($result) = 2") -function ttt:get-chunks() { - let $milestones := tapi-txt:get-milestones-in-text($ttt:sample-transliteration) - return - tapi-txt:get-chunks($milestones) + tapi-txt:get-relevant-text($TEI/tei:text, $milestone-type) }; declare %test:assertXPath("$result[self::*[local-name(.) = 'milestone']]") function ttt:get-end-of-chunk-milestone() { - let $milestone := tapi-txt:get-milestones-in-text($ttt:sample-transliteration)[1] + let $milestone := $ttt:sample-transliteration//tei:milestone[1] return tapi-txt:get-end-of-chunk($milestone) }; @@ -322,7 +300,7 @@ function ttt:get-end-of-chunk-milestone() { declare %test:assertXPath("$result[self::*[local-name(.) = 'ab']]") function ttt:get-end-of-chunk-end-of-text() { - let $milestone := tapi-txt:get-milestones-in-text($ttt:sample-transliteration)[2] + let $milestone := $ttt:sample-transliteration//tei:milestone[2] return tapi-txt:get-end-of-chunk($milestone) }; @@ -360,7 +338,7 @@ declare %test:assertTrue function ttt:has-following-milestone-true() as xs:boolean { - let $milestone := tapi-txt:get-milestones-in-text($ttt:sample-transliteration)[1] + let $milestone := $ttt:sample-transliteration//tei:milestone[1] return tapi-txt:has-following-milestone($milestone) }; @@ -369,7 +347,7 @@ declare %test:assertFalse function ttt:has-following-milestone-false() as xs:boolean { - let $milestone := tapi-txt:get-milestones-in-text($ttt:sample-transliteration)[2] + let $milestone := $ttt:sample-transliteration//tei:milestone[2] return tapi-txt:has-following-milestone($milestone) }; @@ -432,6 +410,14 @@ as document-node() { }; +declare + %test:assertXPath("$result = 'first_narrative_section'") + %test:assertXPath("$result = 'second_narrative_section'") +function ttt:get-milestone-types-per-text() +as xs:string+ { + tapi-txt:get-milestone-types-per-text($ttt:sample-transliteration) +}; + declare %test:args("ahiqar_sample", "transcription") %test:assertXPath("$result[local-name(.) = 'text' and @type = 'transcription']") diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index 3e8d253..ee71734 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -15,7 +15,6 @@ import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifes import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; -import module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests" at "collate-tests.xqm"; let $test-results := @@ -28,8 +27,7 @@ let $test-results := test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/coll-tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")) ) for $result in $test-results return @@ -37,4 +35,4 @@ for $result in $test-results return and $result//@errors = 0) then "Everything okay: " || $result//@package else - $result \ No newline at end of file + $result -- GitLab From 6ec4a516b752bcdfb2eeaa86c8234384631aa45a Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 09:15:51 +0100 Subject: [PATCH 040/155] tests: make compression test more robust --- exist-app/tests/tapi-txt-tests.xqm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index c3e30e7..455b2aa 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -4,6 +4,7 @@ module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests"; declare namespace tei="http://www.tei-c.org/ns/1.0"; +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; import module namespace tapi-txt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt" at "../modules/tapi-txt.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; @@ -185,7 +186,7 @@ declare function ttt:create-txt-collection-if-not-available() { let $create-collection := tapi-txt:create-txt-collection-if-not-available() return - if (xmldb:collection-available("/db/apps/sade/textgrid/txt/")) then + if (xmldb:collection-available($commons:tg-collection || "/txt/")) then true() else false() @@ -483,5 +484,12 @@ declare %test:assertExists function ttt:compress-text() as xs:base64Binary { - tapi-txt:compress-to-zip() + if (xmldb:collection-available($commons:tg-collection || "/txt")) then + tapi-txt:compress-to-zip() + else + ( + let $prepare := tapi-txt:main() + return + tapi-txt:compress-to-zip() + ) }; -- GitLab From 18f9d5c3e9208023cd838d303b5d825ad5a4bf66 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 09:57:29 +0100 Subject: [PATCH 041/155] fix: consider several milestone declarations of same unit --- exist-app/modules/tapi-txt.xqm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index 8d0f337..f89a4b1 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -145,7 +145,11 @@ declare function tapi-txt:get-chunk($text as element(tei:text), $milestone-type as xs:string) as element(tei:TEI) { let $root := $text/root() - let $milestone := $text//tei:milestone[@unit = $milestone-type] + (: the positional predicate must only be provided as long as there are + several milestones of the same unit in a text. + as soon as we have found a solution for this, this predicate should be + removed. :) + let $milestone := $text//tei:milestone[@unit = $milestone-type][1] let $end-of-chunk := tapi-txt:get-end-of-chunk($milestone) return fragment:get-fragment-from-doc( -- GitLab From 443fa0f520164d27aeb4acd403ef8e58cfab5795 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 09:57:39 +0100 Subject: [PATCH 042/155] chore: remove unused module --- exist-app/modules/collate.xqm | 231 ---------------- exist-app/tests/collate-tests.xqm | 419 ------------------------------ 2 files changed, 650 deletions(-) delete mode 100644 exist-app/modules/collate.xqm delete mode 100644 exist-app/tests/collate-tests.xqm diff --git a/exist-app/modules/collate.xqm b/exist-app/modules/collate.xqm deleted file mode 100644 index 29fd73e..0000000 --- a/exist-app/modules/collate.xqm +++ /dev/null @@ -1,231 +0,0 @@ -xquery version "3.1"; - -(:~ - : This module extracts the chunks marked as important for the collation from - : the TEI files and uses them as an input for the plain text creation. These - : serve as a basis for the collation with CollateX in the project's CI/CD - : pipelines. - :) - -module namespace coll="http://ahikar.sub.uni-goettingen.de/ns/collate"; - -declare namespace tei="http://www.tei-c.org/ns/1.0"; -declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; - -import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milestone-chunk.xquery" at "fragment.xqm"; - -declare variable $coll:textgrid := "/db/apps/sade/textgrid"; -declare variable $coll:data := $coll:textgrid || "/data"; -declare variable $coll:txt := $coll:textgrid || "/txt"; -declare variable $coll:milestone-types := - ("first_narrative_section", - "sayings", - "second_narrative_section", - "parables", - "third_narrative_section"); - - -declare function coll:main() -as xs:string+ { - coll:create-txt-collection-if-not-available(), - for $text in coll:get-transcriptions-and-transliterations() return - for $milestone-type in coll:get-milestone-types-per-text($text) return - let $relevant-text := coll:get-relevant-text($text, $milestone-type) - return - if (matches($relevant-text, "\w")) then - xmldb:store($coll:txt, coll:make-file-name($text, $milestone-type), $relevant-text, "text/plain") - else - () -}; - -declare function coll:get-milestone-types-per-text($text as element(tei:text)) -as xs:string+ { - $text//tei:milestone/@unit[./string() = $coll:milestone-types]/string() -}; - -declare function coll:create-txt-collection-if-not-available() -as xs:string? { - if (xmldb:collection-available($coll:txt)) then - () - else - xmldb:create-collection($coll:textgrid, "txt") -}; - -declare function coll:get-transcriptions-and-transliterations() -as element(tei:text)+ { - collection($coll:data)//tei:text[@type = ("transcription", "transliteration")] - [coll:has-text-milestone(.)] -}; - -declare function coll:has-text-milestone($text as element(tei:text)) -as xs:boolean { - exists($text//tei:milestone[@unit = $coll:milestone-types]) -}; - -(:~ - : An example for the file name is - : syriac-Brit_Lib_Add_7200-3r131-transcription.txt - :) -declare function coll:make-file-name($text as element(tei:text), - $milestone-type as xs:string) -as xs:string { - let $lang-prefix := coll:get-language-prefix($text) - let $title-from-metadata := coll:create-metadata-title-for-file-name($text) - let $uri-text-type-milestone := coll:make-file-name-suffix($text, $milestone-type) - return - $lang-prefix || "-" || $title-from-metadata || "-" || $uri-text-type-milestone -}; - -declare function coll:get-language-prefix($text as element(tei:text)) -as xs:string? { - switch ($text/@type) - case "transcription" return - switch ($text/@xml:lang) - case "karshuni" return "karshuni" - case "ara" return "arabic" - case "syc" return "syriac" - default return () - - (: although the transliteration may have another language than - the transcription, the latter remains decisive for the prefix :) - case "transliteration" return - switch ($text/root()//tei:text[@type = "transcription"]/@xml:lang) - case "ara" return "arabic" - case "karshuni" return "karshuni" - case "syc" return "syriac" - default return () - default return () -}; - -declare function coll:create-metadata-title-for-file-name($text as element(tei:text)) -as xs:string { - let $base-uri := coll:get-base-uri($text) - let $metadata := doc($base-uri => replace("/data/", "/meta/")) - return - $metadata//tgmd:title - => replace("[^a-zA-Z0-9]", "_") - => replace("[_]+", "_") -}; - -declare function coll:get-base-uri($text as element(tei:text)) -as xs:string{ - base-uri($text) -}; - -declare function coll:make-file-name-suffix($text as element(tei:text), - $milestone-type as xs:string) -as xs:string { - let $base-uri := coll:get-base-uri($text) - let $file-name := coll:get-file-name($base-uri) - let $type := $text/@type - return - $file-name || "-" || $type || "-" || $milestone-type || ".txt" -}; - -declare function coll:get-file-name($base-uri as xs:string) -as xs:string { - tokenize($base-uri, "/")[last()] - => substring-before(".xml") -}; - -declare function coll:get-relevant-text($text as element(tei:text), - $milestone-type as xs:string) -as xs:string { - let $chunk := coll:get-chunk($text, $milestone-type) - return - coll:get-relevant-text-from-chunks($chunk) -}; - -declare function coll:get-chunk($text as element(tei:text), - $milestone-type as xs:string) -as element(tei:TEI) { - let $root := $text/root() - let $milestone := $text//tei:milestone[@unit = $milestone-type] - let $end-of-chunk := coll:get-end-of-chunk($milestone) - return - fragment:get-fragment-from-doc( - $root, - $milestone, - $end-of-chunk, - false(), - true(), - ("")) -}; - -declare function coll:get-end-of-chunk($milestone as element(tei:milestone)) -as node() { - if (coll:has-following-milestone($milestone)) then - coll:get-next-milestone($milestone) - else - $milestone/ancestor::tei:text[1]/tei:body/child::*[last()] -}; - -declare function coll:has-following-milestone($milestone as element(tei:milestone)) -as xs:boolean { - exists($milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) -}; - -declare function coll:get-next-milestone($milestone as element(tei:milestone)) -as element(tei:milestone)? { - $milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]][1] -}; - -declare function coll:get-relevant-text-from-chunks($chunks as element(tei:TEI)+) -as xs:string { - let $texts := - for $chunk in $chunks return - coll:make-plain-text-from-chunk($chunk) - return - string-join($texts, " ") - => normalize-space() -}; - -declare function coll:make-plain-text-from-chunk($chunk as element(tei:TEI)) -as xs:string { - let $texts := coll:get-relevant-text-nodes($chunk) - let $prepared-texts := - for $text in $texts return - coll:prepare-plain-text-creation($text) - return - coll:format-and-normalize-string($prepared-texts) -}; - -(:~ - : The following nodes shouldn't be considered for the plain text creation: - : * sic (wrong text) - : * surplus (surplus text) - : * supplied (supplied by modern editors) - : * colophons - : * glyphs - : * unclear (text unclear) - : * catchwords (they simply serve to bind the books correctly and reduplicate text) - : * note (they have been added later by another scribe) - :) -declare function coll:get-relevant-text-nodes($chunk as element(tei:TEI)) -as text()+ { - (($chunk//text() - [not(parent::tei:sic)] - [not(parent::tei:surplus)]) - [not(parent::tei:supplied)]) - [not(parent::tei:*[@type = "colophon"])] - [not(parent::tei:g)] - [not(parent::tei:unclear)] - [not(parent::tei:catchwords)] - [not(parent::tei:note)] -}; - -declare function coll:prepare-plain-text-creation($text as text()) -as xs:string { - if ($text/preceding-sibling::*[1][self::tei:lb[@break = "no"]]) then - "@" || $text - else - $text -}; - -declare function coll:format-and-normalize-string($strings as xs:string+) -as xs:string { - string-join($strings, " ") - => replace(" @", "") - => replace("[\p{P}\n+]", "") - => replace("\s+", " ") -}; diff --git a/exist-app/tests/collate-tests.xqm b/exist-app/tests/collate-tests.xqm deleted file mode 100644 index 891ceef..0000000 --- a/exist-app/tests/collate-tests.xqm +++ /dev/null @@ -1,419 +0,0 @@ -xquery version "3.1"; - -module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests"; - -declare namespace tei="http://www.tei-c.org/ns/1.0"; - -import module namespace coll="http://ahikar.sub.uni-goettingen.de/ns/collate" at "../modules/collate.xqm"; -import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; - -declare variable $coll-tests:sample-file := local:open-file("ahiqar_sample"); -declare variable $coll-tests:sample-transliteration := $coll-tests:sample-file//tei:text[@type = "transliteration"]; -declare variable $coll-tests:sample-transcription := $coll-tests:sample-file//tei:text[@type = "transcription"]; - -declare - %test:args("ahiqar_sample") %test:assertExists - %test:args("1234") %test:assertError("org.exist.xquery.XPathException") -function coll-tests:open-file($uri as xs:string) as document-node() { - local:open-file($uri) -}; - -declare - %test:assertExists -function coll-tests:get-next-milestone-succecss() -as element(tei:milestone)? { - let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] - return - coll:get-next-milestone($milestone) -}; - -declare - %test:assertEmpty -function coll-tests:get-next-milestone-fail() -as element(tei:milestone)? { - let $milestone := $coll-tests:sample-transliteration//tei:milestone[2] - return - coll:get-next-milestone($milestone) -}; - -declare - %test:assertExists - %test:assertXPath("$result//*[local-name(.) = 'ab']") -function coll-tests:get-chunk() -as element(tei:TEI) { - let $milestone-type := "first_narrative_section" - return - coll:get-chunk($coll-tests:sample-transliteration, $milestone-type) -}; - - -declare - %test:assertEquals("some text that should be used display some text without a space") -function coll-tests:make-plain-text-from-chunk() -as xs:string { - let $chunk := - - - - - - some text that should - - - - be used - - - no display - display - - no display - no display - no display - [ - no display - no displayno display - no display - - some text with - out a space - - - - - - return - coll:make-plain-text-from-chunk($chunk) -}; - - -declare - %test:assertEquals("some text with") -function coll-tests:prepare-plain-text-creation-no-lb() -as xs:string { - let $chunk := - - - - - - some text with - - - - - - let $text := $chunk//tei:ab/text() - return - coll:prepare-plain-text-creation($text) -}; - -declare - %test:assertEquals("@out a space.") -function coll-tests:prepare-plain-text-creation-lb() -as xs:string { - let $chunk := - - - - - - out a space. - - - - - - let $text := $chunk//tei:ab/text() - return - coll:prepare-plain-text-creation($text) -}; - -declare - %test:assertXPath("count($result) = 6") -function coll-tests:get-relevant-text-nodes() -as text()+ { - let $chunk := - - - - - - some text that should - - - - be used - - - no display - display - - no display - no display - no display - [ - no display - no displayno display - no display - - some text with - out a space - - - - - - return - coll:get-relevant-text-nodes($chunk) -}; - -declare - %test:args(" @test") %test:assertEquals("test") - %test:args("interpunction.") %test:assertEquals("interpunction") - %test:args("white spaces") %test:assertEquals("white spaces") - %test:args("some - - new lines") %test:assertEquals("some new lines") -function coll-tests:format-and-normalize-string($string as xs:string) -as xs:string { - coll:format-and-normalize-string($string) -}; - -declare - %test:assertTrue -function coll-tests:create-txt-collection-if-not-available() { - let $create-collection := coll:create-txt-collection-if-not-available() - return - if (xmldb:collection-available("/db/apps/sade/textgrid/txt/")) then - true() - else - false() -}; - -declare - %test:assertXPath("count($result) gt 0") -function coll-tests:get-transcriptions-and-transliterations() -as element(tei:text)+ { - coll:get-transcriptions-and-transliterations() -}; - -declare - %test:args("ara") %test:assertEquals("arabic") - %test:args("karshuni") %test:assertEquals("karshuni") - %test:args("syc") %test:assertEquals("syriac") -function coll-tests:get-language-prefix-transcriptions($lang as xs:string) -as xs:string { - let $text := - - return - coll:get-language-prefix($text) -}; - -declare - %test:args("ara", "ara") %test:assertEquals("arabic") - %test:args("ara", "karshuni") %test:assertEquals("karshuni") - %test:args("ara", "syc") %test:assertEquals("syriac") - %test:args("karshuni", "ara") %test:assertEquals("arabic") - %test:args("karshuni", "karshuni") %test:assertEquals("karshuni") - %test:args("karshuni", "syc") %test:assertEquals("syriac") - %test:args("syriac", "ara") %test:assertEquals("arabic") - %test:args("syriac", "karshuni") %test:assertEquals("karshuni") - %test:args("syriac", "syc") %test:assertEquals("syriac") -function coll-tests:get-language-prefix-transliteration($lang-transliteration as xs:string, -$lang-transcription as xs:string) -as xs:string { - let $TEI := - - - - - let $text := $TEI/tei:text[1] - return - coll:get-language-prefix($text) -}; - -declare - %test:assertEquals("/db/apps/sade/textgrid/data/ahiqar_sample.xml") -function coll-tests:get-base-uri() -as xs:string { - coll:get-base-uri($coll-tests:sample-transcription) -}; - -declare - %test:assertEquals("Beispieldatei_zum_Testen") -function coll-tests:create-metadata-title-for-file-name() -as xs:string { - coll:create-metadata-title-for-file-name($coll-tests:sample-transcription) -}; - -declare - %test:assertEquals("karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-first_narrative_section.txt") -function coll-tests:make-file-name() -as xs:string { - coll:make-file-name($coll-tests:sample-transcription, "first_narrative_section") -}; - -declare - %test:assertEquals("ahiqar_sample-transcription-first_narrative_section.txt") -function coll-tests:make-file-name-suffix() -as xs:string { - coll:make-file-name-suffix($coll-tests:sample-transcription, "first_narrative_section") -}; - -declare - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml") %test:assertEquals("ahiqar_sample") -function coll-tests:get-file-name($base-uri as xs:string) -as xs:string { - coll:get-file-name($base-uri) -}; - -declare - %test:args("first_narrative_section") %test:assertEquals("text of the first narrative section") - %test:args("sayings") %test:assertEquals("some sayings") -function coll-tests:get-relevant-text($milestone-type as xs:string) { - let $TEI := - - - - some ignored text - - text of the first narrative section - - some sayings - - - - return - coll:get-relevant-text($TEI/tei:text, $milestone-type) -}; - -declare - %test:assertXPath("$result[self::*[local-name(.) = 'milestone']]") -function coll-tests:get-end-of-chunk-milestone() { - let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] - return - coll:get-end-of-chunk($milestone) -}; - -declare - %test:assertXPath("$result[self::*[local-name(.) = 'ab']]") -function coll-tests:get-end-of-chunk-end-of-text() { - let $milestone := $coll-tests:sample-transliteration//tei:milestone[2] - return - coll:get-end-of-chunk($milestone) -}; - - -declare - %test:assertXPath("$result[self::*/string() = 'the end text']") -function coll-tests:get-end-of-chunk-end-of-text-2() { - let $TEI := - - - - - - some text more text - the end text - - - - - some text2 more text - another end text - - - - - - let $milestone := $TEI//tei:text[@type = "transliteration"]//tei:milestone - - return - coll:get-end-of-chunk($milestone) -}; - -declare - %test:assertTrue -function coll-tests:has-following-milestone-true() -as xs:boolean { - let $milestone := $coll-tests:sample-transliteration//tei:milestone[1] - return - coll:has-following-milestone($milestone) -}; - -declare - %test:assertFalse -function coll-tests:has-following-milestone-false() -as xs:boolean { - let $milestone := $coll-tests:sample-transliteration//tei:milestone[2] - return - coll:has-following-milestone($milestone) -}; - -declare - %test:assertEquals("chunk1 relevant text more relevant text chunk2 relevant text more relevant text") -function coll-tests:get-relevant-text-from-chunks() -as xs:string { - let $chunk1 := - - - - chunk1: relevant text - more relevant text irrelevant. - - - - let $chunk2 := - - - - chunk2: relevant text - more relevant text irrelevant - - - - return - coll:get-relevant-text-from-chunks(($chunk1, $chunk2)) -}; - -declare - %test:assertTrue -function coll-tests:has-text-milestone-succcess() { - let $text:= - - - some text - - - return - coll:has-text-milestone($text) -}; - -declare - %test:assertFalse -function coll-tests:has-text-milestones-fail() { - let $text:= - - - some text - - - return - coll:has-text-milestone($text) -}; - - -declare - %test:assertXPath("$result = 'first_narrative_section'") - %test:assertXPath("$result = 'second_narrative_section'") -function coll-tests:get-milestone-types-per-text() -as xs:string+ { - coll:get-milestone-types-per-text($coll-tests:sample-transliteration) -}; - -declare function local:open-file($uri as xs:string) -as document-node() { - doc($coll:data || "/" || $uri || ".xml") -}; -- GitLab From 99e89d3c4499d05dde6b4eaa6c38e2b23b05b5ce Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 09:59:59 +0100 Subject: [PATCH 043/155] chore: bump version number, update changelog --- CHANGELOG.md | 7 +++++++ exist-app/build.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39f29b3..d0e576d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.1] - 2020-1-12 + +## Changed + +- When extracting the relevant plain text sections, the semantic divisions of the texts are now considered. +Each semantic division, which is indicated in the texts by a tei:milestone, is now stored in a separate file. + ## [2.0.0] - 2020-11-06 ### Changed diff --git a/exist-app/build.properties b/exist-app/build.properties index 6a89d1e..3049be6 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.0.0 +project.version=2.1.0 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From b6295984355a07b1ff036e6b78e21305e9d49c62 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 12 Nov 2020 11:59:33 +0100 Subject: [PATCH 044/155] chore: bump version number --- exist-app/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/build.properties b/exist-app/build.properties index 6a89d1e..e1228fd 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.0.0 +project.version=2.2.0 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From f319e3e0ba12fcde7aa6b3d89793b7c177c826b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 12 Nov 2020 13:33:46 +0100 Subject: [PATCH 045/155] update: CHANGELOG and bumb version --- CHANGELOG.md | 11 +++++++++++ exist-app/build.properties | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39f29b3..c6cebb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.1.0] - 2020-11-12 + +### Changed + +- prepared for changed endpoints at Text-API (document-page to document/page) + +### Fixed + +- wrong Annotation IDs + + ## [2.0.0] - 2020-11-06 ### Changed diff --git a/exist-app/build.properties b/exist-app/build.properties index 6a89d1e..3049be6 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.0.0 +project.version=2.1.0 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From c4c0d18c5cb826c027d34a5f3fa0be558a80cf02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 12 Nov 2020 14:14:43 +0100 Subject: [PATCH 046/155] fix: syntax --- exist-app/modules/annotations.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index a5cb88d..3b06551 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -114,7 +114,7 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum (: if $document is a collection then its value in $anno:uris is a map containing the aggregated manifests. at this point it is relevant if $document is actually a manifest or a collection. we have to create different paths containing $first and $last for the two of them, - namely :) + namely $server || "/annotations/ahikar/" || $document || "/" || $first || "/annotationPage.json" for $document being a collection $server || "/annotations/ahikar/" || $collection || "/" || $document || "/" || $first || "/annotationPage.json" for $document being a manifest :) if ($document and anno:find-in-map($anno:uris, $document) instance of map()) then -- GitLab From 571336dfa870d0e1975305a5ba3e552e7e956569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 12 Nov 2020 14:18:37 +0100 Subject: [PATCH 047/155] fix: syntax --- exist-app/modules/annotations.xqm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 3b06551..082207a 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -705,12 +705,20 @@ $document as xs:string, $type as xs:string) { declare function anno:get-prev-or-next-annotationPage-url($collection as xs:string, $document as xs:string?, $page as xs:string?, $server as xs:string) { + let $pageSuffix := + if ($page) then + "/" || $page + else + () + return if ($document) then - $server || "/api/annotations/ahikar/" || $collection|| "/" || $document || "/" || $pageSuffix || "/annotationPage.json" + $server || "/api/annotations/ahikar/" || $collection|| "/" || $document || $pageSuffix || "/annotationPage.json" else () }; +}; + (:~ : Returns a sequence of URIs that are part of a given aggregation. : -- GitLab From 0359c721dee07de633ecc29fc7edef230f9428d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 12 Nov 2020 14:19:01 +0100 Subject: [PATCH 048/155] fix: syntax --- exist-app/modules/annotations.xqm | 1 - 1 file changed, 1 deletion(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 082207a..a1731f7 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -717,7 +717,6 @@ $document as xs:string?, $page as xs:string?, $server as xs:string) { () }; -}; (:~ : Returns a sequence of URIs that are part of a given aggregation. -- GitLab From 85b56c81692597580abcb64ece272b6d7ed1989f Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 08:11:16 +0100 Subject: [PATCH 049/155] style: update code formatting --- exist-app/modules/annotations.xqm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index a1731f7..e28daa6 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -948,7 +948,8 @@ as document-node() { default return error(QName($anno:ns, "ANNO02"), "Unknown type " || $type) let $document-uri := $collection || $uri || ".xml" return - if(doc-available($document-uri)) - then doc($document-uri) - else error(QName($anno:ns, "ANNO03"), "Document not found: " || $document-uri) + if(doc-available($document-uri)) then + doc($document-uri) + else + error(QName($anno:ns, "ANNO03"), "Document not found: " || $document-uri) }; -- GitLab From 0877872b3ccdd5e8086db38fc07b0b7da75ba1ea Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 08:14:22 +0100 Subject: [PATCH 050/155] fix: update REST path for items --- exist-app/modules/tapi-item.xqm | 2 +- exist-app/tests/tapi-item-tests.xqm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exist-app/modules/tapi-item.xqm b/exist-app/modules/tapi-item.xqm index cd1a52c..fe38d60 100644 --- a/exist-app/modules/tapi-item.xqm +++ b/exist-app/modules/tapi-item.xqm @@ -30,7 +30,7 @@ as element(object) { {tapi-item:make-facsimile-id($manifest-uri, $page, $server)} - {$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}-{$page}/annotationCollection.json + {$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}/{$page}/annotationCollection.json }; diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 21c8e71..554ec43 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -57,7 +57,7 @@ declare %test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/ahiqar_sample-82a.html' ") (: checks if images connected to underlying pages are identified :) %test:assertXPath("$result//*[local-name(.) = 'id'] = 'http://0.0.0.0:8080/exist/restxq/api/images/3r1nz' ") - %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/ahiqar_agg-82a/annotationCollection.json' ") + %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/ahiqar_agg/82a/annotationCollection.json' ") function titemt:get-json($collection as xs:string, $document as xs:string, $page as xs:string) -- GitLab From 0e91a86e941d3dd054a781e9e3615a5024bdf786 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 08:16:17 +0100 Subject: [PATCH 051/155] tests: add missing param types and return values, remove unused modules --- exist-app/modules/tapi-item.xqm | 2 +- exist-app/tests/tapi-item-tests.xqm | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/exist-app/modules/tapi-item.xqm b/exist-app/modules/tapi-item.xqm index fe38d60..480c0ca 100644 --- a/exist-app/modules/tapi-item.xqm +++ b/exist-app/modules/tapi-item.xqm @@ -35,7 +35,7 @@ as element(object) { }; -declare function tapi-item:make-title($manifest-uri) +declare function tapi-item:make-title($manifest-uri as xs:string) as xs:string { let $tei-xml := commons:get-tei-xml-for-manifest($manifest-uri) return diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 554ec43..a11acf7 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -5,8 +5,6 @@ module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" declare namespace http = "http://expath.org/ns/http-client"; declare namespace tei="http://www.tei-c.org/ns/1.0"; -import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; -import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item" at "../modules/tapi-item.xqm"; @@ -70,6 +68,7 @@ declare %test:args("ahiqar_agg") %test:assertXPath("count($result) = 5") %test:args("ahiqar_agg") %test:assertXPath("$result[local-name(.) = ('lang', 'langAlt')]") %test:args("ahiqar_agg") %test:assertXPath("count($result[local-name(.) = 'lang']) = 2") -function titemt:make-language-elements($manifest-uri as xs:string) { +function titemt:make-language-elements($manifest-uri as xs:string) +as element()+ { tapi-item:make-language-elements($manifest-uri) }; -- GitLab From 299b0624b0ede8a2f839aa5fdec49e5f56118d65 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 08:51:36 +0100 Subject: [PATCH 052/155] refactor: rename variable --- exist-app/modules/annotations.xqm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index e28daa6..dc35fab 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -45,10 +45,10 @@ declare variable $anno:annotationElements := (: this variable holds a map with the complete project structure (excluding images) :) declare variable $anno:uris := - let $main-collection := "3r132" (: main textgrid edition object :) - let $language-aggs := anno:get-uris($main-collection) + let $main-edition-object := "3r132" + let $language-aggs := anno:get-uris($main-edition-object) return - map { $main-collection: + map { $main-edition-object: (: level 1: language aggregations :) map:merge(for $lang in $language-aggs return map:entry($lang, -- GitLab From 944e6806e85f82840524e4d12d43e99c63a4eab1 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 09:54:01 +0100 Subject: [PATCH 053/155] chore: tidy up repo.xml --- exist-app/repo.xml | 64 +--------------------------------------------- 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/exist-app/repo.xml b/exist-app/repo.xml index 81dfad6..6dc29f7 100644 --- a/exist-app/repo.xml +++ b/exist-app/repo.xml @@ -9,68 +9,6 @@ ahikar - post-install.xq - - - -

    -
  • Features -
      -
    • add sample text for the viewer
    • -
    • only consider pagebreaks with a facsimile in serialization
    • -
    -
  • -
- - -
    -
  • Features -
      -
    • add image endpoint
    • -
    • refine Text-API structure
    • -
    • add function documentation
    • -
    -
  • -
  • Bugfixes -
      -
    • -
    -
  • -
-
- -
    -
  • Features -
      -
    • plain text generation
    • -
    • plain text download
    • -
    • deployment via API
    • -
    • renamed application to match development tracks (git flow)
    • -
    -
  • -
  • Bugfixes -
      -
    • -
    -
  • -
-
- -
    -
  • Features -
      -
    • Application setup
    • -
    • Docker implementation incl. httpd reverse proxy
    • -
    -
  • -
  • Bugfixes -
      -
    • -
    -
  • -
-
- - + post-install.xq 2020-06-04T05:35:59.135Z -- GitLab From 181c2af393ca4176b64be153732e8af374e8af39 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 09:55:53 +0100 Subject: [PATCH 054/155] tests: add basic test set up --- exist-app/modules/testtrigger.xqm | 4 +++- exist-app/tests/annotation-tests.xqm | 18 ++++++++++++++++++ exist-app/tests/tests-runner.xq | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 exist-app/tests/annotation-tests.xqm diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 0624295..2609b0f 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -23,6 +23,7 @@ import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "../tests/tapi-item-tests.xqm"; import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "../tests/tapi-manifest-tests.xqm"; import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "../tests/tapi-tests.xqm"; +import module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" at "../tests/annotation-tests.xqm"; (:~ : Triggers the tests for the Ahikar backend. Called by the CI. @@ -52,7 +53,8 @@ as item()? { test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) ) let $fileSeparator := util:system-property("file.separator") diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm new file mode 100644 index 0000000..dd3830c --- /dev/null +++ b/exist-app/tests/annotation-tests.xqm @@ -0,0 +1,18 @@ +xquery version "3.1"; + +module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests"; + +declare namespace http = "http://expath.org/ns/http-client"; +declare namespace tei="http://www.tei-c.org/ns/1.0"; + +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; +import module neEsamespace map="http://www.w3.org/2005/xpath-functions/map"; +import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; +import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; +import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; + +declare + %test:assertTrue +function at:fail() { + false() +}; \ No newline at end of file diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index 60ab7ac..b608b0e 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -15,6 +15,7 @@ import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifes import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; +import module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" at "../tests/annotation-tests.xqm"; let $test-results := @@ -27,7 +28,8 @@ let $test-results := test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) ) for $result in $test-results return -- GitLab From 36e0f88aa079e4fa5c712a1a99101cae16fe0745 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 10:01:35 +0100 Subject: [PATCH 055/155] refactor: move existing test to apt module --- exist-app/tests/annotation-tests.xqm | 126 ++++++++++++++++++++++++-- exist-app/tests/tapi-tests.xqm | 129 --------------------------- 2 files changed, 121 insertions(+), 134 deletions(-) diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index dd3830c..31df25d 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -6,13 +6,129 @@ declare namespace http = "http://expath.org/ns/http-client"; declare namespace tei="http://www.tei-c.org/ns/1.0"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; -import module neEsamespace map="http://www.w3.org/2005/xpath-functions/map"; +import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; declare - %test:assertTrue -function at:fail() { - false() -}; \ No newline at end of file + %test:args("ahiqar_sample", "data") + %test:assertXPath("$result//*[local-name(.) = 'TEI']") +function at:anno-get-document($uri as xs:string, $type as xs:string) as document-node() { + anno:get-document($uri, $type) +}; + + +(:declare:) +(: %test:args("3r679", "114r"):) +(: %test:assertEquals("0"):) +(:function at:anno-determine-start-index-for-page($uri as xs:string, $page as xs:string) {:) +(: anno:determine-start-index-for-page($uri, $page):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r131"):) +(: %test:assertEquals("16"):) +(:function at:anno-determine-start-index($uri as xs:string) {:) +(: anno:determine-start-index($uri):) +(:};:) +(::) +(:declare:) +(: %test:args("3r131"):) +(: %test:assertEquals("3r679"):) +(:function at:anno-get-parent-aggregation($uri as xs:string) {:) +(: anno:get-parent-aggregation($uri):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r131"):) +(: %test:assertEquals("114r", "114v"):) +(:function at:anno-get-pages-in-TEI($uri as xs:string) {:) +(: anno:get-pages-in-TEI($uri):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r679"):) +(: %test:assertTrue:) +(:function at:anno-is-resource-edition($uri as xs:string) {:) +(: anno:is-resource-edition($uri):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r131"):) +(: %test:assertTrue:) +(:function at:anno-is-resource-xml($uri as xs:string) {:) +(: anno:is-resource-xml($uri):) +(:};:) + + +(:declare:) +(: %test:assertEquals("A place's name."):) +(:function at:anno-get-bodyValue() {:) +(: let $annotation := doc("/db/test-records/sample-tei.xml")//tei:placeName:) +(: return:) +(: anno:get-bodyValue($annotation):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("asdf"):) +(: %test:assertFalse:) +(:(: %test:args("3r131"):):) +(:(: %test:assertTrue:):) +(:function at:anno-are-resources-available($resources as xs:string+) {:) +(: anno:are-resources-available($resources):) +(:};:) + + +(:declare:) +(: %test:args("3r131"):) +(: %test:assertEquals("Simon Birol, Aly Elrefaei"):) +(:function at:anno-get-creator($uri as xs:string) {:) +(: anno:get-creator($uri):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r131"):) +(: %test:assertEquals("Brit. Lib. Add. 7200"):) +(:function at:anno-get-metadata-title($uri as xs:string) {:) +(: anno:get-metadata-title($uri):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r679"):) +(: %test:assertEquals("3r676", "3r672"):) +(:function at:anno-get-prev-xml-uris($uri as xs:string) {:) +(: anno:get-prev-xml-uris($uri):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r679"):) +(: %test:assertEquals("3r676", "3r672"):) +(:function at:anno-get-xmls-prev-in-collection($uri as xs:string) {:) +(: anno:get-xmls-prev-in-collection($uri):) +(:};:) + + +(:declare:) +(: %test:args("3r679", "114r", "next"):) +(: %test:assertEquals("114v"):) +(:function at:anno-get-prev-or-next-page($documentURI as xs:string,:) +(:$page as xs:string, $type as xs:string) {:) +(: anno:get-prev-or-next-page($documentURI, $page, $type):) +(:};:) +(::) +(::) +(:declare:) +(: %test:args("3r9ps"):) +(: %test:assertEquals("3r177", "3r178", "3r7vw", "3r7p1", "3r7p9", "3r7sk", "3r7tp", "3r7vd", "3r179", "3r7n0", "3r9vn", "3r9wf", "3rb3z", "3rbm9", "3rbmc", "3rx14", "3vp38"):) +(:function at:anno-get-uris($documentURI) {:) +(: anno:get-uris($documentURI):) +(:};:) diff --git a/exist-app/tests/tapi-tests.xqm b/exist-app/tests/tapi-tests.xqm index 646cb6f..5916370 100644 --- a/exist-app/tests/tapi-tests.xqm +++ b/exist-app/tests/tapi-tests.xqm @@ -241,132 +241,3 @@ function tt:endpoint-item() as item() { => util:base64-decode() => parse-json() }; - - -(: - : ***************** - : * AnnotationAPI * - : ***************** - :) - -declare - %test:args("ahiqar_sample", "data") - %test:assertXPath("$result//*[local-name(.) = 'TEI']") -function tt:anno-get-document($uri as xs:string, $type as xs:string) as document-node() { - anno:get-document($uri, $type) -}; - - -(:declare:) -(: %test:args("3r679", "114r"):) -(: %test:assertEquals("0"):) -(:function tt:anno-determine-start-index-for-page($uri as xs:string, $page as xs:string) {:) -(: anno:determine-start-index-for-page($uri, $page):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("16"):) -(:function tt:anno-determine-start-index($uri as xs:string) {:) -(: anno:determine-start-index($uri):) -(:};:) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("3r679"):) -(:function tt:anno-get-parent-aggregation($uri as xs:string) {:) -(: anno:get-parent-aggregation($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("114r", "114v"):) -(:function tt:anno-get-pages-in-TEI($uri as xs:string) {:) -(: anno:get-pages-in-TEI($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r679"):) -(: %test:assertTrue:) -(:function tt:anno-is-resource-edition($uri as xs:string) {:) -(: anno:is-resource-edition($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertTrue:) -(:function tt:anno-is-resource-xml($uri as xs:string) {:) -(: anno:is-resource-xml($uri):) -(:};:) - - -declare - %test:assertEquals("A place's name.") -function tt:anno-get-bodyValue() { - let $annotation := doc("/db/test-records/sample-tei.xml")//tei:placeName - return - anno:get-bodyValue($annotation) -}; - - -declare - %test:args("asdf") - %test:assertFalse -(: %test:args("3r131"):) -(: %test:assertTrue:) -function tt:anno-are-resources-available($resources as xs:string+) { - anno:are-resources-available($resources) -}; - - -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("Simon Birol, Aly Elrefaei"):) -(:function tt:anno-get-creator($uri as xs:string) {:) -(: anno:get-creator($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("Brit. Lib. Add. 7200"):) -(:function tt:anno-get-metadata-title($uri as xs:string) {:) -(: anno:get-metadata-title($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r679"):) -(: %test:assertEquals("3r676", "3r672"):) -(:function tt:anno-get-prev-xml-uris($uri as xs:string) {:) -(: anno:get-prev-xml-uris($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r679"):) -(: %test:assertEquals("3r676", "3r672"):) -(:function tt:anno-get-xmls-prev-in-collection($uri as xs:string) {:) -(: anno:get-xmls-prev-in-collection($uri):) -(:};:) - - -(:declare:) -(: %test:args("3r679", "114r", "next"):) -(: %test:assertEquals("114v"):) -(:function tt:anno-get-prev-or-next-page($documentURI as xs:string,:) -(:$page as xs:string, $type as xs:string) {:) -(: anno:get-prev-or-next-page($documentURI, $page, $type):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r9ps"):) -(: %test:assertEquals("3r177", "3r178", "3r7vw", "3r7p1", "3r7p9", "3r7sk", "3r7tp", "3r7vd", "3r179", "3r7n0", "3r9vn", "3r9wf", "3rb3z", "3rbm9", "3rbmc", "3rx14", "3vp38"):) -(:function tt:anno-get-uris($documentURI) {:) -(: anno:get-uris($documentURI):) -(:};:) -- GitLab From 07e7eb303ef0ca5a31e980cd1fe9ac2bd83f4988 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 10:39:44 +0100 Subject: [PATCH 056/155] refactor: add generic function for document retrieval --- exist-app/modules/annotations.xqm | 43 +++++++++------------------- exist-app/modules/commons.xqm | 32 ++++++++++++++------- exist-app/modules/tapi-txt.xqm | 8 +++--- exist-app/tests/annotation-tests.xqm | 7 ++--- exist-app/tests/commons-tests.xqm | 19 ++++++------ 5 files changed, 50 insertions(+), 59 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index dc35fab..6a0f5c0 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -168,7 +168,7 @@ declare function anno:get-information-for-collection-object($collectionURI as xs : @return The resource's title :) declare function anno:get-metadata-title($uri as xs:string) as xs:string { - anno:get-document($uri, "meta")//tgmd:title/string() + commons:get-document($uri, "meta")//tgmd:title/string() }; @@ -216,7 +216,7 @@ declare function anno:get-creator($uri as xs:string) as xs:string { return anno:get-all-xml-uris-for-submap($map) let $creators := for $xml in $xmls return - let $doc := anno:get-document($xml, "data") + let $doc := commons:get-document($xml, "data") return $doc//tei:teiHeader//tei:editor return distinct-values($creators) => string-join(", ") @@ -513,7 +513,7 @@ declare function anno:get-annotations($documentURI as xs:string, $page as xs:str : @param $page The page to be returned as tei:pb/@n/string() :) declare function anno:get-page-fragment($documentURI as xs:string, $page as xs:string) { - let $nodeURI :=anno:get-document($documentURI, "data")/base-uri() + let $nodeURI :=commons:get-document($documentURI, "data")/base-uri() return tapi-html:get-page-fragment($nodeURI, $page) }; @@ -538,7 +538,7 @@ declare function anno:get-total-no-of-annotations($uri as xs:string) as xs:integ let $annotation-no-per-xml := for $xml in $xmls return - let $doc := anno:get-document($xml, "data") + let $doc := commons:get-document($xml, "data") let $noOfElementsEach := for $element in $anno:annotationElements return count($doc//tei:text//*[name(.) = $element]) @@ -728,7 +728,7 @@ $document as xs:string?, $page as xs:string?, $server as xs:string) { declare function anno:get-uris($resource as xs:string) as xs:string+ { let $resource-doc := try { - anno:get-document($resource, "agg") + commons:get-document($resource, "agg") } catch * { error(QName($anno:ns, "ANNO01"), $resource || " is either not an aggregation or could not be found in the database.") @@ -745,7 +745,7 @@ declare function anno:get-uris($resource as xs:string) as xs:string+ { : @return true() if resources stated by $uri is a TEI/XML resource :) declare function anno:is-resource-xml($uri as xs:string) as xs:boolean { - anno:get-document($uri, "meta")//tgmd:format = "text/xml" + commons:get-document($uri, "meta")//tgmd:format = "text/xml" }; (:~ @@ -767,7 +767,7 @@ declare function anno:is-resource-edition($uri as xs:string) as xs:boolean { : @return A sequence of all page breaks occuring in the resource :) declare function anno:get-pages-in-TEI($documentURI as xs:string) as xs:string+ { - anno:get-document($documentURI, "data")//tei:pb[@facs]/@n/string() + commons:get-document($documentURI, "data")//tei:pb[@facs]/@n/string() }; @@ -846,7 +846,7 @@ as xs:string* { :) declare function anno:get-prev-xml-uris($uri as xs:string) as xs:string* { let $collection := anno:get-parent-aggregation($uri) - let $collection := anno:get-document($collection, "agg") + let $collection := commons:get-document($collection, "agg") let $tgURI := "textgrid:" || $uri let $tgURINode := $collection//@rdf:resource[./string() = $tgURI] @@ -885,12 +885,12 @@ declare function anno:get-parent-aggregation($uri as xs:string) as xs:string { : @return The relative position of the first annotation :) declare function anno:determine-start-index($uri as xs:string) as xs:integer { - let $resourceType := anno:get-document($uri, "meta")//tgmd:format + let $resourceType := commons:get-document($uri, "meta")//tgmd:format return if ($resourceType = "text/tg.aggregation+xml") then let $project := anno:get-parent-aggregation($uri) - let $nodeForURI := anno:get-document($project, "agg")//*[@rdf:resource[matches(., $uri)]] - let $prevCollections := anno:get-document($project, "agg")//*[@rdf:resource[. << $nodeForURI]]/@rdf:resource + let $nodeForURI := commons:get-document($project, "agg")//*[@rdf:resource[matches(., $uri)]] + let $prevCollections := commons:get-document($project, "agg")//*[@rdf:resource[. << $nodeForURI]]/@rdf:resource let $prevCollections := for $collURI in $prevCollections return replace($collURI, "textgrid:", "") @@ -903,7 +903,7 @@ declare function anno:determine-start-index($uri as xs:string) as xs:integer { let $prevXMLs := anno:get-xmls-prev-in-collection($uri) let $noOfAnnotationsPerXML := for $xml in $prevXMLs return - let $doc := anno:get-document($xml, "data") + let $doc := commons:get-document($xml, "data") let $noOfAnnotationsPerElement := for $name in $anno:annotationElements return count($doc//tei:text//*[name(.) = $name]) @@ -928,7 +928,7 @@ declare function anno:determine-start-index($uri as xs:string) as xs:integer { declare function anno:determine-start-index-for-page($uri as xs:string, $page as xs:string) as xs:integer { let $xml := anno:find-in-map($anno:uris, $uri) - let $doc := anno:get-document($xml, "data") + let $doc := commons:get-document($xml, "data") let $currentPb := $doc//tei:pb[@n = $page and @facs] let $noOfAnnotationsPerElement := for $name in $anno:annotationElements return @@ -936,20 +936,3 @@ $page as xs:string) as xs:integer { return sum($noOfAnnotationsPerElement) }; - - -declare function anno:get-document($uri as xs:string, $type as xs:string) -as document-node() { - let $collection := - switch ($type) - case "agg" return $commons:agg - case "data" return $commons:tg-collection || "/data/" - case "meta" return $commons:meta - default return error(QName($anno:ns, "ANNO02"), "Unknown type " || $type) - let $document-uri := $collection || $uri || ".xml" - return - if(doc-available($document-uri)) then - doc($document-uri) - else - error(QName($anno:ns, "ANNO03"), "Document not found: " || $document-uri) -}; diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index 77c61d9..b9db008 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -13,6 +13,8 @@ declare variable $commons:meta := $commons:tg-collection || "/meta/"; declare variable $commons:agg := $commons:tg-collection || "/agg/"; declare variable $commons:appHome := "/db/apps/ahikar"; +declare variable $commons:ns := "http://ahikar.sub.uni-goettingen.de/ns/commons"; + declare variable $commons:responseHeader200 := @@ -20,14 +22,9 @@ declare variable $commons:responseHeader200 := ; -declare function commons:get-aggregation($manifest-uri as xs:string) -as document-node() { - doc($commons:agg || $manifest-uri || ".xml") -}; - declare function commons:get-xml-uri($manifest-uri as xs:string) as xs:string { - let $aggregation-file := commons:get-aggregation($manifest-uri) + let $aggregation-file := commons:get-document($manifest-uri, "agg") return $aggregation-file//ore:aggregates[1]/@rdf:resource => substring-after(":") @@ -37,10 +34,23 @@ declare function commons:get-tei-xml-for-manifest($manifest-uri as xs:string) as document-node() { let $xml-uri := commons:get-xml-uri($manifest-uri) return - doc($commons:data || $xml-uri || ".xml") + commons:get-document($xml-uri, "data") }; -declare function commons:open-tei-xml($tei-xml-uri as xs:string) -as document-node() { - doc($commons:data || $tei-xml-uri || ".xml") -}; \ No newline at end of file + +declare function commons:get-document($uri as xs:string, + $type as xs:string) +as document-node()? { + let $collection := + switch ($type) + case "agg" return $commons:agg + case "data" return $commons:data + case "meta" return $commons:meta + default return error(QName($commons:ns, "COMMONS001"), "Unknown type " || $type) + let $base-uri := $collection || $uri || ".xml" + return + if (doc-available($base-uri)) then + doc($base-uri) + else + error(QName($commons:ns, "COMMONS002"), "URI " || $uri || " not found.") +}; diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index 6dd2652..577661b 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -249,7 +249,7 @@ declare function tapi-txt:get-TEI-text($document-uri as xs:string, $type as xs:string) as element(tei:text) { if (tapi-txt:is-document-tei-xml($document-uri)) then - commons:open-tei-xml($document-uri)//tei:text[@type = $type] + commons:get-document($document-uri, "data")//tei:text[@type = $type] else tapi-txt:get-tei-xml-uri-from-edition => tapi-txt:get-text-of-type($type) @@ -287,7 +287,7 @@ as xs:string { declare function tapi-txt:get-edition-aggregates-without-uri-namespace($document-uri as xs:string) as xs:string+ { - let $edition := commons:get-aggregation($document-uri) + let $edition := commons:get-document($document-uri, "agg") for $agg in $edition//ore:aggregates/@rdf:resource return replace($agg, "textgrid:", "") }; @@ -306,11 +306,11 @@ as xs:string { declare function tapi-txt:get-text-of-type($uri as xs:string, $type as xs:string) as element(tei:text) { - commons:open-tei-xml($uri)//tei:text[@type = $type] + commons:get-document($uri, "data")//tei:text[@type = $type] }; declare function tapi-txt:compress-to-zip() as xs:base64Binary* { compression:zip(xs:anyURI($commons:tg-collection || "/txt/"), false()) -}; \ No newline at end of file +}; diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 31df25d..dcd5c86 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -12,10 +12,9 @@ import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:o import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; declare - %test:args("ahiqar_sample", "data") - %test:assertXPath("$result//*[local-name(.) = 'TEI']") -function at:anno-get-document($uri as xs:string, $type as xs:string) as document-node() { - anno:get-document($uri, $type) + %test:assertTrue +function at:success() { + true() }; diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index 1fd6839..1a3374a 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -11,12 +11,6 @@ import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:o declare variable $ct:restxq := "http://0.0.0.0:8080/exist/restxq/"; -declare - %test:args("ahiqar_agg") %test:assertXPath("$result//@* = 'textgrid:ahiqar_sample'") -function ct:get-aggregation($manifest-uri as xs:string) { - commons:get-aggregation($manifest-uri) -}; - declare %test:args("ahiqar_agg") %test:assertEquals("ahiqar_sample") function ct:get-xml-uri($manifest-uri as xs:string) @@ -33,8 +27,13 @@ function ct:get-tei-xml-for-manifest($manifest-uri) { declare - %test:args("ahiqar_sample") %test:assertXPath("$result//*[local-name(.) = 'TEI']") -function ct:open-tei-xml($tei-xml-uri as xs:string) -as document-node() { - commons:open-tei-xml($tei-xml-uri) + %test:args("ahiqar_sample", "data") %test:assertXPath("$result/*[local-name(.) = 'TEI']") + %test:args("ahiqar_sample", "meta") %test:assertXPath("$result//* = 'Beispieldatei zum Testen'") + %test:args("ahiqar_agg", "agg") %test:assertXPath("$result//@* = 'textgrid:ahiqar_sample'") + %test:args("ahiqar_sample", "sata") %test:assertError("COMMONS001") + %test:args("qwerty", "data") %test:assertError("COMMONS002") +function ct:get-document($uri as xs:string, + $type as xs:string) +as document-node()? { + commons:get-document($uri, $type) }; -- GitLab From 2069fa34ec49772fe82169041e1df45f35a48722 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 11:35:23 +0100 Subject: [PATCH 057/155] feat: only return aggregates that exist in database --- exist-app/data/ahiqar_agg.xml | 3 ++- exist-app/modules/annotations.xqm | 35 ++++------------------------ exist-app/modules/commons.xqm | 13 +++++++++++ exist-app/modules/tapi-txt.xqm | 15 +++--------- exist-app/tests/annotation-tests.xqm | 6 ++--- exist-app/tests/commons-tests.xqm | 8 +++++++ exist-app/tests/tapi-txt-tests.xqm | 7 ------ 7 files changed, 33 insertions(+), 54 deletions(-) diff --git a/exist-app/data/ahiqar_agg.xml b/exist-app/data/ahiqar_agg.xml index 67a6389..5b4d835 100644 --- a/exist-app/data/ahiqar_agg.xml +++ b/exist-app/data/ahiqar_agg.xml @@ -1,5 +1,6 @@ + - + \ No newline at end of file diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 6a0f5c0..e3759ae 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -46,7 +46,7 @@ declare variable $anno:annotationElements := (: this variable holds a map with the complete project structure (excluding images) :) declare variable $anno:uris := let $main-edition-object := "3r132" - let $language-aggs := anno:get-uris($main-edition-object) + let $language-aggs := commons:get-available-aggregates($main-edition-object) return map { $main-edition-object: (: level 1: language aggregations :) @@ -54,10 +54,10 @@ declare variable $anno:uris := map:entry($lang, (: level 2 (key): editions associated to a language aggregation :) map:merge( - let $editions := anno:get-uris($lang) - for $uri in $editions[not(. = "3rrnp")] return + let $editions := commons:get-available-aggregates($lang) + for $uri in $editions return (: level 2 (value): XML associated with edition :) - let $edition-parts := anno:get-uris($uri) + let $edition-parts := commons:get-available-aggregates($uri) for $part in $edition-parts return if (anno:is-resource-xml($part)) then @@ -69,12 +69,6 @@ declare variable $anno:uris := } ; -(: - : ################## - : # REST ENDPOINTS # - : ################## - :) - (:~ : Returns annotation information about a single collection. Although this works for all collections, : it has mainly been designed for Ahikar's main collection, 3r132. @@ -717,27 +711,6 @@ $document as xs:string?, $page as xs:string?, $server as xs:string) { () }; - -(:~ - : Returns a sequence of URIs that are part of a given aggregation. - : - : @param $resource The URI of the current aggregation, e.g. '3r9ps' - : @return A sequence of resource URIs that are part of the given aggregation - : @error The resource provided isn't an aggregation or the file couldn't be opened - :) -declare function anno:get-uris($resource as xs:string) as xs:string+ { - let $resource-doc := - try { - commons:get-document($resource, "agg") - } catch * { - error(QName($anno:ns, "ANNO01"), - $resource || " is either not an aggregation or could not be found in the database.") - } - - return - for $res in $resource-doc//ore:aggregates/@rdf:resource return substring-after($res, "textgrid:") -}; - (:~ : Checks if a given resource is a TEI/XML. : diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index b9db008..10d92bd 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -54,3 +54,16 @@ as document-node()? { else error(QName($commons:ns, "COMMONS002"), "URI " || $uri || " not found.") }; + +declare function commons:get-available-aggregates($aggregation-uri as xs:string) +as xs:string* { + let $aggregation-doc := commons:get-document($aggregation-uri, "agg") + for $aggregate in $aggregation-doc//ore:aggregates/@rdf:resource + let $unprefixed-uri := substring-after($aggregate, "textgrid:") + let $aggregate-base-uri := $commons:meta || $unprefixed-uri || ".xml" + return + if (doc-available($aggregate-base-uri)) then + $unprefixed-uri + else + () +}; \ No newline at end of file diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index 577661b..a244435 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -279,17 +279,8 @@ declare function tapi-txt:get-format($uri as xs:string) as xs:string { declare function tapi-txt:get-tei-xml-uri-from-edition($document-uri as xs:string) as xs:string { - let $aggregates := tapi-txt:get-edition-aggregates-without-uri-namespace($document-uri) - return - tapi-txt:get-tei-xml-from-aggregates($aggregates) -}; - - -declare function tapi-txt:get-edition-aggregates-without-uri-namespace($document-uri as xs:string) -as xs:string+ { - let $edition := commons:get-document($document-uri, "agg") - for $agg in $edition//ore:aggregates/@rdf:resource return - replace($agg, "textgrid:", "") + commons:get-available-aggregates($document-uri) + => tapi-txt:get-tei-xml-from-aggregates() }; @@ -313,4 +304,4 @@ as element(tei:text) { declare function tapi-txt:compress-to-zip() as xs:base64Binary* { compression:zip(xs:anyURI($commons:tg-collection || "/txt/"), false()) -}; +}; \ No newline at end of file diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index dcd5c86..afa8446 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -12,9 +12,9 @@ import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:o import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; declare - %test:assertTrue -function at:success() { - true() + %test:assertFalse +function at:fail() { + false() }; diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index 1a3374a..bbc7f18 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -37,3 +37,11 @@ function ct:get-document($uri as xs:string, as document-node()? { commons:get-document($uri, $type) }; + +declare + %test:args("ahiqar_agg") %test:assertEquals("ahiqar_sample") + %test:args("qwerty") %test:assertError("COMMONS002") +function ct:get-available-aggregates($uri as xs:string) +as xs:string+ { + commons:get-available-aggregates($uri) +}; diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index eb82e33..4700e67 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -465,13 +465,6 @@ function ttt:get-tei-xml-uri-from-edition($document as xs:string) { }; -declare - %test:args("ahiqar_agg") %test:assertEquals("ahiqar_sample") -function ttt:get-edition-aggregates-without-uri-namespace($document as xs:string) { - tapi-txt:get-edition-aggregates-without-uri-namespace($document) -}; - - declare %test:args("ahiqar_sample") %test:assertEquals("ahiqar_sample") function ttt:get-tei-xml-from-aggregates($aggregates as xs:string+) { -- GitLab From 190cf94770306e48b150eea10b183054d198aba4 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 12:05:41 +0100 Subject: [PATCH 058/155] refactor: is-resource-edition, add missing tests --- exist-app/modules/annotations.xqm | 10 ++++-- exist-app/tests/annotation-tests.xqm | 52 ++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index e3759ae..9e7cbd3 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -601,6 +601,7 @@ declare function anno:get-bodyValue($annotation as node()) as xs:string { : @param $resources The URI of the resources to be checked : @return true() if all resources are available :) +(: ## tested ## :) declare function anno:are-resources-available($resources as xs:string+) as xs:boolean { let $availability := @@ -619,6 +620,7 @@ as xs:boolean { : @param $resources The URIs of resource's requested in an API call : @return The response header :) +(: ## tested ## :) declare function anno:get-404-header($resources as xs:string+) { Date: Fri, 13 Nov 2020 13:34:52 +0100 Subject: [PATCH 059/155] tests: add return type, remove unused module --- exist-app/tests/tapi-collection-tests.xqm | 1 - exist-app/tests/tapi-manifest-tests.xqm | 1 - exist-app/tests/test-commons.xqm | 3 ++- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/exist-app/tests/tapi-collection-tests.xqm b/exist-app/tests/tapi-collection-tests.xqm index 82b61b2..e7b12be 100644 --- a/exist-app/tests/tapi-collection-tests.xqm +++ b/exist-app/tests/tapi-collection-tests.xqm @@ -6,7 +6,6 @@ declare namespace http = "http://expath.org/ns/http-client"; declare namespace tei="http://www.tei-c.org/ns/1.0"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; -import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-coll="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection" at "../modules/tapi-collection.xqm"; diff --git a/exist-app/tests/tapi-manifest-tests.xqm b/exist-app/tests/tapi-manifest-tests.xqm index d2d828b..a10304c 100644 --- a/exist-app/tests/tapi-manifest-tests.xqm +++ b/exist-app/tests/tapi-manifest-tests.xqm @@ -6,7 +6,6 @@ declare namespace http = "http://expath.org/ns/http-client"; declare namespace tei="http://www.tei-c.org/ns/1.0"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; -import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-mani="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest" at "../modules/tapi-manifest.xqm"; diff --git a/exist-app/tests/test-commons.xqm b/exist-app/tests/test-commons.xqm index eaa1777..2762d95 100644 --- a/exist-app/tests/test-commons.xqm +++ b/exist-app/tests/test-commons.xqm @@ -18,7 +18,8 @@ declare function tc:get-http-status($url as xs:string) as xs:string { http:send-request($req)[1]/@status }; -declare function tc:make-request($url as xs:string) { +declare function tc:make-request($url as xs:string) +as element() { -- GitLab From ba9d4ef0b3461240b01800da238dc6f0574338ca Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 13:53:28 +0100 Subject: [PATCH 060/155] tests: add further tests, revert change of is-resource-edition --- exist-app/modules/annotations.xqm | 45 +++++++++++----- exist-app/tests/annotation-tests.xqm | 78 +++++++++++++++++++++++----- 2 files changed, 96 insertions(+), 27 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 9e7cbd3..cb1ffe6 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -161,7 +161,9 @@ declare function anno:get-information-for-collection-object($collectionURI as xs : @param $uri The resource's URI : @return The resource's title :) -declare function anno:get-metadata-title($uri as xs:string) as xs:string { +(: ## tested ## :) +declare function anno:get-metadata-title($uri as xs:string) +as xs:string { commons:get-document($uri, "meta")//tgmd:title/string() }; @@ -368,7 +370,10 @@ $document as xs:string, $page as xs:string) { : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server :) declare function anno:make-annotationCollection-for-manifest($collection as xs:string, -$document as xs:string, $page as xs:string, $server as xs:string) { + $document as xs:string, + $page as xs:string, + $server as xs:string) +as map() { let $title := anno:get-metadata-title($collection) return @@ -376,7 +381,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) { "annotationCollection": map { "@context": "http://www.w3.org/ns/anno.jsonld", - "id": $anno:ns || "/annotationCollection/" || $document || "-" || $page, + "id": $anno:ns || "/annotationCollection/" || $document || "/" || $page, "type": "AnnotationCollection", "label": "Ahikar annotations for textgrid:" || $document || ": " || $title || ", page " || $page, "x-creator": anno:get-creator($document), @@ -507,7 +512,7 @@ declare function anno:get-annotations($documentURI as xs:string, $page as xs:str : @param $page The page to be returned as tei:pb/@n/string() :) declare function anno:get-page-fragment($documentURI as xs:string, $page as xs:string) { - let $nodeURI :=commons:get-document($documentURI, "data")/base-uri() + let $nodeURI := commons:get-document($documentURI, "data")/base-uri() return tapi-html:get-page-fragment($nodeURI, $page) }; @@ -570,7 +575,11 @@ declare function anno:get-all-xml-uris-for-submap($map as map()) { : @param $id The node ID of the annotation. It is equivalent to generate-id($annotation) : @return A map containing the target information :) -declare function anno:get-target-information($annotation as node(), $documentURI as xs:string, $id as xs:string) as map(*) { +(: ## tested ## :) +declare function anno:get-target-information($annotation as node(), + $documentURI as xs:string, + $id as xs:string) +as map(*) { map { "id": $anno:ns || "/" || $documentURI || "/"|| $id, "format": "text/xml", @@ -587,7 +596,9 @@ declare function anno:get-target-information($annotation as node(), $documentURI : @param $annotation The node which serves as a basis for the annotation : @return The content of bodyValue. :) -declare function anno:get-bodyValue($annotation as node()) as xs:string { +(: ## tested ## :) +declare function anno:get-bodyValue($annotation as node()) +as xs:string { switch ($annotation/local-name()) case "persName" return "A person's name." case "placeName" return "A place's name." @@ -726,14 +737,14 @@ declare function anno:is-resource-xml($uri as xs:string) as xs:boolean { (:~ : Checks if the URI to a given resource belongs to an edition object. In this - : case, its format i text/tg.edition+tg.aggregation+xml. + : case, its entry in $anno:uris isn't a map but a simple xs:string denoting the + : URI of the corresponding TEI/XML. : : @param $uri The resource's URI : @return true() if resources stated by $uri is an edition object :) - (: ## tested ## :) declare function anno:is-resource-edition($uri as xs:string) as xs:boolean { - commons:get-document($uri, "meta")//tgmd:format = "text/tg.edition+tg.aggregation+xml" + not(anno:find-in-map($anno:uris, $uri) instance of map()) }; (:~ @@ -757,7 +768,9 @@ declare function anno:get-pages-in-TEI($documentURI as xs:string) as xs:string+ : @param $type "prev" for the previous, "next" for the next page break :) declare function anno:get-prev-or-next-page($documentURI as xs:string, -$page as xs:string, $type as xs:string) as xs:string? { + $page as xs:string, + $type as xs:string) +as xs:string? { let $tei := anno:find-in-map($anno:uris, $documentURI) let $pages := anno:get-pages-in-TEI($tei) let $no-of-pages := count($pages) @@ -841,10 +854,14 @@ declare function anno:get-prev-xml-uris($uri as xs:string) as xs:string* { : @param $uri The resource's URI : @return The URI of the given resource's parent aggregation :) -declare function anno:get-parent-aggregation($uri as xs:string) as xs:string { - for $doc in collection($commons:agg) return - if ($doc//@rdf:resource[matches(., $uri)]) then - base-uri($doc) => substring-after("agg/") => substring-before(".xml") +(: ## tested ## :) +declare function anno:get-parent-aggregation($uri as xs:string) +as xs:string? { + if (collection($commons:agg)[.//@rdf:resource = "textgrid:" || $uri]) then + collection($commons:agg)[.//@rdf:resource = "textgrid:" || $uri] + => base-uri() + => substring-after("agg/") + => substring-before(".xml") else () }; diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 0d3a628..e01ecfc 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -11,11 +11,7 @@ import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; -declare - %test:assertFalse -function at:fail() { - false() -}; +declare variable $at:sample-doc := doc($commons:data || "/ahiqar_sample.xml"); declare %test:args("ahiqar_sample") %test:assertTrue @@ -28,6 +24,7 @@ as xs:boolean { declare %test:args("ahiqar_sample") %test:assertFalse %test:args("ahiqar_agg") %test:assertTrue + %test:pending function at:is-resource-edition($uri as xs:string) as xs:boolean { anno:is-resource-edition($uri) @@ -70,6 +67,69 @@ as element() { }; +declare + %test:args("ahiqar_sample") %test:assertEquals("ahiqar_agg") + %test:args("ahiqar_agg") %test:assertEquals("ahiqar_collection") + %test:args("ahiqar_collection") %test:assertEmpty +function at:get-parent-aggregation($uri as xs:string) +as xs:string? { + anno:get-parent-aggregation($uri) +}; + +declare + %test:args("ahiqar_sample", "82a", "next") %test:assertEquals("82b") + %test:args("ahiqar_sample", "82b", "prev") %test:assertEquals("82a") + %test:args("ahiqar_sample", "83b", "next") %test:assertEmpty + %test:args("ahiqar_sample", "82a", "prev") %test:assertEmpty + %test:pending +function at:get-prev-or-next-page($documentURI as xs:string, + $page as xs:string, + $type as xs:string) +as xs:string? { + anno:get-prev-or-next-page($documentURI, $page, $type) +}; + +declare + %test:args("ahiqar_sample") %test:assertEquals("Beispieldatei zum Testen") +function at:get-metadata-title($uri as xs:string) +as xs:string { + anno:get-metadata-title($uri) +}; + +declare + %test:assertEquals("A place's name.") +function at:anno-get-bodyValue() { + let $annotation := $at:sample-doc//tei:text[@type = "transcription"]/descendant::tei:placeName[1] + return + anno:get-bodyValue($annotation) +}; + +declare + %test:args("ahiqar_sample", "N1.2.3.4") + %test:assertXPath("map:get($result, 'id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/ahiqar_sample/N1.2.3.4'") + %test:assertXPath("map:get($result, 'format') = 'text/xml'") + %test:assertXPath("map:get($result, 'language') = 'karshuni'") +function at:get-target-information($documentURI as xs:string, + $id as xs:string) +as map() { + let $annotation := $at:sample-doc//tei:text[@type = "transcription"]/descendant::tei:placeName[1] + return + anno:get-target-information($annotation, $documentURI, $id) +}; + +declare + %test:args("ahiqar_collection", "ahiqar_agg", "82a", "http://localhost:8080") + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/ahiqar_agg/82a'") + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('label') = 'Ahikar annotations for textgrid:ahiqar_agg: Beispieldatei zum Testen, page 82a'") + %test:pending +function at:make-annotationCollection-for-manifest($collection as xs:string, + $document as xs:string, + $page as xs:string, + $server as xs:string) +as map() { + anno:make-annotationCollection-for-manifest($collection, $document, $page, $server) +}; + (:declare:) (: %test:args("3r679", "114r"):) (: %test:assertEquals("0"):) @@ -117,14 +177,6 @@ as element() { (:};:) -(:declare:) -(: %test:assertEquals("A place's name."):) -(:function at:anno-get-bodyValue() {:) -(: let $annotation := doc("/db/test-records/sample-tei.xml")//tei:placeName:) -(: return:) -(: anno:get-bodyValue($annotation):) -(:};:) -(::) (::) (:declare:) (: %test:args("asdf"):) -- GitLab From bfb3e9ec6cf0104149d014c4d4d9013d41c27ffa Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 13:56:12 +0100 Subject: [PATCH 061/155] ci: remove surplus download --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3bdd583..a6a7d1b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,18 +56,17 @@ test_exist_app: reports: junit: exist-app/test/ahikar-test-results.xml -build_exist_app-all: +build_exist_app: image: docker.gitlab.gwdg.de/fontane-notizbuecher/build:latest stage: build script: - cd exist-app - - ant -propertyfile ${CI_COMMIT_REF_NAME}.build.properties prepare + - ant xar - FILENAME=$(ls build/ahikar*.xar) - curl -u ci:${EXIST_UPLOAD_PW} -X POST -F file=@${FILENAME} https://ci.de.dariah.eu/exist-upload artifacts: paths: - exist-app/build/*.xar - - exist-app/build/dependencies/*.xar load_frontend-all: image: docker.gitlab.gwdg.de/fontane-notizbuecher/build:latest -- GitLab From cc6eed002b33fc4d5a5e19d6a70f5fcb05f6764c Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 14:16:59 +0100 Subject: [PATCH 062/155] revert last commit --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6a7d1b..282217e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,12 +61,13 @@ build_exist_app: stage: build script: - cd exist-app - - ant xar + - ant -propertyfile ${CI_COMMIT_REF_NAME}.build.properties prepare - FILENAME=$(ls build/ahikar*.xar) - curl -u ci:${EXIST_UPLOAD_PW} -X POST -F file=@${FILENAME} https://ci.de.dariah.eu/exist-upload artifacts: paths: - exist-app/build/*.xar + - exist-app/build/dependencies/*.xar load_frontend-all: image: docker.gitlab.gwdg.de/fontane-notizbuecher/build:latest -- GitLab From d8e8a12eeb9ab49eb5fce2ab2e143a3296f58e7d Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 13 Nov 2020 15:19:03 +0100 Subject: [PATCH 063/155] tests: add separate map for testint --- exist-app/modules/annotations.xqm | 62 ++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index cb1ffe6..5e516de 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -45,28 +45,46 @@ declare variable $anno:annotationElements := (: this variable holds a map with the complete project structure (excluding images) :) declare variable $anno:uris := - let $main-edition-object := "3r132" - let $language-aggs := commons:get-available-aggregates($main-edition-object) - return - map { $main-edition-object: - (: level 1: language aggregations :) - map:merge(for $lang in $language-aggs return - map:entry($lang, - (: level 2 (key): editions associated to a language aggregation :) - map:merge( - let $editions := commons:get-available-aggregates($lang) - for $uri in $editions return - (: level 2 (value): XML associated with edition :) - let $edition-parts := commons:get-available-aggregates($uri) - for $part in $edition-parts - return - if (anno:is-resource-xml($part)) then - map:entry($uri, $part) - else - () - ) - )) - } + if (doc-available($commons:agg || "3r132.xml")) then + let $main-edition-object := "3r132" + let $language-aggs := commons:get-available-aggregates($main-edition-object) + return + map { $main-edition-object: + (: level 1: language aggregations :) + map:merge(for $lang in $language-aggs return + map:entry($lang, + (: level 2 (key): editions associated to a language aggregation :) + map:merge( + let $editions := commons:get-available-aggregates($lang) + for $uri in $editions return + (: level 2 (value): XML associated with edition :) + let $edition-parts := commons:get-available-aggregates($uri) + for $part in $edition-parts + return + if (anno:is-resource-xml($part)) then + map:entry($uri, $part) + else + () + ) + )) + } + else + let $main-edition-object := "ahiqar_collection" + let $editions := commons:get-available-aggregates($main-edition-object) + return + map { $main-edition-object: + map:merge( + for $uri in $editions return + (: level 2 (value): XML associated with edition :) + let $edition-parts := commons:get-available-aggregates($uri) + for $part in $edition-parts + return + if (anno:is-resource-xml($part)) then + map:entry($uri, $part) + else + () + ) + } ; (:~ -- GitLab From a859aa6c32add3448cc0f66ab315a2d9ec36e704 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 07:53:01 +0100 Subject: [PATCH 064/155] feat: rename and add sample files to match project structure --- .../{ahiqar_agg.xml => sample_edition.xml} | 4 +- ...r_agg_meta.xml => sample_edition_meta.xml} | 2 +- exist-app/data/sample_lang_aggregation.xml | 5 ++ .../data/sample_lang_aggregation_meta.xml | 22 +++++++++ ...collection.xml => sample_main_edition.xml} | 4 +- ..._meta.xml => sample_main_edition_meta.xml} | 2 +- .../{ahiqar_sample.xml => sample_teixml.xml} | 0 ...sample_meta.xml => sample_teixml_meta.xml} | 2 +- exist-app/modules/annotations.xqm | 2 +- exist-app/post-install.xq | 16 ++++--- exist-app/tests/annotation-tests.xqm | 48 +++++++++---------- exist-app/tests/commons-tests.xqm | 14 +++--- exist-app/tests/tapi-collection-tests.xqm | 26 +++++----- exist-app/tests/tapi-html-tests.xqm | 20 ++++---- exist-app/tests/tapi-item-tests.xqm | 20 ++++---- exist-app/tests/tapi-manifest-tests.xqm | 26 +++++----- exist-app/tests/tapi-tests.xqm | 22 ++++----- exist-app/tests/tapi-txt-tests.xqm | 30 ++++++------ 18 files changed, 147 insertions(+), 118 deletions(-) rename exist-app/data/{ahiqar_agg.xml => sample_edition.xml} (71%) rename exist-app/data/{ahiqar_agg_meta.xml => sample_edition_meta.xml} (93%) create mode 100644 exist-app/data/sample_lang_aggregation.xml create mode 100644 exist-app/data/sample_lang_aggregation_meta.xml rename exist-app/data/{ahiqar_collection.xml => sample_main_edition.xml} (65%) rename exist-app/data/{ahiqar_collection_meta.xml => sample_main_edition_meta.xml} (92%) rename exist-app/data/{ahiqar_sample.xml => sample_teixml.xml} (100%) rename exist-app/data/{ahiqar_sample_meta.xml => sample_teixml_meta.xml} (93%) diff --git a/exist-app/data/ahiqar_agg.xml b/exist-app/data/sample_edition.xml similarity index 71% rename from exist-app/data/ahiqar_agg.xml rename to exist-app/data/sample_edition.xml index 5b4d835..259105e 100644 --- a/exist-app/data/ahiqar_agg.xml +++ b/exist-app/data/sample_edition.xml @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/exist-app/data/ahiqar_agg_meta.xml b/exist-app/data/sample_edition_meta.xml similarity index 93% rename from exist-app/data/ahiqar_agg_meta.xml rename to exist-app/data/sample_edition_meta.xml index be6c810..e1625b5 100644 --- a/exist-app/data/ahiqar_agg_meta.xml +++ b/exist-app/data/sample_edition_meta.xml @@ -7,7 +7,7 @@ - textgrid:ahiqar_agg.0 + textgrid:sample_edition.0 diff --git a/exist-app/data/sample_lang_aggregation.xml b/exist-app/data/sample_lang_aggregation.xml new file mode 100644 index 0000000..de973ee --- /dev/null +++ b/exist-app/data/sample_lang_aggregation.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/exist-app/data/sample_lang_aggregation_meta.xml b/exist-app/data/sample_lang_aggregation_meta.xml new file mode 100644 index 0000000..1752f2b --- /dev/null +++ b/exist-app/data/sample_lang_aggregation_meta.xml @@ -0,0 +1,22 @@ + + + + + Beispieldatei für Sprachenaggregation + text/tg.aggregation+xml + + + + textgrid:sample_lang_aggregation.0 + + + + + + + + + + + + diff --git a/exist-app/data/ahiqar_collection.xml b/exist-app/data/sample_main_edition.xml similarity index 65% rename from exist-app/data/ahiqar_collection.xml rename to exist-app/data/sample_main_edition.xml index 123a6b3..c5fad93 100644 --- a/exist-app/data/ahiqar_collection.xml +++ b/exist-app/data/sample_main_edition.xml @@ -1,5 +1,5 @@ - - + + diff --git a/exist-app/data/ahiqar_collection_meta.xml b/exist-app/data/sample_main_edition_meta.xml similarity index 92% rename from exist-app/data/ahiqar_collection_meta.xml rename to exist-app/data/sample_main_edition_meta.xml index 015cc67..5aef6d3 100644 --- a/exist-app/data/ahiqar_collection_meta.xml +++ b/exist-app/data/sample_main_edition_meta.xml @@ -7,7 +7,7 @@ - textgrid:ahiqar_collection.0 + textgrid:sample_main_edition.0 diff --git a/exist-app/data/ahiqar_sample.xml b/exist-app/data/sample_teixml.xml similarity index 100% rename from exist-app/data/ahiqar_sample.xml rename to exist-app/data/sample_teixml.xml diff --git a/exist-app/data/ahiqar_sample_meta.xml b/exist-app/data/sample_teixml_meta.xml similarity index 93% rename from exist-app/data/ahiqar_sample_meta.xml rename to exist-app/data/sample_teixml_meta.xml index a73bf40..69132f1 100644 --- a/exist-app/data/ahiqar_sample_meta.xml +++ b/exist-app/data/sample_teixml_meta.xml @@ -7,7 +7,7 @@ - textgrid:ahiqar_sample.0 + textgrid:sample_teixml.0 diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 5e516de..7672547 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -69,7 +69,7 @@ declare variable $anno:uris := )) } else - let $main-edition-object := "ahiqar_collection" + let $main-edition-object := "sample_main_edition" let $editions := commons:get-available-aggregates($main-edition-object) return map { $main-edition-object: diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index b8e8e62..35eb282 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -18,7 +18,7 @@ declare function local:move-and-rename($filename as xs:string) as item()* { xmldb:rename($target-meta-collection, $filename, $new-filename) ) else - if (matches($filename, "sample")) then + if (matches($filename, "teixml")) then xmldb:move($data-file-path, $target-data-collection, $filename) else xmldb:move($data-file-path, $target-agg-collection, $filename) @@ -64,14 +64,16 @@ return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), ( let $files := ( - "ahiqar_sample.xml", - "ahiqar_sample_meta.xml", - "ahiqar_agg.xml", - "ahiqar_agg_meta.xml", + "sample_teixml.xml", + "sample_teixml_meta.xml", + "sample_edition.xml", + "sample_edition_meta.xml", "ahiqar_images.xml", "ahiqar_images_meta.xml", - "ahiqar_collection.xml", - "ahiqar_collection_meta.xml") + "sample_main_edition.xml", + "sample_main_edition_meta.xml", + "sample_lang_aggregation.xml", + "sample_lang_aggregation_meta.xml") return ( for $file in $files return diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index e01ecfc..5f873ee 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -11,19 +11,19 @@ import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; -declare variable $at:sample-doc := doc($commons:data || "/ahiqar_sample.xml"); +declare variable $at:sample-doc := doc($commons:data || "/sample_teixml.xml"); declare - %test:args("ahiqar_sample") %test:assertTrue - %test:args("ahiqar_agg") %test:assertFalse + %test:args("sample_teixml") %test:assertTrue + %test:args("sample_edition") %test:assertFalse function at:is-resource-xml($uri as xs:string) as xs:boolean { anno:is-resource-xml($uri) }; declare - %test:args("ahiqar_sample") %test:assertFalse - %test:args("ahiqar_agg") %test:assertTrue + %test:args("sample_teixml") %test:assertFalse + %test:args("sample_edition") %test:assertTrue %test:pending function at:is-resource-edition($uri as xs:string) as xs:boolean { @@ -31,8 +31,8 @@ as xs:boolean { }; declare - %test:args("ahiqar_sample") %test:assertXPath("count($result) = 4") - %test:args("ahiqar_sample") %test:assertXPath("$result = '82a'") + %test:args("sample_teixml") %test:assertXPath("count($result) = 4") + %test:args("sample_teixml") %test:assertXPath("$result = '82a'") function at:get-pages-in-TEI($uri as xs:string) as xs:string+ { anno:get-pages-in-TEI($uri) @@ -42,7 +42,7 @@ declare %test:assertTrue function at:are-resources-available-true() as xs:boolean { - let $resources := "ahiqar_sample" + let $resources := "sample_teixml" return anno:are-resources-available($resources) }; @@ -51,36 +51,36 @@ declare %test:assertFalse function at:are-resources-available-false() as xs:boolean { - let $resources := ("qwerty", "ahiqar_sample") + let $resources := ("qwerty", "sample_teixml") return anno:are-resources-available($resources) }; declare %test:assertXPath("$result//@status = '404'") - %test:assertXPath("$result//@message = 'One of the following requested resources couldn''t be found: qwerty, ahiqar_sample'") + %test:assertXPath("$result//@message = 'One of the following requested resources couldn''t be found: qwerty, sample_teixml'") function at:get-404-header() as element() { - let $resources := ("qwerty", "ahiqar_sample") + let $resources := ("qwerty", "sample_teixml") return anno:get-404-header($resources) }; declare - %test:args("ahiqar_sample") %test:assertEquals("ahiqar_agg") - %test:args("ahiqar_agg") %test:assertEquals("ahiqar_collection") - %test:args("ahiqar_collection") %test:assertEmpty + %test:args("sample_teixml") %test:assertEquals("sample_edition") + %test:args("sample_edition") %test:assertEquals("sample_lang_aggregation") + %test:args("sample_main_edition") %test:assertEmpty function at:get-parent-aggregation($uri as xs:string) as xs:string? { anno:get-parent-aggregation($uri) }; declare - %test:args("ahiqar_sample", "82a", "next") %test:assertEquals("82b") - %test:args("ahiqar_sample", "82b", "prev") %test:assertEquals("82a") - %test:args("ahiqar_sample", "83b", "next") %test:assertEmpty - %test:args("ahiqar_sample", "82a", "prev") %test:assertEmpty + %test:args("sample_teixml", "82a", "next") %test:assertEquals("82b") + %test:args("sample_teixml", "82b", "prev") %test:assertEquals("82a") + %test:args("sample_teixml", "83b", "next") %test:assertEmpty + %test:args("sample_teixml", "82a", "prev") %test:assertEmpty %test:pending function at:get-prev-or-next-page($documentURI as xs:string, $page as xs:string, @@ -90,7 +90,7 @@ as xs:string? { }; declare - %test:args("ahiqar_sample") %test:assertEquals("Beispieldatei zum Testen") + %test:args("sample_teixml") %test:assertEquals("Beispieldatei zum Testen") function at:get-metadata-title($uri as xs:string) as xs:string { anno:get-metadata-title($uri) @@ -105,8 +105,8 @@ function at:anno-get-bodyValue() { }; declare - %test:args("ahiqar_sample", "N1.2.3.4") - %test:assertXPath("map:get($result, 'id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/ahiqar_sample/N1.2.3.4'") + %test:args("sample_teixml", "N1.2.3.4") + %test:assertXPath("map:get($result, 'id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/sample_teixml/N1.2.3.4'") %test:assertXPath("map:get($result, 'format') = 'text/xml'") %test:assertXPath("map:get($result, 'language') = 'karshuni'") function at:get-target-information($documentURI as xs:string, @@ -118,9 +118,9 @@ as map() { }; declare - %test:args("ahiqar_collection", "ahiqar_agg", "82a", "http://localhost:8080") - %test:assertXPath("map:get($result, 'annotationCollection') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/ahiqar_agg/82a'") - %test:assertXPath("map:get($result, 'annotationCollection') => map:get('label') = 'Ahikar annotations for textgrid:ahiqar_agg: Beispieldatei zum Testen, page 82a'") + %test:args("sample_main_edition", "sample_edition", "82a", "http://localhost:8080") + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/sample_edition/82a'") + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('label') = 'Ahikar annotations for textgrid:sample_edition: Beispieldatei zum Testen, page 82a'") %test:pending function at:make-annotationCollection-for-manifest($collection as xs:string, $document as xs:string, diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index bbc7f18..773d970 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -12,14 +12,14 @@ import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:o declare variable $ct:restxq := "http://0.0.0.0:8080/exist/restxq/"; declare - %test:args("ahiqar_agg") %test:assertEquals("ahiqar_sample") + %test:args("sample_edition") %test:assertEquals("sample_teixml") function ct:get-xml-uri($manifest-uri as xs:string) as xs:string { commons:get-xml-uri($manifest-uri) }; declare - %test:args("ahiqar_agg") %test:assertXPath("$result//*[local-name(.) = 'title'] = 'The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, + %test:args("sample_edition") %test:assertXPath("$result//*[local-name(.) = 'title'] = 'The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, king of Assyria and Nineveh'") function ct:get-tei-xml-for-manifest($manifest-uri) { commons:get-tei-xml-for-manifest($manifest-uri) @@ -27,10 +27,10 @@ function ct:get-tei-xml-for-manifest($manifest-uri) { declare - %test:args("ahiqar_sample", "data") %test:assertXPath("$result/*[local-name(.) = 'TEI']") - %test:args("ahiqar_sample", "meta") %test:assertXPath("$result//* = 'Beispieldatei zum Testen'") - %test:args("ahiqar_agg", "agg") %test:assertXPath("$result//@* = 'textgrid:ahiqar_sample'") - %test:args("ahiqar_sample", "sata") %test:assertError("COMMONS001") + %test:args("sample_teixml", "data") %test:assertXPath("$result/*[local-name(.) = 'TEI']") + %test:args("sample_teixml", "meta") %test:assertXPath("$result//* = 'Beispieldatei zum Testen'") + %test:args("sample_edition", "agg") %test:assertXPath("$result//@* = 'textgrid:sample_teixml'") + %test:args("sample_teixml", "sata") %test:assertError("COMMONS001") %test:args("qwerty", "data") %test:assertError("COMMONS002") function ct:get-document($uri as xs:string, $type as xs:string) @@ -39,7 +39,7 @@ as document-node()? { }; declare - %test:args("ahiqar_agg") %test:assertEquals("ahiqar_sample") + %test:args("sample_edition") %test:assertEquals("sample_teixml") %test:args("qwerty") %test:assertError("COMMONS002") function ct:get-available-aggregates($uri as xs:string) as xs:string+ { diff --git a/exist-app/tests/tapi-collection-tests.xqm b/exist-app/tests/tapi-collection-tests.xqm index e7b12be..c65731a 100644 --- a/exist-app/tests/tapi-collection-tests.xqm +++ b/exist-app/tests/tapi-collection-tests.xqm @@ -42,7 +42,7 @@ function tct:_test-setup(){ - + let $agg1-meta := @@ -62,7 +62,7 @@ function tct:_test-setup(){ - + let $agg2-meta := @@ -102,7 +102,7 @@ function tct:_test-teardown() { }; declare - %test:args("ahiqar_collection") %test:assertXPath("$result//*[local-name(.) = 'aggregates']") + %test:args("sample_main_edition") %test:assertXPath("$result//*[local-name(.) = 'aggregates']") function tct:get-aggregation($uri as xs:string) { tapi-coll:get-aggregation($uri) }; @@ -141,7 +141,7 @@ function tct:get-allowed-manifest-uris-mock-up-input-excluded() { declare - %test:args("ahiqar_collection", "ahiqar_agg") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json") + %test:args("sample_main_edition", "sample_edition") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/sample_main_edition/sample_edition/manifest.json") function tct:make-id($colletion-uri as xs:string, $manifest-uri as xs:string) as xs:string { tapi-coll:make-id($tc:server, $colletion-uri, $manifest-uri) @@ -149,15 +149,15 @@ as xs:string { declare - %test:assertEquals("ahiqar_agg") + %test:assertEquals("sample_edition") function tct:get-allowed-manifest-uris-sample-input() { - let $collection-metadata := tapi-coll:get-aggregation("ahiqar_collection") + let $collection-metadata := tapi-coll:get-aggregation("sample_lang_aggregation") return tapi-coll:get-allowed-manifest-uris($collection-metadata) }; declare - %test:args("ahiqar_collection") %test:assertXPath("$result[self::document-node()]") + %test:args("sample_main_edition") %test:assertXPath("$result[self::document-node()]") function tct:get-metadata-file($uri as xs:string) { tapi-coll:get-metadata-file($uri) }; @@ -181,15 +181,15 @@ function tct:make-format-type($tgmd-format as xs:string) { declare %test:assertEquals("manifest") function tct:get-format-type() { - let $metadata := tapi-coll:get-metadata-file("ahiqar_agg") + let $metadata := tapi-coll:get-metadata-file("sample_edition") return tapi-coll:get-format-type($metadata) }; declare - %test:args("ahiqar_collection") %test:assertXPath("$result//type[. = 'manifest']") - %test:args("ahiqar_collection") %test:assertXPath("$result//id[matches(., 'ahiqar_agg/manifest.json')]") + %test:args("sample_main_edition") %test:assertXPath("$result//type[. = 'manifest']") + %test:args("sample_lang_aggregation") %test:assertXPath("$result//id[matches(., 'sample_edition/manifest.json')]") %test:args("testapi-collection") %test:assertXPath("$result//id[matches(., 'test-aggregation-1/manifest.json')]") %test:args("testapi-collection") %test:assertXPath("$result//id[matches(., 'test-aggregation-2/manifest.json')]") function tct:make-sequence($collection-uri as xs:string) { @@ -197,7 +197,7 @@ function tct:make-sequence($collection-uri as xs:string) { }; declare - %test:args("ahiqar_collection") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/annotationCollection.json") + %test:args("sample_main_edition") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/sample_main_edition/annotationCollection.json") function tct:make-annotationCollection-uri($collection-uri as xs:string) as xs:string { tapi-coll:make-annotationCollection-uri($tc:server, $collection-uri) @@ -205,8 +205,8 @@ as xs:string { declare - %test:args("ahiqar_collection") %test:assertXPath("$result//title = 'The Story and Proverbs of Ahikar the Wise'") - %test:args("ahiqar_collection") %test:assertXPath("$result//*/string() = 'http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json' ") + %test:args("sample_lang_aggregation") %test:assertXPath("$result//title = 'The Story and Proverbs of Ahikar the Wise'") + %test:args("sample_lang_aggregation") %test:assertXPath("$result//*/string() = 'http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/sample_lang_aggregation/sample_edition/manifest.json' ") function tct:get-json($collection-uri as xs:string) { tapi-coll:get-json($collection-uri, $tc:server) }; diff --git a/exist-app/tests/tapi-html-tests.xqm b/exist-app/tests/tapi-html-tests.xqm index c54e4c1..cb5b126 100644 --- a/exist-app/tests/tapi-html-tests.xqm +++ b/exist-app/tests/tapi-html-tests.xqm @@ -14,18 +14,18 @@ declare %test:assertXPath("$result//@id = 'N4'") function thtmlt:add-IDs() as node()+ { - let $manifest := doc($commons:data || "ahiqar_sample.xml")/* + let $manifest := doc($commons:data || "sample_teixml.xml")/* return tapi-html:add-IDs($manifest) }; declare - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml", "82a") %test:assertXPath("$result[local-name(.) = 'pb']") - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml", "82a") %test:assertXPath("$result/@facs = 'textgrid:3r1p0'") - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml", "82a") %test:assertXPath("$result/@n = '82b'") - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml", "83b") %test:assertXPath("$result[local-name(.) = 'ab']") - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml", "83b") %test:assertXPath("matches($result, 'ܘܗܦܟܬ ܛܥܢܬ ܐܰܒܵܪܐ ܘܠܐ ܐܝܼܩܰܪ ܥܠ')") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result[local-name(.) = 'pb']") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result/@facs = 'textgrid:3r1p0'") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result/@n = '82b'") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "83b") %test:assertXPath("$result[local-name(.) = 'ab']") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "83b") %test:assertXPath("matches($result, 'ܘܗܦܟܬ ܛܥܢܬ ܐܰܒܵܪܐ ܘܠܐ ܐܝܼܩܰܪ ܥܠ')") function thtmlt:get-end-node($tei-xml-base-uri as xs:string, $page as xs:string) as item()+ { @@ -37,7 +37,7 @@ as item()+ { declare - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml", "82a") %test:assertXPath("$result//*[local-name(.) = 'add'][@place = 'margin'] = 'حقًا'") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result//*[local-name(.) = 'add'][@place = 'margin'] = 'حقًا'") function thtmlt:get-page-fragment($tei-xml-base-uri as xs:string, $page as xs:string) as element() { @@ -46,7 +46,7 @@ as element() { declare - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml", "82a") %test:assertXPath("$result//text()[matches(., 'حقًا')]") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result//text()[matches(., 'حقًا')]") function thtmlt:transform-fragment($tei-xml-base-uri as xs:string, $page as xs:string) as element(xhtml:div) { @@ -57,8 +57,8 @@ as element(xhtml:div) { declare - %test:args("ahiqar_sample", "82a") %test:assertXPath("$result//text()[matches(., 'حقًا')]") - %test:args("ahiqar_sample", "82a") + %test:args("sample_teixml", "82a") %test:assertXPath("$result//text()[matches(., 'حقًا')]") + %test:args("sample_teixml", "82a") (: checks if there is text at all in the result :) %test:assertXPath("$result//text()[matches(., '[\w]')]") (: if a div[@class = 'tei_body'] is present, the transformation has been successfull :) diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index a11acf7..9c010c0 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -11,7 +11,7 @@ import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/i declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("3r1nz") + %test:args("sample_edition", "82a") %test:assertEquals("3r1nz") function titemt:get-facsimile-uri-for-page($manifest-uri as xs:string, $page as xs:string) as xs:string { @@ -19,14 +19,14 @@ as xs:string { }; declare - %test:args("ahiqar_agg") %test:assertEquals("Arabic, Classical Syriac, Eastern Syriac, Karshuni, Western Syriac") + %test:args("sample_edition") %test:assertEquals("Arabic, Classical Syriac, Eastern Syriac, Karshuni, Western Syriac") function titemt:get-language-string($manifest-uri as xs:string) as xs:string { tapi-item:get-language-string($manifest-uri) }; declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") + %test:args("sample_edition", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") function titemt:make-facsimile-id($manifest-uri as xs:string, $page as xs:string) as xs:string { @@ -34,7 +34,7 @@ as xs:string { }; declare - %test:args("ahiqar_agg") %test:assertEquals("The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, + %test:args("sample_edition") %test:assertEquals("The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, king of Assyria and Nineveh") function titemt:make-title($manifest-uri as xs:string) as xs:string { @@ -43,7 +43,7 @@ as xs:string { declare - %test:args("ahiqar_collection", "ahiqar_agg", "82a") + %test:args("sample_main_edition", "sample_edition", "82a") (: checks if the correct file has been opened :) %test:assertXPath("$result//*[local-name(.) = 'title'] = 'The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, king of Assyria and Nineveh' ") @@ -52,10 +52,10 @@ declare %test:assertXPath("$result//*[local-name(.) = 'langAlt'] = 'karshuni' ") %test:assertXPath("$result//*[local-name(.) = 'x-langString'][matches(., 'Classical Syriac')]") (: checks if underlying pages are identified :) - %test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/ahiqar_sample-82a.html' ") + %test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/sample_teixml-82a.html' ") (: checks if images connected to underlying pages are identified :) %test:assertXPath("$result//*[local-name(.) = 'id'] = 'http://0.0.0.0:8080/exist/restxq/api/images/3r1nz' ") - %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/ahiqar_agg/82a/annotationCollection.json' ") + %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/sample_main_edition/sample_edition/82a/annotationCollection.json' ") function titemt:get-json($collection as xs:string, $document as xs:string, $page as xs:string) @@ -65,9 +65,9 @@ as element(object){ declare - %test:args("ahiqar_agg") %test:assertXPath("count($result) = 5") - %test:args("ahiqar_agg") %test:assertXPath("$result[local-name(.) = ('lang', 'langAlt')]") - %test:args("ahiqar_agg") %test:assertXPath("count($result[local-name(.) = 'lang']) = 2") + %test:args("sample_edition") %test:assertXPath("count($result) = 5") + %test:args("sample_edition") %test:assertXPath("$result[local-name(.) = ('lang', 'langAlt')]") + %test:args("sample_edition") %test:assertXPath("count($result[local-name(.) = 'lang']) = 2") function titemt:make-language-elements($manifest-uri as xs:string) as element()+ { tapi-item:make-language-elements($manifest-uri) diff --git a/exist-app/tests/tapi-manifest-tests.xqm b/exist-app/tests/tapi-manifest-tests.xqm index a10304c..2811fdf 100644 --- a/exist-app/tests/tapi-manifest-tests.xqm +++ b/exist-app/tests/tapi-manifest-tests.xqm @@ -129,44 +129,44 @@ function tmt:_test-teardown() { }; declare - %test:args("ahiqar_agg") %test:assertXPath("$result//* = 'textgrid:ahiqar_agg.0'") + %test:args("sample_edition") %test:assertXPath("$result//* = 'textgrid:sample_edition.0'") function tmt:get-metadata-file($manifest-uri) { tapi-mani:get-metadata-file($manifest-uri) }; declare - %test:args("ahiqar_collection", "ahiqar_agg") %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/ahiqar_collection/ahiqar_agg-82a/latest/item.json')]") + %test:args("sample_main_edition", "sample_edition") %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/sample_main_edition/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) }; declare - %test:args("ahiqar_agg") %test:assertXPath("count($result) = 4") + %test:args("sample_edition") %test:assertXPath("count($result) = 4") function tmt:get-valid-page-ids($manifest-uri as xs:string) { tapi-mani:get-valid-page-ids($manifest-uri) }; declare - %test:args("ahiqar_collection", "ahiqar_agg") + %test:args("sample_main_edition", "sample_edition") %test:assertXPath("$result//label = 'Beispieldatei zum Testen'") - %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json')]") - %test:assertXPath("$result//annotationCollection[matches(., '/api/annotations/ahikar/ahiqar_collection/ahiqar_agg-82a/annotationCollection.json')] ") + %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/sample_main_edition/sample_edition/manifest.json')]") + %test:assertXPath("$result//annotationCollection[matches(., '/api/annotations/ahikar/sample_main_edition/sample_edition-82a/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) }; declare - %test:args("ahiqar_agg") %test:assertEquals("Beispieldatei zum Testen") + %test:args("sample_edition") %test:assertEquals("Beispieldatei zum Testen") function tmt:get-manifest-title($manifest-uri as xs:string) { tapi-mani:get-manifest-title($manifest-uri) }; declare - %test:args("ahiqar_agg") %test:assertXPath("count($result) = 2") - %test:args("ahiqar_agg") %test:assertXPath("$result//name = 'Simon Birol'") + %test:args("sample_edition") %test:assertXPath("count($result) = 2") + %test:args("sample_edition") %test:assertXPath("$result//name = 'Simon Birol'") %test:args("test-manifest1") %test:assertXPath("count($result) = 1") %test:args("test-manifest1") %test:assertXPath("$result//name = 'none'") function tmt:make-editors($manifest-uri as xs:string) { @@ -174,14 +174,14 @@ function tmt:make-editors($manifest-uri as xs:string) { }; declare - %test:args("ahiqar_agg") %test:assertXPath("$result/string() = '18.10.1697'") + %test:args("sample_edition") %test:assertXPath("$result/string() = '18.10.1697'") %test:args("test-manifest1") %test:assertXPath("$result/string() = 'unknown'") function tmt:make-creation-date($manifest-uri as xs:string) { tapi-mani:make-creation-date($manifest-uri) }; declare - %test:args("ahiqar_agg") %test:assertXPath("$result/string() = 'Alqosh, Iraq'") + %test:args("sample_edition") %test:assertXPath("$result/string() = 'Alqosh, Iraq'") %test:args("test-manifest1") %test:assertXPath("$result/string() = 'unknown'") %test:args("test-manifest2") %test:assertXPath("$result/string() = 'Iraq'") %test:args("test-manifest3") %test:assertXPath("$result/string() = 'Alqosh'") @@ -190,7 +190,7 @@ function tmt:make-origin($manifest-uri as xs:string) { }; declare - %test:args("ahiqar_agg") %test:assertXPath("$result/string() = 'University of Cambridge - Cambridge University Library, Great Britain'") + %test:args("sample_edition") %test:assertXPath("$result/string() = 'University of Cambridge - Cambridge University Library, Great Britain'") %test:args("test-manifest1") %test:assertXPath("$result/string() = 'unknown'") %test:args("test-manifest2") %test:assertXPath("$result/string() = 'University of Cambridge - Cambridge University Library'") %test:args("test-manifest3") %test:assertXPath("$result/string() = 'Great Britain'") @@ -199,7 +199,7 @@ function tmt:make-current-location($manifest-uri as xs:string) { }; declare - %test:args("ahiqar_collection", "ahiqar_agg") %test:assertExists + %test:args("sample_main_edition", "sample_edition") %test:assertExists function tmt:get-json($collection-uri as xs:string, $manifest-uri as xs:string) { tapi-mani:get-json($collection-uri, $manifest-uri, $tc:server) diff --git a/exist-app/tests/tapi-tests.xqm b/exist-app/tests/tapi-tests.xqm index 5916370..5939dca 100644 --- a/exist-app/tests/tapi-tests.xqm +++ b/exist-app/tests/tapi-tests.xqm @@ -86,7 +86,7 @@ declare %test:assertTrue function tt:is-html-api-available() as xs:boolean { - let $url := $tc:server || "/content/ahiqar_sample-82a.html" + let $url := $tc:server || "/content/sample_teixml-82a.html" return tc:is-endpoint-http200($url) }; @@ -97,7 +97,7 @@ declare : the underlying function. :) %test:assertXPath("$result//*[@class = 'tei_body']") function tt:content-rest() as document-node() { - let $url := $tc:server || "/content/ahiqar_sample-82a.html" + let $url := $tc:server || "/content/sample_teixml-82a.html" let $req := tc:make-request($url) return http:send-request($req)[2] }; @@ -124,7 +124,7 @@ declare : the underlying function. :) %test:assertXPath("matches($result, '[\w]')") function tt:content-txt() as xs:string { - let $url := $tc:server || "/textapi/ahikar/ahiqar_collection/ahiqar_sample.txt" + let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_teixml.txt" let $req := @@ -135,13 +135,13 @@ function tt:content-txt() as xs:string { declare %test:assertTrue function tt:is-txt-api-available() { - let $url := $tc:server || "/content/ahiqar_sample.txt" + let $url := $tc:server || "/content/sample_teixml.txt" return tc:is-endpoint-http200($url) }; declare function tt:txt() { - let $url := $tc:server || "textapi/ahiqar/ahiqar_collection/ahiqar_sample.txt" + let $url := $tc:server || "textapi/ahiqar/sample_main_edition/sample_teixml.txt" let $req := tc:make-request($url) return http:send-request($req)[2] => util:base64-decode() }; @@ -158,7 +158,7 @@ function tt:remove-whitespaces() as document-node() { declare %test:assertTrue function tt:is-collection-endpoint-http200() { - let $url := $tc:server || "/textapi/ahikar/ahiqar_collection/collection.json" + let $url := $tc:server || "/textapi/ahikar/sample_main_edition/collection.json" return tc:is-endpoint-http200($url) }; @@ -174,7 +174,7 @@ declare %test:assertXPath("map:contains($result, 'sequence')") function tt:endpoint-collection() as item() { - let $url := $tc:server || "/textapi/ahikar/ahiqar_collection/collection.json" + let $url := $tc:server || "/textapi/ahikar/sample_main_edition/collection.json" let $req := @@ -184,7 +184,7 @@ as item() { declare %test:assertTrue function tt:is-manifest-endpoint-http200() { - let $url := $tc:server || "/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json" + let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition/manifest.json" return tc:is-endpoint-http200($url) }; @@ -205,7 +205,7 @@ declare %test:assertXPath("map:contains($result, 'sequence')") function tt:endpoint-manifest() as item() { - let $url := $tc:server || "/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json" + let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition/manifest.json" let $req := tc:make-request($url) return http:send-request($req)[2] @@ -216,7 +216,7 @@ as item() { declare %test:assertTrue function tt:is-item-endpoint-http200() { - let $url := $tc:server || "/textapi/ahikar/ahiqar_collection/ahiqar_agg-82a/latest/item.json" + let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition-82a/latest/item.json" return tc:is-endpoint-http200($url) }; @@ -235,7 +235,7 @@ declare %test:assertXPath("map:contains($result, 'langAlt')") %test:assertXPath("map:contains($result, 'image')") function tt:endpoint-item() as item() { - let $url := $tc:server || "/textapi/ahikar/ahiqar_collection/ahiqar_agg-82a/latest/item.json" + let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition-82a/latest/item.json" let $req := tc:make-request($url) return http:send-request($req)[2] => util:base64-decode() diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index 4700e67..43e3a98 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -7,7 +7,7 @@ declare namespace tei="http://www.tei-c.org/ns/1.0"; import module namespace tapi-txt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt" at "../modules/tapi-txt.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -declare variable $ttt:sample-file := local:open-file("ahiqar_sample"); +declare variable $ttt:sample-file := local:open-file("sample_teixml"); declare variable $ttt:sample-transliteration := $ttt:sample-file//tei:text[@type = "transliteration"]; declare variable $ttt:sample-transcription := $ttt:sample-file//tei:text[@type = "transcription"]; @@ -20,7 +20,7 @@ as xs:string+ { declare - %test:args("ahiqar_sample") %test:assertExists + %test:args("sample_teixml") %test:assertExists %test:args("1234") %test:assertError("org.exist.xquery.XPathException") function ttt:open-file($uri as xs:string) as document-node() { local:open-file($uri) @@ -250,7 +250,7 @@ as xs:string { }; declare - %test:assertEquals("/db/apps/sade/textgrid/data/ahiqar_sample.xml") + %test:assertEquals("/db/apps/sade/textgrid/data/sample_teixml.xml") function ttt:get-base-uri() as xs:string { tapi-txt:get-base-uri($ttt:sample-transcription) @@ -264,21 +264,21 @@ as xs:string { }; declare - %test:assertEquals("karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription.txt") + %test:assertEquals("karshuni-Beispieldatei_zum_Testen-sample_teixml-transcription.txt") function ttt:make-file-name() as xs:string { tapi-txt:make-file-name($ttt:sample-transcription) }; declare - %test:assertEquals("ahiqar_sample-transcription.txt") + %test:assertEquals("sample_teixml-transcription.txt") function ttt:make-file-name-suffix() as xs:string { tapi-txt:make-file-name-suffix($ttt:sample-transcription) }; declare - %test:args("/db/apps/sade/textgrid/data/ahiqar_sample.xml") %test:assertEquals("ahiqar_sample") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml") %test:assertEquals("sample_teixml") function ttt:get-file-name($base-uri as xs:string) as xs:string { tapi-txt:get-file-name($base-uri) @@ -433,7 +433,7 @@ as document-node() { declare - %test:args("ahiqar_sample", "transcription") + %test:args("sample_teixml", "transcription") %test:assertXPath("$result[local-name(.) = 'text' and @type = 'transcription']") function ttt:get-tei($document-uri as xs:string, $type as xs:string) @@ -442,8 +442,8 @@ as element() { }; declare - %test:args("ahiqar_sample") %test:assertEquals("text/xml") - %test:args("ahiqar_agg") %test:assertEquals("text/tg.edition+tg.aggregation+xml") + %test:args("sample_teixml") %test:assertEquals("text/xml") + %test:args("sample_edition") %test:assertEquals("text/tg.edition+tg.aggregation+xml") function ttt:tgmd-format($uri as xs:string) as xs:string { tapi-txt:get-format($uri) @@ -451,7 +451,7 @@ as xs:string { declare - %test:args("ahiqar_sample", "transcription") + %test:args("sample_teixml", "transcription") %test:assertXPath("$result[local-name(.) = 'text' and @type = 'transcription']") function ttt:get-tei($document as xs:string, $type as xs:string) as element() { tapi-txt:get-TEI-text($document, $type) @@ -459,28 +459,28 @@ function ttt:get-tei($document as xs:string, $type as xs:string) as element() { declare - %test:args("ahiqar_agg") %test:assertEquals("ahiqar_sample") + %test:args("sample_edition") %test:assertEquals("sample_teixml") function ttt:get-tei-xml-uri-from-edition($document as xs:string) { tapi-txt:get-tei-xml-uri-from-edition($document) }; declare - %test:args("ahiqar_sample") %test:assertEquals("ahiqar_sample") + %test:args("sample_teixml") %test:assertEquals("sample_teixml") function ttt:get-tei-xml-from-aggregates($aggregates as xs:string+) { tapi-txt:get-tei-xml-from-aggregates($aggregates) }; declare - %test:args("ahiqar_sample", "transliteration") %test:assertXPath("$result[@type = 'transliteration']") + %test:args("sample_teixml", "transliteration") %test:assertXPath("$result[@type = 'transliteration']") function ttt:get-text-of-type($uri as xs:string, $type as xs:string) { tapi-txt:get-text-of-type($uri, $type) }; declare - %test:args("ahiqar_sample") %test:assertTrue - %test:args("ahiqar_agg") %test:assertFalse + %test:args("sample_teixml") %test:assertTrue + %test:args("sample_edition") %test:assertFalse function ttt:is-document-tei-xml($document-uri as xs:string) as xs:boolean { tapi-txt:is-document-tei-xml($document-uri) -- GitLab From a6d64f5bbd2ee10bc7e18be40ab6d62cd73527ad Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 08:02:06 +0100 Subject: [PATCH 065/155] tests: let $anno:uris depend on database state --- exist-app/modules/annotations.xqm | 69 +++++++++++++------------------ 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 7672547..7e0d812 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -45,47 +45,34 @@ declare variable $anno:annotationElements := (: this variable holds a map with the complete project structure (excluding images) :) declare variable $anno:uris := - if (doc-available($commons:agg || "3r132.xml")) then - let $main-edition-object := "3r132" - let $language-aggs := commons:get-available-aggregates($main-edition-object) - return - map { $main-edition-object: - (: level 1: language aggregations :) - map:merge(for $lang in $language-aggs return - map:entry($lang, - (: level 2 (key): editions associated to a language aggregation :) - map:merge( - let $editions := commons:get-available-aggregates($lang) - for $uri in $editions return - (: level 2 (value): XML associated with edition :) - let $edition-parts := commons:get-available-aggregates($uri) - for $part in $edition-parts - return - if (anno:is-resource-xml($part)) then - map:entry($uri, $part) - else - () - ) - )) - } - else - let $main-edition-object := "sample_main_edition" - let $editions := commons:get-available-aggregates($main-edition-object) - return - map { $main-edition-object: - map:merge( - for $uri in $editions return - (: level 2 (value): XML associated with edition :) - let $edition-parts := commons:get-available-aggregates($uri) - for $part in $edition-parts - return - if (anno:is-resource-xml($part)) then - map:entry($uri, $part) - else - () - ) - } - ; + let $main-edition-object := + if (doc-available($commons:agg || "3r132.xml")) then + "3r132" + else + "sample_main_edition" + + let $language-aggs := commons:get-available-aggregates($main-edition-object) + return + map { $main-edition-object: + (: level 1: language aggregations :) + map:merge(for $lang in $language-aggs return + map:entry($lang, + (: level 2 (key): editions associated to a language aggregation :) + map:merge( + let $editions := commons:get-available-aggregates($lang) + for $uri in $editions return + (: level 2 (value): XML associated with edition :) + let $edition-parts := commons:get-available-aggregates($uri) + for $part in $edition-parts + return + if (anno:is-resource-xml($part)) then + map:entry($uri, $part) + else + () + ) + )) + } +; (:~ : Returns annotation information about a single collection. Although this works for all collections, -- GitLab From 705212607bd8160bb5826b9f949b899e6b5f6efe Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 08:12:35 +0100 Subject: [PATCH 066/155] refactor: remove unused modules --- exist-app/modules/annotations.xqm | 2 -- 1 file changed, 2 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 7e0d812..3c5fa5c 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -19,11 +19,9 @@ declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; -import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milestone-chunk.xquery" at "fragment.xqm"; import module namespace functx = "http://www.functx.com"; import module namespace requestr="http://exquery.org/ns/request"; import module namespace rest="http://exquery.org/ns/restxq"; -import module namespace tapi="http://ahikar.sub.uni-goettingen.de/ns/tapi" at "tapi.xqm"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; -- GitLab From e7d435575d9ec2004feb8280bc87bcae69dd8c2b Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 08:13:26 +0100 Subject: [PATCH 067/155] tests: make output human and machine readable Closes #61 --- exist-app/modules/testtrigger.xqm | 112 +++++++++++++----------------- 1 file changed, 49 insertions(+), 63 deletions(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 2609b0f..997d4ed 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -1,70 +1,56 @@ xquery version "3.1"; - (:~ - : Providing an API endpoint for triggering test execution. - : This endpoint has been established instead of the text execution in post-install.xq - : since at this point the RESTXQ API isn't fired up yet which causes the tests to throw errors. - : - : @author Michelle Weidling - : @since 0.4.0 + : Script providing access to the test functions (XQSuite) for local unit test + : execution. + : Elevated rights (dba/admin) are required for some tests. :) -module namespace testtrigger="http://ahikar.sub.uni-goettingen.de/ns/testtrigger"; - -import module namespace rest="http://exquery.org/ns/restxq"; +import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "tapi-txt-tests.xqm"; +import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "commons-tests.xqm"; +import module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" at "tapi-collection-tests.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; - -import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm"; -import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; -import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; -import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "../tests/tapi-txt-tests.xqm"; -import module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" at "../tests/tapi-collection-tests.xqm"; -import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" at "../tests/tapi-html-tests.xqm"; -import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "../tests/tapi-item-tests.xqm"; -import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "../tests/tapi-manifest-tests.xqm"; -import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "../tests/tapi-tests.xqm"; +import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" at "tapi-html-tests.xqm"; +import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "tapi-item-tests.xqm"; +import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "tapi-manifest-tests.xqm"; +import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; +import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; +import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; import module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" at "../tests/annotation-tests.xqm"; -(:~ - : Triggers the tests for the Ahikar backend. Called by the CI. - : - : @param $token A CI token - : @return item() A log message to std out. In the Docker environment, this goes to exist.log. - : @error The deploy token provided is incorrect - :) -declare - %rest:GET - %rest:HEAD - %rest:path("/trigger-tests") - %rest:query-param("token", "{$token}") -function testtrigger:trigger($token) -as item()? { - if( $token ne environment-variable("APP_DEPLOY_TOKEN" )) - then error(QName("error://1", "deploy"), "Deploy token incorrect.") - else - let $sysout := util:log-system-out("TextAPI and package installation done. running tests…") - let $tests := - ( - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) - ) - - let $fileSeparator := util:system-property("file.separator") - let $system-path := system:get-exist-home() || $fileSeparator - - let $testWrap := { $tests } - - let $filename := $system-path || "ahikar-test-results.xml" - let $file := file:serialize($testWrap, $filename, ()) - - return - util:log-system-out("Tests complete. See " || $filename) -}; \ No newline at end of file +declare function local:get-human-readable-pkg-name($package as xs:string) +as xs:string? { + switch ($package) + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" return "TextAPI general" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" return "TXT creation" + case "http://ahikar.sub.uni-goettingen.de/ns/commons-tests" return "Commons" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" return "TextAPI Collections" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" return "TextAPI Manifests" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" return "TextAPI Items" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" return "HTML creation" + case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" return "TEI2HTML transformation" + case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" return "TEI2HTML text processing" + case "http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" return "AnnotationAPI" + default return () +}; + +let $test-results := + ( + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) + ) + +for $result in $test-results +order by $result//@package return + if ($result//@failures = 0 + and $result//@errors = 0) then + + else + $result \ No newline at end of file -- GitLab From 1601d17776a75e6387838f7554e6ab00810c807d Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 08:52:31 +0100 Subject: [PATCH 068/155] tests: only get relevant output (cf. #61) --- exist-app/modules/testtrigger.xqm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 997d4ed..9c2ab16 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -53,4 +53,10 @@ order by $result//@package return and $result//@errors = 0) then else - $result \ No newline at end of file + + {$result//testcase[child::*[self::failure or self::error]]} + + \ No newline at end of file -- GitLab From a52b914607dbb575cedf3ac4b4756c63c06940d0 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 09:46:16 +0100 Subject: [PATCH 069/155] tests: add more tests --- exist-app/modules/annotations.xqm | 74 ++++++++++++------ exist-app/tests/annotation-tests.xqm | 107 ++++++++++++++++++++++++--- 2 files changed, 147 insertions(+), 34 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 3c5fa5c..ed874c5 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -24,6 +24,8 @@ import module namespace requestr="http://exquery.org/ns/request"; import module namespace rest="http://exquery.org/ns/restxq"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; +import module namespace console="http://exist-db.org/xquery/console"; + declare variable $anno:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations"; declare variable $anno:server := @@ -179,7 +181,11 @@ as xs:string { : @param $first-entry The IRI of the first Annotation Page that is included within the Collection : @param $last-entry The IRI of the last Annotation Page that is included within the Collection :) -declare function anno:make-annotationCollection-map($uri as xs:string, $title as xs:string, $first-entry as xs:string, $last-entry as xs:string) { +declare function anno:make-annotationCollection-map($uri as xs:string, + $title as xs:string, + $first-entry as xs:string, + $last-entry as xs:string) +as map() { map { "annotationCollection": map { @@ -204,11 +210,12 @@ declare function anno:make-annotationCollection-map($uri as xs:string, $title as : @return A string containing the creators of the annotations as stated in the : TEI header of the (underlying) resource(s). :) -declare function anno:get-creator($uri as xs:string) as xs:string { +declare function anno:get-creator($uri as xs:string) +as xs:string { let $xmls := if (anno:is-resource-xml($uri)) then $uri - else if(anno:is-resource-edition($uri)) then + else if(anno:is-resource-edition($anno:uris, $uri)) then anno:find-in-map($anno:uris, $uri) else let $map := anno:find-in-map($anno:uris, $uri) @@ -261,12 +268,14 @@ $document as xs:string) { : @return A map with all information necessary for the Annotation Collection :) declare function anno:make-annotationPage($collection as xs:string, -$document as xs:string, $server as xs:string) { + $document as xs:string, + $server as xs:string) +as map() { let $nextPage := anno:get-prev-or-next-annotationPage-ID($collection, $document, "next") let $prevPage := anno:get-prev-or-next-annotationPage-ID($collection, $document, "prev") let $xmls := - if(anno:is-resource-edition($document)) then + if(anno:is-resource-edition($anno:uris, $document)) then anno:find-in-map($anno:uris, $document) else anno:find-in-map($anno:uris, $document) => anno:get-all-xml-uris-for-submap() @@ -372,6 +381,7 @@ $document as xs:string, $page as xs:string) { : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server :) +(: ## tested ## :) declare function anno:make-annotationCollection-for-manifest($collection as xs:string, $document as xs:string, $page as xs:string, @@ -488,7 +498,9 @@ $document as xs:string, $page as xs:string, $server as xs:string) { : @param $documentURI The XML's URI. Attention: This refers directly to the XML file, NOT the superordinate edition! : @param $page The page within an XML file, i.e. a tei:pb/@n within a TEI resource :) -declare function anno:get-annotations($documentURI as xs:string, $page as xs:string) { +declare function anno:get-annotations($documentURI as xs:string, + $page as xs:string) +as map() { let $pageChunk := anno:get-page-fragment($documentURI, $page) let $annotation-elements := @@ -514,7 +526,10 @@ declare function anno:get-annotations($documentURI as xs:string, $page as xs:str : @param $documentURI The resource's URI. Attention: This refers to the TEI file itself! : @param $page The page to be returned as tei:pb/@n/string() :) -declare function anno:get-page-fragment($documentURI as xs:string, $page as xs:string) { +(: ## tested ## :) +declare function anno:get-page-fragment($documentURI as xs:string, + $page as xs:string) +as element(tei:TEI) { let $nodeURI := commons:get-document($documentURI, "data")/base-uri() return tapi-html:get-page-fragment($nodeURI, $page) @@ -529,11 +544,13 @@ declare function anno:get-page-fragment($documentURI as xs:string, $page as xs:s : @param $uri The resource's URI : @return The number of annotations that are associated with the $uri :) -declare function anno:get-total-no-of-annotations($uri as xs:string) as xs:integer { +(: ## tested ## :) +declare function anno:get-total-no-of-annotations($uri as xs:string) +as xs:integer { let $map-entry-for-uri := anno:find-in-map($anno:uris, $uri) let $xmls := - if (anno:is-resource-edition($uri)) then + if (anno:is-resource-edition($anno:uris, $uri)) then $map-entry-for-uri else anno:get-all-xml-uris-for-submap($map-entry-for-uri) @@ -557,16 +574,20 @@ declare function anno:get-total-no-of-annotations($uri as xs:string) as xs:integ : @param $map A part of the $anno:uris map : @return All values of the lowest $map level :) -declare function anno:get-all-xml-uris-for-submap($map as map()) { +(: ## tested ## :) +declare function anno:get-all-xml-uris-for-submap($map as map()) +as xs:string* { let $get-values := function($key, $value){$value} for $value in map:for-each($map, $get-values) return if ($value instance of map()) then anno:get-all-xml-uris-for-submap($value) - else if ($value = "3rrnp") then - () - else + (: this condition ensures that TEI/XMLs that have been deleted or aren't + available for some other reason are not considered :) + else if(doc-available($commons:data || $value || ".xml")) then $value + else + () }; @@ -657,7 +678,10 @@ declare function anno:get-404-header($resources as xs:string+) { : @param $key The key whose value is to be returned : @return The value of the given $key :) -declare function anno:find-in-map($map as map(), $key as xs:string) as item()? { +(: ## tested ## :) +declare function anno:find-in-map($map as map(), + $key as xs:string) +as item()? { let $get-values := function($key, $value){$value} return if (map:keys($map) = $key) then @@ -712,9 +736,12 @@ $document as xs:string, $type as xs:string) { default return () }; - +(: ## tested ## :) declare function anno:get-prev-or-next-annotationPage-url($collection as xs:string, -$document as xs:string?, $page as xs:string?, $server as xs:string) { + $document as xs:string?, + $page as xs:string?, + $server as xs:string) +as xs:string? { let $pageSuffix := if ($page) then "/" || $page @@ -746,8 +773,11 @@ declare function anno:is-resource-xml($uri as xs:string) as xs:boolean { : @param $uri The resource's URI : @return true() if resources stated by $uri is an edition object :) -declare function anno:is-resource-edition($uri as xs:string) as xs:boolean { - not(anno:find-in-map($anno:uris, $uri) instance of map()) +(: ## tested ää :) +declare function anno:is-resource-edition($map as map(), + $uri as xs:string) +as xs:boolean { + not(anno:find-in-map($map, $uri) instance of map()) }; (:~ @@ -766,15 +796,15 @@ declare function anno:get-pages-in-TEI($documentURI as xs:string) as xs:string+ : Returns the previous or next @n of a tei:pb seen from a given tei:pb which is : denoted in $page. : - : @param $documentURI The current resource's URI + : @param $manifest-uri The current manifest's URI : @param $page The @n attribute of the current page break/tei:pb : @param $type "prev" for the previous, "next" for the next page break :) -declare function anno:get-prev-or-next-page($documentURI as xs:string, +declare function anno:get-prev-or-next-page($manifest-uri as xs:string, $page as xs:string, $type as xs:string) as xs:string? { - let $tei := anno:find-in-map($anno:uris, $documentURI) + let $tei := anno:find-in-map($anno:uris, $manifest-uri) let $pages := anno:get-pages-in-TEI($tei) let $no-of-pages := count($pages) let $current-position := index-of($pages, $page) @@ -817,7 +847,7 @@ as xs:string* { let $edition := anno:get-parent-aggregation($uri) return anno:get-prev-xml-uris($edition) - else if(anno:is-resource-edition($uri)) then + else if(anno:is-resource-edition($anno-uris, $uri)) then anno:get-prev-xml-uris($uri) else () diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 5f873ee..ee17dc4 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -21,15 +21,6 @@ as xs:boolean { anno:is-resource-xml($uri) }; -declare - %test:args("sample_teixml") %test:assertFalse - %test:args("sample_edition") %test:assertTrue - %test:pending -function at:is-resource-edition($uri as xs:string) -as xs:boolean { - anno:is-resource-edition($uri) -}; - declare %test:args("sample_teixml") %test:assertXPath("count($result) = 4") %test:args("sample_teixml") %test:assertXPath("$result = '82a'") @@ -118,10 +109,9 @@ as map() { }; declare - %test:args("sample_main_edition", "sample_edition", "82a", "http://localhost:8080") + %test:args("sample_lang_aggregation", "sample_edition", "82a", "http://localhost:8080") %test:assertXPath("map:get($result, 'annotationCollection') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/sample_edition/82a'") - %test:assertXPath("map:get($result, 'annotationCollection') => map:get('label') = 'Ahikar annotations for textgrid:sample_edition: Beispieldatei zum Testen, page 82a'") - %test:pending + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('type') = 'AnnotationCollection'") function at:make-annotationCollection-for-manifest($collection as xs:string, $document as xs:string, $page as xs:string, @@ -130,6 +120,99 @@ as map() { anno:make-annotationCollection-for-manifest($collection, $document, $page, $server) }; +declare + %test:args("sample_teixml", "82a") %test:assertXPath("$result//* = 'حقًا'") +function at:get-page-fragment($documentURI as xs:string, + $page as xs:string) +as element(tei:TEI) { + anno:get-page-fragment($documentURI, $page) +}; + +declare + %test:args("sample_main_edition") %test:assertEquals("65") + %test:args("sample_lang_aggregation") %test:assertEquals("65") +function at:get-total-no-of-annotations($uri as xs:string) { + anno:get-total-no-of-annotations($uri) +}; + +declare + %test:assertEquals("sample_teixml") +function at:get-all-xml-uris-for-submap() +as xs:string* { + let $map := + map { + "sample_lang_aggregation": + map { + "sample_edition": "sample_teixml", + "faux_edition": "faux_teixml" + } + } + return + anno:get-all-xml-uris-for-submap($map) +}; + + +declare + %test:args("sample_edition") %test:assertEquals("sample_teixml") +function at:find-in-map($key as xs:string) +as item()? { + let $map := + map { + "sample_lang_aggregation": + map { + "sample_edition": "sample_teixml", + "faux_edition": "faux_teixml" + } + } + + return + anno:find-in-map($map, $key) +}; + + +declare + %test:args("sample_edition", "11") + %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/11/annotationPage.json") + %test:args("sample_edition", "") + %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json") + %test:args("", "") + %test:assertEmpty +function at:get-prev-or-next-annotationPage-url($document as xs:string?, + $page as xs:string?) +as xs:string? { + let $collection := "sample_lang_aggregation" + let $server := "http://localhost:8080" + return + anno:get-prev-or-next-annotationPage-url($collection, $document, $page, $server) +}; + +declare + %test:args("sample_edition") %test:assertTrue + %test:args("sample_lang_aggregation") %test:assertFalse +function at:is-resource-edition($uri as xs:string) { + let $map := + map { + "sample_lang_aggregation": + map { + "sample_edition": "sample_teixml", + "faux_edition": "faux_teixml" + } + } + return + anno:is-resource-edition($map, $uri) +}; + +declare + %test:args("sample_edition", "82a", "next") %test:assertEquals("82b") + %test:args("sample_edition", "82a", "prev") %test:assertEmpty + %test:args("sample_edition", "82b", "prev") %test:assertEquals("82a") +function at:get-prev-or-next-page($manifest-uri as xs:string, + $page as xs:string, + $type as xs:string) +as xs:string? { + anno:get-prev-or-next-page($manifest-uri, $page, $type) +}; + (:declare:) (: %test:args("3r679", "114r"):) (: %test:assertEquals("0"):) -- GitLab From 2e1bf6a10374459d12f7cf32f263c33c857de106 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 09:52:53 +0100 Subject: [PATCH 070/155] refactor: replace switch --- exist-app/modules/annotations.xqm | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index ed874c5..eab2732 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -800,6 +800,7 @@ declare function anno:get-pages-in-TEI($documentURI as xs:string) as xs:string+ : @param $page The @n attribute of the current page break/tei:pb : @param $type "prev" for the previous, "next" for the next page break :) +(: ## tested ## :) declare function anno:get-prev-or-next-page($manifest-uri as xs:string, $page as xs:string, $type as xs:string) @@ -814,19 +815,14 @@ as xs:string? { else $current-position - 1 return - switch ($type) - case "prev" return - if ($new-position le $no-of-pages - and $new-position != 0) then - $pages[$new-position] - else - () - case "next" return - if ($new-position le $no-of-pages) then - $pages[$new-position] - else - () - default return () + if ($new-position le $no-of-pages + and ($type = "prev" + and $new-position != 0 + or + $type = "next")) then + $pages[$new-position] + else + () }; -- GitLab From a4867f0a4128f5e690b5fb715d23121c54c2121d Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 10:05:04 +0100 Subject: [PATCH 071/155] chore: update changelog --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0e576d..78d1d67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2.0.1] - 2020-1-12 +## [2.2.1] - 2020-11-16 ## Changed - When extracting the relevant plain text sections, the semantic divisions of the texts are now considered. Each semantic division, which is indicated in the texts by a tei:milestone, is now stored in a separate file. +## [2.1.0] - 2020-11-12 + +### Changed + +- prepared for changed endpoints at Text-API (document-page to document/page) + +### Fixed + +- wrong Annotation IDs + ## [2.0.0] - 2020-11-06 ### Changed -- GitLab From 81c1d72a548b385ec93e18dd39c4b6a07e003989 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 10:14:21 +0100 Subject: [PATCH 072/155] chore: remove console module --- exist-app/modules/annotations.xqm | 2 -- 1 file changed, 2 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index eab2732..c768eae 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -24,8 +24,6 @@ import module namespace requestr="http://exquery.org/ns/request"; import module namespace rest="http://exquery.org/ns/restxq"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; -import module namespace console="http://exist-db.org/xquery/console"; - declare variable $anno:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations"; declare variable $anno:server := -- GitLab From 8b08400170de0d1ca739aa356940bdf02162b938 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 10:18:59 +0100 Subject: [PATCH 073/155] chore: update changelog --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6cebb4..63c8a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.3.0] - 2020-11-16 + +### Changed + +- Some parts of `annotation.xqm` have been refactored to improve the code and/or make it testable. +- `test-runner.xq` now produces machine-readable output and only displays the tests that fail. + +### Added + +- Tests for the AnnotationAPI. + ## [2.1.0] - 2020-11-12 ### Changed @@ -15,7 +26,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - wrong Annotation IDs - ## [2.0.0] - 2020-11-06 ### Changed -- GitLab From 0f0d490c9d849e367577c1eee8d69257513de1c4 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 10:23:51 +0100 Subject: [PATCH 074/155] test: restore old state of test trigger --- exist-app/modules/testtrigger.xqm | 116 ++++++++++++++++-------------- exist-app/tests/tests-runner.xq | 28 +++++++- 2 files changed, 87 insertions(+), 57 deletions(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 9c2ab16..671da1f 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -1,62 +1,70 @@ xquery version "3.1"; + (:~ - : Script providing access to the test functions (XQSuite) for local unit test - : execution. - : Elevated rights (dba/admin) are required for some tests. + : Providing an API endpoint for triggering test execution. + : This endpoint has been established instead of the text execution in post-install.xq + : since at this point the RESTXQ API isn't fired up yet which causes the tests to throw errors. + : + : @author Michelle Weidling + : @since 0.4.0 :) -import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "tapi-txt-tests.xqm"; -import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "commons-tests.xqm"; -import module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" at "tapi-collection-tests.xqm"; +module namespace testtrigger="http://ahikar.sub.uni-goettingen.de/ns/testtrigger"; + +import module namespace rest="http://exquery.org/ns/restxq"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" at "tapi-html-tests.xqm"; -import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "tapi-item-tests.xqm"; -import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "tapi-manifest-tests.xqm"; -import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; -import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; -import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; + +import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm"; +import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; +import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; +import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "../tests/tapi-txt-tests.xqm"; +import module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" at "../tests/tapi-collection-tests.xqm"; +import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" at "../tests/tapi-html-tests.xqm"; +import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "../tests/tapi-item-tests.xqm"; +import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "../tests/tapi-manifest-tests.xqm"; +import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "../tests/tapi-tests.xqm"; import module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" at "../tests/annotation-tests.xqm"; -declare function local:get-human-readable-pkg-name($package as xs:string) -as xs:string? { - switch ($package) - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" return "TextAPI general" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" return "TXT creation" - case "http://ahikar.sub.uni-goettingen.de/ns/commons-tests" return "Commons" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" return "TextAPI Collections" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" return "TextAPI Manifests" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" return "TextAPI Items" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" return "HTML creation" - case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" return "TEI2HTML transformation" - case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" return "TEI2HTML text processing" - case "http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" return "AnnotationAPI" - default return () +(:~ + : Triggers the tests for the Ahikar backend. Called by the CI. + : + : @param $token A CI token + : @return item() A log message to std out. In the Docker environment, this goes to exist.log. + : @error The deploy token provided is incorrect + :) +declare + %rest:GET + %rest:HEAD + %rest:path("/trigger-tests") + %rest:query-param("token", "{$token}") +function testtrigger:trigger($token) +as item()? { + if( $token ne environment-variable("APP_DEPLOY_TOKEN" )) + then error(QName("error://1", "deploy"), "Deploy token incorrect.") + else + let $sysout := util:log-system-out("TextAPI and package installation done. running tests…") + let $tests := + ( + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) + ) + + let $fileSeparator := util:system-property("file.separator") + let $system-path := system:get-exist-home() || $fileSeparator + + let $testWrap := { $tests } + + let $filename := $system-path || "ahikar-test-results.xml" + let $file := file:serialize($testWrap, $filename, ()) + + return + util:log-system-out("Tests complete. See " || $filename) }; - -let $test-results := - ( - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) - ) - -for $result in $test-results -order by $result//@package return - if ($result//@failures = 0 - and $result//@errors = 0) then - - else - - {$result//testcase[child::*[self::failure or self::error]]} - - \ No newline at end of file diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index b608b0e..9c2ab16 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -17,6 +17,21 @@ import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-te import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; import module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" at "../tests/annotation-tests.xqm"; +declare function local:get-human-readable-pkg-name($package as xs:string) +as xs:string? { + switch ($package) + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" return "TextAPI general" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" return "TXT creation" + case "http://ahikar.sub.uni-goettingen.de/ns/commons-tests" return "Commons" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" return "TextAPI Collections" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" return "TextAPI Manifests" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" return "TextAPI Items" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" return "HTML creation" + case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" return "TEI2HTML transformation" + case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" return "TEI2HTML text processing" + case "http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" return "AnnotationAPI" + default return () +}; let $test-results := ( @@ -32,9 +47,16 @@ let $test-results := test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) ) -for $result in $test-results return +for $result in $test-results +order by $result//@package return if ($result//@failures = 0 and $result//@errors = 0) then - "Everything okay: " || $result//@package + else - $result \ No newline at end of file + + {$result//testcase[child::*[self::failure or self::error]]} + + \ No newline at end of file -- GitLab From 4dfd64fb71f1f55010123e384e492b86e5ca826b Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 10:31:23 +0100 Subject: [PATCH 075/155] tests: remove redundancies between API and local runner Cf. #62 --- exist-app/modules/testtrigger.xqm | 60 ++++++++++++++++++++++++------- exist-app/tests/tests-runner.xq | 56 ++--------------------------- 2 files changed, 49 insertions(+), 67 deletions(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 671da1f..e56797c 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -43,19 +43,7 @@ as item()? { then error(QName("error://1", "deploy"), "Deploy token incorrect.") else let $sysout := util:log-system-out("TextAPI and package installation done. running tests…") - let $tests := - ( - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) - ) + let $tests := testtrigger:execute-tests() let $fileSeparator := util:system-property("file.separator") let $system-path := system:get-exist-home() || $fileSeparator @@ -68,3 +56,49 @@ as item()? { return util:log-system-out("Tests complete. See " || $filename) }; + +declare function testtrigger:execute-tests() +as element()+ { + let $test-results := + ( + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) + ) + + for $result in $test-results + order by $result//@package return + if ($result//@failures = 0 + and $result//@errors = 0) then + + else + + {$result//testcase[child::*[self::failure or self::error]]} + +}; + +declare function local:get-human-readable-pkg-name($package as xs:string) +as xs:string? { + switch ($package) + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" return "TextAPI general" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" return "TXT creation" + case "http://ahikar.sub.uni-goettingen.de/ns/commons-tests" return "Commons" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" return "TextAPI Collections" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" return "TextAPI Manifests" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" return "TextAPI Items" + case "http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" return "HTML creation" + case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" return "TEI2HTML transformation" + case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" return "TEI2HTML text processing" + case "http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" return "AnnotationAPI" + default return () +}; diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index 9c2ab16..664f46f 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -5,58 +5,6 @@ xquery version "3.1"; : Elevated rights (dba/admin) are required for some tests. :) -import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "tapi-txt-tests.xqm"; -import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "commons-tests.xqm"; -import module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" at "tapi-collection-tests.xqm"; -import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" at "tapi-html-tests.xqm"; -import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "tapi-item-tests.xqm"; -import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "tapi-manifest-tests.xqm"; -import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; -import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; -import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; -import module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" at "../tests/annotation-tests.xqm"; +import module namespace testtrigger="http://ahikar.sub.uni-goettingen.de/ns/testtrigger" at "../modules/testtrigger.xqm"; -declare function local:get-human-readable-pkg-name($package as xs:string) -as xs:string? { - switch ($package) - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" return "TextAPI general" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" return "TXT creation" - case "http://ahikar.sub.uni-goettingen.de/ns/commons-tests" return "Commons" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" return "TextAPI Collections" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" return "TextAPI Manifests" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" return "TextAPI Items" - case "http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" return "HTML creation" - case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" return "TEI2HTML transformation" - case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" return "TEI2HTML text processing" - case "http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" return "AnnotationAPI" - default return () -}; - -let $test-results := - ( - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) - ) - -for $result in $test-results -order by $result//@package return - if ($result//@failures = 0 - and $result//@errors = 0) then - - else - - {$result//testcase[child::*[self::failure or self::error]]} - - \ No newline at end of file +testtrigger:execute-tests() \ No newline at end of file -- GitLab From 3aaffe0ad6df1dafe22ac422245d62b6e0b81030 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 11:34:40 +0100 Subject: [PATCH 076/155] tests: add more tests --- exist-app/data/sample_teixml.xml | 4 + exist-app/modules/annotations.xqm | 20 ++-- exist-app/tests/annotation-tests.xqm | 145 +++++++----------------- exist-app/tests/tapi-html-tests.xqm | 4 +- exist-app/tests/tapi-manifest-tests.xqm | 2 +- 5 files changed, 59 insertions(+), 116 deletions(-) diff --git a/exist-app/data/sample_teixml.xml b/exist-app/data/sample_teixml.xml index 83e35c3..44f9e2f 100644 --- a/exist-app/data/sample_teixml.xml +++ b/exist-app/data/sample_teixml.xml @@ -810,6 +810,10 @@ Ideas (or parts of ideas) that have bee marked with LC refer to the Leiden Conve ܘܗܦܟܬ ܛܥܢܬ ܐܰܒܵܪܐ ܘܠܐ ܐܝܼܩܰܪ ܥܠܝ ܐܝܟ + + + some test text + some testܢܕܢ܂ diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index c768eae..c9fc0df 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -46,6 +46,7 @@ declare variable $anno:uris := let $main-edition-object := if (doc-available($commons:agg || "3r132.xml")) then "3r132" + (: this main edition object is for testing purposes :) else "sample_main_edition" @@ -179,6 +180,7 @@ as xs:string { : @param $first-entry The IRI of the first Annotation Page that is included within the Collection : @param $last-entry The IRI of the last Annotation Page that is included within the Collection :) +(: ## tested ## :) declare function anno:make-annotationCollection-map($uri as xs:string, $title as xs:string, $first-entry as xs:string, @@ -208,6 +210,7 @@ as map() { : @return A string containing the creators of the annotations as stated in the : TEI header of the (underlying) resource(s). :) +(: ## tested ## :) declare function anno:get-creator($uri as xs:string) as xs:string { let $xmls := @@ -265,6 +268,7 @@ $document as xs:string) { : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) +(: ## tested ## :) declare function anno:make-annotationPage($collection as xs:string, $document as xs:string, $server as xs:string) @@ -493,13 +497,13 @@ $document as xs:string, $page as xs:string, $server as xs:string) { : : At this stage, TEI files are scraped for person and place names. : - : @param $documentURI The XML's URI. Attention: This refers directly to the XML file, NOT the superordinate edition! + : @param $teixml-uri The XML's URI. : @param $page The page within an XML file, i.e. a tei:pb/@n within a TEI resource :) -declare function anno:get-annotations($documentURI as xs:string, +declare function anno:get-annotations($teixml-uri as xs:string, $page as xs:string) -as map() { - let $pageChunk := anno:get-page-fragment($documentURI, $page) +as map()+ { + let $pageChunk := anno:get-page-fragment($teixml-uri, $page) let $annotation-elements := for $name in $anno:annotationElements return @@ -509,10 +513,10 @@ as map() { let $id := string( $annotation/@id ) (: get the predefined ID from the in-memory TEI with IDs :) return map { - "id": $anno:ns || "/" || $documentURI || "/annotation-" || $id, + "id": $anno:ns || "/" || $teixml-uri || "/annotation-" || $id, "type": "Annotation", "bodyValue": anno:get-bodyValue($annotation), - "target": anno:get-target-information($annotation, $documentURI, $id) + "target": anno:get-target-information($annotation, $teixml-uri, $id) } }; @@ -771,7 +775,7 @@ declare function anno:is-resource-xml($uri as xs:string) as xs:boolean { : @param $uri The resource's URI : @return true() if resources stated by $uri is an edition object :) -(: ## tested ää :) +(: ## tested ## :) declare function anno:is-resource-edition($map as map(), $uri as xs:string) as xs:boolean { @@ -841,7 +845,7 @@ as xs:string* { let $edition := anno:get-parent-aggregation($uri) return anno:get-prev-xml-uris($edition) - else if(anno:is-resource-edition($anno-uris, $uri)) then + else if(anno:is-resource-edition($anno:uris, $uri)) then anno:get-prev-xml-uris($uri) else () diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index ee17dc4..a888891 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -22,7 +22,7 @@ as xs:boolean { }; declare - %test:args("sample_teixml") %test:assertXPath("count($result) = 4") + %test:args("sample_teixml") %test:assertXPath("count($result) = 5") %test:args("sample_teixml") %test:assertXPath("$result = '82a'") function at:get-pages-in-TEI($uri as xs:string) as xs:string+ { @@ -129,8 +129,8 @@ as element(tei:TEI) { }; declare - %test:args("sample_main_edition") %test:assertEquals("65") - %test:args("sample_lang_aggregation") %test:assertEquals("65") + %test:args("sample_main_edition") %test:assertEquals("66") + %test:args("sample_lang_aggregation") %test:assertEquals("66") function at:get-total-no-of-annotations($uri as xs:string) { anno:get-total-no-of-annotations($uri) }; @@ -213,108 +213,43 @@ as xs:string? { anno:get-prev-or-next-page($manifest-uri, $page, $type) }; -(:declare:) -(: %test:args("3r679", "114r"):) -(: %test:assertEquals("0"):) -(:function at:anno-determine-start-index-for-page($uri as xs:string, $page as xs:string) {:) -(: anno:determine-start-index-for-page($uri, $page):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("16"):) -(:function at:anno-determine-start-index($uri as xs:string) {:) -(: anno:determine-start-index($uri):) -(:};:) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("3r679"):) -(:function at:anno-get-parent-aggregation($uri as xs:string) {:) -(: anno:get-parent-aggregation($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("114r", "114v"):) -(:function at:anno-get-pages-in-TEI($uri as xs:string) {:) -(: anno:get-pages-in-TEI($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r679"):) -(: %test:assertTrue:) -(:function at:anno-is-resource-edition($uri as xs:string) {:) -(: anno:is-resource-edition($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertTrue:) -(:function at:anno-is-resource-xml($uri as xs:string) {:) -(: anno:is-resource-xml($uri):) -(:};:) - - -(::) -(:declare:) -(: %test:args("asdf"):) -(: %test:assertFalse:) -(:(: %test:args("3r131"):):) -(:(: %test:assertTrue:):) -(:function at:anno-are-resources-available($resources as xs:string+) {:) -(: anno:are-resources-available($resources):) -(:};:) - +declare + %test:args("sample_teixml") %test:assertEquals("Simon Birol, Aly Elrefaei") + %test:args("sample_edition") %test:assertEquals("Simon Birol, Aly Elrefaei") +function at:get-creator($uri as xs:string) +as xs:string { + anno:get-creator($uri) +}; -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("Simon Birol, Aly Elrefaei"):) -(:function at:anno-get-creator($uri as xs:string) {:) -(: anno:get-creator($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r131"):) -(: %test:assertEquals("Brit. Lib. Add. 7200"):) -(:function at:anno-get-metadata-title($uri as xs:string) {:) -(: anno:get-metadata-title($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r679"):) -(: %test:assertEquals("3r676", "3r672"):) -(:function at:anno-get-prev-xml-uris($uri as xs:string) {:) -(: anno:get-prev-xml-uris($uri):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r679"):) -(: %test:assertEquals("3r676", "3r672"):) -(:function at:anno-get-xmls-prev-in-collection($uri as xs:string) {:) -(: anno:get-xmls-prev-in-collection($uri):) -(:};:) +declare + %test:args("sample_edition", + "Beispieledition", + "http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/82a/annotationPage.json", + "http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/83b/annotationPage.json") + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('label') = 'Ahikar annotations for textgrid:sample_edition: Beispieledition'") + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('x-creator') = 'Simon Birol, Aly Elrefaei'") +function at:make-annotationCollection-map($uri as xs:string, + $title as xs:string, + $first-entry as xs:string, + $last-entry as xs:string) +as map() { + anno:make-annotationCollection-map($uri, $title, $first-entry, $last-entry) +}; +declare + %test:args("sample_lang_aggregation", "sample_edition", "http://localhost:8080") + %test:assertXPath("map:get($result, 'annotationPage') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation/sample_edition'") +function at:make-annotationPage($collection as xs:string, + $manifest as xs:string, + $server as xs:string) +as map() { + anno:make-annotationPage($collection, $manifest, $server) +}; -(:declare:) -(: %test:args("3r679", "114r", "next"):) -(: %test:assertEquals("114v"):) -(:function at:anno-get-prev-or-next-page($documentURI as xs:string,:) -(:$page as xs:string, $type as xs:string) {:) -(: anno:get-prev-or-next-page($documentURI, $page, $type):) -(:};:) -(::) -(::) -(:declare:) -(: %test:args("3r9ps"):) -(: %test:assertEquals("3r177", "3r178", "3r7vw", "3r7p1", "3r7p9", "3r7sk", "3r7tp", "3r7vd", "3r179", "3r7n0", "3r9vn", "3r9wf", "3rb3z", "3rbm9", "3rbmc", "3rx14", "3vp38"):) -(:function at:anno-get-uris($documentURI) {:) -(: anno:get-uris($documentURI):) -(:};:) +declare + %test:args("sample_teixml", "83b") %test:assertXPath("count($result) = 15") +function at:get-annotations($teixml-uri as xs:string, + $page as xs:string) +as map()+ { + anno:get-annotations($teixml-uri, $page) +}; diff --git a/exist-app/tests/tapi-html-tests.xqm b/exist-app/tests/tapi-html-tests.xqm index cb5b126..166b087 100644 --- a/exist-app/tests/tapi-html-tests.xqm +++ b/exist-app/tests/tapi-html-tests.xqm @@ -24,8 +24,8 @@ declare %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result[local-name(.) = 'pb']") %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result/@facs = 'textgrid:3r1p0'") %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result/@n = '82b'") - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "83b") %test:assertXPath("$result[local-name(.) = 'ab']") - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "83b") %test:assertXPath("matches($result, 'ܘܗܦܟܬ ܛܥܢܬ ܐܰܒܵܪܐ ܘܠܐ ܐܝܼܩܰܪ ܥܠ')") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "84a") %test:assertXPath("$result[local-name(.) = 'ab']") + %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "84a") %test:assertXPath("matches($result, 'ܢܕܢ')") function thtmlt:get-end-node($tei-xml-base-uri as xs:string, $page as xs:string) as item()+ { diff --git a/exist-app/tests/tapi-manifest-tests.xqm b/exist-app/tests/tapi-manifest-tests.xqm index 2811fdf..62eb08d 100644 --- a/exist-app/tests/tapi-manifest-tests.xqm +++ b/exist-app/tests/tapi-manifest-tests.xqm @@ -143,7 +143,7 @@ function tmt:make-sequences($collection-uri as xs:string, }; declare - %test:args("sample_edition") %test:assertXPath("count($result) = 4") + %test:args("sample_edition") %test:assertXPath("count($result) = 5") function tmt:get-valid-page-ids($manifest-uri as xs:string) { tapi-mani:get-valid-page-ids($manifest-uri) }; -- GitLab From a97eb015d53309c1b6a38306a348acca7e76c910 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 11:34:57 +0100 Subject: [PATCH 077/155] fix: include start and end nodes in fragments --- exist-app/modules/tapi-html.xqm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exist-app/modules/tapi-html.xqm b/exist-app/modules/tapi-html.xqm index dd83c2c..920be10 100644 --- a/exist-app/modules/tapi-html.xqm +++ b/exist-app/modules/tapi-html.xqm @@ -42,8 +42,9 @@ as element() { $start-node := $node//tei:pb[@n = $page and @facs], $end-node := tapi-html:get-end-node($start-node), $wrap-in-first-common-ancestor-only := false(), - $include-start-and-end-nodes := false(), + $include-start-and-end-nodes := true(), $empty-ancestor-elements-to-include := ("") + return fragment:get-fragment-from-doc( $node, -- GitLab From 17cf480fd2a5cee957fd40fea65da01f8c0d85f9 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 13:29:56 +0100 Subject: [PATCH 078/155] tests: add more tests --- exist-app/modules/annotations.xqm | 86 ++++++++++++++-------------- exist-app/tests/annotation-tests.xqm | 81 ++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 43 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index c9fc0df..69e79e6 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -500,6 +500,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) { : @param $teixml-uri The XML's URI. : @param $page The page within an XML file, i.e. a tei:pb/@n within a TEI resource :) +(: ## tested ## :) declare function anno:get-annotations($teixml-uri as xs:string, $page as xs:string) as map()+ { @@ -512,12 +513,12 @@ as map()+ { for $annotation in $annotation-elements return let $id := string( $annotation/@id ) (: get the predefined ID from the in-memory TEI with IDs :) return - map { - "id": $anno:ns || "/" || $teixml-uri || "/annotation-" || $id, - "type": "Annotation", - "bodyValue": anno:get-bodyValue($annotation), - "target": anno:get-target-information($annotation, $teixml-uri, $id) - } + map { + "id": $anno:ns || "/" || $teixml-uri || "/annotation-" || $id, + "type": "Annotation", + "bodyValue": anno:get-bodyValue($annotation), + "target": anno:get-target-information($annotation, $teixml-uri, $id) + } }; @@ -713,29 +714,37 @@ as item()? { : @param $type "prev" for getting the previous page, "next" for getting the next page : @return :) +(: ## tested ## :) declare function anno:get-prev-or-next-annotationPage-ID($collection as xs:string, -$document as xs:string, $type as xs:string) { + $document as xs:string, + $type as xs:string) +as xs:string? { let $collection-keys := anno:find-in-map($anno:uris, $collection) => map:keys() - let $no-of-keys := count($collection-keys) - let $position := index-of($collection-keys, $document) + return + anno:get-prev-or-next($collection-keys, $document, $type) +}; + +(: ## tested ## :) +declare function anno:get-prev-or-next($entities as item()+, + $searched-for as xs:string, + $type as xs:string) +as xs:string? { + let $no-of-entities := count($entities) + let $position-of-searched-for := index-of($entities, $searched-for) let $new-position := if ($type = "prev") then - $position - 1 + $position-of-searched-for - 1 else - $position + 1 + $position-of-searched-for + 1 return - switch ($type) - case "prev" return - if ($new-position le $no-of-keys) then - $collection-keys[$new-position] - else - () - case "next" return - if ($new-position le $no-of-keys) then - $collection-keys[$new-position] - else - () - default return () + if ($new-position le $no-of-entities + and ($type = "prev" + and $new-position != 0 + or + $type = "next")) then + $entities[$new-position] + else + () }; (: ## tested ## :) @@ -809,22 +818,8 @@ declare function anno:get-prev-or-next-page($manifest-uri as xs:string, as xs:string? { let $tei := anno:find-in-map($anno:uris, $manifest-uri) let $pages := anno:get-pages-in-TEI($tei) - let $no-of-pages := count($pages) - let $current-position := index-of($pages, $page) - let $new-position := - if ($type = "next") then - $current-position + 1 - else - $current-position - 1 return - if ($new-position le $no-of-pages - and ($type = "prev" - and $new-position != 0 - or - $type = "next")) then - $pages[$new-position] - else - () + anno:get-prev-or-next($pages, $page, $type) }; @@ -865,7 +860,8 @@ as xs:string* { : @param $uri The URI of the current edition : @return A list of all URIs of TEI resources that appear before the given edition in a collection :) -declare function anno:get-prev-xml-uris($uri as xs:string) as xs:string* { +declare function anno:get-prev-xml-uris($uri as xs:string) +as xs:string* { let $collection := anno:get-parent-aggregation($uri) let $collection := commons:get-document($collection, "agg") @@ -909,7 +905,9 @@ as xs:string? { : an edition. : @return The relative position of the first annotation :) -declare function anno:determine-start-index($uri as xs:string) as xs:integer { +(: ## tested ## :) +declare function anno:determine-start-index($uri as xs:string) +as xs:integer { let $resourceType := commons:get-document($uri, "meta")//tgmd:format return if ($resourceType = "text/tg.aggregation+xml") then @@ -946,18 +944,20 @@ declare function anno:determine-start-index($uri as xs:string) as xs:integer { : XML file, and this function returns the start index for a page in a TEI/XML. : : @see https://www.w3.org/TR/annotation-model/#annotation-page - : @param $uri The URI of the given resource. This may refers to an edition. + : @param $uri The URI of the given resource. This may refer to an edition. : @param $page The @n attribute of the current tei:pb : @return The relative position of the first annotation :) +(: ## tested ## :) declare function anno:determine-start-index-for-page($uri as xs:string, -$page as xs:string) as xs:integer { + $page as xs:string) +as xs:integer { let $xml := anno:find-in-map($anno:uris, $uri) let $doc := commons:get-document($xml, "data") let $currentPb := $doc//tei:pb[@n = $page and @facs] let $noOfAnnotationsPerElement := for $name in $anno:annotationElements return - count($doc//tei:text//*[name(.) = $name][. << $currentPb]) + count($doc//*[name(.) = $name][.[ancestor::tei:text[1] = $currentPb/ancestor::tei:text[1]] << $currentPb]) return sum($noOfAnnotationsPerElement) }; diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index a888891..60a4714 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -11,6 +11,8 @@ import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; +import module namespace console="http://exist-db.org/xquery/console"; + declare variable $at:sample-doc := doc($commons:data || "/sample_teixml.xml"); declare @@ -239,6 +241,7 @@ as map() { declare %test:args("sample_lang_aggregation", "sample_edition", "http://localhost:8080") %test:assertXPath("map:get($result, 'annotationPage') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation/sample_edition'") + %test:pending function at:make-annotationPage($collection as xs:string, $manifest as xs:string, $server as xs:string) @@ -253,3 +256,81 @@ function at:get-annotations($teixml-uri as xs:string, as map()+ { anno:get-annotations($teixml-uri, $page) }; + +declare + %test:args("sample_teixml", "84a") + %test:assertXPath("$result = 'A person''s name.'") +function at:get-annotations-detailed-bodyValue($teixml-uri as xs:string, + $page as xs:string) +as xs:string { + let $result-map := anno:get-annotations($teixml-uri, $page) + let $bodyValue := map:get($result-map, "bodyValue") + return + $bodyValue +}; + +declare + %test:args("sample_teixml", "84a") + %test:assertXPath("$result = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/sample_teixml/annotation-N4.4.2.4.4.354.2'") +function at:get-annotations-detailed-id($teixml-uri as xs:string, + $page as xs:string) +as xs:string { + let $result-map := anno:get-annotations($teixml-uri, $page) + let $id := map:get($result-map, "id") + return + $id +}; + +declare + %test:args("sample_teixml", "84a") + %test:assertXPath("$result instance of map()") +function at:get-annotations-detailed-target($teixml-uri as xs:string, + $page as xs:string) +as map() { + let $result-map := anno:get-annotations($teixml-uri, $page) + let $target := map:get($result-map, "target") + return + $target +}; + +declare + %test:args("sample_edition", "82a") %test:assertEquals("0") + %test:args("sample_edition", "82b") %test:assertEquals("11") +function at:determine-start-index-for-page($uri as xs:string, + $page as xs:string) +as xs:integer { + anno:determine-start-index-for-page($uri, $page) +}; + +declare + %test:args("sample_lang_aggregation") %test:assertEquals("0") + %test:args("sample_edition") %test:assertEquals("0") + %test:args("sample_teixml") %test:assertEquals("0") +function at:determine-start-index($uri as xs:string) +as xs:integer { + anno:determine-start-index($uri) +}; + + +declare + %test:args("next", "1r") %test:assertEquals("1v") + %test:args("prev", "1r") %test:assertEmpty + %test:args("next", "2r") %test:assertEmpty + %test:args("prev", "2r") %test:assertEquals("1ab") +function at:get-prev-or-next($type as xs:string, + $searched-for as xs:string) +as xs:string? { + let $entities := ("1r", "1v", "1ab", "2r") + return + anno:get-prev-or-next($entities, $searched-for, $type) +}; + +declare + %test:args("sample_lang_aggregation", "sample_edition", "next") %test:assertEmpty + %test:args("sample_lang_aggregation", "sample_edition", "prev") %test:assertEmpty +function anno:get-prev-or-next-annotationPage-ID($collection as xs:string, + $document as xs:string, + $type as xs:string) +as xs:string? { + anno:get-prev-or-next-annotationPage-ID($collection, $document, $type) +}; \ No newline at end of file -- GitLab From 2dc4148dc9f00851ac575c6a2c42e8fd7bc2459b Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 13:31:47 +0100 Subject: [PATCH 079/155] fix: remove console module --- exist-app/tests/annotation-tests.xqm | 2 -- 1 file changed, 2 deletions(-) diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 60a4714..eadbdf6 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -11,8 +11,6 @@ import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; -import module namespace console="http://exist-db.org/xquery/console"; - declare variable $at:sample-doc := doc($commons:data || "/sample_teixml.xml"); declare -- GitLab From db1a34ada4f82af0ab39f313e065e02b7d120b8b Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 14:49:20 +0100 Subject: [PATCH 080/155] tests: add more tests --- exist-app/modules/annotations.xqm | 28 ++++++++--- exist-app/tests/annotation-tests.xqm | 73 +++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/annotations.xqm index 69e79e6..16afc1b 100644 --- a/exist-app/modules/annotations.xqm +++ b/exist-app/modules/annotations.xqm @@ -24,7 +24,6 @@ import module namespace requestr="http://exquery.org/ns/request"; import module namespace rest="http://exquery.org/ns/restxq"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; - declare variable $anno:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations"; declare variable $anno:server := if(try { @@ -108,7 +107,11 @@ function anno:collection-rest($collection as xs:string) { : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) -declare function anno:make-annotationCollection($collection as xs:string, $document as xs:string?, $server as xs:string) as map(){ +(: ## tested ## :) +declare function anno:make-annotationCollection($collection as xs:string, + $document as xs:string?, + $server as xs:string) +as map() { (: if $document is a collection then its value in $anno:uris is a map containing the aggregated manifests. at this point it is relevant if $document is actually a manifest or a collection. we have to create different paths containing $first and $last for the two of them, @@ -146,7 +149,10 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum : @param The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) -declare function anno:get-information-for-collection-object($collectionURI as xs:string, $server as xs:string) as map() { +(: ## tested ## :) +declare function anno:get-information-for-collection-object($collectionURI as xs:string, + $server as xs:string) +as map() { let $child-keys := anno:find-in-map($anno:uris, $collectionURI) => map:keys() let $first := $child-keys[1] let $last := $child-keys[last()] @@ -429,7 +435,9 @@ declare %rest:path("/api/annotations/ahikar/{$collection}/{$document}/{$page}/annotationPage.json") %output:method("json") function anno:annotationPage-for-manifest-rest($collection as xs:string, -$document as xs:string, $page as xs:string) { + $document as xs:string, + $page as xs:string) +as element()+ { if (anno:are-resources-available(($collection, $document))) then ($commons:responseHeader200, anno:make-annotationPage-for-manifest($collection, $document, $page, $anno:server)) @@ -453,8 +461,12 @@ $document as xs:string, $page as xs:string) { : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server :) +(: ## tested ## :) declare function anno:make-annotationPage-for-manifest($collection as xs:string, -$document as xs:string, $page as xs:string, $server as xs:string) { + $document as xs:string, + $page as xs:string, + $server as xs:string) +as map() { let $docTitle := anno:get-metadata-title($document) let $xml := anno:find-in-map($anno:uris, $document) let $prevPage := anno:get-prev-or-next-page($document, $page, "prev") @@ -834,6 +846,7 @@ as xs:string? { : @param $uri The URI of the current resource. This may refer to a edition or TEI/XML. : @return A list of URIs that appear before the given resource in a collection :) +(: ## tested ## :) declare function anno:get-xmls-prev-in-collection($uri as xs:string) as xs:string* { if (anno:is-resource-xml($uri)) then @@ -860,6 +873,7 @@ as xs:string* { : @param $uri The URI of the current edition : @return A list of all URIs of TEI resources that appear before the given edition in a collection :) +(: ## tested ## :) declare function anno:get-prev-xml-uris($uri as xs:string) as xs:string* { let $collection := anno:get-parent-aggregation($uri) @@ -868,7 +882,9 @@ as xs:string* { let $tgURI := "textgrid:" || $uri let $tgURINode := $collection//@rdf:resource[./string() = $tgURI] let $prevEditions := $collection//@rdf:resource[. << $tgURINode] - let $prevEditionsURIs := for $edition in $prevEditions return replace($edition, "textgrid:", "") + let $prevEditionsURIs := + for $edition in $prevEditions return + replace($edition, "textgrid:", "") for $edition in $prevEditionsURIs return anno:find-in-map($anno:uris, $edition) diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index eadbdf6..abca7af 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -7,7 +7,6 @@ declare namespace tei="http://www.tei-c.org/ns/1.0"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; import module namespace map="http://www.w3.org/2005/xpath-functions/map"; -import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; @@ -89,7 +88,8 @@ as xs:string { declare %test:assertEquals("A place's name.") -function at:anno-get-bodyValue() { +function at:anno-get-bodyValue() +as xs:string { let $annotation := $at:sample-doc//tei:text[@type = "transcription"]/descendant::tei:placeName[1] return anno:get-bodyValue($annotation) @@ -331,4 +331,73 @@ function anno:get-prev-or-next-annotationPage-ID($collection as xs:string, $type as xs:string) as xs:string? { anno:get-prev-or-next-annotationPage-ID($collection, $document, $type) +}; + +declare + %test:args("sample_lang_aggregation", "sample_edition", "84a", "http://localhost:8080") + %test:assertEquals("http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation/sample_edition-84a") +function at:make-annotationPage-for-manifest-id($collection as xs:string, + $document as xs:string, + $page as xs:string, + $server as xs:string) +as xs:string { + let $result := anno:make-annotationPage-for-manifest($collection, $document, $page, $server) + return + map:get($result, "annotationPage") + => map:get("id") +}; + + +declare + %test:args("sample_lang_aggregation", "sample_edition", "84a", "http://localhost:8080") + %test:assertEquals("http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/sample_edition") +function at:make-annotationPage-for-manifest-part-of($collection as xs:string, + $document as xs:string, + $page as xs:string, + $server as xs:string) +as xs:string { + let $result := anno:make-annotationPage-for-manifest($collection, $document, $page, $server) + return + map:get($result, "annotationPage") + => map:get("partOf") + => map:get("id") +}; + +declare + %test:args("sample_lang_aggregation", "http://localhost:8080") + %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json") +function at:get-information-for-collection-object($collectionURI as xs:string, + $server as xs:string) +as xs:string { + let $result := anno:get-information-for-collection-object($collectionURI, $server) + return + map:get($result, "annotationCollection") + => map:get("first") +}; + +declare + %test:args("sample_lang_aggregation", "sample_edition", "http://localhost:8080") + %test:assertXPath("$result instance of map()") + %test:args("sample_lang_aggregation", "", "http://localhost:8080") + %test:assertXPath("$result instance of map()") +function at:make-annotationCollection($collection as xs:string, + $document as xs:string?, + $server as xs:string) +as map() { + anno:make-annotationCollection($collection, $document, $server) +}; + +declare + %test:args("sample_teixml") %test:assertEmpty +function at:get-prev-xml-uris($uri as xs:string) +as xs:string* { + anno:get-prev-xml-uris($uri) +}; + +declare + %test:args("sample_teixml") %test:assertEmpty + %test:args("sample_edition") %test:assertEmpty +function at:get-xmls-prev-in-collection($uri as xs:string) +as xs:string* { + anno:get-xmls-prev-in-collection($uri) }; \ No newline at end of file -- GitLab From 6907361a11f7bb0b927e02cdcb9b908aa69bd3ed Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 14:53:25 +0100 Subject: [PATCH 081/155] chore: remove unused module --- exist-app/tests/tapi-tests.xqm | 1 - 1 file changed, 1 deletion(-) diff --git a/exist-app/tests/tapi-tests.xqm b/exist-app/tests/tapi-tests.xqm index 5939dca..7eaa7ce 100644 --- a/exist-app/tests/tapi-tests.xqm +++ b/exist-app/tests/tapi-tests.xqm @@ -12,7 +12,6 @@ module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests"; declare namespace http = "http://expath.org/ns/http-client"; declare namespace tei="http://www.tei-c.org/ns/1.0"; -import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace tapi="http://ahikar.sub.uni-goettingen.de/ns/tapi" at "../modules/tapi.xqm"; import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; -- GitLab From 30152c103179d773b3f4fdbd4f482ae6b8ce2189 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 14:54:14 +0100 Subject: [PATCH 082/155] refactor: move annotation.xqm to separate subcollection --- exist-app/modules/{ => AnnotationAPI}/annotations.xqm | 0 exist-app/tests/annotation-tests.xqm | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename exist-app/modules/{ => AnnotationAPI}/annotations.xqm (100%) diff --git a/exist-app/modules/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm similarity index 100% rename from exist-app/modules/annotations.xqm rename to exist-app/modules/AnnotationAPI/annotations.xqm diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index abca7af..036b610 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -8,7 +8,7 @@ declare namespace tei="http://www.tei-c.org/ns/1.0"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/annotations.xqm"; +import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "../modules/AnnotationAPI/annotations.xqm"; declare variable $at:sample-doc := doc($commons:data || "/sample_teixml.xml"); -- GitLab From f514a2e7169e15851ff8c6c674915c8c99bc62e5 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 15:17:08 +0100 Subject: [PATCH 083/155] refactor: move REST to separate module --- .../AnnotationAPI/annotations-rest.xqm | 194 ++++++++++++++++++ .../modules/AnnotationAPI/annotations.xqm | 180 +--------------- exist-app/modules/testtrigger.xqm | 5 +- exist-app/tests/annotation-rest-tests.xqm | 21 ++ exist-app/tests/annotation-tests.xqm | 13 +- 5 files changed, 222 insertions(+), 191 deletions(-) create mode 100644 exist-app/modules/AnnotationAPI/annotations-rest.xqm create mode 100644 exist-app/tests/annotation-rest-tests.xqm diff --git a/exist-app/modules/AnnotationAPI/annotations-rest.xqm b/exist-app/modules/AnnotationAPI/annotations-rest.xqm new file mode 100644 index 0000000..3fde836 --- /dev/null +++ b/exist-app/modules/AnnotationAPI/annotations-rest.xqm @@ -0,0 +1,194 @@ +xquery version "3.1"; + +(:~ + : This module provides the REST interface for Ahiqar's AnnotationAPI. + : + : @author Michelle Weidling + : @version 1.8.1 + : @since 1.7.0 + : @see https://subugoe.pages.gwdg.de/ahiqar/api-documentation/ + : @see https://subugoe.pages.gwdg.de/ahiqar/api-documentation/page/text-api-specs/ + : :) + +module namespace anno-rest="http://ahikar.sub.uni-goettingen.de/ns/annotations/rest"; + +declare namespace tei="http://www.tei-c.org/ns/1.0"; +declare namespace ore="http://www.openarchives.org/ore/terms/"; +declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; +declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; +declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; + +import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "annotations.xqm"; +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; +import module namespace requestr="http://exquery.org/ns/request"; +import module namespace rest="http://exquery.org/ns/restxq"; + +declare variable $anno-rest:server := + if(try { + requestr:hostname() = "existdb" +} catch * { + true() +}) + then doc("../expath-pkg.xml")/*/@name => replace("/$", "") + else "http://localhost:8094/exist/restxq"; + +(:~ + : Returns annotation information about a single collection. Although this works for all collections, + : it has mainly been designed for Ahikar's main collection, 3r132. + : + : For retrieving annotation information about other collections cf. the endpoint + : /annotations/ahikar/{$collection}/{$document}/annotationCollection.json + : + : @param $collection The URI of the collection, e.g. '3r132' + : @return An Annotation Collecion for the given collection + :) +declare + %rest:GET + %rest:HEAD + %rest:path("/annotations/ahikar/{$collection}/annotationCollection.json") + %output:method("json") +function anno-rest:collection-rest($collection as xs:string) { + if (anno:are-resources-available($collection)) then + ($commons:responseHeader200, + anno:make-annotationCollection($collection, (), $anno-rest:server)) + else + anno-rest:get-404-header($collection) +}; + +(:~ + : Returns the Annotation Page of a given Collection Object according to W3C. + : + : @see https://www.w3.org/TR/annotation-model/#annotation-page + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object + : + : @param $collection The URI of the Collection Object + : @param $document The URI of an aggregated Collection or Manifest Object + :) +declare + %rest:GET + %rest:HEAD + %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationPage.json") + %output:method("json") +function anno-rest:annotationPage-for-collection-rest($collection as xs:string, +$document as xs:string) { + if (anno:are-resources-available(($collection, $document))) then + ($commons:responseHeader200, + anno:make-annotationPage($collection, $document, $anno-rest:server)) + + else + anno-rest:get-404-header(($collection, $document)) +}; + + +(:~ + : Returns the Annotation Collection of a given Collection or Manifest Object according to W3C. + : + : The Collection Object given by $collection mainly serves for identification and compliance + : with the TextAPI. + : + : @see https://www.w3.org/TR/annotation-model/#annotation-collection + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object + : + : @param $collection The URI of the Collection Object + : @param $document The URI of an aggregated Collection or Manifest Object + : @return An Annotation Collecion for the given Collection or Manifest Object + :) +declare + %rest:GET + %rest:HEAD + %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationCollection.json") + %output:method("json") +function anno-rest:manifest-rest($collection as xs:string, +$document as xs:string) { + if (anno:are-resources-available(($collection, $document))) then + ($commons:responseHeader200, + anno:make-annotationCollection($collection, $document, $anno-rest:server)) + + else + anno-rest:get-404-header(($collection, $document)) +}; + + +(:~ + : Returns the Annotation Collection of a given Collection or Manifest Object according to W3C. + : + : The Collection Object given by $collection mainly serves for identification and compliance + : with the TextAPI. + : + : @see https://www.w3.org/TR/annotation-model/#annotation-collection + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object + : + : @param $collection The URI of the Collection Object + : @param $document The URI of an aggregated Collection or Manifest Object + : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource + : @return An Annotation Collection for the given Collection or Manifest Object + :) +declare + %rest:GET + %rest:HEAD + %rest:path("/api/annotations/ahikar/{$collection}/{$document}/{$page}/annotationCollection.json") + %output:method("json") +function anno-rest:annotationCollection-for-manifest-rest($collection as xs:string, +$document as xs:string, $page as xs:string) { + if (anno:are-resources-available(($collection, $document))) then + ($commons:responseHeader200, + anno:make-annotationCollection-for-manifest($collection, $document, $page, $anno-rest:server)) + + else + anno-rest:get-404-header(($collection, $document)) +}; + +(:~ + : Returns the Annotation Page of a given Collection or Manifest Object according to W3C. + : + : The Collection Object given by $collection mainly serves for identification and compliance + : with the TextAPI. + : + : @see https://www.w3.org/TR/annotation-model/#annotation-page + : @see https://www.w3.org/TR/annotation-model/#annotation-page + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object + : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object + : + : @param $collection The URI of the Collection Object + : @param $document The URI of an aggregated Collection or Manifest Object + : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource + : @return An Annotation Page for the given Collection or Manifest Object + :) +declare + %rest:GET + %rest:HEAD + %rest:path("/api/annotations/ahikar/{$collection}/{$document}/{$page}/annotationPage.json") + %output:method("json") +function anno-rest:annotationPage-for-manifest-rest($collection as xs:string, + $document as xs:string, + $page as xs:string) +as element()+ { + if (anno:are-resources-available(($collection, $document))) then + ($commons:responseHeader200, + anno:make-annotationPage-for-manifest($collection, $document, $page, $anno-rest:server)) + + else + anno-rest:get-404-header(($collection, $document)) +}; + +(:~ + : Creates a HTTP 404 header containing information about missing resources. + : This function is called whenever an API call is made but at least one of the + : requested resources isn't available. + : + : @param $resources The URIs of resource's requested in an API call + : @return The response header + :) +(: ## tested ## :) +declare function anno-rest:get-404-header($resources as xs:string+) { + + + + + +}; \ No newline at end of file diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index 16afc1b..24ae575 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -18,21 +18,11 @@ declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; -import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../commons.xqm"; import module namespace functx = "http://www.functx.com"; -import module namespace requestr="http://exquery.org/ns/request"; -import module namespace rest="http://exquery.org/ns/restxq"; -import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "tapi-html.xqm"; +import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "../tapi-html.xqm"; declare variable $anno:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations"; -declare variable $anno:server := - if(try { - requestr:hostname() = "existdb" -} catch * { - true() -}) - then doc("../expath-pkg.xml")/*/@name => replace("/$", "") - else "http://localhost:8094/exist/restxq"; declare variable $anno:annotationElements := ( @@ -72,30 +62,6 @@ declare variable $anno:uris := } ; -(:~ - : Returns annotation information about a single collection. Although this works for all collections, - : it has mainly been designed for Ahikar's main collection, 3r132. - : - : For retrieving annotation information about other collections cf. the endpoint - : /annotations/ahikar/{$collection}/{$document}/annotationCollection.json - : - : @param $collection The URI of the collection, e.g. '3r132' - : @return An Annotation Collecion for the given collection - :) -declare - %rest:GET - %rest:HEAD - %rest:path("/annotations/ahikar/{$collection}/annotationCollection.json") - %output:method("json") -function anno:collection-rest($collection as xs:string) { - if (anno:are-resources-available($collection)) then - ($commons:responseHeader200, - anno:make-annotationCollection($collection, (), $anno:server)) - else - anno:get-404-header($collection) -}; - - (:~ : A generic function for creating an W3C compliant Annotation Collection for a given resource. : @@ -236,32 +202,6 @@ as xs:string { }; -(:~ - : Returns the Annotation Page of a given Collection Object according to W3C. - : - : @see https://www.w3.org/TR/annotation-model/#annotation-page - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object - : - : @param $collection The URI of the Collection Object - : @param $document The URI of an aggregated Collection or Manifest Object - :) -declare - %rest:GET - %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationPage.json") - %output:method("json") -function anno:annotationPage-for-collection-rest($collection as xs:string, -$document as xs:string) { - if (anno:are-resources-available(($collection, $document))) then - ($commons:responseHeader200, - anno:make-annotationPage($collection, $document, $anno:server)) - - else - anno:get-404-header(($collection, $document)) -}; - - (:~ : A generic function for creating an W3C compliant Annotation Page for a given resource. : @@ -311,68 +251,6 @@ as map() { } }; - -(:~ - : Returns the Annotation Collection of a given Collection or Manifest Object according to W3C. - : - : The Collection Object given by $collection mainly serves for identification and compliance - : with the TextAPI. - : - : @see https://www.w3.org/TR/annotation-model/#annotation-collection - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object - : - : @param $collection The URI of the Collection Object - : @param $document The URI of an aggregated Collection or Manifest Object - : @return An Annotation Collecion for the given Collection or Manifest Object - :) -declare - %rest:GET - %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationCollection.json") - %output:method("json") -function anno:manifest-rest($collection as xs:string, -$document as xs:string) { - if (anno:are-resources-available(($collection, $document))) then - ($commons:responseHeader200, - anno:make-annotationCollection($collection, $document, $anno:server)) - - else - anno:get-404-header(($collection, $document)) -}; - - -(:~ - : Returns the Annotation Collection of a given Collection or Manifest Object according to W3C. - : - : The Collection Object given by $collection mainly serves for identification and compliance - : with the TextAPI. - : - : @see https://www.w3.org/TR/annotation-model/#annotation-collection - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object - : - : @param $collection The URI of the Collection Object - : @param $document The URI of an aggregated Collection or Manifest Object - : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource - : @return An Annotation Collection for the given Collection or Manifest Object - :) -declare - %rest:GET - %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/{$page}/annotationCollection.json") - %output:method("json") -function anno:annotationCollection-for-manifest-rest($collection as xs:string, -$document as xs:string, $page as xs:string) { - if (anno:are-resources-available(($collection, $document))) then - ($commons:responseHeader200, - anno:make-annotationCollection-for-manifest($collection, $document, $page, $anno:server)) - - else - anno:get-404-header(($collection, $document)) -}; - - (:~ : A function for creating an W3C compliant Annotation Collection for a given page : in a Manifest Object. @@ -413,40 +291,6 @@ as map() { }; -(:~ - : Returns the Annotation Page of a given Collection or Manifest Object according to W3C. - : - : The Collection Object given by $collection mainly serves for identification and compliance - : with the TextAPI. - : - : @see https://www.w3.org/TR/annotation-model/#annotation-page - : @see https://www.w3.org/TR/annotation-model/#annotation-page - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object - : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object - : - : @param $collection The URI of the Collection Object - : @param $document The URI of an aggregated Collection or Manifest Object - : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource - : @return An Annotation Page for the given Collection or Manifest Object - :) -declare - %rest:GET - %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/{$page}/annotationPage.json") - %output:method("json") -function anno:annotationPage-for-manifest-rest($collection as xs:string, - $document as xs:string, - $page as xs:string) -as element()+ { - if (anno:are-resources-available(($collection, $document))) then - ($commons:responseHeader200, - anno:make-annotationPage-for-manifest($collection, $document, $page, $anno:server)) - - else - anno:get-404-header(($collection, $document)) -}; - - (:~ : A function for creating an W3C compliant Annotation Page for a given Manifest Object. : Since we need a slightly different string for the 'next' and 'prev' fields, this @@ -662,26 +506,6 @@ as xs:boolean { }; -(:~ - : Creates a HTTP 404 header containing information about missing resources. - : This function is called whenever an API call is made but at least one of the - : requested resources isn't available. - : - : @param $resources The URIs of resource's requested in an API call - : @return The response header - :) -(: ## tested ## :) -declare function anno:get-404-header($resources as xs:string+) { - - - - - -}; - - (:~ : Returns the value of a key which can be on an arbitrary level of a nested map. : Thus it corresponds to the map:find function which hasn't been implemented in diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index e56797c..8955918 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -24,6 +24,7 @@ import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "../tests/tapi-manifest-tests.xqm"; import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "../tests/tapi-tests.xqm"; import module namespace at="http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" at "../tests/annotation-tests.xqm"; +import module namespace art="http://ahikar.sub.uni-goettingen.de/ns/annotations/rest/tests" at "../tests/annotation-rest-tests.xqm"; (:~ : Triggers the tests for the Ahikar backend. Called by the CI. @@ -70,7 +71,8 @@ as element()+ { test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/annotations/rest/tests")) ) for $result in $test-results @@ -100,5 +102,6 @@ as xs:string? { case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" return "TEI2HTML transformation" case "http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" return "TEI2HTML text processing" case "http://ahikar.sub.uni-goettingen.de/ns/annotations/tests" return "AnnotationAPI" + case "http://ahikar.sub.uni-goettingen.de/ns/annotations/rest/tests" return "AnnotationAPI REST" default return () }; diff --git a/exist-app/tests/annotation-rest-tests.xqm b/exist-app/tests/annotation-rest-tests.xqm new file mode 100644 index 0000000..7ba9de9 --- /dev/null +++ b/exist-app/tests/annotation-rest-tests.xqm @@ -0,0 +1,21 @@ +xquery version "3.1"; + +module namespace art="http://ahikar.sub.uni-goettingen.de/ns/annotations/rest/tests"; + +declare namespace http = "http://expath.org/ns/http-client"; +declare namespace tei="http://www.tei-c.org/ns/1.0"; + +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; +import module namespace map="http://www.w3.org/2005/xpath-functions/map"; +import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; +import module namespace anno-rest="http://ahikar.sub.uni-goettingen.de/ns/annotations/rest" at "../modules/AnnotationAPI/annotations-rest.xqm"; + +declare + %test:assertXPath("$result//@status = '404'") + %test:assertXPath("$result//@message = 'One of the following requested resources couldn''t be found: qwerty, sample_teixml'") +function art:get-404-header() +as element() { + let $resources := ("qwerty", "sample_teixml") + return + anno-rest:get-404-header($resources) +}; \ No newline at end of file diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 036b610..d468eee 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -46,17 +46,6 @@ as xs:boolean { anno:are-resources-available($resources) }; -declare - %test:assertXPath("$result//@status = '404'") - %test:assertXPath("$result//@message = 'One of the following requested resources couldn''t be found: qwerty, sample_teixml'") -function at:get-404-header() -as element() { - let $resources := ("qwerty", "sample_teixml") - return - anno:get-404-header($resources) -}; - - declare %test:args("sample_teixml") %test:assertEquals("sample_edition") %test:args("sample_edition") %test:assertEquals("sample_lang_aggregation") @@ -400,4 +389,4 @@ declare function at:get-xmls-prev-in-collection($uri as xs:string) as xs:string* { anno:get-xmls-prev-in-collection($uri) -}; \ No newline at end of file +}; -- GitLab From 5f71fc7fc321cf27d8079ac5a9bae74173c2fc32 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 15:52:44 +0100 Subject: [PATCH 084/155] tests: add tests for REST interface --- .../AnnotationAPI/annotations-rest.xqm | 29 +-- .../modules/AnnotationAPI/annotations.xqm | 2 +- exist-app/tests/annotation-rest-tests.xqm | 169 +++++++++++++++++- 3 files changed, 183 insertions(+), 17 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations-rest.xqm b/exist-app/modules/AnnotationAPI/annotations-rest.xqm index 3fde836..e54e843 100644 --- a/exist-app/modules/AnnotationAPI/annotations-rest.xqm +++ b/exist-app/modules/AnnotationAPI/annotations-rest.xqm @@ -12,11 +12,7 @@ xquery version "3.1"; module namespace anno-rest="http://ahikar.sub.uni-goettingen.de/ns/annotations/rest"; -declare namespace tei="http://www.tei-c.org/ns/1.0"; -declare namespace ore="http://www.openarchives.org/ore/terms/"; declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; -declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; -declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations" at "annotations.xqm"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; @@ -42,6 +38,7 @@ declare variable $anno-rest:server := : @param $collection The URI of the collection, e.g. '3r132' : @return An Annotation Collecion for the given collection :) +(: ## tested ## :) declare %rest:GET %rest:HEAD @@ -65,10 +62,11 @@ function anno-rest:collection-rest($collection as xs:string) { : @param $collection The URI of the Collection Object : @param $document The URI of an aggregated Collection or Manifest Object :) +(: ## tested ## :) declare %rest:GET %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationPage.json") + %rest:path("/annotations/ahikar/{$collection}/{$document}/annotationPage.json") %output:method("json") function anno-rest:annotationPage-for-collection-rest($collection as xs:string, $document as xs:string) { @@ -95,13 +93,15 @@ $document as xs:string) { : @param $document The URI of an aggregated Collection or Manifest Object : @return An Annotation Collecion for the given Collection or Manifest Object :) +(: ## tested ## :) declare %rest:GET %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationCollection.json") + %rest:path("/annotations/ahikar/{$collection}/{$document}/annotationCollection.json") %output:method("json") function anno-rest:manifest-rest($collection as xs:string, -$document as xs:string) { + $document as xs:string) +as item()+ { if (anno:are-resources-available(($collection, $document))) then ($commons:responseHeader200, anno:make-annotationCollection($collection, $document, $anno-rest:server)) @@ -129,10 +129,12 @@ $document as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/{$page}/annotationCollection.json") + %rest:path("/annotations/ahikar/{$collection}/{$document}/{$page}/annotationCollection.json") %output:method("json") function anno-rest:annotationCollection-for-manifest-rest($collection as xs:string, -$document as xs:string, $page as xs:string) { + $document as xs:string, + $page as xs:string) +as item()+ { if (anno:are-resources-available(($collection, $document))) then ($commons:responseHeader200, anno:make-annotationCollection-for-manifest($collection, $document, $page, $anno-rest:server)) @@ -160,12 +162,12 @@ $document as xs:string, $page as xs:string) { declare %rest:GET %rest:HEAD - %rest:path("/api/annotations/ahikar/{$collection}/{$document}/{$page}/annotationPage.json") + %rest:path("/annotations/ahikar/{$collection}/{$document}/{$page}/annotationPage.json") %output:method("json") function anno-rest:annotationPage-for-manifest-rest($collection as xs:string, $document as xs:string, $page as xs:string) -as element()+ { +as item()+ { if (anno:are-resources-available(($collection, $document))) then ($commons:responseHeader200, anno:make-annotationPage-for-manifest($collection, $document, $page, $anno-rest:server)) @@ -183,7 +185,8 @@ as element()+ { : @return The response header :) (: ## tested ## :) -declare function anno-rest:get-404-header($resources as xs:string+) { +declare function anno-rest:get-404-header($resources as xs:string+) +as element() { -}; \ No newline at end of file +}; diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index 24ae575..e4cf511 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -359,7 +359,7 @@ as map() { (: ## tested ## :) declare function anno:get-annotations($teixml-uri as xs:string, $page as xs:string) -as map()+ { +as map()* { let $pageChunk := anno:get-page-fragment($teixml-uri, $page) let $annotation-elements := diff --git a/exist-app/tests/annotation-rest-tests.xqm b/exist-app/tests/annotation-rest-tests.xqm index 7ba9de9..f149748 100644 --- a/exist-app/tests/annotation-rest-tests.xqm +++ b/exist-app/tests/annotation-rest-tests.xqm @@ -3,12 +3,12 @@ xquery version "3.1"; module namespace art="http://ahikar.sub.uni-goettingen.de/ns/annotations/rest/tests"; declare namespace http = "http://expath.org/ns/http-client"; -declare namespace tei="http://www.tei-c.org/ns/1.0"; -import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace anno-rest="http://ahikar.sub.uni-goettingen.de/ns/annotations/rest" at "../modules/AnnotationAPI/annotations-rest.xqm"; +import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; + declare %test:assertXPath("$result//@status = '404'") @@ -18,4 +18,167 @@ as element() { let $resources := ("qwerty", "sample_teixml") return anno-rest:get-404-header($resources) -}; \ No newline at end of file +}; + +declare + %test:assertTrue +function art:is-collection-annotationCollection-endpoint-http200() +as xs:boolean { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/annotationCollection.json" + return + tc:is-endpoint-http200($url) +}; + + +declare + (: check if all parts are present. + : no further tests are needed since the content has been tested while testing + : the underlying function. :) + %test:assertXPath("map:contains($result, 'total')") + %test:assertXPath("map:contains($result, 'first')") + %test:assertXPath("map:contains($result, 'label')") + %test:assertXPath("map:contains($result, 'last')") + %test:assertXPath("map:contains($result, 'x-creator')") + %test:assertXPath("map:contains($result, 'type')") + %test:assertXPath("map:contains($result, 'id')") +function art:endpoint-collection-annotationCollection() +as item() { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/annotationCollection.json" + let $req := + + + return + http:send-request($req)[2] + => util:base64-decode() + => parse-json() + => map:get("annotationCollection") +}; + +declare + %test:assertTrue +function art:is-document-annotationPage-endpoint-http200() +as xs:boolean { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json" + return + tc:is-endpoint-http200($url) +}; + + +declare + (: check if all parts are present. + : no further tests are needed since the content has been tested while testing + : the underlying function. :) + %test:assertXPath("map:contains($result, 'partOf')") + %test:assertXPath("map:contains($result, 'items')") + %test:assertXPath("map:contains($result, 'startIndex')") + %test:assertXPath("map:contains($result, 'prev')") + %test:assertXPath("map:contains($result, 'next')") + %test:assertXPath("map:contains($result, 'id')") +function art:endpoint-document-annotationPage() +as item() { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json" + let $req := + + + return + http:send-request($req)[2] + => util:base64-decode() + => parse-json() + => map:get("annotationPage") +}; +declare + %test:assertTrue +function art:is-document-annotationCollection-endpoint-http200() +as xs:boolean { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationCollection.json" + return + tc:is-endpoint-http200($url) +}; + +declare + (: check if all parts are present. + : no further tests are needed since the content has been tested while testing + : the underlying function. :) + %test:assertXPath("map:contains($result, 'total')") + %test:assertXPath("map:contains($result, 'first')") + %test:assertXPath("map:contains($result, 'label')") + %test:assertXPath("map:contains($result, 'last')") + %test:assertXPath("map:contains($result, 'x-creator')") + %test:assertXPath("map:contains($result, 'type')") + %test:assertXPath("map:contains($result, 'id')") +function art:endpoint-document-annotationCollection() +as item() { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationCollection.json" + let $req := + + + return + http:send-request($req)[2] + => util:base64-decode() + => parse-json() + => map:get("annotationCollection") +}; + +declare + %test:assertTrue +function art:is-item-annotationCollection-endpoint-http200() +as xs:boolean { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationCollection.json" + return + tc:is-endpoint-http200($url) +}; + +declare + (: check if all parts are present. + : no further tests are needed since the content has been tested while testing + : the underlying function. :) + %test:assertXPath("map:contains($result, 'total')") + %test:assertXPath("map:contains($result, 'first')") + %test:assertXPath("map:contains($result, 'label')") + %test:assertXPath("map:contains($result, 'x-creator')") + %test:assertXPath("map:contains($result, 'type')") + %test:assertXPath("map:contains($result, 'id')") +function art:endpoint-item-annotationCollection() +as item() { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationCollection.json" + let $req := + + + return + http:send-request($req)[2] + => util:base64-decode() + => parse-json() + => map:get("annotationCollection") +}; + +declare + %test:assertTrue +function art:is-item-annotationPage-endpoint-http200() +as xs:boolean { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationPage.json" + return + tc:is-endpoint-http200($url) +}; + +declare + (: check if all parts are present. + : no further tests are needed since the content has been tested while testing + : the underlying function. :) + %test:assertXPath("map:contains($result, 'partOf')") + %test:assertXPath("map:contains($result, 'items')") + %test:assertXPath("map:contains($result, 'startIndex')") + %test:assertXPath("map:contains($result, 'prev')") + %test:assertXPath("map:contains($result, 'next')") + %test:assertXPath("map:contains($result, 'id')") +function art:endpoint-item-annotationPage() +as item() { + let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationPage.json" + let $req := + + + return + http:send-request($req)[2] + => util:base64-decode() + => parse-json() + => map:get("annotationPage") +}; -- GitLab From 8ed464e10470f8c4eb7c9d3294be6b31783d03bd Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 16 Nov 2020 15:56:35 +0100 Subject: [PATCH 085/155] chore: remove unnecessary comments --- .../AnnotationAPI/annotations-rest.xqm | 4 --- .../modules/AnnotationAPI/annotations.xqm | 28 ------------------- 2 files changed, 32 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations-rest.xqm b/exist-app/modules/AnnotationAPI/annotations-rest.xqm index e54e843..654ed2c 100644 --- a/exist-app/modules/AnnotationAPI/annotations-rest.xqm +++ b/exist-app/modules/AnnotationAPI/annotations-rest.xqm @@ -38,7 +38,6 @@ declare variable $anno-rest:server := : @param $collection The URI of the collection, e.g. '3r132' : @return An Annotation Collecion for the given collection :) -(: ## tested ## :) declare %rest:GET %rest:HEAD @@ -62,7 +61,6 @@ function anno-rest:collection-rest($collection as xs:string) { : @param $collection The URI of the Collection Object : @param $document The URI of an aggregated Collection or Manifest Object :) -(: ## tested ## :) declare %rest:GET %rest:HEAD @@ -93,7 +91,6 @@ $document as xs:string) { : @param $document The URI of an aggregated Collection or Manifest Object : @return An Annotation Collecion for the given Collection or Manifest Object :) -(: ## tested ## :) declare %rest:GET %rest:HEAD @@ -184,7 +181,6 @@ as item()+ { : @param $resources The URIs of resource's requested in an API call : @return The response header :) -(: ## tested ## :) declare function anno-rest:get-404-header($resources as xs:string+) as element() { diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index e4cf511..60204a2 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -73,7 +73,6 @@ declare variable $anno:uris := : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) -(: ## tested ## :) declare function anno:make-annotationCollection($collection as xs:string, $document as xs:string?, $server as xs:string) @@ -115,7 +114,6 @@ as map() { : @param The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) -(: ## tested ## :) declare function anno:get-information-for-collection-object($collectionURI as xs:string, $server as xs:string) as map() { @@ -137,7 +135,6 @@ as map() { : @param $uri The resource's URI : @return The resource's title :) -(: ## tested ## :) declare function anno:get-metadata-title($uri as xs:string) as xs:string { commons:get-document($uri, "meta")//tgmd:title/string() @@ -152,7 +149,6 @@ as xs:string { : @param $first-entry The IRI of the first Annotation Page that is included within the Collection : @param $last-entry The IRI of the last Annotation Page that is included within the Collection :) -(: ## tested ## :) declare function anno:make-annotationCollection-map($uri as xs:string, $title as xs:string, $first-entry as xs:string, @@ -182,7 +178,6 @@ as map() { : @return A string containing the creators of the annotations as stated in the : TEI header of the (underlying) resource(s). :) -(: ## tested ## :) declare function anno:get-creator($uri as xs:string) as xs:string { let $xmls := @@ -214,7 +209,6 @@ as xs:string { : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) -(: ## tested ## :) declare function anno:make-annotationPage($collection as xs:string, $document as xs:string, $server as xs:string) @@ -267,7 +261,6 @@ as map() { : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server :) -(: ## tested ## :) declare function anno:make-annotationCollection-for-manifest($collection as xs:string, $document as xs:string, $page as xs:string, @@ -305,7 +298,6 @@ as map() { : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server :) -(: ## tested ## :) declare function anno:make-annotationPage-for-manifest($collection as xs:string, $document as xs:string, $page as xs:string, @@ -356,7 +348,6 @@ as map() { : @param $teixml-uri The XML's URI. : @param $page The page within an XML file, i.e. a tei:pb/@n within a TEI resource :) -(: ## tested ## :) declare function anno:get-annotations($teixml-uri as xs:string, $page as xs:string) as map()* { @@ -385,7 +376,6 @@ as map()* { : @param $documentURI The resource's URI. Attention: This refers to the TEI file itself! : @param $page The page to be returned as tei:pb/@n/string() :) -(: ## tested ## :) declare function anno:get-page-fragment($documentURI as xs:string, $page as xs:string) as element(tei:TEI) { @@ -403,7 +393,6 @@ as element(tei:TEI) { : @param $uri The resource's URI : @return The number of annotations that are associated with the $uri :) -(: ## tested ## :) declare function anno:get-total-no-of-annotations($uri as xs:string) as xs:integer { let $map-entry-for-uri := anno:find-in-map($anno:uris, $uri) @@ -433,7 +422,6 @@ as xs:integer { : @param $map A part of the $anno:uris map : @return All values of the lowest $map level :) -(: ## tested ## :) declare function anno:get-all-xml-uris-for-submap($map as map()) as xs:string* { let $get-values := function($key, $value){$value} @@ -458,7 +446,6 @@ as xs:string* { : @param $id The node ID of the annotation. It is equivalent to generate-id($annotation) : @return A map containing the target information :) -(: ## tested ## :) declare function anno:get-target-information($annotation as node(), $documentURI as xs:string, $id as xs:string) @@ -479,7 +466,6 @@ as map(*) { : @param $annotation The node which serves as a basis for the annotation : @return The content of bodyValue. :) -(: ## tested ## :) declare function anno:get-bodyValue($annotation as node()) as xs:string { switch ($annotation/local-name()) @@ -495,7 +481,6 @@ as xs:string { : @param $resources The URI of the resources to be checked : @return true() if all resources are available :) -(: ## tested ## :) declare function anno:are-resources-available($resources as xs:string+) as xs:boolean { let $availability := @@ -517,7 +502,6 @@ as xs:boolean { : @param $key The key whose value is to be returned : @return The value of the given $key :) -(: ## tested ## :) declare function anno:find-in-map($map as map(), $key as xs:string) as item()? { @@ -550,7 +534,6 @@ as item()? { : @param $type "prev" for getting the previous page, "next" for getting the next page : @return :) -(: ## tested ## :) declare function anno:get-prev-or-next-annotationPage-ID($collection as xs:string, $document as xs:string, $type as xs:string) @@ -560,7 +543,6 @@ as xs:string? { anno:get-prev-or-next($collection-keys, $document, $type) }; -(: ## tested ## :) declare function anno:get-prev-or-next($entities as item()+, $searched-for as xs:string, $type as xs:string) @@ -583,7 +565,6 @@ as xs:string? { () }; -(: ## tested ## :) declare function anno:get-prev-or-next-annotationPage-url($collection as xs:string, $document as xs:string?, $page as xs:string?, @@ -607,7 +588,6 @@ as xs:string? { : @param $uri The resource's URI : @return true() if resources stated by $uri is a TEI/XML resource :) - (: ## tested ## :) declare function anno:is-resource-xml($uri as xs:string) as xs:boolean { commons:get-document($uri, "meta")//tgmd:format = "text/xml" }; @@ -620,7 +600,6 @@ declare function anno:is-resource-xml($uri as xs:string) as xs:boolean { : @param $uri The resource's URI : @return true() if resources stated by $uri is an edition object :) -(: ## tested ## :) declare function anno:is-resource-edition($map as map(), $uri as xs:string) as xs:boolean { @@ -633,7 +612,6 @@ as xs:boolean { : @param $documentURI The TEI resource's URI : @return A sequence of all page breaks occuring in the resource :) - (: ## tested ## :) declare function anno:get-pages-in-TEI($documentURI as xs:string) as xs:string+ { commons:get-document($documentURI, "data")//tei:pb[@facs]/@n/string() }; @@ -647,7 +625,6 @@ declare function anno:get-pages-in-TEI($documentURI as xs:string) as xs:string+ : @param $page The @n attribute of the current page break/tei:pb : @param $type "prev" for the previous, "next" for the next page break :) -(: ## tested ## :) declare function anno:get-prev-or-next-page($manifest-uri as xs:string, $page as xs:string, $type as xs:string) @@ -670,7 +647,6 @@ as xs:string? { : @param $uri The URI of the current resource. This may refer to a edition or TEI/XML. : @return A list of URIs that appear before the given resource in a collection :) -(: ## tested ## :) declare function anno:get-xmls-prev-in-collection($uri as xs:string) as xs:string* { if (anno:is-resource-xml($uri)) then @@ -697,7 +673,6 @@ as xs:string* { : @param $uri The URI of the current edition : @return A list of all URIs of TEI resources that appear before the given edition in a collection :) -(: ## tested ## :) declare function anno:get-prev-xml-uris($uri as xs:string) as xs:string* { let $collection := anno:get-parent-aggregation($uri) @@ -721,7 +696,6 @@ as xs:string* { : @param $uri The resource's URI : @return The URI of the given resource's parent aggregation :) -(: ## tested ## :) declare function anno:get-parent-aggregation($uri as xs:string) as xs:string? { if (collection($commons:agg)[.//@rdf:resource = "textgrid:" || $uri]) then @@ -745,7 +719,6 @@ as xs:string? { : an edition. : @return The relative position of the first annotation :) -(: ## tested ## :) declare function anno:determine-start-index($uri as xs:string) as xs:integer { let $resourceType := commons:get-document($uri, "meta")//tgmd:format @@ -788,7 +761,6 @@ as xs:integer { : @param $page The @n attribute of the current tei:pb : @return The relative position of the first annotation :) -(: ## tested ## :) declare function anno:determine-start-index-for-page($uri as xs:string, $page as xs:string) as xs:integer { -- GitLab From 12e129614ccb0eb5559a747eda8e80b5ec25ad18 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 17 Nov 2020 08:12:03 +0100 Subject: [PATCH 086/155] ci: consider new test output format --- get-unit-test-failures-and-errors.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/get-unit-test-failures-and-errors.sh b/get-unit-test-failures-and-errors.sh index 60b48dc..6d57802 100755 --- a/get-unit-test-failures-and-errors.sh +++ b/get-unit-test-failures-and-errors.sh @@ -1,13 +1,5 @@ #!/bin/bash -failures=$(xmllint --xpath '/tests/testsuites/testsuite/@failures' exist-app/test/ahikar-test-results.xml | egrep -o "[0-9]+") -errors=$(xmllint --xpath '/tests/testsuites/testsuite/@errors' exist-app/test/ahikar-test-results.xml | egrep -o "[0-9]+") +PROBLEMS=$(xmllint --xpath 'count(/tests/PROBLEM)' exist-app/test/ahikar-test-results.xml) -problem_sum=0 - -for FAILURE in $failures $errors -do - let problem_sum+=$FAILURE -done - -echo $problem_sum +echo $PROBLEMS -- GitLab From 62c3981ac481b131ba53b8537db76ff9f15ea61f Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 17 Nov 2020 08:14:07 +0100 Subject: [PATCH 087/155] refactor: move fragment retrieval to commons --- .../modules/AnnotationAPI/annotations.xqm | 3 +- exist-app/modules/commons.xqm | 58 +++++++++++++++++- exist-app/modules/tapi-html.xqm | 59 +------------------ exist-app/tests/commons-tests.xqm | 33 +++++++++++ exist-app/tests/tapi-html-tests.xqm | 38 +----------- 5 files changed, 93 insertions(+), 98 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index 60204a2..146953b 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -20,7 +20,6 @@ declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../commons.xqm"; import module namespace functx = "http://www.functx.com"; -import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "../tapi-html.xqm"; declare variable $anno:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations"; @@ -381,7 +380,7 @@ declare function anno:get-page-fragment($documentURI as xs:string, as element(tei:TEI) { let $nodeURI := commons:get-document($documentURI, "data")/base-uri() return - tapi-html:get-page-fragment($nodeURI, $page) + commons:get-page-fragment($nodeURI, $page) }; diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index 10d92bd..470e427 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -4,6 +4,9 @@ module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons"; declare namespace ore="http://www.openarchives.org/ore/terms/"; declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; +declare namespace tei="http://www.tei-c.org/ns/1.0"; + +import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milestone-chunk.xquery" at "fragment.xqm"; declare variable $commons:expath-pkg := doc("../expath-pkg.xml"); declare variable $commons:version := $commons:expath-pkg/*/@version; @@ -66,4 +69,57 @@ as xs:string* { $unprefixed-uri else () -}; \ No newline at end of file +}; + +declare function commons:get-page-fragment($tei-xml-base-uri as xs:string, + $page as xs:string) +as element() { + let $node := doc($tei-xml-base-uri)/* + => commons:add-IDs(), + $start-node := $node//tei:pb[@n = $page and @facs], + $end-node := commons:get-end-node($start-node), + $wrap-in-first-common-ancestor-only := false(), + $include-start-and-end-nodes := true(), + $empty-ancestor-elements-to-include := ("") + + return + fragment:get-fragment-from-doc( + $node, + $start-node, + $end-node, + $wrap-in-first-common-ancestor-only, + $include-start-and-end-nodes, + $empty-ancestor-elements-to-include) +}; + +declare function commons:add-IDs($nodes as node()*) +as node()* { + for $node in $nodes return + typeswitch ($node) + + case text() return + $node + + case comment() return + () + + case processing-instruction() return + $node + + default return + element {QName("http://www.tei-c.org/ns/1.0", local-name($node))} { + attribute id {generate-id($node)}, + $node/@*, + commons:add-IDs($node/node()) + } +}; + +declare function commons:get-end-node($start-node as element(tei:pb)) +as element() { + let $following-pb := $start-node/following::tei:pb[1][@facs] + return + if($following-pb) then + $following-pb + else + $start-node/following::tei:ab[last()] +}; diff --git a/exist-app/modules/tapi-html.xqm b/exist-app/modules/tapi-html.xqm index 920be10..5c8bcf0 100644 --- a/exist-app/modules/tapi-html.xqm +++ b/exist-app/modules/tapi-html.xqm @@ -10,7 +10,6 @@ declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace xhtml="http://www.w3.org/1999/xhtml"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; -import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milestone-chunk.xquery" at "fragment.xqm"; import module namespace tei2html="http://ahikar.sub.uni-goettingen.de/ns/tei2html" at "tei2html.xqm"; (:~ @@ -26,7 +25,7 @@ as element(div) { let $tei-xml-base-uri := $commons:data || $tei-xml-uri || ".xml" let $fragment := if ($page) then - tapi-html:get-page-fragment($tei-xml-base-uri, $page) + commons:get-page-fragment($tei-xml-base-uri, $page) else doc($tei-xml-base-uri)/* return @@ -34,62 +33,6 @@ as element(div) { }; -declare function tapi-html:get-page-fragment($tei-xml-base-uri as xs:string, - $page as xs:string) -as element() { - let $node := doc($tei-xml-base-uri)/* - => tapi-html:add-IDs(), - $start-node := $node//tei:pb[@n = $page and @facs], - $end-node := tapi-html:get-end-node($start-node), - $wrap-in-first-common-ancestor-only := false(), - $include-start-and-end-nodes := true(), - $empty-ancestor-elements-to-include := ("") - - return - fragment:get-fragment-from-doc( - $node, - $start-node, - $end-node, - $wrap-in-first-common-ancestor-only, - $include-start-and-end-nodes, - $empty-ancestor-elements-to-include) -}; - - -declare function tapi-html:add-IDs($nodes as node()*) -as node()* { - for $node in $nodes return - typeswitch ($node) - - case text() return - $node - - case comment() return - () - - case processing-instruction() return - $node - - default return - element {QName("http://www.tei-c.org/ns/1.0", local-name($node))} { - attribute id {generate-id($node)}, - $node/@*, - tapi-html:add-IDs($node/node()) - } -}; - - -declare function tapi-html:get-end-node($start-node as element(tei:pb)) -as element() { - let $following-pb := $start-node/following::tei:pb[1][@facs] - return - if($following-pb) then - $following-pb - else - $start-node/following::tei:ab[last()] -}; - - declare function tapi-html:get-html-from-fragment($fragment as element()) as element(xhtml:div) { (: this wrapping is necessary in order to correctly set the namespace. diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index 773d970..7908328 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -10,6 +10,7 @@ import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; declare variable $ct:restxq := "http://0.0.0.0:8080/exist/restxq/"; +declare variable $ct:base-uri := "/db/apps/sade/textgrid/data/sample_teixml.xml"; declare %test:args("sample_edition") %test:assertEquals("sample_teixml") @@ -45,3 +46,35 @@ function ct:get-available-aggregates($uri as xs:string) as xs:string+ { commons:get-available-aggregates($uri) }; + +declare + %test:assertXPath("$result//@id = 'N4'") +function ct:add-IDs() +as node()+ { + let $manifest := doc($commons:data || "sample_teixml.xml")/* + return + commons:add-IDs($manifest) +}; + + +declare + %test:args("82a") %test:assertXPath("$result[local-name(.) = 'pb']") + %test:args("82a") %test:assertXPath("$result/@facs = 'textgrid:3r1p0'") + %test:args("82a") %test:assertXPath("$result/@n = '82b'") + %test:args("84a") %test:assertXPath("$result[local-name(.) = 'ab']") + %test:args("84a") %test:assertXPath("matches($result, 'ܢܕܢ')") +function ct:get-end-node($page as xs:string) +as item()+ { + let $node := doc($ct:base-uri)/* + let $start-node := $node//tei:pb[@n = $page and @facs] + return + commons:get-end-node($start-node) +}; + + +declare + %test:args("82a") %test:assertXPath("$result//*[local-name(.) = 'add'][@place = 'margin'] = 'حقًا'") +function ct:get-page-fragment($page as xs:string) +as element() { + commons:get-page-fragment($ct:base-uri, $page) +}; diff --git a/exist-app/tests/tapi-html-tests.xqm b/exist-app/tests/tapi-html-tests.xqm index 166b087..9ad50bd 100644 --- a/exist-app/tests/tapi-html-tests.xqm +++ b/exist-app/tests/tapi-html-tests.xqm @@ -9,48 +9,12 @@ import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "../modules/tapi-html.xqm"; - -declare - %test:assertXPath("$result//@id = 'N4'") -function thtmlt:add-IDs() -as node()+ { - let $manifest := doc($commons:data || "sample_teixml.xml")/* - return - tapi-html:add-IDs($manifest) -}; - - -declare - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result[local-name(.) = 'pb']") - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result/@facs = 'textgrid:3r1p0'") - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result/@n = '82b'") - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "84a") %test:assertXPath("$result[local-name(.) = 'ab']") - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "84a") %test:assertXPath("matches($result, 'ܢܕܢ')") -function thtmlt:get-end-node($tei-xml-base-uri as xs:string, - $page as xs:string) -as item()+ { - let $node := doc($tei-xml-base-uri)/* - let $start-node := $node//tei:pb[@n = $page and @facs] - return - tapi-html:get-end-node($start-node) -}; - - -declare - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result//*[local-name(.) = 'add'][@place = 'margin'] = 'حقًا'") -function thtmlt:get-page-fragment($tei-xml-base-uri as xs:string, - $page as xs:string) -as element() { - tapi-html:get-page-fragment($tei-xml-base-uri, $page) -}; - - declare %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result//text()[matches(., 'حقًا')]") function thtmlt:transform-fragment($tei-xml-base-uri as xs:string, $page as xs:string) as element(xhtml:div) { - let $fragment := tapi-html:get-page-fragment($tei-xml-base-uri, $page) + let $fragment := commons:get-page-fragment($tei-xml-base-uri, $page) return tapi-html:get-html-from-fragment($fragment) }; -- GitLab From 5526c629c91fa7ed989eb7854260167200205fb9 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 17 Nov 2020 08:29:06 +0100 Subject: [PATCH 088/155] chore: bump version number --- exist-app/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/build.properties b/exist-app/build.properties index 3049be6..ca3035b 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.1.0 +project.version=2.3.0 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From e6d1c1ce1402602dbd98d0a33c5e8cb62bee588d Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 17 Nov 2020 09:25:12 +0100 Subject: [PATCH 089/155] ci: make YML modular to increase clarity --- .gitlab-ci.yml | 68 +++------------------------------------ ci-scripts/.api_tests.yml | 67 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 64 deletions(-) create mode 100644 ci-scripts/.api_tests.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3bdd583..e7e807e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,10 +4,13 @@ stages: - package - deploy_docker - deploy_app - - test + - api_tests - release - reassign_labels +include: + - '/ci-scripts/.api_tests.yml' + ## TEMPLATES: .ssh-config: &ssh - which ssh-agent @@ -183,69 +186,6 @@ deploy_app-main: script: - curl --get --silent https://ahikar.sub.uni-goettingen.de/api/deploy -# this serves for checking if a commit has accidentally broken the API -test_api_status-test: - image: docker.gitlab.gwdg.de/mrodzis/test - stage: test - except: - - main - - tags - - develop - script: - - header=$(curl --head -s https://ahikar-test.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) - - status=$(echo $header | head -n 1 | cut -d" " -f 2) - - echo "Current HTTP status is $status." - - if [[ "$status" == "200" ]]; then exit 0; else exit 1; fi - -test_api_status-develop: - image: docker.gitlab.gwdg.de/mrodzis/test - stage: test - only: - - develop - script: - - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) - - status=$(echo $header | head -n 1 | cut -d" " -f 2) - - echo "Current HTTP status is $status." - - if [[ "$status" == "200" ]]; then exit 0; else exit 1; fi - -test_api_status-main: - image: docker.gitlab.gwdg.de/mrodzis/test - stage: test - only: - - main - script: - - header=$(curl --head -s https://ahikar.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) - - status=$(echo $header | head -n 1 | cut -d" " -f 2) - - echo "Current HTTP status is $status." - - if [[ "$status" == "200" ]]; then exit 0; else exit 1; fi - retry: 2 - -full_plain_text_api_status-test: - image: docker.gitlab.gwdg.de/mrodzis/test - stage: test - except: - - main - - tags - - develop - script: - - header=$(curl --head --silent https://ahikar-test.sub.uni-goettingen.de/api/content/ahikar-plain-text.zip) - -full_plain_text_api_status-develop: - image: docker.gitlab.gwdg.de/mrodzis/test - stage: test - only: - - develop - script: - - header=$(curl --head --silent https://ahikar-dev.sub.uni-goettingen.de/api/content/ahikar-plain-text.zip) - -full_plain_text_api_status-main: - image: docker.gitlab.gwdg.de/mrodzis/test - stage: test - only: - - main - script: - - header=$(curl --head --silent https://ahikar.sub.uni-goettingen.de/api/content/ahikar-plain-text.zip) - # when a git flow release is made, a tag will be pushed starting this job. it # will keep the resulting artifact from job number one and it will set up a # Gitlab release at the repo. therefore the merge message starting at the release diff --git a/ci-scripts/.api_tests.yml b/ci-scripts/.api_tests.yml new file mode 100644 index 0000000..c856fff --- /dev/null +++ b/ci-scripts/.api_tests.yml @@ -0,0 +1,67 @@ +# Templates + +.job_definition: &job_definition + image: docker.gitlab.gwdg.de/mrodzis/test + stage: api_test + +.check_HTTP_status: &check_HTTP_status + - status=$(echo $header | head -n 1 | cut -d" " -f 2) + - echo "Current HTTP status is $status." + - if [[ "$status" == "200" ]]; then exit 0; else exit 1; fi + + +# TextAPI + +test_api_status-test: + <<: *job_definition + except: + - main + - tags + - develop + script: + - header=$(curl --head -s https://ahikar-test.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - *check_HTTP_status + +test_api_status-develop: + <<: *job_definition + only: + - develop + script: + - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - *check_HTTP_status + +test_api_status-main: + <<: *job_definition + only: + - main + script: + - header=$(curl --head -s https://ahikar.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - *check_HTTP_status + retry: 2 + +# AnnotationAPI + +# API for ZIPs + +full_plain_text_api_status-test: + <<: *job_definition + except: + - main + - tags + - develop + script: + - header=$(curl --head --silent https://ahikar-test.sub.uni-goettingen.de/api/content/ahikar-plain-text.zip) + +full_plain_text_api_status-develop: + <<: *job_definition + only: + - develop + script: + - header=$(curl --head --silent https://ahikar-dev.sub.uni-goettingen.de/api/content/ahikar-plain-text.zip) + +full_plain_text_api_status-main: + <<: *job_definition + only: + - main + script: + - header=$(curl --head --silent https://ahikar.sub.uni-goettingen.de/api/content/ahikar-plain-text.zip) -- GitLab From 1c53e4fd8809925d78955cdaa25f1a62e034588e Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 17 Nov 2020 09:27:08 +0100 Subject: [PATCH 090/155] ci: fix typo --- ci-scripts/.api_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/.api_tests.yml b/ci-scripts/.api_tests.yml index c856fff..34e178a 100644 --- a/ci-scripts/.api_tests.yml +++ b/ci-scripts/.api_tests.yml @@ -2,7 +2,7 @@ .job_definition: &job_definition image: docker.gitlab.gwdg.de/mrodzis/test - stage: api_test + stage: api_tests .check_HTTP_status: &check_HTTP_status - status=$(echo $header | head -n 1 | cut -d" " -f 2) -- GitLab From ab0412326de7fb3668d0bf3b37b2e2072941fcb3 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 18 Nov 2020 07:19:13 +0100 Subject: [PATCH 091/155] refactor: remove surplus variables --- exist-app/modules/tapi-txt.xqm | 2 -- 1 file changed, 2 deletions(-) diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index f89a4b1..bcbeacb 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -25,8 +25,6 @@ declare variable $tapi-txt:milestone-types := "sayings", "second_narrative_section", "parables", - "parables_1", - "parables_2", "third_narrative_section"); -- GitLab From 009111b57a53e9bfa3a5e14e60aedb1148947d0a Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 18 Nov 2020 08:20:39 +0100 Subject: [PATCH 092/155] feat: create txt for every narrative section Independent of whether it exists in a manuscript or not. --- exist-app/modules/tapi-txt.xqm | 45 +++++++++++++++++------------- exist-app/tests/tapi-txt-tests.xqm | 19 ++++++++++--- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index bcbeacb..f07ed7c 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -32,13 +32,10 @@ declare function tapi-txt:main() as xs:string+ { tapi-txt:create-txt-collection-if-not-available(), for $text in tapi-txt:get-transcriptions-and-transliterations() return - for $milestone-type in tapi-txt:get-milestone-types-per-text($text) return + for $milestone-type in $tapi-txt:milestone-types return let $relevant-text := tapi-txt:get-relevant-text($text, $milestone-type) return - if (matches($relevant-text, "\w")) then - xmldb:store($tapi-txt:txt, tapi-txt:make-file-name($text, $milestone-type), $relevant-text, "text/plain") - else - () + xmldb:store($tapi-txt:txt, tapi-txt:make-file-name($text, $milestone-type), $relevant-text, "text/plain") }; declare function tapi-txt:get-milestone-types-per-text($text as element(tei:text)) @@ -135,28 +132,38 @@ declare function tapi-txt:get-relevant-text($text as element(tei:text), $milestone-type as xs:string) as xs:string { let $chunk := tapi-txt:get-chunk($text, $milestone-type) + (: this filler is needed where tapi-txt:get-relevant-text-from-chunks is + empty because a manuscript doesn't have any text in the section of $milestone-type. + nevertheless, we want this manuscript to be part of the collation in order + to quickly see that said text is missing. however, compress:zip does not + allow for empty files, so we insert at least a white space in the file. :) + let $filler := " " return - tapi-txt:get-relevant-text-from-chunks($chunk) + $filler || tapi-txt:get-relevant-text-from-chunks($chunk) }; +(:~ + : this function returns an empty tei:TEI element if the narrative section + : searched for via $milestone-type does not exist in a manuscript. + :) declare function tapi-txt:get-chunk($text as element(tei:text), $milestone-type as xs:string) as element(tei:TEI) { let $root := $text/root() - (: the positional predicate must only be provided as long as there are - several milestones of the same unit in a text. - as soon as we have found a solution for this, this predicate should be - removed. :) - let $milestone := $text//tei:milestone[@unit = $milestone-type][1] - let $end-of-chunk := tapi-txt:get-end-of-chunk($milestone) + let $milestone := $text//tei:milestone[@unit = $milestone-type] return - fragment:get-fragment-from-doc( - $root, - $milestone, - $end-of-chunk, - false(), - true(), - ("")) + if (exists($milestone)) then + let $end-of-chunk := tapi-txt:get-end-of-chunk($milestone) + return + fragment:get-fragment-from-doc( + $root, + $milestone, + $end-of-chunk, + false(), + true(), + ("")) + else + element {QName("http://www.tei-c.org/ns/1.0", "TEI")} {text{" "}} }; declare function tapi-txt:get-end-of-chunk($milestone as element(tei:milestone)) diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index 455b2aa..cb90097 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -40,13 +40,23 @@ as element(tei:milestone)? { declare %test:assertExists %test:assertXPath("$result//*[local-name(.) = 'ab']") -function ttt:get-chunk() +function ttt:get-chunk-successs() as element(tei:TEI) { let $milestone-type := "first_narrative_section" return tapi-txt:get-chunk($ttt:sample-transliteration, $milestone-type) }; +declare + %test:assertExists + %test:assertXPath("not($result//*)") +function ttt:get-chunk-fail() +as element(tei:TEI) { + let $milestone-type := "third_narrative_section" + return + tapi-txt:get-chunk($ttt:sample-transliteration, $milestone-type) +}; + declare %test:assertEquals("some text that should be used display some text without a space") @@ -271,9 +281,10 @@ as xs:string { }; declare - %test:args("first_narrative_section") %test:assertEquals("text of the first narrative section") - %test:args("sayings") %test:assertEquals("some sayings") -function ttt:get-relevant-text($milestone-type as xs:string) { + %test:args("first_narrative_section") %test:assertEquals(" text of the first narrative section") + %test:args("sayings") %test:assertEquals(" some sayings") +function ttt:get-relevant-text($milestone-type as xs:string) +as xs:string { let $TEI := -- GitLab From b7c524f85f3fe17309201813f5fb7d6374de4edd Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 19 Nov 2020 07:09:33 +0100 Subject: [PATCH 093/155] fix: bug in annotation server URL --- exist-app/modules/AnnotationAPI/annotations-rest.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/modules/AnnotationAPI/annotations-rest.xqm b/exist-app/modules/AnnotationAPI/annotations-rest.xqm index 654ed2c..1e6b614 100644 --- a/exist-app/modules/AnnotationAPI/annotations-rest.xqm +++ b/exist-app/modules/AnnotationAPI/annotations-rest.xqm @@ -25,7 +25,7 @@ declare variable $anno-rest:server := } catch * { true() }) - then doc("../expath-pkg.xml")/*/@name => replace("/$", "") + then $commons:expath-pkg/*/@name => replace("/$", "") else "http://localhost:8094/exist/restxq"; (:~ -- GitLab From ecafa6efe2fb93cdab1e5f6563022493fd3c477d Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 19 Nov 2020 14:57:52 +0100 Subject: [PATCH 094/155] fix: consider normalization in txt creation --- exist-app/modules/tapi-txt.xqm | 2 ++ exist-app/tests/tapi-txt-normalization-tests.xqm | 2 +- exist-app/tests/tests-runner.xq | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index f07ed7c..8bf0562 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -16,6 +16,7 @@ declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milestone-chunk.xquery" at "fragment.xqm"; +import module namespace norm="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/normalization" at "tapi-txt-normalization.xqm"; declare variable $tapi-txt:textgrid := "/db/apps/sade/textgrid"; declare variable $tapi-txt:data := $tapi-txt:textgrid || "/data"; @@ -242,6 +243,7 @@ as xs:string { => replace(" @", "") => replace("[\p{P}\n+]", "") => replace("\s+", " ") + => norm:get-txt-without-diacritics() }; diff --git a/exist-app/tests/tapi-txt-normalization-tests.xqm b/exist-app/tests/tapi-txt-normalization-tests.xqm index 06f84c1..504a09c 100644 --- a/exist-app/tests/tapi-txt-normalization-tests.xqm +++ b/exist-app/tests/tapi-txt-normalization-tests.xqm @@ -62,7 +62,7 @@ declare function local:create-and-store-test-data() { let $mix := for $iii in 1 to 10 return - insert-before(($norm:arabic-tashkil-and-combining-marks, $norm:syriac-vowels), $iii * 3, $txt-cps[$iii]) + insert-before(($norm:syriac-vowels), $iii * 3, $txt-cps[$iii]) let $mix-str := codepoints-to-string($mix) return xmldb:store-as-binary("/db/tmp", "test.txt", $mix-str) diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index ee71734..a7aaa64 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -15,7 +15,7 @@ import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifes import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "tapi-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "tei2html-textprocessing-tests.xqm"; - +import module namespace ttnt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/normalization/tests" at "tapi-txt-normalization-tests.xqm"; let $test-results := ( @@ -27,7 +27,8 @@ let $test-results := test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/normalization/tests")) ) for $result in $test-results return -- GitLab From 04610a47cc374cb020f88a49a0ac9fd677566ecc Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 3 Dec 2020 07:44:41 +0100 Subject: [PATCH 095/155] feat: update viewer name, minor corrections --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78dbfa3..41cb2f8 100644 --- a/README.md +++ b/README.md @@ -114,9 +114,9 @@ docker-compose --env-file docker/.env --file docker/docker-compose.yml up --deta ## Connecting the Backend with the Frontend -The corresponding frontend for the Ahiwar backend is the [EMo viewer](https://gitlab.gwdg.de/subugoe/emo/Qviewer). +The corresponding frontend for the Ahiqar backend is [Ahiqar's version of the TIDO viewer](https://gitlab.gwdg.de/subugoe/ahiqar/frontend). In order to connect it with the simply has to expose a REST API that complies to the specification of the [SUB's generic TextAPI](https://subugoe.pages.gwdg.de/emo/text-api/) -The frontend takes care of the data transfer as described in the [frontend's README](https://gitlab.gwdg.de/subugoe/emo/Qviewer/-/blob/develop/README.md#connecting-the-viewer-with-a-backend). +The frontend takes care of the data transfer as described in [TIDO's README](https://gitlab.gwdg.de/subugoe/emo/Qviewer/-/blob/develop/README.md#connecting-the-viewer-with-a-backend). ## API documentation -- GitLab From de97a3929a46639b70b6133f18025d7ebacfade3 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 3 Dec 2020 13:14:24 +0100 Subject: [PATCH 096/155] feat: introduce example with Latin alphabet --- exist-app/data/kant_sample.xml | 97 ++++++++++++++++++++++++++++++++++ exist-app/post-install.xq | 3 +- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 exist-app/data/kant_sample.xml diff --git a/exist-app/data/kant_sample.xml b/exist-app/data/kant_sample.xml new file mode 100644 index 0000000..3235dcc --- /dev/null +++ b/exist-app/data/kant_sample.xml @@ -0,0 +1,97 @@ + + + + + + The Story and Proverbs of Ahiqar the Wise + Simon Birol + Aly Elrefaei + + + Georg-August Universität Göttingen, Theologische Fakultät, Seminar für Altes Testament + + + + + + Vatican + + Vatican Library + Borg. ar. 201 + + + + + + + + + codex + 19th century + + + + + Graf, GCAL I, p. 218; Delio V. Proverbio, Turcica Vaticana. Città del Vaticano (Biblioteca Apostolica Vaticana, 2010), p. 199. + E. Tisserant, Inventaire sommaire des manuscrits arabes du fonds Borgia à la Bibliothèque Vaticane, in Miscellanea Francesco Ehrle. Scritti di storia e paleografia pubblicati sotto gli auspici di S. S. Pio XI in occasione dell'ottantesimo natalizio dell'E.mo cardinale Francesco Ehrle, V: Biblioteca ed Archivio Vaticano. Biblioteche diverse, Roma 1924, pp. 1-34 (20). + + + + + + the last two sections of the story including Ahikar return to Assyria and his parables are missing from the MS. + + + + proverb + prose + + + + Arabic + Classical Syriac + English + Latin + Karshuni + Western Syriac + Eastern Syriac + + + + + color: red; + Serto Jerusalem + + + + + + Convertion to specified TEI by SUB Göttingen + + + + + + + + + + + + + + + Daß alle unsere Erkenntnis mit der Erfahrung anfange, daran + + + Wenn aber gleich alle unsere Erkenntnis mit der Erfahrung anhebt, so entspringt sie darum doch nicht eben + + + + Es ist also wenigstens eine der näheren Untersuchung noch benötigte und nicht auf den + + + + + + \ No newline at end of file diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index b8e8e62..46520c1 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -71,7 +71,8 @@ return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), "ahiqar_images.xml", "ahiqar_images_meta.xml", "ahiqar_collection.xml", - "ahiqar_collection_meta.xml") + "ahiqar_collection_meta.xml", + "kant_sample.xml") return ( for $file in $files return -- GitLab From 440819a1bbd80e4c262b3be9ed8a3d475d997ffa Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 3 Dec 2020 13:21:39 +0100 Subject: [PATCH 097/155] fix: bug in finding the end of a chunk --- exist-app/modules/tapi-txt.xqm | 11 +++-- exist-app/tests/tapi-txt-tests.xqm | 71 +++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 7 deletions(-) diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index 8bf0562..cc5ba85 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -54,8 +54,7 @@ as xs:string? { declare function tapi-txt:get-transcriptions-and-transliterations() as element(tei:text)+ { - collection($tapi-txt:data)//tei:text[@type = ("transcription", "transliteration")] - [tapi-txt:has-text-milestone(.)] + collection($tapi-txt:data)//tei:text[@type = ("transcription", "transliteration")][tapi-txt:has-text-milestone(.)] }; declare function tapi-txt:has-text-milestone($text as element(tei:text)) @@ -168,8 +167,8 @@ as element(tei:TEI) { }; declare function tapi-txt:get-end-of-chunk($milestone as element(tei:milestone)) -as node() { - if (tapi-txt:has-following-milestone($milestone)) then +as element() { + if (tapi-txt:has-following-milestone($milestone)) then tapi-txt:get-next-milestone($milestone) else $milestone/ancestor::tei:text[1]/tei:body/child::*[last()] @@ -177,12 +176,12 @@ as node() { declare function tapi-txt:has-following-milestone($milestone as element(tei:milestone)) as xs:boolean { - exists($milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) + exists($milestone/following::*[local-name(.) = 'milestone'][./ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]]) }; declare function tapi-txt:get-next-milestone($milestone as element(tei:milestone)) as element(tei:milestone)? { - $milestone/following::tei:milestone[ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]][1] + $milestone/following::*[local-name(.) = 'milestone'][./ancestor::tei:text[1] = $milestone/ancestor::tei:text[1]][1] }; declare function tapi-txt:get-relevant-text-from-chunks($chunks as element(tei:TEI)+) diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index cb90097..944fc51 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -8,10 +8,14 @@ import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" import module namespace tapi-txt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt" at "../modules/tapi-txt.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; + declare variable $ttt:sample-file := local:open-file("ahiqar_sample"); declare variable $ttt:sample-transliteration := $ttt:sample-file//tei:text[@type = "transliteration"]; declare variable $ttt:sample-transcription := $ttt:sample-file//tei:text[@type = "transcription"]; +declare variable $ttt:kant-sample := local:open-file("kant_sample"); +declare variable $ttt:kant-transcription := $ttt:kant-sample//tei:text[@type = "transcription"]; + declare %test:args("ahiqar_sample") %test:assertExists %test:args("1234") %test:assertError("org.exist.xquery.XPathException") @@ -498,9 +502,74 @@ as xs:base64Binary { if (xmldb:collection-available($commons:tg-collection || "/txt")) then tapi-txt:compress-to-zip() else - ( + ( let $prepare := tapi-txt:main() return tapi-txt:compress-to-zip() ) }; + +declare + %test:args("first_narrative_section") + %test:assertEquals(" Daß alle unsere Erkenntnis mit der Erfahrung anfange daran") + %test:args("sayings") + %test:assertEquals(" Wenn aber gleich alle unsere Erkenntnis mit der Erfahrung anhebt so entspringt sie darum doch nicht eben") + %test:args("second_narrative_section") + %test:assertEquals(" Es ist also wenigstens eine der näheren Untersuchung noch benötigte und nicht auf den") +function ttt:check-contents($chunk-type as xs:string) { + let $serialize := tapi-txt:main() + let $filepath := "/db/apps/sade/textgrid/txt/arabic--kant_sample-transcription-" || $chunk-type || ".txt" + return + util:binary-doc($filepath) + => util:base64-decode() +}; + +declare + %test:args("first_narrative_section") + %test:assertXPath("$result[local-name(.) = 'milestone'][@unit = 'sayings']") + %test:args("sayings") + %test:assertXPath("$result[local-name(.) = 'milestone'][@unit = 'second_narrative_section']") + %test:args("second_narrative_section") + %test:assertXPath("$result[local-name(.) = 'ab']") +function ttt:get-end-of-chunk-kant($type as xs:string) { + let $milestone := $ttt:kant-transcription//tei:milestone[@unit = $type] + return + tapi-txt:get-end-of-chunk($milestone) +}; + +declare + %test:args("first_narrative_section") + %test:assertXPath("$result//*[local-name(.) = 'ab'][count(../*[local-name(.) = 'ab']) = 1]/text() = 'Daß alle unsere Erkenntnis mit der Erfahrung anfange, daran '") + %test:args("sayings") + %test:assertXPath("$result//*[local-name(.) = 'ab'][count(../*[local-name(.) = 'ab']) = 1]/text() = 'Wenn aber gleich alle unsere Erkenntnis mit der Erfahrung anhebt, so entspringt sie darum doch nicht eben'") + %test:args("second_narrative_section") + %test:assertXPath("$result//*[local-name(.) = 'ab'][count(../*[local-name(.) = 'ab']) = 1]/text() = 'Es ist also wenigstens eine der näheren Untersuchung noch benötigte und nicht auf den'") +function ttt:get-chunk-kant($type as xs:string) { + tapi-txt:get-chunk($ttt:kant-transcription, $type) +}; + +declare + %test:args("first_narrative_section") + %test:assertEquals("Daß alle unsere Erkenntnis mit der Erfahrung anfange daran") + %test:args("sayings") + %test:assertEquals("Wenn aber gleich alle unsere Erkenntnis mit der Erfahrung anhebt so entspringt sie darum doch nicht eben") + %test:args("second_narrative_section") + %test:assertEquals("Es ist also wenigstens eine der näheren Untersuchung noch benötigte und nicht auf den") +function ttt:get-relevant-text-from-chunks($type as xs:string) +as xs:string { + let $chunk := tapi-txt:get-chunk($ttt:kant-transcription, $type) + return + tapi-txt:get-relevant-text-from-chunks($chunk) +}; + +declare + %test:args("first_narrative_section") + %test:assertEquals(" Daß alle unsere Erkenntnis mit der Erfahrung anfange daran") + %test:args("sayings") + %test:assertEquals(" Wenn aber gleich alle unsere Erkenntnis mit der Erfahrung anhebt so entspringt sie darum doch nicht eben") + %test:args("second_narrative_section") + %test:assertEquals(" Es ist also wenigstens eine der näheren Untersuchung noch benötigte und nicht auf den") +function ttt:get-relevant-text($type as xs:string) +as xs:string { + tapi-txt:get-relevant-text($ttt:kant-transcription, $type) +}; -- GitLab From 010a6586b27b6b581b36184607f4df61905fdcf2 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 3 Dec 2020 13:55:13 +0100 Subject: [PATCH 098/155] tests: remove test data --- exist-app/tests/tapi-txt-tests.xqm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index 944fc51..1842a66 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -16,6 +16,23 @@ declare variable $ttt:sample-transcription := $ttt:sample-file//tei:text[@type = declare variable $ttt:kant-sample := local:open-file("kant_sample"); declare variable $ttt:kant-transcription := $ttt:kant-sample//tei:text[@type = "transcription"]; +declare + %test:tearDown +function ttt:_test-teardown() { + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-first_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-sayings.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-second_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-third_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-parables.txt"), + + xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-first_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-sayings.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-second_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-third_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-parables.txt") + +}; + declare %test:args("ahiqar_sample") %test:assertExists %test:args("1234") %test:assertError("org.exist.xquery.XPathException") -- GitLab From 35a6ef2ef3d621ce1219d8623bc5311f412f40c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Wed, 6 Jan 2021 12:08:33 +0100 Subject: [PATCH 099/155] feat: round numeric values from TILE --- exist-app/modules/tapi-img.xqm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exist-app/modules/tapi-img.xqm b/exist-app/modules/tapi-img.xqm index be5c807..cee7052 100644 --- a/exist-app/modules/tapi-img.xqm +++ b/exist-app/modules/tapi-img.xqm @@ -108,10 +108,10 @@ as xs:string { declare function local:truncate($number-as-string as attribute()) as xs:string { - if (matches($number-as-string, "\.")) then - functx:get-matches($number-as-string, "\d+\.\d{1}") - else - $number-as-string/string() + $number-as-string + => substring-before("%") + => xs:decimal() + => format-number("0.00") (: will round last number; converts to string :) }; declare function tapi-img:get-relevant-image-section($manifest-uri as xs:string, -- GitLab From 437af3615ce3f6be027e63f31aafb23bf455ba29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Wed, 6 Jan 2021 13:10:31 +0100 Subject: [PATCH 100/155] tests: adjust for more precise sections --- exist-app/tests/tapi-img-tests.xqm | 4 ++-- exist-app/tests/tapi-item-tests.xqm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exist-app/tests/tapi-img-tests.xqm b/exist-app/tests/tapi-img-tests.xqm index afab48c..9e95fd4 100644 --- a/exist-app/tests/tapi-img-tests.xqm +++ b/exist-app/tests/tapi-img-tests.xqm @@ -80,7 +80,7 @@ as element() { }; declare - %test:assertEquals("50.0,0.4,49.8,100.0") + %test:assertEquals("50.03,0.48,49.83,100.00") function t:get-svg-section-dimensions-as-string() as xs:string { let $manifest-uri := "ahiqar_agg" @@ -92,7 +92,7 @@ as xs:string { }; declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("50.0,0.4,49.8,100.0") + %test:args("ahiqar_agg", "82a") %test:assertEquals("50.03,0.48,49.83,100.00") function t:get-relevant-image-section($manifest-uri as xs:string, $page-uri as xs:string) as xs:string { diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 901c20f..88fa5f6 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -24,7 +24,7 @@ as xs:string { }; declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.0,0.4,49.8,100.0") + %test:args("ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.03,0.48,49.83,100.00") %test:args("ahiqar_agg_wo_tile", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") function titemt:make-facsimile-id($manifest-uri as xs:string, $page as xs:string) @@ -81,7 +81,7 @@ as xs:string { }; declare - %test:args("3r1nz", "ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.0,0.4,49.8,100.0") + %test:args("3r1nz", "ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.03,0.48,49.83,100.00") function titemt:make-url-for-double-page-image($facsimile-uri as xs:string, $manifest-uri as xs:string, $page as xs:string) -- GitLab From afc0c5a8c9c66a21fdad5793681d03b098fa214a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 7 Jan 2021 12:22:10 +0100 Subject: [PATCH 101/155] fix: use external $target var to determine app collection --- exist-app/post-install.xq | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index 35eb282..2099309 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -1,11 +1,10 @@ xquery version "3.1"; (: the target collection into which the app is deployed :) -declare variable $target external; -declare variable $ahikar-base := "/db/apps/ahikar"; +declare variable $target external; (: := "/db/apps/ahikar"; :) declare variable $tg-base := "/db/apps/sade/textgrid"; declare function local:move-and-rename($filename as xs:string) as item()* { - let $data-file-path := $ahikar-base || "/data/" + let $data-file-path := $target || "/data/" let $target-data-collection := $tg-base || "/data/" let $target-meta-collection := $tg-base || "/meta/" let $target-agg-collection := $tg-base || "/agg/" @@ -49,43 +48,29 @@ declare function local:move-and-rename($filename as xs:string) as item()* { ), (: set owner and mode for RestXq module :) -(let $path := $ahikar-base || "/modules/tapi.xqm" +(let $path := $target || "/modules/tapi.xqm" return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), (: set owner and mode for deployment module :) -(let $path := $ahikar-base || "/modules/deploy.xqm" +(let $path := $target || "/modules/deploy.xqm" return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), (: set owner and mode for testtrigger module :) -(let $path := $ahikar-base || "/modules/testtrigger.xqm" +(let $path := $target || "/modules/testtrigger.xqm" return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), (: move the sample XMLs to sade/textgrid to be available in the viewer :) ( - let $files := - ( - "sample_teixml.xml", - "sample_teixml_meta.xml", - "sample_edition.xml", - "sample_edition_meta.xml", - "ahiqar_images.xml", - "ahiqar_images_meta.xml", - "sample_main_edition.xml", - "sample_main_edition_meta.xml", - "sample_lang_aggregation.xml", - "sample_lang_aggregation_meta.xml") - return - ( - for $file in $files return - local:move-and-rename($file) - ) + + xmldb:get-child-resources($target || "/data")[ends-with(., ".xml")] + ! local:move-and-rename(.) ), (: make Ahikar specific OpenAPI config available to the OpenAPI app :) ( if (xmldb:collection-available("/db/apps/openapi")) then (xmldb:remove("/db/apps/openapi", "openapi-config.xml"), - xmldb:move($ahikar-base, "/db/apps/openapi", "openapi-config.xml")) + xmldb:move($target, "/db/apps/openapi", "openapi-config.xml")) else () ) \ No newline at end of file -- GitLab From b58acbdd5473f3d7769f163d33e6be1c418ead41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 7 Jan 2021 12:44:42 +0100 Subject: [PATCH 102/155] fix: path to module --- exist-app/modules/testtrigger.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 86c7584..9d132af 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -22,7 +22,7 @@ import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "../tests/tapi-item-tests.xqm"; import module namespace tmt="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests" at "../tests/tapi-manifest-tests.xqm"; import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" at "../tests/tapi-tests.xqm"; -import module namespace ttnt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/normalization/tests" at "tapi-txt-normalization-tests.xqm"; +import module namespace ttnt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/normalization/tests" at "../tests/tapi-txt-normalization-tests.xqm"; import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "../tests/tapi-txt-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; -- GitLab From 41169c72fa18558384d56311403bbdebe1fecf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Thu, 7 Jan 2021 12:44:56 +0100 Subject: [PATCH 103/155] fix: readd Kant sample --- exist-app/post-install.xq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index 2099309..e081091 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -17,7 +17,7 @@ declare function local:move-and-rename($filename as xs:string) as item()* { xmldb:rename($target-meta-collection, $filename, $new-filename) ) else - if (matches($filename, "teixml")) then + if (matches($filename, "teixml|kant")) then xmldb:move($data-file-path, $target-data-collection, $filename) else xmldb:move($data-file-path, $target-agg-collection, $filename) -- GitLab From 6eda1de5cb5c3b4a72cf1fd09579e5acc8a1195c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 11 Jan 2021 09:26:43 +0100 Subject: [PATCH 104/155] fix: rename sample file according to processing in post-install.xq --- exist-app/data/{kant_sample.xml => kant_sample_teixml.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename exist-app/data/{kant_sample.xml => kant_sample_teixml.xml} (100%) diff --git a/exist-app/data/kant_sample.xml b/exist-app/data/kant_sample_teixml.xml similarity index 100% rename from exist-app/data/kant_sample.xml rename to exist-app/data/kant_sample_teixml.xml -- GitLab From 7295c4ff76715c10698df99d8c35d87035e0bbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 11 Jan 2021 10:49:39 +0100 Subject: [PATCH 105/155] fix: adjust object names in tests --- exist-app/tests/commons-tests.xqm | 2 +- exist-app/tests/tapi-collection-tests.xqm | 7 ------- exist-app/tests/tapi-img-tests.xqm | 16 ++++++++-------- exist-app/tests/tapi-item-tests.xqm | 2 ++ exist-app/tests/tapi-manifest-tests.xqm | 6 ------ 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index e3a44d7..95d8a2b 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -80,7 +80,7 @@ as element() { }; declare - %test:args("ahiqar_sample") %test:assertXPath("$result//*[local-name(.) = 'title'] = 'Beispieldatei zum Testen'") + %test:args("sample_teixml") %test:assertXPath("$result//*[local-name(.) = 'title'] = 'Beispieldatei zum Testen'") function ct:get-metadata-file($uri as xs:string) as document-node() { commons:get-metadata-file($uri) diff --git a/exist-app/tests/tapi-collection-tests.xqm b/exist-app/tests/tapi-collection-tests.xqm index 0d9d3d5..696a80e 100644 --- a/exist-app/tests/tapi-collection-tests.xqm +++ b/exist-app/tests/tapi-collection-tests.xqm @@ -156,13 +156,6 @@ function tct:get-allowed-manifest-uris-sample-input() { tapi-coll:get-allowed-manifest-uris($collection-metadata) }; -declare - %test:args("sample_main_edition") %test:assertXPath("$result[self::document-node()]") -function tct:get-metadata-file($uri as xs:string) { - tapi-coll:get-metadata-file($uri) -}; - - declare %test:args("textgrid:1234") %test:assertEquals("1234") %test:args("1234") %test:assertEquals("1234") diff --git a/exist-app/tests/tapi-img-tests.xqm b/exist-app/tests/tapi-img-tests.xqm index 9e95fd4..7477d88 100644 --- a/exist-app/tests/tapi-img-tests.xqm +++ b/exist-app/tests/tapi-img-tests.xqm @@ -8,7 +8,7 @@ import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:o import module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images" at "../modules/tapi-img.xqm"; declare - %test:args("ahiqar_agg") + %test:args("sample_edition") %test:assertTrue function t:has-manifest-tile($manifest-uri) as xs:boolean { tapi-img:has-manifest-tile($manifest-uri) @@ -30,7 +30,7 @@ as xs:boolean { }; declare - %test:args("ahiqar_agg") %test:assertEquals("ahiqar_tile") + %test:args("sample_edition") %test:assertEquals("ahiqar_tile") function t:get-tile-uri($manifest-uri as xs:string) as xs:string { tapi-img:get-tile-uri($manifest-uri) @@ -38,7 +38,7 @@ as xs:string { declare - %test:args("ahiqar_agg") %test:assertXPath("$result//*[local-name(.) = 'rect']") + %test:args("sample_edition") %test:assertXPath("$result//*[local-name(.) = 'rect']") function t:get-tile($manifest-uri as xs:string) as document-node() { tapi-img:get-tile($manifest-uri) @@ -46,8 +46,8 @@ as document-node() { declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("3r1nz") - %test:args("ahiqar_agg_wo_tile", "82b") %test:assertEquals("3r1p0") + %test:args("sample_edition", "82a") %test:assertEquals("3r1nz") +(: %test:args("ahiqar_agg_wo_tile", "82b") %test:assertEquals("3r1p0"):) function t:get-facsimile-uri-for-page($manifest-uri as xs:string, $page as xs:string) as xs:string { @@ -55,7 +55,7 @@ as xs:string { }; declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("a1") + %test:args("sample_edition", "82a") %test:assertEquals("a1") function t:get-xml-id-for-page($manifest-uri as xs:string, $page as xs:string) as xs:string { @@ -63,7 +63,7 @@ as xs:string { }; declare - %test:args("ahiqar_agg", "a1") %test:assertEquals("shape-1") + %test:args("sample_edition", "a1") %test:assertEquals("shape-1") function t:get-shape-id($manifest-uri as xs:string, $page-id as xs:string) as xs:string { @@ -92,7 +92,7 @@ as xs:string { }; declare - %test:args("ahiqar_agg", "82a") %test:assertEquals("50.03,0.48,49.83,100.00") + %test:args("sample_edition", "82a") %test:assertEquals("50.03,0.48,49.83,100.00") function t:get-relevant-image-section($manifest-uri as xs:string, $page-uri as xs:string) as xs:string { diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index d2b3397..698bc83 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -16,6 +16,7 @@ function titemt:_test-setup() { local:create-and-store-test-data() }; +(: TODO @michelle: is this still required? declare %test:args("sample_edition", "82a") %test:assertEquals("3r1nz") function titemt:get-facsimile-uri-for-page($manifest-uri as xs:string, @@ -23,6 +24,7 @@ function titemt:get-facsimile-uri-for-page($manifest-uri as xs:string, as xs:string { tapi-item:get-facsimile-uri-for-page($manifest-uri, $page) }; +:) declare %test:args("sample_edition") %test:assertEquals("Arabic, Classical Syriac, Eastern Syriac, Karshuni, Western Syriac") diff --git a/exist-app/tests/tapi-manifest-tests.xqm b/exist-app/tests/tapi-manifest-tests.xqm index 62eb08d..05b4fa3 100644 --- a/exist-app/tests/tapi-manifest-tests.xqm +++ b/exist-app/tests/tapi-manifest-tests.xqm @@ -128,12 +128,6 @@ function tmt:_test-teardown() { xmldb:remove($commons:data, $tmt:tei3-uri) }; -declare - %test:args("sample_edition") %test:assertXPath("$result//* = 'textgrid:sample_edition.0'") -function tmt:get-metadata-file($manifest-uri) { - tapi-mani:get-metadata-file($manifest-uri) -}; - declare %test:args("sample_main_edition", "sample_edition") %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/sample_main_edition/sample_edition-82a/latest/item.json')]") -- GitLab From 3642dec88c2ef236986c37d0ad23f93d11cb369f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 11 Jan 2021 10:51:06 +0100 Subject: [PATCH 106/155] fix: take over functions to commons potential regression! @mrodzis please check --- exist-app/modules/commons.xqm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index ef0bb85..57aef3d 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -124,3 +124,22 @@ as element() { else $start-node/following::tei:ab[last()] }; + +(: following added by MERGE !55 feat/#52-annotation-api-tests :) + +declare function commons:get-metadata-file($uri as xs:string) +as document-node() { + doc($commons:meta || $uri || ".xml") +}; + +declare function commons:get-aggregation($manifest-uri as xs:string) +as document-node() { + doc($commons:agg || $manifest-uri || ".xml") +}; + +declare function commons:open-tei-xml($tei-xml-uri as xs:string) +as document-node() { + doc($commons:data || $tei-xml-uri || ".xml") +}; + + -- GitLab From 4e3f6ce84f6298bb62eae6c4a3fe0daa719e77ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 11 Jan 2021 10:51:28 +0100 Subject: [PATCH 107/155] fix: switch on sample data --- exist-app/post-install.xq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index 6997018..e6cfdab 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -28,7 +28,7 @@ declare function local:move-and-rename($filename as xs:string) as item()* { ) case "tile" return xmldb:move($data-file-path, $target-tile-collection, $filename) - case "sample" return + case "teixml" return xmldb:move($data-file-path, $target-data-collection, $filename) default return xmldb:move($data-file-path, $target-agg-collection, $filename) -- GitLab From 6085c4bfe125771faf0cfc53557819b84c7ab106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20G=C3=B6bel?= Date: Mon, 11 Jan 2021 11:55:14 +0100 Subject: [PATCH 108/155] fix: kant filename --- exist-app/tests/tapi-txt-tests.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index c14b26a..0faf708 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -12,7 +12,7 @@ declare variable $ttt:sample-file := local:open-file("sample_teixml"); declare variable $ttt:sample-transliteration := $ttt:sample-file//tei:text[@type = "transliteration"]; declare variable $ttt:sample-transcription := $ttt:sample-file//tei:text[@type = "transcription"]; -declare variable $ttt:kant-sample := local:open-file("kant_sample"); +declare variable $ttt:kant-sample := local:open-file("kant_sample_teixml"); declare variable $ttt:kant-transcription := $ttt:kant-sample//tei:text[@type = "transcription"]; declare -- GitLab From 82ff70e9f59f0e583fff060a8c7b2f02a488523e Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 11 Jan 2021 15:09:59 +0100 Subject: [PATCH 109/155] fix: semantic errors --- CHANGELOG.md | 6 ++++++ exist-app/build.properties | 2 +- exist-app/post-install.xq | 2 +- exist-app/tests/tests-runner.xq | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78d1d67..3a23563 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.2.2.] - 2021-01-11 + +### Fixed + +- semantic errors that lead to the application not being installed properly. + ## [2.2.1] - 2020-11-16 ## Changed diff --git a/exist-app/build.properties b/exist-app/build.properties index e1228fd..8201e5f 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.2.0 +project.version=2.2.2 project.title=TextAPI for Ahikar project.abbrev=ahikar-test project.processorversion=5.2.0 diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index 185d374..d9d2793 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -84,7 +84,7 @@ return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), "ahiqar_collection.xml", "ahiqar_collection_meta.xml", "ahiqar_tile.xml", - "ahiqar_tile_meta.xml") + "ahiqar_tile_meta.xml", "kant_sample.xml") return diff --git a/exist-app/tests/tests-runner.xq b/exist-app/tests/tests-runner.xq index 22daeda..a048409 100644 --- a/exist-app/tests/tests-runner.xq +++ b/exist-app/tests/tests-runner.xq @@ -29,7 +29,7 @@ let $test-results := test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests")) + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/normalization/tests")) ) -- GitLab From 9c9a1b34cc4d35d2c7b5cc6a0dd892082df30ac4 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 07:14:04 +0100 Subject: [PATCH 110/155] tests: adjust path to new name of Kant sample file --- exist-app/tests/tapi-txt-tests.xqm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index 0faf708..05aecef 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -18,11 +18,11 @@ declare variable $ttt:kant-transcription := $ttt:kant-sample//tei:text[@type = " declare %test:tearDown function ttt:_test-teardown() { - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-first_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-sayings.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-second_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-third_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample-transcription-parables.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-first_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-sayings.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-second_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-third_narrative_section.txt"), + xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-parables.txt"), xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-first_narrative_section.txt"), xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-sayings.txt"), @@ -527,7 +527,7 @@ declare %test:assertEquals(" Es ist also wenigstens eine der näheren Untersuchung noch benötigte und nicht auf den") function ttt:check-contents($chunk-type as xs:string) { let $serialize := tapi-txt:main() - let $filepath := "/db/apps/sade/textgrid/txt/arabic--kant_sample-transcription-" || $chunk-type || ".txt" + let $filepath := "/db/apps/sade/textgrid/txt/arabic--kant_sample_teixml-transcription-" || $chunk-type || ".txt" return util:binary-doc($filepath) => util:base64-decode() -- GitLab From 387df95a690cdbd93555ff640c19699a4517d605 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 07:48:15 +0100 Subject: [PATCH 111/155] fix: adjust faux sample to current format --- exist-app/data/sample_edition.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exist-app/data/sample_edition.xml b/exist-app/data/sample_edition.xml index 259105e..9f37449 100644 --- a/exist-app/data/sample_edition.xml +++ b/exist-app/data/sample_edition.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file -- GitLab From dd449c6306438e0fd11c08d70acde911e29c4632 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 07:48:43 +0100 Subject: [PATCH 112/155] fix: add missing reference to TILE --- exist-app/data/sample_edition.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/exist-app/data/sample_edition.xml b/exist-app/data/sample_edition.xml index 9f37449..2d293cc 100644 --- a/exist-app/data/sample_edition.xml +++ b/exist-app/data/sample_edition.xml @@ -2,5 +2,6 @@ + \ No newline at end of file -- GitLab From 332b375be5f81a17b6bc48ec9f47631aee6e5af7 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 08:02:51 +0100 Subject: [PATCH 113/155] refactor: remove dead code, consider only availble TILEs --- exist-app/modules/tapi-img.xqm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exist-app/modules/tapi-img.xqm b/exist-app/modules/tapi-img.xqm index cee7052..032b45c 100644 --- a/exist-app/modules/tapi-img.xqm +++ b/exist-app/modules/tapi-img.xqm @@ -17,7 +17,6 @@ declare namespace svg="http://www.w3.org/2000/svg"; declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; -import module namespace functx="http://www.functx.com"; declare function tapi-img:has-manifest-tile($manifest-uri as xs:string) as xs:boolean { @@ -43,8 +42,7 @@ as xs:string* { for $element in $aggregated return let $stripped-uri := substring-after($element/@rdf:resource/string(), "textgrid:") return - if (tapi-img:is-resource-tile($stripped-uri) - and tapi-img:is-tile-available($stripped-uri)) then + if (tapi-img:is-tile-available($stripped-uri)) then $stripped-uri else () -- GitLab From bb04baf62520dc9be946e36f73bdacb22196a3d3 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 08:17:47 +0100 Subject: [PATCH 114/155] tests: fix file names; add setup and teadown for clarity The setUp and tearDown originally takes places in tapi-item-tests.xqm, which is confusing. --- exist-app/tests/tapi-img-tests.xqm | 51 ++++++++++++++++++++++++++--- exist-app/tests/tapi-item-tests.xqm | 29 ---------------- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/exist-app/tests/tapi-img-tests.xqm b/exist-app/tests/tapi-img-tests.xqm index 7477d88..b74d73d 100644 --- a/exist-app/tests/tapi-img-tests.xqm +++ b/exist-app/tests/tapi-img-tests.xqm @@ -4,9 +4,22 @@ module namespace t="http://ahikar.sub.uni-goettingen.de/ns/tapi/images/tests"; declare namespace http = "http://expath.org/ns/http-client"; +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images" at "../modules/tapi-img.xqm"; +declare + %test:setUp +function t:_test-setup() { + local:create-and-store-test-data() +}; + +declare + %test:tearDown +function t:_test-teardown() { + local:remove-test-data() +}; + declare %test:args("sample_edition") %test:assertTrue @@ -15,7 +28,7 @@ function t:has-manifest-tile($manifest-uri) as xs:boolean { }; declare - %test:args("ahiqar_sample") %test:assertFalse + %test:args("sample_teixml") %test:assertFalse %test:args("ahiqar_tile") %test:assertTrue function t:is-resource-tile($uri) as xs:boolean { tapi-img:is-resource-tile($uri) @@ -23,6 +36,7 @@ function t:is-resource-tile($uri) as xs:boolean { declare %test:args("ahiqar_tile") %test:assertTrue + (: the following is a sample for a resource that's not available in the db :) %test:args("ahiqar_tile-non-existent") %test:assertFalse function t:is-tile-available($tile-uri as xs:string) as xs:boolean { @@ -47,7 +61,7 @@ as document-node() { declare %test:args("sample_edition", "82a") %test:assertEquals("3r1nz") -(: %test:args("ahiqar_agg_wo_tile", "82b") %test:assertEquals("3r1p0"):) + %test:args("ahiqar_agg_wo_tile", "82b") %test:assertEquals("3r1p0") function t:get-facsimile-uri-for-page($manifest-uri as xs:string, $page as xs:string) as xs:string { @@ -74,7 +88,7 @@ declare %test:args("shape-1") %test:assertXPath("$result[@id = 'shape-1']") function t:get-svg-rect($shape-id as xs:string) as element() { - let $tile := tapi-img:get-tile("ahiqar_agg") + let $tile := tapi-img:get-tile("sample_edition") return tapi-img:get-svg-rect($tile, $shape-id) }; @@ -83,7 +97,7 @@ declare %test:assertEquals("50.03,0.48,49.83,100.00") function t:get-svg-section-dimensions-as-string() as xs:string { - let $manifest-uri := "ahiqar_agg" + let $manifest-uri := "sample_edition" let $shape-id := "shape-1" let $tile := tapi-img:get-tile($manifest-uri) let $svg := tapi-img:get-svg-rect($tile, $shape-id) @@ -98,3 +112,32 @@ function t:get-relevant-image-section($manifest-uri as xs:string, as xs:string { tapi-img:get-relevant-image-section($manifest-uri, $page-uri) }; + +declare function local:create-and-store-test-data() +as xs:string+ { + let $agg-wo-tile := + + + + + + let $agg-wo-tile-meta := commons:get-metadata-file("sample_edition") + + let $sample-xml-2 := commons:open-tei-xml("sample_teixml") + let $sample-xml-2-meta := commons:get-metadata-file("sample_teixml") + + return + ( + xmldb:store("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), + xmldb:store("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), + xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta), + xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta) + ) +}; + +declare function local:remove-test-data() { + xmldb:remove("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml"), + xmldb:remove("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml"), + xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml"), + xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml") +}; diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 698bc83..9189474 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -10,12 +10,6 @@ import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:o import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item" at "../modules/tapi-item.xqm"; -declare - %test:setUp -function titemt:_test-setup() { - local:create-and-store-test-data() -}; - (: TODO @michelle: is this still required? declare %test:args("sample_edition", "82a") %test:assertEquals("3r1nz") @@ -101,26 +95,3 @@ function titemt:make-url-for-double-page-image($facsimile-uri as xs:string, as xs:string { tapi-item:make-url-for-double-page-image($facsimile-uri, $manifest-uri, $page, $tc:server) }; - - -declare function local:create-and-store-test-data() -as xs:string+ { - let $agg-wo-tile := - - - - - - let $agg-wo-tile-meta := commons:get-metadata-file("ahiqar_agg") - - let $sample-xml-2 := commons:open-tei-xml("ahiqar_sample") - let $sample-xml-2-meta := commons:get-metadata-file("ahiqar_sample") - - return - ( - xmldb:store("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), - xmldb:store("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), - xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta), - xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta) - ) -}; -- GitLab From 22741ae5890e3396cbbe618729ca752c962af386 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 08:22:47 +0100 Subject: [PATCH 115/155] tests: re-add test data (still needed) --- exist-app/tests/tapi-item-tests.xqm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 9189474..698bc83 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -10,6 +10,12 @@ import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:o import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item" at "../modules/tapi-item.xqm"; +declare + %test:setUp +function titemt:_test-setup() { + local:create-and-store-test-data() +}; + (: TODO @michelle: is this still required? declare %test:args("sample_edition", "82a") %test:assertEquals("3r1nz") @@ -95,3 +101,26 @@ function titemt:make-url-for-double-page-image($facsimile-uri as xs:string, as xs:string { tapi-item:make-url-for-double-page-image($facsimile-uri, $manifest-uri, $page, $tc:server) }; + + +declare function local:create-and-store-test-data() +as xs:string+ { + let $agg-wo-tile := + + + + + + let $agg-wo-tile-meta := commons:get-metadata-file("ahiqar_agg") + + let $sample-xml-2 := commons:open-tei-xml("ahiqar_sample") + let $sample-xml-2-meta := commons:get-metadata-file("ahiqar_sample") + + return + ( + xmldb:store("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), + xmldb:store("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), + xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta), + xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta) + ) +}; -- GitLab From 712762c3c0ea0734b3380bbd1d19973ac9b027a3 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 08:25:56 +0100 Subject: [PATCH 116/155] tests: adjust to changes in sample_edition --- exist-app/tests/commons-tests.xqm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index 95d8a2b..e53f02d 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -40,7 +40,7 @@ as document-node()? { }; declare - %test:args("sample_edition") %test:assertEquals("sample_teixml") + %test:args("sample_edition") %test:assertXPath("count($result) = 2 and $result = 'sample_teixml' and $result = 'ahiqar_tile'") %test:args("qwerty") %test:assertError("COMMONS002") function ct:get-available-aggregates($uri as xs:string) as xs:string+ { @@ -84,4 +84,4 @@ declare function ct:get-metadata-file($uri as xs:string) as document-node() { commons:get-metadata-file($uri) -}; \ No newline at end of file +}; -- GitLab From f2efa9c379c4efde994ce2db6470f75bef90fba9 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 08:45:24 +0100 Subject: [PATCH 117/155] tests: add tearDown, fix errors caused by MR, remove surplus test --- exist-app/tests/tapi-item-tests.xqm | 39 +++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 698bc83..9fcc3e8 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -16,15 +16,13 @@ function titemt:_test-setup() { local:create-and-store-test-data() }; -(: TODO @michelle: is this still required? + declare - %test:args("sample_edition", "82a") %test:assertEquals("3r1nz") -function titemt:get-facsimile-uri-for-page($manifest-uri as xs:string, - $page as xs:string) -as xs:string { - tapi-item:get-facsimile-uri-for-page($manifest-uri, $page) + %test:tearDown +function titemt:_test-teardown() { + local:remove-test-data() }; -:) + declare %test:args("sample_edition") %test:assertEquals("Arabic, Classical Syriac, Eastern Syriac, Karshuni, Western Syriac") @@ -33,18 +31,18 @@ as xs:string { tapi-item:get-language-string($manifest-uri) }; + declare %test:args("sample_edition", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.03,0.48,49.83,100.00") -(: TODO: old name used here. dont know how to translate. + (: the following file is test data created by setUp :) %test:args("ahiqar_agg_wo_tile", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") - %test:args("sample_edition", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz") -:) function titemt:make-facsimile-id($manifest-uri as xs:string, $page as xs:string) as xs:string { tapi-item:make-facsimile-id($manifest-uri, $page, $tc:server) }; + declare %test:args("sample_edition") %test:assertEquals("The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, king of Assyria and Nineveh") @@ -66,7 +64,7 @@ declare (: checks if underlying pages are identified :) %test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/sample_teixml-82a.html' ") (: checks if images connected to underlying pages are identified :) - %test:assertXPath("$result//*[local-name(.) = 'id'] = 'http://0.0.0.0:8080/exist/restxq/api/images/3r1nz' ") + %test:assertXPath("$result//*[local-name(.) = 'id'] = 'http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.03,0.48,49.83,100.00' ") %test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/sample_main_edition/sample_edition/82a/annotationCollection.json' ") function titemt:get-json($collection as xs:string, $document as xs:string, @@ -94,7 +92,7 @@ as xs:string { }; declare - %test:args("3r1nz", "ahiqar_agg", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.03,0.48,49.83,100.00") + %test:args("3r1nz", "sample_edition", "82a") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/images/3r1nz/50.03,0.48,49.83,100.00") function titemt:make-url-for-double-page-image($facsimile-uri as xs:string, $manifest-uri as xs:string, $page as xs:string) @@ -107,14 +105,14 @@ declare function local:create-and-store-test-data() as xs:string+ { let $agg-wo-tile := - + - let $agg-wo-tile-meta := commons:get-metadata-file("ahiqar_agg") + let $agg-wo-tile-meta := commons:get-metadata-file("sample_edition") - let $sample-xml-2 := commons:open-tei-xml("ahiqar_sample") - let $sample-xml-2-meta := commons:get-metadata-file("ahiqar_sample") + let $sample-xml-2 := commons:open-tei-xml("sample_teixml") + let $sample-xml-2-meta := commons:get-metadata-file("sample_teixml") return ( @@ -124,3 +122,12 @@ as xs:string+ { xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta) ) }; + + +declare function local:remove-test-data() { + xmldb:remove("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml"), + xmldb:remove("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml"), + xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml"), + xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml") +}; + -- GitLab From 246e039e2b62ab93cbdd26b53b9ccc81ce7460e6 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 13 Jan 2021 08:57:59 +0100 Subject: [PATCH 118/155] chore: remove surplus comment --- exist-app/modules/commons.xqm | 2 -- 1 file changed, 2 deletions(-) diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index 57aef3d..627a8bf 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -125,8 +125,6 @@ as element() { $start-node/following::tei:ab[last()] }; -(: following added by MERGE !55 feat/#52-annotation-api-tests :) - declare function commons:get-metadata-file($uri as xs:string) as document-node() { doc($commons:meta || $uri || ".xml") -- GitLab From d77ed464b09299b122d15970b7f8dbcdb71d1b53 Mon Sep 17 00:00:00 2001 From: mrodzis Date: Wed, 13 Jan 2021 14:31:40 +0100 Subject: [PATCH 119/155] Resolve "Rename App" --- CHANGELOG.md | 6 +++++- exist-app/build.properties | 4 ++-- exist-app/tests/tapi-tests.xqm | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeb325a..8214772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2.3.0] - 2020-11-16 +## [2.4.0] - 2020-01-13 + +- updated the eXist application's name since it was misleading + +## [2.3.0] - 2020-01-13 ### Changed diff --git a/exist-app/build.properties b/exist-app/build.properties index ca3035b..1d96b11 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,6 +1,6 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.3.0 -project.title=TextAPI for Ahikar +project.version=2.4.0 +project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 diff --git a/exist-app/tests/tapi-tests.xqm b/exist-app/tests/tapi-tests.xqm index 7eaa7ce..fa2036f 100644 --- a/exist-app/tests/tapi-tests.xqm +++ b/exist-app/tests/tapi-tests.xqm @@ -71,7 +71,7 @@ declare (: check if requests work :) %test:assertXPath("map:get($result, 'request') => map:get('scheme') = 'http'") (: check if expathpkg works :) - %test:assertXPath("map:get($result, 'package') => map:get('title') = 'TextAPI for Ahikar'") + %test:assertXPath("map:get($result, 'package') => map:get('title') = 'Ahiqar'") (: check if repo.xml works :) %test:assertXPath("map:get($result, 'meta') => map:get('target') = 'ahikar'") function tt:api-info() as item() { -- GitLab From 55177bf5f6dfc7f9d2655088d5eab8c55b080c10 Mon Sep 17 00:00:00 2001 From: mrodzis Date: Thu, 14 Jan 2021 08:41:39 +0100 Subject: [PATCH 120/155] tests: remove tests using removed functions (tentative) --- CHANGELOG.md | 10 ++++++++-- README.md | 2 +- docker/httpd/vhosts/exist.conf | 6 +++--- exist-app/build.properties | 6 +----- exist-app/build.xml | 4 +--- exist-app/expath-pkg.xml.tmpl | 3 ++- exist-app/modules/commons.xqm | 2 +- exist-app/modules/tapi-html.xqm | 4 ---- exist-app/modules/tapi-txt.xqm | 4 ++-- exist-app/post-install.xq | 4 ++-- exist-app/tests/commons-tests.xqm | 2 +- exist-app/tests/tapi-html-tests.xqm | 9 --------- exist-app/tests/tapi-img-tests.xqm | 17 ++++++++-------- exist-app/tests/tapi-item-tests.xqm | 17 ++++++++-------- exist-app/tests/tapi-txt-tests.xqm | 31 +++++++++++++---------------- 15 files changed, 54 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8214772..3f48461 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2.4.0] - 2020-01-13 +## [2.5.0] - 2021-01-14 + +## Changed + +- switched from SADE to TextGrid Connect Standalone as a means to get data from TextGrid + +## [2.4.0] - 2021-01-13 - updated the eXist application's name since it was misleading -## [2.3.0] - 2020-01-13 +## [2.3.0] - 2021-01-13 ### Changed diff --git a/README.md b/README.md index 41cb2f8..daf0e06 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ To pass credentials to the container, we use the file `ahikar.env` which is not - TGUSER - TGPASS -For local development this file MUST be present but can be left empty. In this case, the SADE Publish Tool may be used to import data from TextGrid. +For local development this file MUST be present but can be left empty. In this case, TextGrid Connect Standalone may be used to import data from TextGrid. ```bash touch docker/ahikar.env diff --git a/docker/httpd/vhosts/exist.conf b/docker/httpd/vhosts/exist.conf index 1cd5370..26feba8 100644 --- a/docker/httpd/vhosts/exist.conf +++ b/docker/httpd/vhosts/exist.conf @@ -17,10 +17,10 @@ ProxyPassReverse http://existdb:8080/exist/ - + ProxyPreserveHost Off - ProxyPass http://existdb:8080/exist/apps/sade/ retry=0 - ProxyPassReverse http://existdb:8080/exist/apps/sade/ + ProxyPass http://existdb:8080/exist/apps/textgrid-connect/ retry=0 + ProxyPassReverse http://existdb:8080/exist/apps/textgrid-connect/ diff --git a/exist-app/build.properties b/exist-app/build.properties index 1d96b11..1378932 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.4.0 +project.version=2.5.0 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 @@ -7,7 +7,3 @@ project.processorversion=5.2.0 destfile=${build.dir}/${project.abbrev}-${project.version}.xar test.dir=test dependencies.dir=${build.dir}/dependencies - -sade.abbrev=SADE-develop -assets.abbrev=sade_assets-develop -code-viewer.abbrev=cv diff --git a/exist-app/build.xml b/exist-app/build.xml index 51e4a69..1512b88 100644 --- a/exist-app/build.xml +++ b/exist-app/build.xml @@ -56,10 +56,8 @@ - - - + diff --git a/exist-app/expath-pkg.xml.tmpl b/exist-app/expath-pkg.xml.tmpl index aa8e732..973432b 100644 --- a/exist-app/expath-pkg.xml.tmpl +++ b/exist-app/expath-pkg.xml.tmpl @@ -6,5 +6,6 @@ spec="1.0"> @project.title@ - + + diff --git a/exist-app/modules/commons.xqm b/exist-app/modules/commons.xqm index 627a8bf..f2cf628 100644 --- a/exist-app/modules/commons.xqm +++ b/exist-app/modules/commons.xqm @@ -10,7 +10,7 @@ import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milesto declare variable $commons:expath-pkg := doc("../expath-pkg.xml"); declare variable $commons:version := $commons:expath-pkg/*/@version; -declare variable $commons:tg-collection := "/db/apps/sade/textgrid"; +declare variable $commons:tg-collection := "/db/data/textgrid"; declare variable $commons:data := $commons:tg-collection || "/data/"; declare variable $commons:meta := $commons:tg-collection || "/meta/"; declare variable $commons:agg := $commons:tg-collection || "/agg/"; diff --git a/exist-app/modules/tapi-html.xqm b/exist-app/modules/tapi-html.xqm index 5c8bcf0..92a8868 100644 --- a/exist-app/modules/tapi-html.xqm +++ b/exist-app/modules/tapi-html.xqm @@ -1,8 +1,4 @@ xquery version "3.1"; -(: - : This module is for preparing the HTML serialization of a - : given TEI document or fragment. - :) module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html"; diff --git a/exist-app/modules/tapi-txt.xqm b/exist-app/modules/tapi-txt.xqm index f887ffa..f8c9e60 100644 --- a/exist-app/modules/tapi-txt.xqm +++ b/exist-app/modules/tapi-txt.xqm @@ -18,7 +18,7 @@ import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" import module namespace fragment="https://wiki.tei-c.org/index.php?title=Milestone-chunk.xquery" at "fragment.xqm"; import module namespace norm="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/normalization" at "tapi-txt-normalization.xqm"; -declare variable $tapi-txt:textgrid := "/db/apps/sade/textgrid"; +declare variable $tapi-txt:textgrid := "/db/data/textgrid"; declare variable $tapi-txt:data := $tapi-txt:textgrid || "/data"; declare variable $tapi-txt:txt := $tapi-txt:textgrid || "/txt"; declare variable $tapi-txt:milestone-types := @@ -100,7 +100,7 @@ as xs:string? { declare function tapi-txt:create-metadata-title-for-file-name($text as element(tei:text)) as xs:string { let $base-uri := tapi-txt:get-base-uri($text) - let $metadata := doc($base-uri => replace("/data/", "/meta/")) + let $metadata := doc($base-uri => replace("textgrid/data/", "textgrid/meta/")) return $metadata//tgmd:title => replace("[^a-zA-Z0-9]", "_") diff --git a/exist-app/post-install.xq b/exist-app/post-install.xq index e6cfdab..df805ad 100644 --- a/exist-app/post-install.xq +++ b/exist-app/post-install.xq @@ -4,7 +4,7 @@ import module namespace functx="http://www.functx.com"; (: the target collection into which the app is deployed :) declare variable $target external; (: := "/db/apps/ahikar"; :) -declare variable $tg-base := "/db/apps/sade/textgrid"; +declare variable $tg-base := "/db/data/textgrid"; declare function local:move-and-rename($filename as xs:string) as item()* { let $data-file-path := $target || "/data/" @@ -70,7 +70,7 @@ return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), (let $path := $target || "/modules/testtrigger.xqm" return (sm:chown($path, "admin"), sm:chmod($path, "rwsrwxr-x"))), -(: move the sample XMLs to sade/textgrid to be available in the viewer :) +(: move the sample XMLs to /db/data/textgrid to be available in the viewer :) ( xmldb:get-child-resources($target || "/data")[ends-with(., ".xml")] diff --git a/exist-app/tests/commons-tests.xqm b/exist-app/tests/commons-tests.xqm index e53f02d..3a75ad8 100644 --- a/exist-app/tests/commons-tests.xqm +++ b/exist-app/tests/commons-tests.xqm @@ -10,7 +10,7 @@ import module namespace map="http://www.w3.org/2005/xpath-functions/map"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; declare variable $ct:restxq := "http://0.0.0.0:8080/exist/restxq/"; -declare variable $ct:base-uri := "/db/apps/sade/textgrid/data/sample_teixml.xml"; +declare variable $ct:base-uri := "/db/data/textgrid/data/sample_teixml.xml"; declare %test:args("sample_edition") %test:assertEquals("sample_teixml") diff --git a/exist-app/tests/tapi-html-tests.xqm b/exist-app/tests/tapi-html-tests.xqm index 9ad50bd..00a3579 100644 --- a/exist-app/tests/tapi-html-tests.xqm +++ b/exist-app/tests/tapi-html-tests.xqm @@ -9,15 +9,6 @@ import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-html="http://ahikar.sub.uni-goettingen.de/ns/tapi/html" at "../modules/tapi-html.xqm"; -declare - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml", "82a") %test:assertXPath("$result//text()[matches(., 'حقًا')]") -function thtmlt:transform-fragment($tei-xml-base-uri as xs:string, - $page as xs:string) -as element(xhtml:div) { - let $fragment := commons:get-page-fragment($tei-xml-base-uri, $page) - return - tapi-html:get-html-from-fragment($fragment) -}; declare diff --git a/exist-app/tests/tapi-img-tests.xqm b/exist-app/tests/tapi-img-tests.xqm index b74d73d..7cbf8d9 100644 --- a/exist-app/tests/tapi-img-tests.xqm +++ b/exist-app/tests/tapi-img-tests.xqm @@ -128,16 +128,17 @@ as xs:string+ { return ( - xmldb:store("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), - xmldb:store("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), - xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta), - xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta) + xmldb:store("/db/data/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), + xmldb:store("/db/data/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta), + + xmldb:store("/db/data/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), + xmldb:store("/db/data/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta) ) }; declare function local:remove-test-data() { - xmldb:remove("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml"), - xmldb:remove("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml"), - xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml"), - xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml") + xmldb:remove("/db/data/textgrid/agg", "ahiqar_agg_wo_tile.xml"), + xmldb:remove("/db/data/textgrid/data", "ahiqar_sample_2.xml"), + xmldb:remove("/db/data/textgrid/meta", "ahiqar_sample_2.xml"), + xmldb:remove("/db/data/textgrid/meta", "ahiqar_agg_wo_tile.xml") }; diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 9fcc3e8..837f3c9 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -116,18 +116,19 @@ as xs:string+ { return ( - xmldb:store("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), - xmldb:store("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), - xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta), - xmldb:store("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta) + xmldb:store("/db/data/textgrid/agg", "ahiqar_agg_wo_tile.xml", $agg-wo-tile), + xmldb:store("/db/data/textgrid/meta", "ahiqar_agg_wo_tile.xml", $agg-wo-tile-meta), + + xmldb:store("/db/data/textgrid/data", "ahiqar_sample_2.xml", $sample-xml-2), + xmldb:store("/db/data/textgrid/meta", "ahiqar_sample_2.xml", $sample-xml-2-meta) ) }; declare function local:remove-test-data() { - xmldb:remove("/db/apps/sade/textgrid/agg", "ahiqar_agg_wo_tile.xml"), - xmldb:remove("/db/apps/sade/textgrid/data", "ahiqar_sample_2.xml"), - xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_sample_2.xml"), - xmldb:remove("/db/apps/sade/textgrid/meta", "ahiqar_agg_wo_tile.xml") + xmldb:remove("/db/data/textgrid/agg", "ahiqar_agg_wo_tile.xml"), + xmldb:remove("/db/data/textgrid/data", "ahiqar_sample_2.xml"), + xmldb:remove("/db/data/textgrid/meta", "ahiqar_sample_2.xml"), + xmldb:remove("/db/data/textgrid/meta", "ahiqar_agg_wo_tile.xml") }; diff --git a/exist-app/tests/tapi-txt-tests.xqm b/exist-app/tests/tapi-txt-tests.xqm index 05aecef..d9ad145 100644 --- a/exist-app/tests/tapi-txt-tests.xqm +++ b/exist-app/tests/tapi-txt-tests.xqm @@ -18,17 +18,17 @@ declare variable $ttt:kant-transcription := $ttt:kant-sample//tei:text[@type = " declare %test:tearDown function ttt:_test-teardown() { - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-first_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-sayings.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-second_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-third_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "arabic--kant_sample_teixml-transcription-parables.txt"), + xmldb:remove("/db/data/textgrid/txt", "arabic--kant_sample_teixml-transcription-first_narrative_section.txt"), + xmldb:remove("/db/data/textgrid/txt", "arabic--kant_sample_teixml-transcription-sayings.txt"), + xmldb:remove("/db/data/textgrid/txt", "arabic--kant_sample_teixml-transcription-second_narrative_section.txt"), + xmldb:remove("/db/data/textgrid/txt", "arabic--kant_sample_teixml-transcription-third_narrative_section.txt"), + xmldb:remove("/db/data/textgrid/txt", "arabic--kant_sample_teixml-transcription-parables.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-first_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-sayings.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-second_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-third_narrative_section.txt"), - xmldb:remove("/db/apps/sade/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-parables.txt") + xmldb:remove("/db/data/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-first_narrative_section.txt"), + xmldb:remove("/db/data/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-sayings.txt"), + xmldb:remove("/db/data/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-second_narrative_section.txt"), + xmldb:remove("/db/data/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-third_narrative_section.txt"), + xmldb:remove("/db/data/textgrid/txt", "karshuni-Beispieldatei_zum_Testen-ahiqar_sample-transcription-parables.txt") }; @@ -216,10 +216,7 @@ declare function ttt:create-txt-collection-if-not-available() { let $create-collection := tapi-txt:create-txt-collection-if-not-available() return - if (xmldb:collection-available($commons:tg-collection || "/txt/")) then - true() - else - false() + xmldb:collection-available("/db/data/textgrid/txt/") }; declare @@ -266,7 +263,7 @@ as xs:string { }; declare - %test:assertEquals("/db/apps/sade/textgrid/data/sample_teixml.xml") + %test:assertEquals("/db/data/textgrid/data/sample_teixml.xml") function ttt:get-base-uri() as xs:string { tapi-txt:get-base-uri($ttt:sample-transcription) @@ -294,7 +291,7 @@ as xs:string { }; declare - %test:args("/db/apps/sade/textgrid/data/sample_teixml.xml") %test:assertEquals("sample_teixml") + %test:args("/db/data/textgrid/data/sample_teixml.xml") %test:assertEquals("sample_teixml") function ttt:get-file-name($base-uri as xs:string) as xs:string { tapi-txt:get-file-name($base-uri) @@ -527,7 +524,7 @@ declare %test:assertEquals(" Es ist also wenigstens eine der näheren Untersuchung noch benötigte und nicht auf den") function ttt:check-contents($chunk-type as xs:string) { let $serialize := tapi-txt:main() - let $filepath := "/db/apps/sade/textgrid/txt/arabic--kant_sample_teixml-transcription-" || $chunk-type || ".txt" + let $filepath := "/db/data/textgrid/txt/arabic--kant_sample_teixml-transcription-" || $chunk-type || ".txt" return util:binary-doc($filepath) => util:base64-decode() -- GitLab From dcf7d50a52aba74d9e31f2e4fc5796d509add4a0 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Thu, 14 Jan 2021 14:03:31 +0100 Subject: [PATCH 121/155] feat: add model for syriac and arabic-karshuni endpoint --- exist-app/data/sample_edition_arabic.xml | 5 + exist-app/data/sample_edition_arabic_meta.xml | 22 +++ exist-app/data/sample_edition_karshuni.xml | 5 + .../data/sample_edition_karshuni_meta.xml | 22 +++ .../data/sample_lang_aggregation_arabic.xml | 5 + .../sample_lang_aggregation_arabic_meta.xml | 22 +++ .../data/sample_lang_aggregation_karshuni.xml | 5 + .../sample_lang_aggregation_karshuni_meta.xml | 22 +++ ...xml => sample_lang_aggregation_syriac.xml} | 2 +- ...> sample_lang_aggregation_syriac_meta.xml} | 4 +- exist-app/data/sample_main_edition.xml | 2 +- exist-app/modules/draft-tapi-collection.xqm | 133 ++++++++++++++++ exist-app/modules/tapi.xqm | 7 +- exist-app/modules/testtrigger.xqm | 4 +- exist-app/tests/annotation-tests.xqm | 34 ++-- .../tests/draft-tapi-collection-tests.xqm | 145 ++++++++++++++++++ exist-app/tests/tapi-collection-tests.xqm | 8 +- exist-app/tests/tapi-tests.xqm | 16 +- 18 files changed, 426 insertions(+), 37 deletions(-) create mode 100644 exist-app/data/sample_edition_arabic.xml create mode 100644 exist-app/data/sample_edition_arabic_meta.xml create mode 100644 exist-app/data/sample_edition_karshuni.xml create mode 100644 exist-app/data/sample_edition_karshuni_meta.xml create mode 100644 exist-app/data/sample_lang_aggregation_arabic.xml create mode 100644 exist-app/data/sample_lang_aggregation_arabic_meta.xml create mode 100644 exist-app/data/sample_lang_aggregation_karshuni.xml create mode 100644 exist-app/data/sample_lang_aggregation_karshuni_meta.xml rename exist-app/data/{sample_lang_aggregation.xml => sample_lang_aggregation_syriac.xml} (81%) rename exist-app/data/{sample_lang_aggregation_meta.xml => sample_lang_aggregation_syriac_meta.xml} (90%) create mode 100644 exist-app/modules/draft-tapi-collection.xqm create mode 100644 exist-app/tests/draft-tapi-collection-tests.xqm diff --git a/exist-app/data/sample_edition_arabic.xml b/exist-app/data/sample_edition_arabic.xml new file mode 100644 index 0000000..9eedbe1 --- /dev/null +++ b/exist-app/data/sample_edition_arabic.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/exist-app/data/sample_edition_arabic_meta.xml b/exist-app/data/sample_edition_arabic_meta.xml new file mode 100644 index 0000000..be70bf0 --- /dev/null +++ b/exist-app/data/sample_edition_arabic_meta.xml @@ -0,0 +1,22 @@ + + + + + Beispieldatei zum Testen, Arabisch + text/tg.edition+tg.aggregation+xml + + + + textgrid:sample_edition_arabic.0 + + + + + + + + + + + + diff --git a/exist-app/data/sample_edition_karshuni.xml b/exist-app/data/sample_edition_karshuni.xml new file mode 100644 index 0000000..1aedb68 --- /dev/null +++ b/exist-app/data/sample_edition_karshuni.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/exist-app/data/sample_edition_karshuni_meta.xml b/exist-app/data/sample_edition_karshuni_meta.xml new file mode 100644 index 0000000..d2281ec --- /dev/null +++ b/exist-app/data/sample_edition_karshuni_meta.xml @@ -0,0 +1,22 @@ + + + + + Beispieldatei zum Testen, Karshuni + text/tg.edition+tg.aggregation+xml + + + + textgrid:sample_edition_karshuni.0 + + + + + + + + + + + + diff --git a/exist-app/data/sample_lang_aggregation_arabic.xml b/exist-app/data/sample_lang_aggregation_arabic.xml new file mode 100644 index 0000000..0235492 --- /dev/null +++ b/exist-app/data/sample_lang_aggregation_arabic.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/exist-app/data/sample_lang_aggregation_arabic_meta.xml b/exist-app/data/sample_lang_aggregation_arabic_meta.xml new file mode 100644 index 0000000..e0ca65a --- /dev/null +++ b/exist-app/data/sample_lang_aggregation_arabic_meta.xml @@ -0,0 +1,22 @@ + + + + + Beispieldatei für Sprachenaggregation Arabisch + text/tg.aggregation+xml + + + + textgrid:sample_lang_aggregation_arabic.0 + + + + + + + + + + + + diff --git a/exist-app/data/sample_lang_aggregation_karshuni.xml b/exist-app/data/sample_lang_aggregation_karshuni.xml new file mode 100644 index 0000000..e0d8c36 --- /dev/null +++ b/exist-app/data/sample_lang_aggregation_karshuni.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/exist-app/data/sample_lang_aggregation_karshuni_meta.xml b/exist-app/data/sample_lang_aggregation_karshuni_meta.xml new file mode 100644 index 0000000..d8b0b4d --- /dev/null +++ b/exist-app/data/sample_lang_aggregation_karshuni_meta.xml @@ -0,0 +1,22 @@ + + + + + Beispieldatei für Sprachenaggregation Karshuni + text/tg.aggregation+xml + + + + textgrid:sample_lang_aggregation_karshuni.0 + + + + + + + + + + + + diff --git a/exist-app/data/sample_lang_aggregation.xml b/exist-app/data/sample_lang_aggregation_syriac.xml similarity index 81% rename from exist-app/data/sample_lang_aggregation.xml rename to exist-app/data/sample_lang_aggregation_syriac.xml index de973ee..3dd5259 100644 --- a/exist-app/data/sample_lang_aggregation.xml +++ b/exist-app/data/sample_lang_aggregation_syriac.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/exist-app/data/sample_lang_aggregation_meta.xml b/exist-app/data/sample_lang_aggregation_syriac_meta.xml similarity index 90% rename from exist-app/data/sample_lang_aggregation_meta.xml rename to exist-app/data/sample_lang_aggregation_syriac_meta.xml index 1752f2b..50542d0 100644 --- a/exist-app/data/sample_lang_aggregation_meta.xml +++ b/exist-app/data/sample_lang_aggregation_syriac_meta.xml @@ -2,12 +2,12 @@ - Beispieldatei für Sprachenaggregation + Beispieldatei für Sprachenaggregation Syrisch text/tg.aggregation+xml - textgrid:sample_lang_aggregation.0 + textgrid:sample_lang_aggregation_syriac.0 diff --git a/exist-app/data/sample_main_edition.xml b/exist-app/data/sample_main_edition.xml index c5fad93..fde30f7 100644 --- a/exist-app/data/sample_main_edition.xml +++ b/exist-app/data/sample_main_edition.xml @@ -1,5 +1,5 @@ - + diff --git a/exist-app/modules/draft-tapi-collection.xqm b/exist-app/modules/draft-tapi-collection.xqm new file mode 100644 index 0000000..4a05722 --- /dev/null +++ b/exist-app/modules/draft-tapi-collection.xqm @@ -0,0 +1,133 @@ +xquery version "3.1"; + +module namespace d="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft"; + +declare namespace ore="http://www.openarchives.org/ore/terms/"; +declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; +declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; + +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; + +declare variable $d:uris := + map { + "syriac": if (doc-available($commons:agg || "3r84g.xml")) then "3r84g" else "sample_lang_aggregation_syriac", + "arabic-karshuni": ( + if (doc-available($commons:agg || "3r9ps.xml")) then "3r9ps" else "sample_lang_aggregation_arabic", + if (doc-available($commons:agg || "3r84h.xml")) then "3r84h" else "sample_lang_aggregation_karshuni") + }; + +declare function d:get-uris($collection-type as xs:string) +as xs:string+ { + map:get($d:uris, $collection-type) +}; + + +declare function d:get-json($collection-type as xs:string, + $server as xs:string) +as item()+ { + let $collection-string := d:get-collection-string($collection-type) + let $sequence := d:make-sequence($collection-type, $server) + let $annotationCollection-uri := d:make-annotationCollection-uri($server, $collection-type) + + return + + {$commons:version} + + <title>The Story and Proverbs of Ahikar the Wise + main + + + + <collector> + <role>collector</role> + <name>Prof. Dr. theol. Kratz, Reinhard Gregor</name> + <idref> + <base>http://d-nb.info/gnd/</base> + <id>115412700</id> + <type>GND</type> + </idref> + </collector> + <description>{$collection-string} collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen</description> + <annotationCollection>{$annotationCollection-uri}</annotationCollection> + {$sequence} + </object> +}; + +declare function d:get-collection-string($collection-type as xs:string) +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) +}; + +declare function d:make-sequence($collection-type as xs:string, + $server as xs:string) +as element(sequence)+ { + let $uris := d:get-uris($collection-type) + let $aggregations := d:get-aggregations($uris) + let $allowed-manifest-uris := d:get-allowed-manifest-uris($aggregations) + for $manifest-uri in $allowed-manifest-uris return + let $manifest-metadata := commons:get-metadata-file($manifest-uri) + let $id := d:make-id($server, $collection-type, $manifest-uri) + let $type := d:make-format-type($manifest-metadata) + return + <sequence> + <id>{$id}</id> + <type>{$type}</type> + </sequence> +}; + +declare function d:get-aggregations($uris as xs:string+) +as document-node()+ { + for $uri in $uris return + doc($commons:agg || $uri || ".xml") +}; + +declare function d:get-allowed-manifest-uris($aggregations as node()+) +as xs:string+ { + let $not-allowed := + ( + "textgrid:3vp38" + ) + let $allowed := + for $aggregation-file in $aggregations return + for $aggregate in $aggregation-file//ore:aggregates return + $aggregate[@rdf:resource != $not-allowed]/@rdf:resource + return + for $uri in $allowed return + d:remove-textgrid-prefix($uri) +}; + +declare function d:remove-textgrid-prefix($uri as xs:string) +as xs:string { + replace($uri, "textgrid:", "") +}; + +declare function d:make-id($server as xs:string, + $collection-type as xs:string, + $manifest-uri as xs:string) +as xs:string { + $server || "/api/textapi/ahikar/" || $collection-type || "/" || $manifest-uri || "/manifest.json" +}; + +declare function d:get-format-type($metadata as document-node()) +as xs:string { + $metadata//tgmd:format[1]/string() + => d:make-format-type() +}; + +declare function d:make-format-type($tgmd-format as xs:string) +as xs:string { + switch ($tgmd-format) + case "text/tg.aggregation+xml" return "collection" + case "text/tg.edition+tg.aggregation+xml" return "manifest" + default return "manifest" +}; + +declare function d:make-annotationCollection-uri($server as xs:string, + $collection-type as xs:string) +as xs:string { + $server || "/api/annotations/ahikar/" || $collection-type || "/annotationCollection.json" +}; diff --git a/exist-app/modules/tapi.xqm b/exist-app/modules/tapi.xqm index f1227ce..f3e7351 100644 --- a/exist-app/modules/tapi.xqm +++ b/exist-app/modules/tapi.xqm @@ -19,6 +19,7 @@ declare namespace test="http://exist-db.org/xquery/xqsuite"; declare namespace xhtml="http://www.w3.org/1999/xhtml"; import module namespace tapi-coll="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection" at "tapi-collection.xqm"; +import module namespace d="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft" at "draft-tapi-collection.xqm"; import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item" at "tapi-item.xqm"; import module namespace tapi-mani="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest" at "tapi-manifest.xqm"; import module namespace tapi-txt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt" at "tapi-txt.xqm"; @@ -93,12 +94,12 @@ declare function tapi:remove-whitespaces($doc as document-node()) as document-no declare %rest:GET %rest:HEAD - %rest:path("/textapi/ahikar/{$collection-uri}/collection.json") + %rest:path("/textapi/ahikar/{$collection-type}/collection.json") %output:method("json") -function tapi:endpoint-collection($collection-uri as xs:string) +function tapi:endpoint-collection($collection-type as xs:string) as item()+ { $commons:responseHeader200, - tapi-coll:get-json($collection-uri, $tapi:server) + d:get-json($collection-type, $tapi:server) }; diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 8bf1095..1cd644c 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -27,6 +27,7 @@ import module namespace ttnt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/no import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "../tests/tapi-txt-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; +import module namespace t="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft/tests" at "../tests/draft-tapi-collection-tests.xqm"; (:~ : Triggers the tests for the Ahikar backend. Called by the CI. @@ -64,10 +65,11 @@ declare function testtrigger:execute-tests() as element()+ { let $test-results := ( + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")), + test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index d468eee..18f09df 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -48,7 +48,7 @@ as xs:boolean { declare %test:args("sample_teixml") %test:assertEquals("sample_edition") - %test:args("sample_edition") %test:assertEquals("sample_lang_aggregation") + %test:args("sample_edition") %test:assertEquals("sample_lang_aggregation_syriac") %test:args("sample_main_edition") %test:assertEmpty function at:get-parent-aggregation($uri as xs:string) as xs:string? { @@ -98,7 +98,7 @@ as map() { }; declare - %test:args("sample_lang_aggregation", "sample_edition", "82a", "http://localhost:8080") + %test:args("sample_lang_aggregation_syriac", "sample_edition", "82a", "http://localhost:8080") %test:assertXPath("map:get($result, 'annotationCollection') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/sample_edition/82a'") %test:assertXPath("map:get($result, 'annotationCollection') => map:get('type') = 'AnnotationCollection'") function at:make-annotationCollection-for-manifest($collection as xs:string, @@ -119,7 +119,7 @@ as element(tei:TEI) { declare %test:args("sample_main_edition") %test:assertEquals("66") - %test:args("sample_lang_aggregation") %test:assertEquals("66") + %test:args("sample_lang_aggregation_syriac") %test:assertEquals("66") function at:get-total-no-of-annotations($uri as xs:string) { anno:get-total-no-of-annotations($uri) }; @@ -130,7 +130,7 @@ function at:get-all-xml-uris-for-submap() as xs:string* { let $map := map { - "sample_lang_aggregation": + "sample_lang_aggregation_syriac": map { "sample_edition": "sample_teixml", "faux_edition": "faux_teixml" @@ -147,7 +147,7 @@ function at:find-in-map($key as xs:string) as item()? { let $map := map { - "sample_lang_aggregation": + "sample_lang_aggregation_syriac": map { "sample_edition": "sample_teixml", "faux_edition": "faux_teixml" @@ -169,7 +169,7 @@ declare function at:get-prev-or-next-annotationPage-url($document as xs:string?, $page as xs:string?) as xs:string? { - let $collection := "sample_lang_aggregation" + let $collection := "sample_lang_aggregation_syriac" let $server := "http://localhost:8080" return anno:get-prev-or-next-annotationPage-url($collection, $document, $page, $server) @@ -177,11 +177,11 @@ as xs:string? { declare %test:args("sample_edition") %test:assertTrue - %test:args("sample_lang_aggregation") %test:assertFalse + %test:args("sample_lang_aggregation_syriac") %test:assertFalse function at:is-resource-edition($uri as xs:string) { let $map := map { - "sample_lang_aggregation": + "sample_lang_aggregation_syriac": map { "sample_edition": "sample_teixml", "faux_edition": "faux_teixml" @@ -226,7 +226,7 @@ as map() { }; declare - %test:args("sample_lang_aggregation", "sample_edition", "http://localhost:8080") + %test:args("sample_lang_aggregation_syriac", "sample_edition", "http://localhost:8080") %test:assertXPath("map:get($result, 'annotationPage') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation/sample_edition'") %test:pending function at:make-annotationPage($collection as xs:string, @@ -290,7 +290,7 @@ as xs:integer { }; declare - %test:args("sample_lang_aggregation") %test:assertEquals("0") + %test:args("sample_lang_aggregation_syriac") %test:assertEquals("0") %test:args("sample_edition") %test:assertEquals("0") %test:args("sample_teixml") %test:assertEquals("0") function at:determine-start-index($uri as xs:string) @@ -313,8 +313,8 @@ as xs:string? { }; declare - %test:args("sample_lang_aggregation", "sample_edition", "next") %test:assertEmpty - %test:args("sample_lang_aggregation", "sample_edition", "prev") %test:assertEmpty + %test:args("sample_lang_aggregation_syriac", "sample_edition", "next") %test:assertEmpty + %test:args("sample_lang_aggregation_syriac", "sample_edition", "prev") %test:assertEmpty function anno:get-prev-or-next-annotationPage-ID($collection as xs:string, $document as xs:string, $type as xs:string) @@ -323,7 +323,7 @@ as xs:string? { }; declare - %test:args("sample_lang_aggregation", "sample_edition", "84a", "http://localhost:8080") + %test:args("sample_lang_aggregation_syriac", "sample_edition", "84a", "http://localhost:8080") %test:assertEquals("http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation/sample_edition-84a") function at:make-annotationPage-for-manifest-id($collection as xs:string, $document as xs:string, @@ -338,7 +338,7 @@ as xs:string { declare - %test:args("sample_lang_aggregation", "sample_edition", "84a", "http://localhost:8080") + %test:args("sample_lang_aggregation_syriac", "sample_edition", "84a", "http://localhost:8080") %test:assertEquals("http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/sample_edition") function at:make-annotationPage-for-manifest-part-of($collection as xs:string, $document as xs:string, @@ -353,7 +353,7 @@ as xs:string { }; declare - %test:args("sample_lang_aggregation", "http://localhost:8080") + %test:args("sample_lang_aggregation_syriac", "http://localhost:8080") %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json") function at:get-information-for-collection-object($collectionURI as xs:string, $server as xs:string) @@ -365,9 +365,9 @@ as xs:string { }; declare - %test:args("sample_lang_aggregation", "sample_edition", "http://localhost:8080") + %test:args("sample_lang_aggregation_syriac", "sample_edition", "http://localhost:8080") %test:assertXPath("$result instance of map()") - %test:args("sample_lang_aggregation", "", "http://localhost:8080") + %test:args("sample_lang_aggregation_syriac", "", "http://localhost:8080") %test:assertXPath("$result instance of map()") function at:make-annotationCollection($collection as xs:string, $document as xs:string?, diff --git a/exist-app/tests/draft-tapi-collection-tests.xqm b/exist-app/tests/draft-tapi-collection-tests.xqm new file mode 100644 index 0000000..0857496 --- /dev/null +++ b/exist-app/tests/draft-tapi-collection-tests.xqm @@ -0,0 +1,145 @@ +xquery version "3.1"; + +module namespace t="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft/tests"; + +declare namespace http = "http://expath.org/ns/http-client"; +declare namespace tei="http://www.tei-c.org/ns/1.0"; + +import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; +import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; +import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; +import module namespace d="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft" at "../modules/draft-tapi-collection.xqm"; + +declare + %test:args("syriac") %test:assertEquals("sample_lang_aggregation_syriac") + %test:args("arabic-karshuni") %test:assertXPath("count($result) = 2 and $result = 'sample_lang_aggregation_arabic' and $result = 'sample_lang_aggregation_karshuni'") +function t:get-uris($collection-type as xs:string) +as xs:string+ { + d:get-uris($collection-type) +}; + +declare + %test:args("syriac") %test:assertEquals("Syriac") + %test:args("arabic-karshuni") %test:assertEquals("Arabic/Karshuni") + %test:args("misc") %test:assertError("D001") +function t:get-collection-string($collection-type as xs:string) +as xs:string { + d:get-collection-string($collection-type) +}; + +declare + %test:args("syriac") %test:assertXPath("$result//description = 'Syriac collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen'") + %test:args("arabic-karshuni") %test:assertXPath("$result//description = 'Arabic/Karshuni collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen'") +function t:get-json($collection-type as xs:string) { + d:get-json($collection-type, $tc:server) +}; + + +declare + %test:args("syriac") %test:assertXPath("$result//type[. = 'manifest']") + %test:args("syriac") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/syriac/sample_edition/manifest.json')]") + %test:args("arabic-karshuni") %test:assertXPath("$result//type[. = 'manifest']") + %test:args("arabic-karshuni") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/arabic-karshuni/sample_edition_arabic/manifest.json')]") + %test:args("arabic-karshuni") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/arabic-karshuni/sample_edition_karshuni/manifest.json')]") +function t:make-sequence($collection-type as xs:string) { + d:make-sequence($collection-type, $tc:server) +}; + +declare + %test:args("sample_lang_aggregation_syriac") %test:assertExists +function t:get-aggregations_syriac($uris as xs:string+) +as document-node()+ { + d:get-aggregations($uris) +}; + +declare + %test:assertExists +function t:get-aggregations_arabic_karshuni() +as document-node()+ { + let $uris := + ( + "sample_lang_aggregation_arabic", + "sample_lang_aggregation_karshuni" + ) + return + d:get-aggregations($uris) +}; + +declare + %test:args("textgrid:1234") %test:assertEquals("1234") + %test:args("1234") %test:assertEquals("1234") +function t:remove-textgrid-prefix($uri as xs:string) { + d:remove-textgrid-prefix($uri) +}; + +declare + %test:assertTrue +function t:get-allowed-manifest-uris-mock-up-input-included() { + let $collection-metadata := + ( + <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_lang_aggregation_arabic.0"> + <ore:aggregates rdf:resource="textgrid:3rbm9"/> + <ore:aggregates rdf:resource="textgrid:3rbmc"/> + <ore:aggregates rdf:resource="textgrid:3rx14"/> + <ore:aggregates rdf:resource="textgrid:3vp38"/> + </rdf:Description> + </rdf:RDF>, + <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_lang_aggregation_karshuni.0"> + <ore:aggregates rdf:resource="textgrid:3rbm9"/> + <ore:aggregates rdf:resource="textgrid:3rbmc"/> + <ore:aggregates rdf:resource="textgrid:3rx14"/> + <ore:aggregates rdf:resource="textgrid:3vp38"/> + </rdf:Description> + </rdf:RDF> + ) + return + d:get-allowed-manifest-uris($collection-metadata) = "3rx14" +}; + +declare + %test:assertFalse +function t:get-allowed-manifest-uris-mock-up-input-excluded() { + let $collection-metadata := + <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_lang_aggregation_syriac.0"> + <ore:aggregates rdf:resource="textgrid:3rbm9"/> + <ore:aggregates rdf:resource="textgrid:3rbmc"/> + <ore:aggregates rdf:resource="textgrid:3rx14"/> + <ore:aggregates rdf:resource="textgrid:3vp38"/> + </rdf:Description> + </rdf:RDF> + return + d:get-allowed-manifest-uris($collection-metadata) = "3vp38" +}; + +declare + %test:args("syriac", "sample_edition") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/syriac/sample_edition/manifest.json") +function t:make-id($colletion-type as xs:string, $manifest-uri as xs:string) +as xs:string { + d:make-id($tc:server, $colletion-type, $manifest-uri) +}; + +declare + %test:args("text/tg.aggregation+xml") %test:assertEquals("collection") + %test:args("text/tg.edition+tg.aggregation+xml") %test:assertEquals("manifest") + %test:args("test") %test:assertEquals("manifest") +function t:make-format-type($tgmd-format as xs:string) { + d:make-format-type($tgmd-format) +}; + +declare + %test:assertEquals("manifest") +function t:get-format-type() { + let $metadata := commons:get-metadata-file("sample_edition") + return + d:get-format-type($metadata) +}; + +declare + %test:args("arabic-karshuni") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/arabic-karshuni/annotationCollection.json") +function t:make-annotationCollection-uri($collection-uri as xs:string) +as xs:string { + d:make-annotationCollection-uri($tc:server, $collection-uri) +}; diff --git a/exist-app/tests/tapi-collection-tests.xqm b/exist-app/tests/tapi-collection-tests.xqm index 696a80e..0d366e4 100644 --- a/exist-app/tests/tapi-collection-tests.xqm +++ b/exist-app/tests/tapi-collection-tests.xqm @@ -151,7 +151,7 @@ as xs:string { declare %test:assertEquals("sample_edition") function tct:get-allowed-manifest-uris-sample-input() { - let $collection-metadata := tapi-coll:get-aggregation("sample_lang_aggregation") + let $collection-metadata := tapi-coll:get-aggregation("sample_lang_aggregation_syriac") return tapi-coll:get-allowed-manifest-uris($collection-metadata) }; @@ -182,7 +182,7 @@ function tct:get-format-type() { declare %test:args("sample_main_edition") %test:assertXPath("$result//type[. = 'manifest']") - %test:args("sample_lang_aggregation") %test:assertXPath("$result//id[matches(., 'sample_edition/manifest.json')]") + %test:args("sample_lang_aggregation_syriac") %test:assertXPath("$result//id[matches(., 'sample_edition/manifest.json')]") %test:args("testapi-collection") %test:assertXPath("$result//id[matches(., 'test-aggregation-1/manifest.json')]") %test:args("testapi-collection") %test:assertXPath("$result//id[matches(., 'test-aggregation-2/manifest.json')]") function tct:make-sequence($collection-uri as xs:string) { @@ -198,8 +198,8 @@ as xs:string { declare - %test:args("sample_lang_aggregation") %test:assertXPath("$result//title = 'The Story and Proverbs of Ahikar the Wise'") - %test:args("sample_lang_aggregation") %test:assertXPath("$result//*/string() = 'http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/sample_lang_aggregation/sample_edition/manifest.json' ") + %test:args("sample_lang_aggregation_syriac") %test:assertXPath("$result//title = 'The Story and Proverbs of Ahikar the Wise'") + %test:args("sample_lang_aggregation_syriac") %test:assertXPath("$result//*/string() = 'http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/sample_lang_aggregation_syriac/sample_edition/manifest.json' ") function tct:get-json($collection-uri as xs:string) { tapi-coll:get-json($collection-uri, $tc:server) }; diff --git a/exist-app/tests/tapi-tests.xqm b/exist-app/tests/tapi-tests.xqm index fa2036f..142f2f8 100644 --- a/exist-app/tests/tapi-tests.xqm +++ b/exist-app/tests/tapi-tests.xqm @@ -123,7 +123,7 @@ declare : the underlying function. :) %test:assertXPath("matches($result, '[\w]')") function tt:content-txt() as xs:string { - let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_teixml.txt" + let $url := $tc:server || "/textapi/ahikar/syriac/sample_teixml.txt" let $req := <http:request href="{$url}" method="get"> <http:header name="Connection" value="close"/> </http:request> @@ -140,7 +140,7 @@ function tt:is-txt-api-available() { }; declare function tt:txt() { - let $url := $tc:server || "textapi/ahiqar/sample_main_edition/sample_teixml.txt" + let $url := $tc:server || "textapi/ahiqar/syriac/sample_teixml.txt" let $req := tc:make-request($url) return http:send-request($req)[2] => util:base64-decode() }; @@ -157,7 +157,7 @@ function tt:remove-whitespaces() as document-node() { declare %test:assertTrue function tt:is-collection-endpoint-http200() { - let $url := $tc:server || "/textapi/ahikar/sample_main_edition/collection.json" + let $url := $tc:server || "/textapi/ahikar/arabic-karshuni/collection.json" return tc:is-endpoint-http200($url) }; @@ -173,7 +173,7 @@ declare %test:assertXPath("map:contains($result, 'sequence')") function tt:endpoint-collection() as item() { - let $url := $tc:server || "/textapi/ahikar/sample_main_edition/collection.json" + let $url := $tc:server || "/textapi/ahikar/arabic-karshuni/collection.json" let $req := <http:request href="{$url}" method="get"> <http:header name="Connection" value="close"/> </http:request> @@ -183,7 +183,7 @@ as item() { declare %test:assertTrue function tt:is-manifest-endpoint-http200() { - let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition/manifest.json" + let $url := $tc:server || "/textapi/ahikar/arabic-karshuni/sample_edition_arabic/manifest.json" return tc:is-endpoint-http200($url) }; @@ -204,7 +204,7 @@ declare %test:assertXPath("map:contains($result, 'sequence')") function tt:endpoint-manifest() as item() { - let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition/manifest.json" + let $url := $tc:server || "/textapi/ahikar/syriac/sample_edition/manifest.json" let $req := tc:make-request($url) return http:send-request($req)[2] @@ -215,7 +215,7 @@ as item() { declare %test:assertTrue function tt:is-item-endpoint-http200() { - let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition-82a/latest/item.json" + let $url := $tc:server || "/textapi/ahikar/syriac/sample_edition-82a/latest/item.json" return tc:is-endpoint-http200($url) }; @@ -234,7 +234,7 @@ declare %test:assertXPath("map:contains($result, 'langAlt')") %test:assertXPath("map:contains($result, 'image')") function tt:endpoint-item() as item() { - let $url := $tc:server || "/textapi/ahikar/sample_main_edition/sample_edition-82a/latest/item.json" + let $url := $tc:server || "/textapi/ahikar/syriac/sample_edition-82a/latest/item.json" let $req := tc:make-request($url) return http:send-request($req)[2] => util:base64-decode() -- GitLab From 9a337bcef5cc4e2943977b9d9cf069501bc6e3fc Mon Sep 17 00:00:00 2001 From: Michelle Weidling <weidling@sub.uni-goettingen.de> Date: Fri, 15 Jan 2021 09:10:14 +0100 Subject: [PATCH 122/155] fix: complete test data setup --- exist-app/data/sample_edition_arabic.xml | 2 +- exist-app/data/sample_edition_karshuni.xml | 2 +- exist-app/data/sample_teixml_2.xml | 821 +++++++++++++++++++++ exist-app/data/sample_teixml_2_meta.xml | 19 + exist-app/data/sample_teixml_3.xml | 821 +++++++++++++++++++++ exist-app/data/sample_teixml_3_meta.xml | 19 + 6 files changed, 1682 insertions(+), 2 deletions(-) create mode 100644 exist-app/data/sample_teixml_2.xml create mode 100644 exist-app/data/sample_teixml_2_meta.xml create mode 100644 exist-app/data/sample_teixml_3.xml create mode 100644 exist-app/data/sample_teixml_3_meta.xml diff --git a/exist-app/data/sample_edition_arabic.xml b/exist-app/data/sample_edition_arabic.xml index 9eedbe1..e56ab68 100644 --- a/exist-app/data/sample_edition_arabic.xml +++ b/exist-app/data/sample_edition_arabic.xml @@ -1,5 +1,5 @@ <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_arabic.0"> - <ore:aggregates rdf:resource="textgrid:sample_teixml"/> + <ore:aggregates rdf:resource="textgrid:sample_teixml_2"/> </rdf:Description> </rdf:RDF> \ No newline at end of file diff --git a/exist-app/data/sample_edition_karshuni.xml b/exist-app/data/sample_edition_karshuni.xml index 1aedb68..87c749b 100644 --- a/exist-app/data/sample_edition_karshuni.xml +++ b/exist-app/data/sample_edition_karshuni.xml @@ -1,5 +1,5 @@ <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_karshuni.0"> - <ore:aggregates rdf:resource="textgrid:sample_teixml"/> + <ore:aggregates rdf:resource="textgrid:sample_teixml_3"/> </rdf:Description> </rdf:RDF> \ No newline at end of file diff --git a/exist-app/data/sample_teixml_2.xml b/exist-app/data/sample_teixml_2.xml new file mode 100644 index 0000000..983463a --- /dev/null +++ b/exist-app/data/sample_teixml_2.xml @@ -0,0 +1,821 @@ +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?><?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" + schematypens="http://purl.oclc.org/dsdl/schematron"?><!-- +# INTRODUCTION TO AND PURPOSE OF THIS FILE + +The following document is a sample for the Ahiqar project. +It should display all encoding phenomena that can occur in the project. +Thus it may serve as a basis for further developing the front end, especially the content of the text panel. + +Codex Mingana syr. 133 (textgrid:3r8m5) serves as a basis for this file. +It has been enhanced by a dummy text in order to add encoding. + +From <pn n="83b"/> on the file presents a collation of interesting phenomena that stem from the original data. +To achieve this the sources have been analyzed systematically. +A source for the respective encoding is provided in a commentary directly before the encoding. + +All suggestions regarding the rendering of certain encoding are marked with ###. +The proposed ideas aren't normative and can be altered completely. +Ideas (or parts of ideas) that have bee marked with LC refer to the Leiden Conventions (https://en.wikipedia.org/wiki/Leiden_Conventions) which are common for critical editions +--> +<TEI xmlns="http://www.tei-c.org/ns/1.0"> + <teiHeader> + <fileDesc> + <titleStmt> + <title type="main">The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, + king of Assyria and Nineveh + Simon Birol + Aly Elrefaei + + + Georg-August Universität Göttingen, Theologische Fakultät, Seminar für Altes + Testament + + + + + + Great Britain + + University of Cambridge - Cambridge University Library + Add. 2020 + + + + Classical Syriac + + + + + codex + Iraq + Alqosh + 18.10.1697 + + + + + Wright, William: A catalogue of the Syriac manuscripts preserved in the library + of the University of Cambridge, vol. 2, Cambridge 1901, p. 583-9. + + + + + + East Syriac script + + + + proverbs + prose + + + + Arabic + Classical Syriac + Karshuni + Western Syriac + Eastern Syriac + + + + + color: red; + Serto Jerusalem + + + + + + Conversion to specified TEI by SUB Göttingen + + + + + + + + + + + + + + + . + حقًاحيث تبدأ القصة + + + نبتدي بعون البارياختبار تعالى جل اسمه + + + وتعالى ذكره الى الابد. ونكتب خبر + الحكيم الماهر الفليوس الشاطر + + + وزير سنحاريب ابن سرحادوم ملك + اتور + + + + + ونينوى + والموصل . وما جرا منه ومن + ابن اخته نادان . كان في ايام الملك ابن + سرحادوم + + ملك ارض اتور + ونينوى وبلادها. رجل حكيم يقال + له حيقار . وكان وزير الملك سنحاريب + وكاتبه وكان + ذو مال جزيل ورزق كثير. وكان ماهر حكيم فيلسوف + ذو معرفه وراي وتدبير. وكان قد تزوج ستين امراه + + + + رأس اختبارمتقاطع + وبنى لكل واحده منهن مقصوره. ومع هذا كله + لم يكن له ولد يرثه. وكان كثير الهم لاجل ذلك + وانه في ذات يوم جمع المنجمين والسحره + والعارفين. واشكا لهم حاله وامر + + + بعقوريته + عقوريته + + + بعقوريته + عقوريته + + + فقالوا له ادخل ادبح للالهه واستجير بهم + لعلهم يرزقوك ولدًا. ففعل كما قالوا له. وقدم + القرابين للاصنام واستغاث بهم. وتضرّع اليهم + بالطلبه والدعا. فلم يجيبوه بكلمه. فخرج + يحزان ندمان خايب وانصرف متالم القلب. ورجع + بالتضرع الى الله تعالى. وامن واستعان به بحرقة + قلب قايلًا. يا الاه السما والارض. يا خالق + + + هل اختبار أقارنك بيوم صيفي؟ + انت أكثر جميلة وأكثر اعتدالا: + + + + + . نهايةاختبار + النصوماتت. + + + + + + الخلايق كلها.كان كذلك ، لذا لم يكن كذلك. انا اطلب اليك ان + توهبني + + + ولدًا حتى اتعزا به ويرثني ويحضر بموتي + + ويغمض عيناي ويدفنني. فعند ذلك اتاه صوت + + من السما قايلا. بحيث اتكلت اولًا على الاصنام + المنحوته. وقدمت لهم القرابين. لذلك + تبقا بلا ولد. بل ان نادان ابن اختك خذه + + واجعله لك ولدًا. وعلمه علمك وادبك وحكمتك + وهو يرثك. عند ذلك اخذ نادان ابن اخته وكان + صغير يرضع. فسلمه الى تمانية نسا مرضعات + ليرضعوه ويربوه. فربوه بالاكل الطيب والبسوه + الحرير والارجوان والقرمز وكان جلوسه على + الطنافس الحرير. فلما كبر نادان ومشى ونمى + مثل الارز العالي فعلمه الكتابه والقرااه + والتاديب والفلسفه. فلما كان بعض الايام + نظر سنحاريب الملك فراى حيقار وزيره + وكاتبه وهو قد بقى رجل شيخ كبير + فقال له ايها الصاحب المحب المكرم + الماهر المدبر الحكيم كاتبي ووزيري وكاتم + سري ومدبر دولتي. ها قد كبرت وطعنت في + السناختبار وشخت. وقرب وقت موتك ووفاتك. فقول + + + ألي من يقوم في خدمتي بعدك. فقال له + + حقر + + هذا حيث ينتهي النص. + + + + + + + + + وقال للسياف كان اسمه يبوس + + + ميكمسكينكنتي قوم خد + حيقر وامضي + + + + + + مصر الى عند + فرعون الملك ولما + + + والان كملت قصت حيقر الحكيم الفارسي + + + + + + فتركهم وحزن وتالم ܘܟܓܪܒ بقوله + + + + + + وختمهم بختم خاله حيقار . واما + + هم في دار الملك ثم مضا ايضا وكتب + + + + صوته فيطرحون + صهل في بلاد اتور + ونينوا فسمعوا خيلنا صوته فطرحوا فلما سمع + حيقار + + + + قيل بالامثال من لا يسمع من اذنيه + + + + + + فيا سادتي رقّوا لعبدًا + في ذنوبا لا يعدوا + جا بالتقصير يسال + ان تروا عيبا فسدّوا + + + + + + الرعيَّه. يا ابني اربعةً اخر العاقل والاحمق + + + + + هذا + سطين الحجر قدَّ حتى اخيط لكم هذا الحجر ... + + + + + + + + + بالعطاي وكبره وبعد يوم انا + + حيقار بعثت الى اشفغني زوجتي + وقلت لها حال وصول اليكي + امري قولي للصيادين ان يصيدوا + لنا فرخين نسورا وقولي لصناع + القطن ان يفتلوا لنا شريطين + يكونوا غليظ صبع وطول الفين + ذراع والنجارين حتى ينجرون صناديق + كبار واعطي نبوحال + وطبوليم + + لسبعة نسا مرضعة حتى يربوهم + واذبحي كليوم خاروف للنسورا + ... + + + + فرعون اكابره ان يلبسون ثياب + البرفير الاحمار والملك لبس + ثوب ارجاونى وجلس على كرسيه + وكل عظاماه قيام قدامه وامر + ادخلوني اليه قال لى يا ابيشام + + لمن اشبه انا واكابرى لمن + يشبهون قلت له تشبه انت + لبيل الصنم واكابرك يشبهون + لخدامه فقال لى امضي الى + منزلك وايضا قال اكابره بالغد + البسوا كلكم ثياب احمر وتجوا + ... + + + + + + + + + + + . + حقًا + + + + ܀ ܬܘܒ ܒܚܹܝܠ + + + ܝܗ̈ܿ + ܝܗ + ܟܿܬܒܢܐ ܩܲܠܝܼܠ ܡܼܢ ܡ̈ܬܼܠܐ ܕܐܚܝܼܩܲܪ܆ + + + ܢܒܬܕܝ ܒܥܘܢ ܐܠܒܐܪܝاختبار ܬܥܐܠܝ ܓܠ ܐܣܡܗ + + ܘܬܥܐܠܝ ܕܟܪܗ ܐܠܝ ܐܠܐܒܕ. ܘܢܟܬܒ ܟܒܪ + ܐܠܚܟܝܡ ܐܠܡܐܗܪ + ܐܠܦܠܝܘܣ + ܐܠܦܠܝܣܘܦ + ܐܠܫܐܛܪ + ܘܙܝܪ ܣܢܚܐܪܝܒ ܐܒܢ ܣܪܚܐܘܕܡ ܡܠܟ + ܐܬܘܪ + + + ܘܢܝܢܘܝ + ܘܐܠܡܘܨܠ ܘܡܐ ܓܪܐ ܡܥܗ ܘܡܢ + ܐܒܢ ܐܟܬܗ ܢܐܕܐܢ . ܟܐܢ ܦܝ ܐܝܐܡ ܐܠܡܠܟ ܐܒܢ ܣܪܚܐܕܘܡ + ܡܠܟ ܐܪܜ + ܐܬܘܪ + + ܘܢܝܢܘܝ ܘܒܠܐܕܗܐ. ܪܓܠ ܚܟܝܡ ܝܩܐܠ + ܠܗ ܚܝܩܐܪ ܘܟܐܢ ܘܙܝܪ ܐܠܡܠܟ ܣܢܚܐܪܝܒ ܘܟܐܬܒܗ + ܘܟܐܢ + ܕܘ ܡܐܠ ܓܙܝܠ ܘܪܙܩ ܟܬܝܪ. ܘܟܐܢ ܡܐܗܪ ܚܟܝܡ ܦܝܠܣܘܦ + + + + رأس اختبارمتقاطع + + ܕܘ ܡܥܪܦܗ ܘܪܐܝ ܘܬܕܒܝܪ. ܘܟܐܢ ܩܕ ܬܙܘܓ ܣܬܝܢ ܐܡܪܐܗ + ܘܒܢܝ ܠܟܠ ܘܐܚܕܗ ܡܢܗܢ ܡܩܨܘܪܗ. ܘܡܥ ܗܕܐ ܟܠܗ + ܠܡ ܝܟܢ ܠܗ ܘܠܕ ܝܪܬܗ. ܘܟܐܢ ܟܬܝܪ ܐܠܗܡ ܠܐܓܠ ܕܠܟ + ܘܐܢܗ ܦܝ ܕܐܬ ܝܘܡ ܓܡܥ ܐܠܡܢܓܡܝܢ ܘܐܠܣܚܪܗ + ܘܐܠܥܐܪܦܝܢ. ܘܐܫܟܐ ܠܗܡ ܚܐܠܗ ܘܐܡܪ + ܒܥܩܘܪܝܬܗ + ܥܩܘܪܝܬܗ + + + ܒܥܩܘܪܝܬܗ + ܥܩܘܪܝܬܗ + + + ܦܩܐܠܘܐ ܠܗ ܐܕܟܠ ܐܕܒܚ ܠܠܐܠܗܗ ܘܐܣܬܓܝܪ ܒܗܡ + ܠܥܠܗܡ ܝܪܙܩܘܟ ܘܠܕܐ. ܦܦܥܠ ܟܡܐ ܩܐܠܘܐ ܠܗ. ܘܩܕܡ + ܐܠܩܪܐܒܝܢ ܠܠܐܨܢܐܡ ܘܐܣܬܓܐܬ ܒܗܡ. ܘܬܜܪܥ ܐܠܝܗܡ + ܒܐܠܛܠܒܗ ܘܐܠܕܥܐ. ܦܠܡ ܝܓܝܒܘܗ ܒܟܠܡܗ. ܦܟܪܓ + ܝܚܙܐܢ ܢܕܡܐܢ ܟܐܝܒ ܘܐܢܨܪܦ ܡܬܐܠܡ ܐܠܩܠܒ. ܘܪܓܥ + ܒܐܠܬܜܪܥ ܐܠܝ ܐܠܠܗ ܬܥܐܠܝ. ܘܐܡܢ ܘܐܣܬܥܐܢ ܒܗ ܒܚܪܩܗ̈ + ܩܠܒ ܩܐܝܠܐ. ܝܐ ܐܠܐܗ ܐܠܣܡܐ ܘܐܠܐܪܜ. ܝܐ ܟܐܠܩ + + ܩܠܒ اختبار ܩܐܝܠܐ + + ܩܠܒ ܩܐܝܠܐ : + + + + . نهايةاختبار + النصوماتت. + + + + الخلايق كلها + + + + + + + ܐܠܟܠܐܝܩ ܟܠܗܐ. + كان كذلك ، لذا لم يكن كذلك. + + ܐܢܐ ܐܛܠܒ ܐܠܝܟ ܐܢ ܬܘܗܒܢܝ + + ܘܠܕܐ ܚܬܝ ܐܬܥܙܐ ܒܗ ܘܝܪܬܢܝ ܘܝܚܜܪ ܒܡܘܬܝ + + ܘܝܓܡܜ ܥܝܢܐܝ ܘܝܕܦܢܢܝ. ܦܥܢܕ ܕܠܟ ܐܬܐܗ ܨܘܬ + + ܡܢ ܐܠܣܡܐ ܩܐܝܠܐ. ܒܚܝܬ ܐܬܟܠܬ ܐܘܠܐ ܥܠܝ ܐܠܐܨܢܐܡ + ܐܠܡܢܚܘܬܗ. ܘܩܕܡܬ ܠܗܡ ܐܠܩܪܐܒܝܢ. ܠܕܠܟ + ܬܒܩܐ ܒܠܐ ܘܠܕ. ܒܠ ܐܢ ܢܐܕܐܢ ܐܒܢ ܐܟܬܟ ܟܕܗ + ܘܐܓܥܠܗ ܠܟ ܘܠܕܐ. ܘܥܠܡܗ ܥܠܡܟ ܘܐܕܒܟ ܘܚܟܡܬܟ + ܘܗܘ ܝܪܬܟ. ܥܢܕ ܕܠܟ ܐܟܕ ܢܐܕܐܢ ܐܒܢ ܐܟܬܗ ܘܟܐܢ + ܨܓܝܪ ܝܪܜܥ. ܦܣܠܡܗ ܐܠܝ ܬܡܐܢܝܗ̈ ܢܣܐ ܡܪܜܥܐܬ + ܠܝܪܜܥܘܗ ܘܝܪܒܘܗ. ܦܪܒܘܗ ܒܐܠܐܟܠ ܐܠܛܝܒ ܘܐܠܒܣܘܗ + ܐܠܚܪܝܪ ܘܐܠܐܪܓܘܐܢ ܘܐܠܩܪܡܙ ܘܟܐܢ ܓܠܘܣܗ ܥܠܝ + ܐܠܛܢܐܦܣ ܐܠܚܪܝܪ. ܦܠܡܐ ܟܒܪ ܢܐܕܐܢ ܘܡܫܝ ܘܢܡܝ + ܡܬܠ ܐܠܐܪܙ ܐܠܥܐܠܝ ܦܥܠܡܗ ܐܠܟܬܐܒܗ ܘܐܠܩܪܐܐܗ + ܘܐܠܬܐܕܝܒ ܘܐܠܦܠܣܦܗ. ܦܠܡܐ ܟܐܢ ܒܥܜ ܐܠܐܝܐܡ + ܢܜܪ ܣܢܚܐܪܝܒ ܐܠܡܠܟ ܦܪܐܝ ܚܝܩܐܪ ܘܙܝܪܗ + ܘܟܐܬܒܗ ܘܗܘ ܩܕ ܒܩܝ ܪܓܠ ܫܝܟ ܟܒܝܪ + ܦܩܐܠ ܠܗ ܐܝܗܐ ܐܠܨܐܚܒ ܐܠܡܚܒ ܐܠܡܟܪܡ + ܐܠܡܐܗܪ ܐܠܡܕܒܪ ܐܠܚܟܝܡ ܟܐܬܒܝ ܘܘܙܝܪܝ ܘܟܐܬܡ + ܣܪܝ ܘܡܕܒܪ ܕܘܠܬܝ. ܗܐ ܩܕ ܟܒܪܬ ܘܛܥܢܬ ܦܝ + ܐܠܣܢ ܘܫܟܬ.اختبار ܘܩܪܒ ܘܩܬ ܡܘܬܟ ܘܘܦܐܬܟ. ܦܩܘܠ + ܠܝ ܡܢ ܝܩܘܡ ܦܝ ܟܕܡܬܝ ܒܥܕܟ. ܦܩܐܠ ܠܗ + + هذا حيث ينتهي النص. + + + + + + + + + + ܬܘܼܒ + + + + + خدمتني وخدمت ابي سرحادوم كذلك يكون هذا ولدك + يكرمني + يخدمني + + + + + + + + + + [܂]ܢܬ [܂܂܂]ܡܪ + ܫܢܬ ܐܬܐܡܪ ܗܼܘܐ ܠܝܼ܂ + + + + + + unclear + ܘܬܚܙܐ ܐܢܬܬܐ ܕܣܩܝܠܐ + ܘܡܨܒܬܐ܇ + ܠ[܂] ܬܪܓܝ[܂] + ܠܐ ܬܪܓܝܗܿ + + + + + + + + + + نبتدي بعون الله ܘܢܟܬܒ ܩܨܗ̈ + + + + + + + ܥܲܝܢܹܗ ܢܕܲܒܲܪ ܒܲܝܬܹܿܗ܀ ܒܹܪܝ ܛܵܒܼ ܥܘܝܼܪ ܒܥܲܝܢ̈ܘܗܝ ܡܼܢ ܗܵܘܿ ܕܲܥܘܝܼܪ + + + ܠܲܝܬܿ ܠܹܗ܂ ܘܛܵܒܼܘܼ ܩܵܠܐ ܕܐܘܼܠ̈ܝܬܼܵܐ ܒܐܹܕ̈ܢܲܝ ܣܲܟܼܠܵܐ܉ ܡܢ ܙܡܵܪܵܐ + + + + + ܣܿܢܚܹܪܝܼܒܼ ܡܵܪܝ ܠ܂܂܂ + ܂܂܂܂ ܘܪܵܘܪ̈ܒܼܵܢܵܘܗܝ ܠܒܲܪ̈ܩܹܐ + + + + + + + والعساكر وانطلقوا الى الصحره الى بقعة + + + نسرين فلما وصلوا فنظر الملك + الى حيقار + + + + + + + ܟܪܐܣ ܥܐܫܪ + + + + + + والأن فبقي + بقى + أمرادني + اريد منك حتى + ان تبني لك + لي + + + + + + + + + + يا بني + لا تكون مثل شجرة اللوز لانها + + + + ولا تبادر برد الجواب لا + + + + + + + + + + + + + ܦܩܐܠ ܠܗ ܣܝܕܝ ܝܫܒܗ ܐܠܐܗ ܐܠܣܡܐ + ܘܐܟܐܒܪܗ + + + + + + + فيها هكذا وجدنا وكتبنا والله + لهو + له + المجد والشكر الي الابد امين + + + + + + + + + ܦܫܐܚܬܗ + ܦܚܐܫܬܗ + + ܐܠܪܕܝܗ ܝܐ ܐܒܢܝ ܐܩܬܢܝ ܠܟ ܬܘܪ + + + + + + + ܘܟܼܠܡܿܢ ܕܢܹܥܒܲܪ ܥܠܸܝܗܿ ܘܕܵܐܹܫ ܠܵܗܿ + ܐܵܟܹܿܠ ܡܼܢ + + + ܠܙܿܠܝܼܩܵܘ̈ܗܝ܂ ܘܬܼܘܼܒܼ ܐܡܼܪ ܠܝܼ܂ ܙܸܠ + + ܐܲܒܼܝܼܩܵܡ܂ + ܐܲܒܼܝܼܩܲܡ܂ + + + + + + + + + ܫܬܿܝܼܢ܂ ܘܲܒܼܢܝܹܬ ܠܗܹܝܢ ܒܝܼܪ̈ܬܼܵܐ + [܂܂܂]ܢ܂ + ܫܬܝܢ܂ + + + + + ܗܘܹ̇ܝܬܿ ܠܝܼ ܐܲܝܟܼ ܐܲܪܝܵܐ ܕܲܚܙܵܐ ܚܡܵܪܵܐ ܒܥܸܕܵܢ ܨܲܦ + + + ܨܠܘܿܬܼܵܟܼ܂ ܘܠܵܐ ܢܫܲܠܸܡ ܥܲܡܵܟ ܒܛܲܒܼܬܼܵܐ܂ ܐܘܿ ܒܹܪܝ + + ܗܘܿܝܬ ܠܝ + + + + + + + + + + ساداتي رقوا لعبدٍ في ذنوب لا يعدوا + + + + + + ܘܡܹܚܑܼܓܲܪ ܒܗܵܘܬܼܵܐ ܫܝܘܿܠܵܝܬܿܐ܇ ܗܵܪܟܿܐ + ܫܸܠܡܲܬܸ + + + + + + + ܦܘܩܕ̈ܢܐ ܕܚܝܩܪ ܚܟܝܡܐ ܕܠܘܬ ܢܵܕܵܢ ܒܪ ܚܬܗ + النقط مكان تفويت + + + + + + + ܒܼܪܵܐ ܠܵܐ܇ ܒܢܲܝܢܲܫ̈ܐܵ܇ ܕܗܵܐ ܠܵܡ ܐܲܚܝܼܩܲܪ ܟܐܹܢܵܐ ܘܛܵܒܼܵܐ + ܘܲܦܠܲܚ + ܠܐܲܠܗܵ + ܠܐܲܠܗܵܐ + + + + + + + ܒܝܼܪܬܵܐ ܚܕܵܐ ܐܝܼܬ ܠܝܼ ܒܝܪܬܐ ܚܕܐ + + ܕܐܸܒܢܸܐ ܒܲܫܡܲܝܵܐ ܠܐܲܪܥܵܐ ܚܙܝܼ ܫܲܕܲܪ ܠܝܼ ܓܲܒܼܪܵܐ + + + ܡܼܢ + + unclear + + ܕܘܼܟܝܿܬܗ̈ܝܢ + + + ܘܫܛܘܝܬ + ܓܓܠܐ + ܓܝܓܠܐ + ܒܪܹ̈ܓܠܝܼܗܘܢ ܒܡܫܘܚܬܐ ܐܪܟܐܼ + + + + + + الذي رفع السماء ما يقدر يبني + + + عنَّا اعجلوا الينا في الحجاره + + + + + + + + + [܂܂]ܛܿܪܬ + unknown ܓܪ̈ܓܐ + ܒܪܓܠܝܗܘܢ܂ + ܒܪ̈ܓܠܝܗܘܢ܂ + + + + + + + + ܐܙ[܂܂] + unknown + ܗܘ ܕܝܢ ܗܼܒ ܠܝ ܡܠܟܐ + + + + + + + + ܘܪܒܼܐ ܒܪܝ ܘܫܘܼܚ ܐܝܟ ܐܪܢܐ܂ + ܟܬܘܒܼܐ ܡܬܼܚܫܒ ܠܗܿ ܐܪܢܐ ܐܘ ܐܪܙܐ + ܘܟܼܕ ܪܒܼܐ ܐܠܦܬܿܗ + + + + ܣܪܚܕܘܡ + + ܒܐܨܚܬܐ ܐܚܪܝܬܐ ܣܲܪܚܵܠܝܼܡ܂ + ܣܒ ܚܠܝܡ + ܐܒܼܝ܆ ܘܩܕܡܝ ܐܬܼܦܪܥ܂ ܘܐܩܝܡ + + + ܠܐ ܬܣܪܘܚ܆ ܘܥܡ ܣܪܘܚܐ ܬܬܼܚܟܡ܂ + ܒܐܨ܆ ܐܚܪ܆ ܠܐ ܬܬܼܚܟܡܼ + + om. + habet + ܒܪܝ + + + ܘܪܘܪ̈ܒܼܢܝܟ + ܡܢܗܿ܂ ܥܠ ܗܕܐ ܟܬܼܒܬܼ ܠܗ ܡܼܢ ܐܨܚܬܐ ܐܚܪܬܐ܂ + ܠܟܼܘܟܒܼ̈ܐ܀ ܘܐܡܼܪ ܠܝ ܙܠ ܐܒܿܝܩܡ ܘܠܨܦܪܐ + + + + + + ܒܫ̈ܢܝ ܣܢܚܪܝܒ ܡܠܟܐ ܕܐܬܘܪ + + ܘܕܢ + + ܘܕܢܝܢܘܐ + + + + + + + ܡܢ ܕܠܡܠܦܘ ܠܒܪܝ ܢܕܢ܂ ܥܕܡܐ + + + + ܠܘܙܐ ܕܠܘܩܕܡ ܡܦܪܥ ܘܠܚܪܬܐ + + + + + + ܘܗܦܟܬ ܛܥܢܬ ܐܰܒܵܪܐ ܘܠܐ ܐܝܼܩܰܪ ܥܠܝ ܐܝܟ + + + + some test text + some testܢܕܢ܂ + + + + + \ No newline at end of file diff --git a/exist-app/data/sample_teixml_2_meta.xml b/exist-app/data/sample_teixml_2_meta.xml new file mode 100644 index 0000000..69132f1 --- /dev/null +++ b/exist-app/data/sample_teixml_2_meta.xml @@ -0,0 +1,19 @@ + + + + + Beispieldatei zum Testen + text/xml + + + + textgrid:sample_teixml.0 + + + + + + + + + diff --git a/exist-app/data/sample_teixml_3.xml b/exist-app/data/sample_teixml_3.xml new file mode 100644 index 0000000..983463a --- /dev/null +++ b/exist-app/data/sample_teixml_3.xml @@ -0,0 +1,821 @@ + + + + + + The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, + king of Assyria and Nineveh + Simon Birol + Aly Elrefaei + + + Georg-August Universität Göttingen, Theologische Fakultät, Seminar für Altes + Testament + + + + + + Great Britain + + University of Cambridge - Cambridge University Library + Add. 2020 + + + + Classical Syriac + + + + + codex + Iraq + Alqosh + 18.10.1697 + + + + + Wright, William: A catalogue of the Syriac manuscripts preserved in the library + of the University of Cambridge, vol. 2, Cambridge 1901, p. 583-9. + + + + + + East Syriac script + + + + proverbs + prose + + + + Arabic + Classical Syriac + Karshuni + Western Syriac + Eastern Syriac + + + + + color: red; + Serto Jerusalem + + + + + + Conversion to specified TEI by SUB Göttingen + + + + + + + + + + + + + + + . + حقًاحيث تبدأ القصة + + + نبتدي بعون البارياختبار تعالى جل اسمه + + + وتعالى ذكره الى الابد. ونكتب خبر + الحكيم الماهر الفليوس الشاطر + + + وزير سنحاريب ابن سرحادوم ملك + اتور + + + + + ونينوى + والموصل . وما جرا منه ومن + ابن اخته نادان . كان في ايام الملك ابن + سرحادوم + + ملك ارض اتور + ونينوى وبلادها. رجل حكيم يقال + له حيقار . وكان وزير الملك سنحاريب + وكاتبه وكان + ذو مال جزيل ورزق كثير. وكان ماهر حكيم فيلسوف + ذو معرفه وراي وتدبير. وكان قد تزوج ستين امراه + + + + رأس اختبارمتقاطع + وبنى لكل واحده منهن مقصوره. ومع هذا كله + لم يكن له ولد يرثه. وكان كثير الهم لاجل ذلك + وانه في ذات يوم جمع المنجمين والسحره + والعارفين. واشكا لهم حاله وامر + + + بعقوريته + عقوريته + + + بعقوريته + عقوريته + + + فقالوا له ادخل ادبح للالهه واستجير بهم + لعلهم يرزقوك ولدًا. ففعل كما قالوا له. وقدم + القرابين للاصنام واستغاث بهم. وتضرّع اليهم + بالطلبه والدعا. فلم يجيبوه بكلمه. فخرج + يحزان ندمان خايب وانصرف متالم القلب. ورجع + بالتضرع الى الله تعالى. وامن واستعان به بحرقة + قلب قايلًا. يا الاه السما والارض. يا خالق + + + هل اختبار أقارنك بيوم صيفي؟ + انت أكثر جميلة وأكثر اعتدالا: + + + + + . نهايةاختبار + النصوماتت. + + + + + + الخلايق كلها.كان كذلك ، لذا لم يكن كذلك. انا اطلب اليك ان + توهبني + + + ولدًا حتى اتعزا به ويرثني ويحضر بموتي + + ويغمض عيناي ويدفنني. فعند ذلك اتاه صوت + + من السما قايلا. بحيث اتكلت اولًا على الاصنام + المنحوته. وقدمت لهم القرابين. لذلك + تبقا بلا ولد. بل ان نادان ابن اختك خذه + + واجعله لك ولدًا. وعلمه علمك وادبك وحكمتك + وهو يرثك. عند ذلك اخذ نادان ابن اخته وكان + صغير يرضع. فسلمه الى تمانية نسا مرضعات + ليرضعوه ويربوه. فربوه بالاكل الطيب والبسوه + الحرير والارجوان والقرمز وكان جلوسه على + الطنافس الحرير. فلما كبر نادان ومشى ونمى + مثل الارز العالي فعلمه الكتابه والقرااه + والتاديب والفلسفه. فلما كان بعض الايام + نظر سنحاريب الملك فراى حيقار وزيره + وكاتبه وهو قد بقى رجل شيخ كبير + فقال له ايها الصاحب المحب المكرم + الماهر المدبر الحكيم كاتبي ووزيري وكاتم + سري ومدبر دولتي. ها قد كبرت وطعنت في + السناختبار وشخت. وقرب وقت موتك ووفاتك. فقول + + + ألي من يقوم في خدمتي بعدك. فقال له + + حقر + + هذا حيث ينتهي النص. + + + + + + + + + وقال للسياف كان اسمه يبوس + + + ميكمسكينكنتي قوم خد + حيقر وامضي + + + + + + مصر الى عند + فرعون الملك ولما + + + والان كملت قصت حيقر الحكيم الفارسي + + + + + + فتركهم وحزن وتالم ܘܟܓܪܒ بقوله + + + + + + وختمهم بختم خاله حيقار . واما + + هم في دار الملك ثم مضا ايضا وكتب + + + + صوته فيطرحون + صهل في بلاد اتور + ونينوا فسمعوا خيلنا صوته فطرحوا فلما سمع + حيقار + + + + قيل بالامثال من لا يسمع من اذنيه + + + + + + فيا سادتي رقّوا لعبدًا + في ذنوبا لا يعدوا + جا بالتقصير يسال + ان تروا عيبا فسدّوا + + + + + + الرعيَّه. يا ابني اربعةً اخر العاقل والاحمق + + + + + هذا + سطين الحجر قدَّ حتى اخيط لكم هذا الحجر ... + + + + + + + + + بالعطاي وكبره وبعد يوم انا + + حيقار بعثت الى اشفغني زوجتي + وقلت لها حال وصول اليكي + امري قولي للصيادين ان يصيدوا + لنا فرخين نسورا وقولي لصناع + القطن ان يفتلوا لنا شريطين + يكونوا غليظ صبع وطول الفين + ذراع والنجارين حتى ينجرون صناديق + كبار واعطي نبوحال + وطبوليم + + لسبعة نسا مرضعة حتى يربوهم + واذبحي كليوم خاروف للنسورا + ... + + + + فرعون اكابره ان يلبسون ثياب + البرفير الاحمار والملك لبس + ثوب ارجاونى وجلس على كرسيه + وكل عظاماه قيام قدامه وامر + ادخلوني اليه قال لى يا ابيشام + + لمن اشبه انا واكابرى لمن + يشبهون قلت له تشبه انت + لبيل الصنم واكابرك يشبهون + لخدامه فقال لى امضي الى + منزلك وايضا قال اكابره بالغد + البسوا كلكم ثياب احمر وتجوا + ... + + + + + + + + + + + . + حقًا + + + + ܀ ܬܘܒ ܒܚܹܝܠ + + + ܝܗ̈ܿ + ܝܗ + ܟܿܬܒܢܐ ܩܲܠܝܼܠ ܡܼܢ ܡ̈ܬܼܠܐ ܕܐܚܝܼܩܲܪ܆ + + + ܢܒܬܕܝ ܒܥܘܢ ܐܠܒܐܪܝاختبار ܬܥܐܠܝ ܓܠ ܐܣܡܗ + + ܘܬܥܐܠܝ ܕܟܪܗ ܐܠܝ ܐܠܐܒܕ. ܘܢܟܬܒ ܟܒܪ + ܐܠܚܟܝܡ ܐܠܡܐܗܪ + ܐܠܦܠܝܘܣ + ܐܠܦܠܝܣܘܦ + ܐܠܫܐܛܪ + ܘܙܝܪ ܣܢܚܐܪܝܒ ܐܒܢ ܣܪܚܐܘܕܡ ܡܠܟ + ܐܬܘܪ + + + ܘܢܝܢܘܝ + ܘܐܠܡܘܨܠ ܘܡܐ ܓܪܐ ܡܥܗ ܘܡܢ + ܐܒܢ ܐܟܬܗ ܢܐܕܐܢ . ܟܐܢ ܦܝ ܐܝܐܡ ܐܠܡܠܟ ܐܒܢ ܣܪܚܐܕܘܡ + ܡܠܟ ܐܪܜ + ܐܬܘܪ + + ܘܢܝܢܘܝ ܘܒܠܐܕܗܐ. ܪܓܠ ܚܟܝܡ ܝܩܐܠ + ܠܗ ܚܝܩܐܪ ܘܟܐܢ ܘܙܝܪ ܐܠܡܠܟ ܣܢܚܐܪܝܒ ܘܟܐܬܒܗ + ܘܟܐܢ + ܕܘ ܡܐܠ ܓܙܝܠ ܘܪܙܩ ܟܬܝܪ. ܘܟܐܢ ܡܐܗܪ ܚܟܝܡ ܦܝܠܣܘܦ + + + + رأس اختبارمتقاطع + + ܕܘ ܡܥܪܦܗ ܘܪܐܝ ܘܬܕܒܝܪ. ܘܟܐܢ ܩܕ ܬܙܘܓ ܣܬܝܢ ܐܡܪܐܗ + ܘܒܢܝ ܠܟܠ ܘܐܚܕܗ ܡܢܗܢ ܡܩܨܘܪܗ. ܘܡܥ ܗܕܐ ܟܠܗ + ܠܡ ܝܟܢ ܠܗ ܘܠܕ ܝܪܬܗ. ܘܟܐܢ ܟܬܝܪ ܐܠܗܡ ܠܐܓܠ ܕܠܟ + ܘܐܢܗ ܦܝ ܕܐܬ ܝܘܡ ܓܡܥ ܐܠܡܢܓܡܝܢ ܘܐܠܣܚܪܗ + ܘܐܠܥܐܪܦܝܢ. ܘܐܫܟܐ ܠܗܡ ܚܐܠܗ ܘܐܡܪ + ܒܥܩܘܪܝܬܗ + ܥܩܘܪܝܬܗ + + + ܒܥܩܘܪܝܬܗ + ܥܩܘܪܝܬܗ + + + ܦܩܐܠܘܐ ܠܗ ܐܕܟܠ ܐܕܒܚ ܠܠܐܠܗܗ ܘܐܣܬܓܝܪ ܒܗܡ + ܠܥܠܗܡ ܝܪܙܩܘܟ ܘܠܕܐ. ܦܦܥܠ ܟܡܐ ܩܐܠܘܐ ܠܗ. ܘܩܕܡ + ܐܠܩܪܐܒܝܢ ܠܠܐܨܢܐܡ ܘܐܣܬܓܐܬ ܒܗܡ. ܘܬܜܪܥ ܐܠܝܗܡ + ܒܐܠܛܠܒܗ ܘܐܠܕܥܐ. ܦܠܡ ܝܓܝܒܘܗ ܒܟܠܡܗ. ܦܟܪܓ + ܝܚܙܐܢ ܢܕܡܐܢ ܟܐܝܒ ܘܐܢܨܪܦ ܡܬܐܠܡ ܐܠܩܠܒ. ܘܪܓܥ + ܒܐܠܬܜܪܥ ܐܠܝ ܐܠܠܗ ܬܥܐܠܝ. ܘܐܡܢ ܘܐܣܬܥܐܢ ܒܗ ܒܚܪܩܗ̈ + ܩܠܒ ܩܐܝܠܐ. ܝܐ ܐܠܐܗ ܐܠܣܡܐ ܘܐܠܐܪܜ. ܝܐ ܟܐܠܩ + + ܩܠܒ اختبار ܩܐܝܠܐ + + ܩܠܒ ܩܐܝܠܐ : + + + + . نهايةاختبار + النصوماتت. + + + + الخلايق كلها + + + + + + + ܐܠܟܠܐܝܩ ܟܠܗܐ. + كان كذلك ، لذا لم يكن كذلك. + + ܐܢܐ ܐܛܠܒ ܐܠܝܟ ܐܢ ܬܘܗܒܢܝ + + ܘܠܕܐ ܚܬܝ ܐܬܥܙܐ ܒܗ ܘܝܪܬܢܝ ܘܝܚܜܪ ܒܡܘܬܝ + + ܘܝܓܡܜ ܥܝܢܐܝ ܘܝܕܦܢܢܝ. ܦܥܢܕ ܕܠܟ ܐܬܐܗ ܨܘܬ + + ܡܢ ܐܠܣܡܐ ܩܐܝܠܐ. ܒܚܝܬ ܐܬܟܠܬ ܐܘܠܐ ܥܠܝ ܐܠܐܨܢܐܡ + ܐܠܡܢܚܘܬܗ. ܘܩܕܡܬ ܠܗܡ ܐܠܩܪܐܒܝܢ. ܠܕܠܟ + ܬܒܩܐ ܒܠܐ ܘܠܕ. ܒܠ ܐܢ ܢܐܕܐܢ ܐܒܢ ܐܟܬܟ ܟܕܗ + ܘܐܓܥܠܗ ܠܟ ܘܠܕܐ. ܘܥܠܡܗ ܥܠܡܟ ܘܐܕܒܟ ܘܚܟܡܬܟ + ܘܗܘ ܝܪܬܟ. ܥܢܕ ܕܠܟ ܐܟܕ ܢܐܕܐܢ ܐܒܢ ܐܟܬܗ ܘܟܐܢ + ܨܓܝܪ ܝܪܜܥ. ܦܣܠܡܗ ܐܠܝ ܬܡܐܢܝܗ̈ ܢܣܐ ܡܪܜܥܐܬ + ܠܝܪܜܥܘܗ ܘܝܪܒܘܗ. ܦܪܒܘܗ ܒܐܠܐܟܠ ܐܠܛܝܒ ܘܐܠܒܣܘܗ + ܐܠܚܪܝܪ ܘܐܠܐܪܓܘܐܢ ܘܐܠܩܪܡܙ ܘܟܐܢ ܓܠܘܣܗ ܥܠܝ + ܐܠܛܢܐܦܣ ܐܠܚܪܝܪ. ܦܠܡܐ ܟܒܪ ܢܐܕܐܢ ܘܡܫܝ ܘܢܡܝ + ܡܬܠ ܐܠܐܪܙ ܐܠܥܐܠܝ ܦܥܠܡܗ ܐܠܟܬܐܒܗ ܘܐܠܩܪܐܐܗ + ܘܐܠܬܐܕܝܒ ܘܐܠܦܠܣܦܗ. ܦܠܡܐ ܟܐܢ ܒܥܜ ܐܠܐܝܐܡ + ܢܜܪ ܣܢܚܐܪܝܒ ܐܠܡܠܟ ܦܪܐܝ ܚܝܩܐܪ ܘܙܝܪܗ + ܘܟܐܬܒܗ ܘܗܘ ܩܕ ܒܩܝ ܪܓܠ ܫܝܟ ܟܒܝܪ + ܦܩܐܠ ܠܗ ܐܝܗܐ ܐܠܨܐܚܒ ܐܠܡܚܒ ܐܠܡܟܪܡ + ܐܠܡܐܗܪ ܐܠܡܕܒܪ ܐܠܚܟܝܡ ܟܐܬܒܝ ܘܘܙܝܪܝ ܘܟܐܬܡ + ܣܪܝ ܘܡܕܒܪ ܕܘܠܬܝ. ܗܐ ܩܕ ܟܒܪܬ ܘܛܥܢܬ ܦܝ + ܐܠܣܢ ܘܫܟܬ.اختبار ܘܩܪܒ ܘܩܬ ܡܘܬܟ ܘܘܦܐܬܟ. ܦܩܘܠ + ܠܝ ܡܢ ܝܩܘܡ ܦܝ ܟܕܡܬܝ ܒܥܕܟ. ܦܩܐܠ ܠܗ + + هذا حيث ينتهي النص. + + + + + + + + + + ܬܘܼܒ + + + + + خدمتني وخدمت ابي سرحادوم كذلك يكون هذا ولدك + يكرمني + يخدمني + + + + + + + + + + [܂]ܢܬ [܂܂܂]ܡܪ + ܫܢܬ ܐܬܐܡܪ ܗܼܘܐ ܠܝܼ܂ + + + + + + unclear + ܘܬܚܙܐ ܐܢܬܬܐ ܕܣܩܝܠܐ + ܘܡܨܒܬܐ܇ + ܠ[܂] ܬܪܓܝ[܂] + ܠܐ ܬܪܓܝܗܿ + + + + + + + + + + نبتدي بعون الله ܘܢܟܬܒ ܩܨܗ̈ + + + + + + + ܥܲܝܢܹܗ ܢܕܲܒܲܪ ܒܲܝܬܹܿܗ܀ ܒܹܪܝ ܛܵܒܼ ܥܘܝܼܪ ܒܥܲܝܢ̈ܘܗܝ ܡܼܢ ܗܵܘܿ ܕܲܥܘܝܼܪ + + + ܠܲܝܬܿ ܠܹܗ܂ ܘܛܵܒܼܘܼ ܩܵܠܐ ܕܐܘܼܠ̈ܝܬܼܵܐ ܒܐܹܕ̈ܢܲܝ ܣܲܟܼܠܵܐ܉ ܡܢ ܙܡܵܪܵܐ + + + + + ܣܿܢܚܹܪܝܼܒܼ ܡܵܪܝ ܠ܂܂܂ + ܂܂܂܂ ܘܪܵܘܪ̈ܒܼܵܢܵܘܗܝ ܠܒܲܪ̈ܩܹܐ + + + + + + + والعساكر وانطلقوا الى الصحره الى بقعة + + + نسرين فلما وصلوا فنظر الملك + الى حيقار + + + + + + + ܟܪܐܣ ܥܐܫܪ + + + + + + والأن فبقي + بقى + أمرادني + اريد منك حتى + ان تبني لك + لي + + + + + + + + + + يا بني + لا تكون مثل شجرة اللوز لانها + + + + ولا تبادر برد الجواب لا + + + + + + + + + + + + + ܦܩܐܠ ܠܗ ܣܝܕܝ ܝܫܒܗ ܐܠܐܗ ܐܠܣܡܐ + ܘܐܟܐܒܪܗ + + + + + + + فيها هكذا وجدنا وكتبنا والله + لهو + له + المجد والشكر الي الابد امين + + + + + + + + + ܦܫܐܚܬܗ + ܦܚܐܫܬܗ + + ܐܠܪܕܝܗ ܝܐ ܐܒܢܝ ܐܩܬܢܝ ܠܟ ܬܘܪ + + + + + + + ܘܟܼܠܡܿܢ ܕܢܹܥܒܲܪ ܥܠܸܝܗܿ ܘܕܵܐܹܫ ܠܵܗܿ + ܐܵܟܹܿܠ ܡܼܢ + + + ܠܙܿܠܝܼܩܵܘ̈ܗܝ܂ ܘܬܼܘܼܒܼ ܐܡܼܪ ܠܝܼ܂ ܙܸܠ + + ܐܲܒܼܝܼܩܵܡ܂ + ܐܲܒܼܝܼܩܲܡ܂ + + + + + + + + + ܫܬܿܝܼܢ܂ ܘܲܒܼܢܝܹܬ ܠܗܹܝܢ ܒܝܼܪ̈ܬܼܵܐ + [܂܂܂]ܢ܂ + ܫܬܝܢ܂ + + + + + ܗܘܹ̇ܝܬܿ ܠܝܼ ܐܲܝܟܼ ܐܲܪܝܵܐ ܕܲܚܙܵܐ ܚܡܵܪܵܐ ܒܥܸܕܵܢ ܨܲܦ + + + ܨܠܘܿܬܼܵܟܼ܂ ܘܠܵܐ ܢܫܲܠܸܡ ܥܲܡܵܟ ܒܛܲܒܼܬܼܵܐ܂ ܐܘܿ ܒܹܪܝ + + ܗܘܿܝܬ ܠܝ + + + + + + + + + + ساداتي رقوا لعبدٍ في ذنوب لا يعدوا + + + + + + ܘܡܹܚܑܼܓܲܪ ܒܗܵܘܬܼܵܐ ܫܝܘܿܠܵܝܬܿܐ܇ ܗܵܪܟܿܐ + ܫܸܠܡܲܬܸ + + + + + + + ܦܘܩܕ̈ܢܐ ܕܚܝܩܪ ܚܟܝܡܐ ܕܠܘܬ ܢܵܕܵܢ ܒܪ ܚܬܗ + النقط مكان تفويت + + + + + + + ܒܼܪܵܐ ܠܵܐ܇ ܒܢܲܝܢܲܫ̈ܐܵ܇ ܕܗܵܐ ܠܵܡ ܐܲܚܝܼܩܲܪ ܟܐܹܢܵܐ ܘܛܵܒܼܵܐ + ܘܲܦܠܲܚ + ܠܐܲܠܗܵ + ܠܐܲܠܗܵܐ + + + + + + + ܒܝܼܪܬܵܐ ܚܕܵܐ ܐܝܼܬ ܠܝܼ ܒܝܪܬܐ ܚܕܐ + + ܕܐܸܒܢܸܐ ܒܲܫܡܲܝܵܐ ܠܐܲܪܥܵܐ ܚܙܝܼ ܫܲܕܲܪ ܠܝܼ ܓܲܒܼܪܵܐ + + + ܡܼܢ + + unclear + + ܕܘܼܟܝܿܬܗ̈ܝܢ + + + ܘܫܛܘܝܬ + ܓܓܠܐ + ܓܝܓܠܐ + ܒܪܹ̈ܓܠܝܼܗܘܢ ܒܡܫܘܚܬܐ ܐܪܟܐܼ + + + + + + الذي رفع السماء ما يقدر يبني + + + عنَّا اعجلوا الينا في الحجاره + + + + + + + + + [܂܂]ܛܿܪܬ + unknown ܓܪ̈ܓܐ + ܒܪܓܠܝܗܘܢ܂ + ܒܪ̈ܓܠܝܗܘܢ܂ + + + + + + + + ܐܙ[܂܂] + unknown + ܗܘ ܕܝܢ ܗܼܒ ܠܝ ܡܠܟܐ + + + + + + + + ܘܪܒܼܐ ܒܪܝ ܘܫܘܼܚ ܐܝܟ ܐܪܢܐ܂ + ܟܬܘܒܼܐ ܡܬܼܚܫܒ ܠܗܿ ܐܪܢܐ ܐܘ ܐܪܙܐ + ܘܟܼܕ ܪܒܼܐ ܐܠܦܬܿܗ + + + + ܣܪܚܕܘܡ + + ܒܐܨܚܬܐ ܐܚܪܝܬܐ ܣܲܪܚܵܠܝܼܡ܂ + ܣܒ ܚܠܝܡ + ܐܒܼܝ܆ ܘܩܕܡܝ ܐܬܼܦܪܥ܂ ܘܐܩܝܡ + + + ܠܐ ܬܣܪܘܚ܆ ܘܥܡ ܣܪܘܚܐ ܬܬܼܚܟܡ܂ + ܒܐܨ܆ ܐܚܪ܆ ܠܐ ܬܬܼܚܟܡܼ + + om. + habet + ܒܪܝ + + + ܘܪܘܪ̈ܒܼܢܝܟ + ܡܢܗܿ܂ ܥܠ ܗܕܐ ܟܬܼܒܬܼ ܠܗ ܡܼܢ ܐܨܚܬܐ ܐܚܪܬܐ܂ + ܠܟܼܘܟܒܼ̈ܐ܀ ܘܐܡܼܪ ܠܝ ܙܠ ܐܒܿܝܩܡ ܘܠܨܦܪܐ + + + + + + ܒܫ̈ܢܝ ܣܢܚܪܝܒ ܡܠܟܐ ܕܐܬܘܪ + + ܘܕܢ + + ܘܕܢܝܢܘܐ + + + + + + + ܡܢ ܕܠܡܠܦܘ ܠܒܪܝ ܢܕܢ܂ ܥܕܡܐ + + + + ܠܘܙܐ ܕܠܘܩܕܡ ܡܦܪܥ ܘܠܚܪܬܐ + + + + + + ܘܗܦܟܬ ܛܥܢܬ ܐܰܒܵܪܐ ܘܠܐ ܐܝܼܩܰܪ ܥܠܝ ܐܝܟ + + + + some test text + some testܢܕܢ܂ + + + + + \ No newline at end of file diff --git a/exist-app/data/sample_teixml_3_meta.xml b/exist-app/data/sample_teixml_3_meta.xml new file mode 100644 index 0000000..69132f1 --- /dev/null +++ b/exist-app/data/sample_teixml_3_meta.xml @@ -0,0 +1,19 @@ + + + + + Beispieldatei zum Testen + text/xml + + + + textgrid:sample_teixml.0 + + + + + + + + + -- GitLab From 0f60ff657b1b49f890e9a395f35f3464179efb81 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 10:57:49 +0100 Subject: [PATCH 123/155] fix: file names --- exist-app/data/{sample_teixml_2.xml => sample_2_teixml.xml} | 0 .../data/{sample_teixml_2_meta.xml => sample_2_teixml_meta.xml} | 0 exist-app/data/{sample_teixml_3.xml => sample_3_teixml.xml} | 0 .../data/{sample_teixml_3_meta.xml => sample_3_teixml_meta.xml} | 0 exist-app/data/sample_edition_arabic.xml | 2 +- exist-app/data/sample_edition_karshuni.xml | 2 +- 6 files changed, 2 insertions(+), 2 deletions(-) rename exist-app/data/{sample_teixml_2.xml => sample_2_teixml.xml} (100%) rename exist-app/data/{sample_teixml_2_meta.xml => sample_2_teixml_meta.xml} (100%) rename exist-app/data/{sample_teixml_3.xml => sample_3_teixml.xml} (100%) rename exist-app/data/{sample_teixml_3_meta.xml => sample_3_teixml_meta.xml} (100%) diff --git a/exist-app/data/sample_teixml_2.xml b/exist-app/data/sample_2_teixml.xml similarity index 100% rename from exist-app/data/sample_teixml_2.xml rename to exist-app/data/sample_2_teixml.xml diff --git a/exist-app/data/sample_teixml_2_meta.xml b/exist-app/data/sample_2_teixml_meta.xml similarity index 100% rename from exist-app/data/sample_teixml_2_meta.xml rename to exist-app/data/sample_2_teixml_meta.xml diff --git a/exist-app/data/sample_teixml_3.xml b/exist-app/data/sample_3_teixml.xml similarity index 100% rename from exist-app/data/sample_teixml_3.xml rename to exist-app/data/sample_3_teixml.xml diff --git a/exist-app/data/sample_teixml_3_meta.xml b/exist-app/data/sample_3_teixml_meta.xml similarity index 100% rename from exist-app/data/sample_teixml_3_meta.xml rename to exist-app/data/sample_3_teixml_meta.xml diff --git a/exist-app/data/sample_edition_arabic.xml b/exist-app/data/sample_edition_arabic.xml index e56ab68..7f5d48e 100644 --- a/exist-app/data/sample_edition_arabic.xml +++ b/exist-app/data/sample_edition_arabic.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/exist-app/data/sample_edition_karshuni.xml b/exist-app/data/sample_edition_karshuni.xml index 87c749b..bbb86e5 100644 --- a/exist-app/data/sample_edition_karshuni.xml +++ b/exist-app/data/sample_edition_karshuni.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file -- GitLab From 2a0bd55b4c5705e1548e06a10fe3d28f145982bf Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 11:09:33 +0100 Subject: [PATCH 124/155] feat: adjust map to views (syriac or arabic-karshuni) --- .../modules/AnnotationAPI/annotations.xqm | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index 146953b..590a6bd 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -29,6 +29,14 @@ declare variable $anno:annotationElements := "persName" ); +declare variable $anno:lang-aggs := + map { + "syriac": if (doc-available($commons:agg || "3r84g.xml")) then "3r84g" else "sample_lang_aggregation_syriac", + "arabic-karshuni": + if (doc-available($commons:agg || "3r84h.xml") + and doc-available($commons:agg || "3r9ps.xml")) then ("3r84h", "3r9ps") else ("sample_lang_aggregation_arabic", "sample_lang_aggregation_karshuni") + }; + (: this variable holds a map with the complete project structure (excluding images) :) declare variable $anno:uris := let $main-edition-object := @@ -38,14 +46,16 @@ declare variable $anno:uris := else "sample_main_edition" - let $language-aggs := commons:get-available-aggregates($main-edition-object) + let $views := ("syriac", "arabic-karshuni") return map { $main-edition-object: (: level 1: language aggregations :) - map:merge(for $lang in $language-aggs return - map:entry($lang, + map:merge(for $view in $views return + map:entry($view, (: level 2 (key): editions associated to a language aggregation :) map:merge( + let $language-aggregates := anno:get-lang-aggregation-uris($view) + for $lang in $language-aggregates return let $editions := commons:get-available-aggregates($lang) for $uri in $editions return (: level 2 (value): XML associated with edition :) @@ -61,6 +71,11 @@ declare variable $anno:uris := } ; +declare function anno:get-lang-aggregation-uris($collection-type as xs:string) +as xs:string+ { + $anno:lang-aggs?($collection-type) +}; + (:~ : A generic function for creating an W3C compliant Annotation Collection for a given resource. : -- GitLab From 3928b51d5e9f4134de5ce2eaf615abbe11aabccf Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 11:12:42 +0100 Subject: [PATCH 125/155] tests: adjust to new data --- exist-app/tests/annotation-tests.xqm | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 18f09df..815c33c 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -118,8 +118,8 @@ as element(tei:TEI) { }; declare - %test:args("sample_main_edition") %test:assertEquals("66") - %test:args("sample_lang_aggregation_syriac") %test:assertEquals("66") + %test:args("sample_main_edition") %test:assertEquals("198") + %test:args("syriac") %test:assertEquals("66") function at:get-total-no-of-annotations($uri as xs:string) { anno:get-total-no-of-annotations($uri) }; @@ -161,9 +161,9 @@ as item()? { declare %test:args("sample_edition", "11") - %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/11/annotationPage.json") + %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation_syriac/sample_edition/11/annotationPage.json") %test:args("sample_edition", "") - %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json") + %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation_syriac/sample_edition/annotationPage.json") %test:args("", "") %test:assertEmpty function at:get-prev-or-next-annotationPage-url($document as xs:string?, @@ -213,8 +213,8 @@ as xs:string { declare %test:args("sample_edition", "Beispieledition", - "http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/82a/annotationPage.json", - "http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/83b/annotationPage.json") + "http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation_syriac/sample_edition/82a/annotationPage.json", + "http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation_syriac/sample_edition/83b/annotationPage.json") %test:assertXPath("map:get($result, 'annotationCollection') => map:get('label') = 'Ahikar annotations for textgrid:sample_edition: Beispieledition'") %test:assertXPath("map:get($result, 'annotationCollection') => map:get('x-creator') = 'Simon Birol, Aly Elrefaei'") function at:make-annotationCollection-map($uri as xs:string, @@ -227,7 +227,7 @@ as map() { declare %test:args("sample_lang_aggregation_syriac", "sample_edition", "http://localhost:8080") - %test:assertXPath("map:get($result, 'annotationPage') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation/sample_edition'") + %test:assertXPath("map:get($result, 'annotationPage') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation_syriac/sample_edition'") %test:pending function at:make-annotationPage($collection as xs:string, $manifest as xs:string, @@ -324,7 +324,7 @@ as xs:string? { declare %test:args("sample_lang_aggregation_syriac", "sample_edition", "84a", "http://localhost:8080") - %test:assertEquals("http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation/sample_edition-84a") + %test:assertEquals("http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationPage/sample_lang_aggregation_syriac/sample_edition-84a") function at:make-annotationPage-for-manifest-id($collection as xs:string, $document as xs:string, $page as xs:string, @@ -354,7 +354,7 @@ as xs:string { declare %test:args("sample_lang_aggregation_syriac", "http://localhost:8080") - %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json") + %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation_syriac/sample_edition/annotationPage.json") function at:get-information-for-collection-object($collectionURI as xs:string, $server as xs:string) as xs:string { @@ -390,3 +390,11 @@ function at:get-xmls-prev-in-collection($uri as xs:string) as xs:string* { anno:get-xmls-prev-in-collection($uri) }; + +declare + %test:args("syriac") %test:assertEquals("sample_lang_aggregation_syriac") + %test:args("arabic-karshuni") %test:assertXPath("count($result) = 2 and $result = 'sample_lang_aggregation_arabic' and $result = 'sample_lang_aggregation_karshuni'") +function at:get-lang-aggregation-uris($collection-type as xs:string) +as xs:string+ { + anno:get-lang-aggregation-uris($collection-type) +}; -- GitLab From 5084e365e48a0b128bb869378d686e6e35ebad8e Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 11:14:17 +0100 Subject: [PATCH 126/155] tests: test for amount of annotations in arabic-karshuni --- exist-app/tests/annotation-tests.xqm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 815c33c..794b66a 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -120,6 +120,7 @@ as element(tei:TEI) { declare %test:args("sample_main_edition") %test:assertEquals("198") %test:args("syriac") %test:assertEquals("66") + %test:args("arabic-karshuni") %test:assertEquals("132") function at:get-total-no-of-annotations($uri as xs:string) { anno:get-total-no-of-annotations($uri) }; @@ -397,4 +398,4 @@ declare function at:get-lang-aggregation-uris($collection-type as xs:string) as xs:string+ { anno:get-lang-aggregation-uris($collection-type) -}; +}; \ No newline at end of file -- GitLab From 05cf264ed83769dd9af20eebaaeacb9456fc6ad5 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 11:16:12 +0100 Subject: [PATCH 127/155] refactor: update variable name --- exist-app/modules/AnnotationAPI/annotations.xqm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index 590a6bd..a811340 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -124,22 +124,22 @@ as map() { : @see https://www.w3.org/TR/annotation-model/#annotation-collection : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : - : @param $collectionURI The URI of the current Collection Object + : @param $collection-type The type of the current Collection Object (syriac or arabic-karshuni) : @param The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) -declare function anno:get-information-for-collection-object($collectionURI as xs:string, +declare function anno:get-information-for-collection-object($collection-type as xs:string, $server as xs:string) as map() { - let $child-keys := anno:find-in-map($anno:uris, $collectionURI) => map:keys() + let $child-keys := anno:find-in-map($anno:uris, $collection-type) => map:keys() let $first := $child-keys[1] let $last := $child-keys[last()] - let $title := anno:get-metadata-title($collectionURI) - let $first-entry := $server || "/api/annotations/ahikar/" || $collectionURI || "/" || $first || "/annotationPage.json" - let $last-entry := $server || "/api/annotations/ahikar/" || $collectionURI || "/" || $last || "/annotationPage.json" + let $title := anno:get-metadata-title($collection-type) + let $first-entry := $server || "/api/annotations/ahikar/" || $collection-type || "/" || $first || "/annotationPage.json" + let $last-entry := $server || "/api/annotations/ahikar/" || $collection-type || "/" || $last || "/annotationPage.json" return - anno:make-annotationCollection-map($collectionURI, $title, $first-entry, $last-entry) + anno:make-annotationCollection-map($collection-type, $title, $first-entry, $last-entry) }; -- GitLab From acd161cb730b147c6b6b28375fb3f526d9965d4a Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 11:31:12 +0100 Subject: [PATCH 128/155] feat: adjust AnnotationCollection Object title to new map structure --- exist-app/modules/AnnotationAPI/annotations.xqm | 10 +++++++++- exist-app/tests/annotation-tests.xqm | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index a811340..459747e 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -134,7 +134,7 @@ as map() { let $child-keys := anno:find-in-map($anno:uris, $collection-type) => map:keys() let $first := $child-keys[1] let $last := $child-keys[last()] - let $title := anno:get-metadata-title($collection-type) + let $title := anno:make-collection-object-title($collection-type) let $first-entry := $server || "/api/annotations/ahikar/" || $collection-type || "/" || $first || "/annotationPage.json" let $last-entry := $server || "/api/annotations/ahikar/" || $collection-type || "/" || $last || "/annotationPage.json" @@ -142,6 +142,14 @@ as map() { anno:make-annotationCollection-map($collection-type, $title, $first-entry, $last-entry) }; +declare function anno:make-collection-object-title($collection-type as xs:string) +as xs:string { + switch ($collection-type) + case "syriac" return "The Syriac Collection" + case "arabic-karshuni" return "The Arabic and Karshuni Collections" + default return error("ANNO01", "Unknown collection type " || $collection-type) +}; + (:~ : Returns a resource's title as given in the TextGrid metadata. diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 794b66a..bd9e4dc 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -398,4 +398,12 @@ declare function at:get-lang-aggregation-uris($collection-type as xs:string) as xs:string+ { anno:get-lang-aggregation-uris($collection-type) -}; \ No newline at end of file +}; + +declare + %test:args("syriac") %test:assertEquals("The Syriac Collection") + %test:args("arabic-karshuni") %test:assertEquals("The Arabic and Karshuni Collections") + %test:args("asdf") %test:assertError("ANNO01") +function at:make-collection-object-title($collection-type as xs:string) { + anno:make-collection-object-title($collection-type) +}; -- GitLab From 75c357506aea627cc095ab568574ca74be638598 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 11:47:46 +0100 Subject: [PATCH 129/155] tests: fix test input --- exist-app/tests/annotation-tests.xqm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index bd9e4dc..10d35cf 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -354,8 +354,8 @@ as xs:string { }; declare - %test:args("sample_lang_aggregation_syriac", "http://localhost:8080") - %test:assertEquals("http://localhost:8080/api/annotations/ahikar/sample_lang_aggregation_syriac/sample_edition/annotationPage.json") + %test:args("syriac", "http://localhost:8080") + %test:assertEquals("http://localhost:8080/api/annotations/ahikar/syriac/sample_edition/annotationPage.json") function at:get-information-for-collection-object($collectionURI as xs:string, $server as xs:string) as xs:string { @@ -366,9 +366,9 @@ as xs:string { }; declare - %test:args("sample_lang_aggregation_syriac", "sample_edition", "http://localhost:8080") + %test:args("syriac", "sample_edition", "http://localhost:8080") %test:assertXPath("$result instance of map()") - %test:args("sample_lang_aggregation_syriac", "", "http://localhost:8080") + %test:args("syriac", "", "http://localhost:8080") %test:assertXPath("$result instance of map()") function at:make-annotationCollection($collection as xs:string, $document as xs:string?, -- GitLab From cabe7d37b8fed733fd1d768bb32374917eaf03d9 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 13:37:04 +0100 Subject: [PATCH 130/155] refactor: make is-resource-xml more robust --- .../modules/AnnotationAPI/annotations.xqm | 36 ++++++++++--------- exist-app/tests/annotation-tests.xqm | 18 ++++++++-- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index 459747e..2358461 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -12,6 +12,7 @@ xquery version "3.1"; module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations"; +declare namespace err = "http://www.w3.org/2005/xqt-errors"; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace ore="http://www.openarchives.org/ore/terms/"; declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; @@ -147,7 +148,7 @@ as xs:string { switch ($collection-type) case "syriac" return "The Syriac Collection" case "arabic-karshuni" return "The Arabic and Karshuni Collections" - default return error("ANNO01", "Unknown collection type " || $collection-type) + default return anno:get-metadata-title($collection-type) }; @@ -166,29 +167,29 @@ as xs:string { (:~ : Creates a map containing all information necessary for a W3C compliant Annotation Collection. : - : @param $uri The resource's URI + : @param $collection Either the type of the collection (syriac or arabic-karshuni) or the collection URI of an edition. : @param $title The resource's title : @param $first-entry The IRI of the first Annotation Page that is included within the Collection : @param $last-entry The IRI of the last Annotation Page that is included within the Collection :) -declare function anno:make-annotationCollection-map($uri as xs:string, +declare function anno:make-annotationCollection-map($collection as xs:string, $title as xs:string, $first-entry as xs:string, $last-entry as xs:string) as map() { - map { - "annotationCollection": - map { - "@context": "http://www.w3.org/ns/anno.jsonld", - "id": $anno:ns || "/annotationCollection/" || $uri, - "type": "AnnotationCollection", - "label": "Ahikar annotations for textgrid:" || $uri || ": " || $title, - "x-creator": anno:get-creator($uri), - "total": anno:get-total-no-of-annotations($uri), - "first": $first-entry, - "last": $last-entry - } - } + map { + "annotationCollection": + map { + "@context": "http://www.w3.org/ns/anno.jsonld", + "id": $anno:ns || "/annotationCollection/" || $collection, + "type": "AnnotationCollection", + "label": "Ahikar annotations for textgrid:" || $collection || ": " || $title, + "x-creator": anno:get-creator($collection), + "total": anno:get-total-no-of-annotations($collection), + "first": $first-entry, + "last": $last-entry + } + } }; (:~ @@ -611,7 +612,8 @@ as xs:string? { : @return true() if resources stated by $uri is a TEI/XML resource :) declare function anno:is-resource-xml($uri as xs:string) as xs:boolean { - commons:get-document($uri, "meta")//tgmd:format = "text/xml" + doc-available($commons:data || $uri || ".xml") + and commons:get-document($uri, "meta")//tgmd:format = "text/xml" }; (:~ diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 10d35cf..35f0ff2 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -206,6 +206,8 @@ as xs:string? { declare %test:args("sample_teixml") %test:assertEquals("Simon Birol, Aly Elrefaei") %test:args("sample_edition") %test:assertEquals("Simon Birol, Aly Elrefaei") + %test:args("syriac") %test:assertEquals("Simon Birol, Aly Elrefaei") + %test:args("arabic-karshuni") %test:assertEquals("Simon Birol, Aly Elrefaei") function at:get-creator($uri as xs:string) as xs:string { anno:get-creator($uri) @@ -356,10 +358,10 @@ as xs:string { declare %test:args("syriac", "http://localhost:8080") %test:assertEquals("http://localhost:8080/api/annotations/ahikar/syriac/sample_edition/annotationPage.json") -function at:get-information-for-collection-object($collectionURI as xs:string, +function at:get-information-for-collection-object($collection-type as xs:string, $server as xs:string) as xs:string { - let $result := anno:get-information-for-collection-object($collectionURI, $server) + let $result := anno:get-information-for-collection-object($collection-type, $server) return map:get($result, "annotationCollection") => map:get("first") @@ -403,7 +405,17 @@ as xs:string+ { declare %test:args("syriac") %test:assertEquals("The Syriac Collection") %test:args("arabic-karshuni") %test:assertEquals("The Arabic and Karshuni Collections") - %test:args("asdf") %test:assertError("ANNO01") + %test:args("sample_edition") %test:assertEquals("Beispieldatei zum Testen") + %test:args("asdf") %test:assertError("COMMONS002") function at:make-collection-object-title($collection-type as xs:string) { anno:make-collection-object-title($collection-type) }; + +declare + %test:args("syriac") %test:assertEquals("sample_lang_aggregation_syriac") + %test:args("arabic-karshuni") %test:assertXPath("count($result) = 2 and $result = 'sample_lang_aggregation_arabic' and $result = 'sample_lang_aggregation_karshuni'") + %test:args("sample_edition") %test:assertEquals("sample_edition") +function at:determine-uris-for-collection($collection as xs:string) +as xs:string+ { + anno:determine-uris-for-collection($collection) +}; \ No newline at end of file -- GitLab From f0b68f5df91ddc7437c93d0cc2fe23822e2be5cc Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 14:07:18 +0100 Subject: [PATCH 131/155] feat: finalize first draft for distinguishing views in AnnotationAPI --- .../modules/AnnotationAPI/annotations.xqm | 17 ++++++++++++++-- exist-app/tests/annotation-rest-tests.xqm | 20 +++++++++---------- exist-app/tests/annotation-tests.xqm | 12 ++++++++++- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index 2358461..e2425a8 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -192,6 +192,15 @@ as map() { } }; + +declare function anno:determine-uris-for-collection($collection as xs:string) +as xs:string+ { + switch ($collection) + case "syriac" return $anno:lang-aggs?($collection) + case "arabic-karshuni" return $anno:lang-aggs?($collection) + default return $collection +}; + (:~ : Extracts the current edition's editor(s) from the TEI metadata. : In case the URI of a collection or edition is passed, the aggregated TEI/XML @@ -289,7 +298,7 @@ declare function anno:make-annotationCollection-for-manifest($collection as xs:s $page as xs:string, $server as xs:string) as map() { - let $title := anno:get-metadata-title($collection) + let $title := anno:get-metadata-title($document) return map { @@ -508,7 +517,11 @@ declare function anno:are-resources-available($resources as xs:string+) as xs:boolean { let $availability := for $resource in $resources return - doc-available($commons:meta || $resource || ".xml") + if ($resource = ("syriac", "arabic-karshuni")) then + for $edition in $anno:lang-aggs?($resource) return + doc-available($commons:meta || $edition || ".xml") + else + doc-available($commons:meta || $resource || ".xml") return not(functx:is-value-in-sequence(false(), $availability)) }; diff --git a/exist-app/tests/annotation-rest-tests.xqm b/exist-app/tests/annotation-rest-tests.xqm index f149748..1ea9594 100644 --- a/exist-app/tests/annotation-rest-tests.xqm +++ b/exist-app/tests/annotation-rest-tests.xqm @@ -24,7 +24,7 @@ declare %test:assertTrue function art:is-collection-annotationCollection-endpoint-http200() as xs:boolean { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/annotationCollection.json" + let $url := $tc:server || "/annotations/ahikar/syriac/annotationCollection.json" return tc:is-endpoint-http200($url) }; @@ -43,7 +43,7 @@ declare %test:assertXPath("map:contains($result, 'id')") function art:endpoint-collection-annotationCollection() as item() { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/annotationCollection.json" + let $url := $tc:server || "/annotations/ahikar/syriac/annotationCollection.json" let $req := @@ -58,7 +58,7 @@ declare %test:assertTrue function art:is-document-annotationPage-endpoint-http200() as xs:boolean { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json" + let $url := $tc:server || "/annotations/ahikar/arabic-karshuni/sample_edition/annotationPage.json" return tc:is-endpoint-http200($url) }; @@ -76,7 +76,7 @@ declare %test:assertXPath("map:contains($result, 'id')") function art:endpoint-document-annotationPage() as item() { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationPage.json" + let $url := $tc:server || "/annotations/ahikar/syriac/sample_edition/annotationPage.json" let $req := @@ -90,7 +90,7 @@ declare %test:assertTrue function art:is-document-annotationCollection-endpoint-http200() as xs:boolean { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationCollection.json" + let $url := $tc:server || "/annotations/ahikar/arabic-karshuni/sample_edition_karshuni/annotationCollection.json" return tc:is-endpoint-http200($url) }; @@ -108,7 +108,7 @@ declare %test:assertXPath("map:contains($result, 'id')") function art:endpoint-document-annotationCollection() as item() { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/annotationCollection.json" + let $url := $tc:server || "/annotations/ahikar/syriac/sample_edition/annotationCollection.json" let $req := @@ -123,7 +123,7 @@ declare %test:assertTrue function art:is-item-annotationCollection-endpoint-http200() as xs:boolean { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationCollection.json" + let $url := $tc:server || "/annotations/ahikar/arabic-karshuni/sample_edition_arabic/83a/annotationCollection.json" return tc:is-endpoint-http200($url) }; @@ -140,7 +140,7 @@ declare %test:assertXPath("map:contains($result, 'id')") function art:endpoint-item-annotationCollection() as item() { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationCollection.json" + let $url := $tc:server || "/annotations/ahikar/syriac/sample_edition/83a/annotationCollection.json" let $req := @@ -155,7 +155,7 @@ declare %test:assertTrue function art:is-item-annotationPage-endpoint-http200() as xs:boolean { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationPage.json" + let $url := $tc:server || "/annotations/ahikar/arabic-karshuni/sample_edition_karshuni/83a/annotationPage.json" return tc:is-endpoint-http200($url) }; @@ -172,7 +172,7 @@ declare %test:assertXPath("map:contains($result, 'id')") function art:endpoint-item-annotationPage() as item() { - let $url := $tc:server || "/annotations/ahikar/sample_lang_aggregation/sample_edition/83a/annotationPage.json" + let $url := $tc:server || "/annotations/ahikar/syriac/sample_edition/83a/annotationPage.json" let $req := diff --git a/exist-app/tests/annotation-tests.xqm b/exist-app/tests/annotation-tests.xqm index 35f0ff2..2e5f239 100644 --- a/exist-app/tests/annotation-tests.xqm +++ b/exist-app/tests/annotation-tests.xqm @@ -37,6 +37,15 @@ as xs:boolean { anno:are-resources-available($resources) }; +declare + %test:assertTrue +function at:are-resources-available-lang-collection-true() +as xs:boolean { + let $resources := "syriac" + return + anno:are-resources-available($resources) +}; + declare %test:assertFalse function at:are-resources-available-false() @@ -98,9 +107,10 @@ as map() { }; declare - %test:args("sample_lang_aggregation_syriac", "sample_edition", "82a", "http://localhost:8080") + %test:args("syriac", "sample_edition", "82a", "http://localhost:8080") %test:assertXPath("map:get($result, 'annotationCollection') => map:get('id') = 'http://ahikar.sub.uni-goettingen.de/ns/annotations/annotationCollection/sample_edition/82a'") %test:assertXPath("map:get($result, 'annotationCollection') => map:get('type') = 'AnnotationCollection'") + %test:assertXPath("map:get($result, 'annotationCollection') => map:get('label') = 'Ahikar annotations for textgrid:sample_edition: Beispieldatei zum Testen, page 82a'") function at:make-annotationCollection-for-manifest($collection as xs:string, $document as xs:string, $page as xs:string, -- GitLab From 7f0a0cbef1b41b15be6a64f023b2d3a8dad281d9 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 14:21:41 +0100 Subject: [PATCH 132/155] ci: update endpoint for status tests --- ci-scripts/.api_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/.api_tests.yml b/ci-scripts/.api_tests.yml index 34e178a..f9c82b2 100644 --- a/ci-scripts/.api_tests.yml +++ b/ci-scripts/.api_tests.yml @@ -19,7 +19,7 @@ test_api_status-test: - tags - develop script: - - header=$(curl --head -s https://ahikar-test.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - header=$(curl --head -s https://ahikar-test.sub.uni-goettingen.de/api/textapi/ahikar/arabic-karshuni/collection.json) - *check_HTTP_status test_api_status-develop: @@ -27,7 +27,7 @@ test_api_status-develop: only: - develop script: - - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/arabic-karshuni/collection.json) - *check_HTTP_status test_api_status-main: @@ -35,7 +35,7 @@ test_api_status-main: only: - main script: - - header=$(curl --head -s https://ahikar.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - header=$(curl --head -s https://ahikar.sub.uni-goettingen.de/api/textapi/ahikar/arabic-karshuni/collection.json) - *check_HTTP_status retry: 2 -- GitLab From 65bc65b0000b2dafb3c97a117d73e2131fa66da5 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 15 Jan 2021 14:48:21 +0100 Subject: [PATCH 133/155] chore: switch from draft module to production --- exist-app/modules/draft-tapi-collection.xqm | 133 ----------- exist-app/modules/tapi-collection.xqm | 111 ++++++---- exist-app/modules/tapi.xqm | 3 +- exist-app/modules/testtrigger.xqm | 2 - .../tests/draft-tapi-collection-tests.xqm | 145 ------------ exist-app/tests/tapi-collection-tests.xqm | 208 +++++++----------- 6 files changed, 143 insertions(+), 459 deletions(-) delete mode 100644 exist-app/modules/draft-tapi-collection.xqm delete mode 100644 exist-app/tests/draft-tapi-collection-tests.xqm diff --git a/exist-app/modules/draft-tapi-collection.xqm b/exist-app/modules/draft-tapi-collection.xqm deleted file mode 100644 index 4a05722..0000000 --- a/exist-app/modules/draft-tapi-collection.xqm +++ /dev/null @@ -1,133 +0,0 @@ -xquery version "3.1"; - -module namespace d="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft"; - -declare namespace ore="http://www.openarchives.org/ore/terms/"; -declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; -declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; - -import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; - -declare variable $d:uris := - map { - "syriac": if (doc-available($commons:agg || "3r84g.xml")) then "3r84g" else "sample_lang_aggregation_syriac", - "arabic-karshuni": ( - if (doc-available($commons:agg || "3r9ps.xml")) then "3r9ps" else "sample_lang_aggregation_arabic", - if (doc-available($commons:agg || "3r84h.xml")) then "3r84h" else "sample_lang_aggregation_karshuni") - }; - -declare function d:get-uris($collection-type as xs:string) -as xs:string+ { - map:get($d:uris, $collection-type) -}; - - -declare function d:get-json($collection-type as xs:string, - $server as xs:string) -as item()+ { - let $collection-string := d:get-collection-string($collection-type) - let $sequence := d:make-sequence($collection-type, $server) - let $annotationCollection-uri := d:make-annotationCollection-uri($server, $collection-type) - - return - - {$commons:version} - - <title>The Story and Proverbs of Ahikar the Wise - main - - - - <collector> - <role>collector</role> - <name>Prof. Dr. theol. Kratz, Reinhard Gregor</name> - <idref> - <base>http://d-nb.info/gnd/</base> - <id>115412700</id> - <type>GND</type> - </idref> - </collector> - <description>{$collection-string} collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen</description> - <annotationCollection>{$annotationCollection-uri}</annotationCollection> - {$sequence} - </object> -}; - -declare function d:get-collection-string($collection-type as xs:string) -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) -}; - -declare function d:make-sequence($collection-type as xs:string, - $server as xs:string) -as element(sequence)+ { - let $uris := d:get-uris($collection-type) - let $aggregations := d:get-aggregations($uris) - let $allowed-manifest-uris := d:get-allowed-manifest-uris($aggregations) - for $manifest-uri in $allowed-manifest-uris return - let $manifest-metadata := commons:get-metadata-file($manifest-uri) - let $id := d:make-id($server, $collection-type, $manifest-uri) - let $type := d:make-format-type($manifest-metadata) - return - <sequence> - <id>{$id}</id> - <type>{$type}</type> - </sequence> -}; - -declare function d:get-aggregations($uris as xs:string+) -as document-node()+ { - for $uri in $uris return - doc($commons:agg || $uri || ".xml") -}; - -declare function d:get-allowed-manifest-uris($aggregations as node()+) -as xs:string+ { - let $not-allowed := - ( - "textgrid:3vp38" - ) - let $allowed := - for $aggregation-file in $aggregations return - for $aggregate in $aggregation-file//ore:aggregates return - $aggregate[@rdf:resource != $not-allowed]/@rdf:resource - return - for $uri in $allowed return - d:remove-textgrid-prefix($uri) -}; - -declare function d:remove-textgrid-prefix($uri as xs:string) -as xs:string { - replace($uri, "textgrid:", "") -}; - -declare function d:make-id($server as xs:string, - $collection-type as xs:string, - $manifest-uri as xs:string) -as xs:string { - $server || "/api/textapi/ahikar/" || $collection-type || "/" || $manifest-uri || "/manifest.json" -}; - -declare function d:get-format-type($metadata as document-node()) -as xs:string { - $metadata//tgmd:format[1]/string() - => d:make-format-type() -}; - -declare function d:make-format-type($tgmd-format as xs:string) -as xs:string { - switch ($tgmd-format) - case "text/tg.aggregation+xml" return "collection" - case "text/tg.edition+tg.aggregation+xml" return "manifest" - default return "manifest" -}; - -declare function d:make-annotationCollection-uri($server as xs:string, - $collection-type as xs:string) -as xs:string { - $server || "/api/annotations/ahikar/" || $collection-type || "/annotationCollection.json" -}; diff --git a/exist-app/modules/tapi-collection.xqm b/exist-app/modules/tapi-collection.xqm index 8ca2ebe..f726ce4 100644 --- a/exist-app/modules/tapi-collection.xqm +++ b/exist-app/modules/tapi-collection.xqm @@ -14,6 +14,20 @@ declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; +declare variable $tapi-coll:uris := + map { + "syriac": if (doc-available($commons:agg || "3r84g.xml")) then "3r84g" else "sample_lang_aggregation_syriac", + "arabic-karshuni": ( + if (doc-available($commons:agg || "3r9ps.xml")) then "3r9ps" else "sample_lang_aggregation_arabic", + if (doc-available($commons:agg || "3r84h.xml")) then "3r84h" else "sample_lang_aggregation_karshuni") + }; + +declare function tapi-coll:get-uris($collection-type as xs:string) +as xs:string+ { + map:get($tapi-coll:uris, $collection-type) +}; + + (:~ : Returns information about the main collection for the project. This encompasses : the key data described at https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object. @@ -27,44 +41,54 @@ import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" : @param $server A string indicating the server. This parameter has been introduced to make this function testable. : @return An object element containing all necessary information :) -declare function tapi-coll:get-json($collection-uri as xs:string, +declare function tapi-coll:get-json($collection-type as xs:string, $server as xs:string) as item()+ { - let $metadata-file := commons:get-metadata-file($collection-uri) - let $format-type := tapi-coll:get-format-type($metadata-file) - let $sequence := tapi-coll:make-sequence($collection-uri, $server) - let $annotationCollection-uri := tapi-coll:make-annotationCollection-uri($server, $collection-uri) - + let $collection-string := tapi-coll:get-collection-string($collection-type) + let $sequence := tapi-coll:make-sequence($collection-type, $server) + let $annotationCollection-uri := tapi-coll:make-annotationCollection-uri($server, $collection-type) + return - <object> - <textapi>{$commons:version}</textapi> - <title> - <title>The Story and Proverbs of Ahikar the Wise - {$format-type} - - - - <collector> - <role>collector</role> - <name>Prof. Dr. theol. Kratz, Reinhard Gregor</name> - <idref> - <base>http://d-nb.info/gnd/</base> - <id>115412700</id> - <type>GND</type> - </idref> - </collector> - <description>Main collection for the Ahikar project. Funded by DFG, 2019–2020. University of Göttingen</description> - <annotationCollection>{$annotationCollection-uri}</annotationCollection> - {$sequence} - </object> + <object> + <textapi>{$commons:version}</textapi> + <title> + <title>The Story and Proverbs of Ahikar the Wise + main + + + + <collector> + <role>collector</role> + <name>Prof. Dr. theol. Kratz, Reinhard Gregor</name> + <idref> + <base>http://d-nb.info/gnd/</base> + <id>115412700</id> + <type>GND</type> + </idref> + </collector> + <description>{$collection-string} collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen</description> + <annotationCollection>{$annotationCollection-uri}</annotationCollection> + {$sequence} + </object> }; -declare function tapi-coll:get-aggregation($collection-uri as xs:string) -as document-node() { - doc($commons:agg || $collection-uri || ".xml") +declare function tapi-coll:get-collection-string($collection-type as xs:string) +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) +}; + + +declare function tapi-coll:get-aggregations($uris as xs:string+) +as document-node()+ { + for $uri in $uris return + doc($commons:agg || $uri || ".xml") }; + (:~ : Some "editions" that appear in the ore:aggregates list of a collection are : actually no editions; They lack an XML file. @@ -76,15 +100,16 @@ as document-node() { : @return A list of ore:aggregates without the manifests to be excluded : :) -declare function tapi-coll:get-allowed-manifest-uris($aggregation-file as node()) +declare function tapi-coll:get-allowed-manifest-uris($aggregations as node()+) as xs:string+ { let $not-allowed := ( "textgrid:3vp38" ) let $allowed := - for $aggregate in $aggregation-file//ore:aggregates return - $aggregate[@rdf:resource != $not-allowed]/@rdf:resource + for $aggregation-file in $aggregations return + for $aggregate in $aggregation-file//ore:aggregates return + $aggregate[@rdf:resource != $not-allowed]/@rdf:resource return for $uri in $allowed return tapi-coll:remove-textgrid-prefix($uri) @@ -95,15 +120,15 @@ as xs:string { replace($uri, "textgrid:", "") }; -declare function tapi-coll:make-sequence($collection-uri as xs:string, +declare function tapi-coll:make-sequence($collection-type as xs:string, $server as xs:string) as element(sequence)+ { - let $aggregation := tapi-coll:get-aggregation($collection-uri) - let $allowed-manifest-uris := tapi-coll:get-allowed-manifest-uris($aggregation/*) - + let $uris := tapi-coll:get-uris($collection-type) + let $aggregations := tapi-coll:get-aggregations($uris) + let $allowed-manifest-uris := tapi-coll:get-allowed-manifest-uris($aggregations) for $manifest-uri in $allowed-manifest-uris return let $manifest-metadata := commons:get-metadata-file($manifest-uri) - let $id := tapi-coll:make-id($server, $collection-uri, $manifest-uri) + let $id := tapi-coll:make-id($server, $collection-type, $manifest-uri) let $type := tapi-coll:make-format-type($manifest-metadata) return <sequence> @@ -113,10 +138,10 @@ as element(sequence)+ { }; declare function tapi-coll:make-id($server as xs:string, - $collection-uri as xs:string, + $collection-type as xs:string, $manifest-uri as xs:string) as xs:string { - $server || "/api/textapi/ahikar/" || $collection-uri || "/" || $manifest-uri || "/manifest.json" + $server || "/api/textapi/ahikar/" || $collection-type || "/" || $manifest-uri || "/manifest.json" }; declare function tapi-coll:get-format-type($metadata as document-node()) @@ -134,7 +159,7 @@ as xs:string { }; declare function tapi-coll:make-annotationCollection-uri($server as xs:string, - $collection-uri as xs:string) + $collection-type as xs:string) as xs:string { - $server || "/api/annotations/ahikar/" || $collection-uri || "/annotationCollection.json" + $server || "/api/annotations/ahikar/" || $collection-type || "/annotationCollection.json" }; diff --git a/exist-app/modules/tapi.xqm b/exist-app/modules/tapi.xqm index f3e7351..32d9cab 100644 --- a/exist-app/modules/tapi.xqm +++ b/exist-app/modules/tapi.xqm @@ -19,7 +19,6 @@ declare namespace test="http://exist-db.org/xquery/xqsuite"; declare namespace xhtml="http://www.w3.org/1999/xhtml"; import module namespace tapi-coll="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection" at "tapi-collection.xqm"; -import module namespace d="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft" at "draft-tapi-collection.xqm"; import module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item" at "tapi-item.xqm"; import module namespace tapi-mani="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest" at "tapi-manifest.xqm"; import module namespace tapi-txt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt" at "tapi-txt.xqm"; @@ -99,7 +98,7 @@ declare function tapi:endpoint-collection($collection-type as xs:string) as item()+ { $commons:responseHeader200, - d:get-json($collection-type, $tapi:server) + tapi-coll:get-json($collection-type, $tapi:server) }; diff --git a/exist-app/modules/testtrigger.xqm b/exist-app/modules/testtrigger.xqm index 1cd644c..e024397 100644 --- a/exist-app/modules/testtrigger.xqm +++ b/exist-app/modules/testtrigger.xqm @@ -27,7 +27,6 @@ import module namespace ttnt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/no import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "../tests/tapi-txt-tests.xqm"; import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm"; import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm"; -import module namespace t="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft/tests" at "../tests/draft-tapi-collection-tests.xqm"; (:~ : Triggers the tests for the Ahikar backend. Called by the CI. @@ -69,7 +68,6 @@ as element()+ { test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")), - test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests")), test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests")), diff --git a/exist-app/tests/draft-tapi-collection-tests.xqm b/exist-app/tests/draft-tapi-collection-tests.xqm deleted file mode 100644 index 0857496..0000000 --- a/exist-app/tests/draft-tapi-collection-tests.xqm +++ /dev/null @@ -1,145 +0,0 @@ -xquery version "3.1"; - -module namespace t="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft/tests"; - -declare namespace http = "http://expath.org/ns/http-client"; -declare namespace tei="http://www.tei-c.org/ns/1.0"; - -import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "../modules/commons.xqm"; -import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons" at "test-commons.xqm"; -import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -import module namespace d="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection-draft" at "../modules/draft-tapi-collection.xqm"; - -declare - %test:args("syriac") %test:assertEquals("sample_lang_aggregation_syriac") - %test:args("arabic-karshuni") %test:assertXPath("count($result) = 2 and $result = 'sample_lang_aggregation_arabic' and $result = 'sample_lang_aggregation_karshuni'") -function t:get-uris($collection-type as xs:string) -as xs:string+ { - d:get-uris($collection-type) -}; - -declare - %test:args("syriac") %test:assertEquals("Syriac") - %test:args("arabic-karshuni") %test:assertEquals("Arabic/Karshuni") - %test:args("misc") %test:assertError("D001") -function t:get-collection-string($collection-type as xs:string) -as xs:string { - d:get-collection-string($collection-type) -}; - -declare - %test:args("syriac") %test:assertXPath("$result//description = 'Syriac collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen'") - %test:args("arabic-karshuni") %test:assertXPath("$result//description = 'Arabic/Karshuni collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen'") -function t:get-json($collection-type as xs:string) { - d:get-json($collection-type, $tc:server) -}; - - -declare - %test:args("syriac") %test:assertXPath("$result//type[. = 'manifest']") - %test:args("syriac") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/syriac/sample_edition/manifest.json')]") - %test:args("arabic-karshuni") %test:assertXPath("$result//type[. = 'manifest']") - %test:args("arabic-karshuni") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/arabic-karshuni/sample_edition_arabic/manifest.json')]") - %test:args("arabic-karshuni") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/arabic-karshuni/sample_edition_karshuni/manifest.json')]") -function t:make-sequence($collection-type as xs:string) { - d:make-sequence($collection-type, $tc:server) -}; - -declare - %test:args("sample_lang_aggregation_syriac") %test:assertExists -function t:get-aggregations_syriac($uris as xs:string+) -as document-node()+ { - d:get-aggregations($uris) -}; - -declare - %test:assertExists -function t:get-aggregations_arabic_karshuni() -as document-node()+ { - let $uris := - ( - "sample_lang_aggregation_arabic", - "sample_lang_aggregation_karshuni" - ) - return - d:get-aggregations($uris) -}; - -declare - %test:args("textgrid:1234") %test:assertEquals("1234") - %test:args("1234") %test:assertEquals("1234") -function t:remove-textgrid-prefix($uri as xs:string) { - d:remove-textgrid-prefix($uri) -}; - -declare - %test:assertTrue -function t:get-allowed-manifest-uris-mock-up-input-included() { - let $collection-metadata := - ( - <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_lang_aggregation_arabic.0"> - <ore:aggregates rdf:resource="textgrid:3rbm9"/> - <ore:aggregates rdf:resource="textgrid:3rbmc"/> - <ore:aggregates rdf:resource="textgrid:3rx14"/> - <ore:aggregates rdf:resource="textgrid:3vp38"/> - </rdf:Description> - </rdf:RDF>, - <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_lang_aggregation_karshuni.0"> - <ore:aggregates rdf:resource="textgrid:3rbm9"/> - <ore:aggregates rdf:resource="textgrid:3rbmc"/> - <ore:aggregates rdf:resource="textgrid:3rx14"/> - <ore:aggregates rdf:resource="textgrid:3vp38"/> - </rdf:Description> - </rdf:RDF> - ) - return - d:get-allowed-manifest-uris($collection-metadata) = "3rx14" -}; - -declare - %test:assertFalse -function t:get-allowed-manifest-uris-mock-up-input-excluded() { - let $collection-metadata := - <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_lang_aggregation_syriac.0"> - <ore:aggregates rdf:resource="textgrid:3rbm9"/> - <ore:aggregates rdf:resource="textgrid:3rbmc"/> - <ore:aggregates rdf:resource="textgrid:3rx14"/> - <ore:aggregates rdf:resource="textgrid:3vp38"/> - </rdf:Description> - </rdf:RDF> - return - d:get-allowed-manifest-uris($collection-metadata) = "3vp38" -}; - -declare - %test:args("syriac", "sample_edition") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/syriac/sample_edition/manifest.json") -function t:make-id($colletion-type as xs:string, $manifest-uri as xs:string) -as xs:string { - d:make-id($tc:server, $colletion-type, $manifest-uri) -}; - -declare - %test:args("text/tg.aggregation+xml") %test:assertEquals("collection") - %test:args("text/tg.edition+tg.aggregation+xml") %test:assertEquals("manifest") - %test:args("test") %test:assertEquals("manifest") -function t:make-format-type($tgmd-format as xs:string) { - d:make-format-type($tgmd-format) -}; - -declare - %test:assertEquals("manifest") -function t:get-format-type() { - let $metadata := commons:get-metadata-file("sample_edition") - return - d:get-format-type($metadata) -}; - -declare - %test:args("arabic-karshuni") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/arabic-karshuni/annotationCollection.json") -function t:make-annotationCollection-uri($collection-uri as xs:string) -as xs:string { - d:make-annotationCollection-uri($tc:server, $collection-uri) -}; diff --git a/exist-app/tests/tapi-collection-tests.xqm b/exist-app/tests/tapi-collection-tests.xqm index 0d366e4..6b44d7f 100644 --- a/exist-app/tests/tapi-collection-tests.xqm +++ b/exist-app/tests/tapi-collection-tests.xqm @@ -1,6 +1,6 @@ xquery version "3.1"; -module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests"; +module namespace t="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests"; declare namespace http = "http://expath.org/ns/http-client"; declare namespace tei="http://www.tei-c.org/ns/1.0"; @@ -10,125 +10,100 @@ import module namespace tc="http://ahikar.sub.uni-goettingen.de/ns/tests/commons import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; import module namespace tapi-coll="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection" at "../modules/tapi-collection.xqm"; -declare variable $tct:collection-uri := "testapi-collection.xml"; -declare variable $tct:agg1-uri := "test-aggregation-1.xml"; -declare variable $tct:agg2-uri := "test-aggregation-2.xml"; +declare + %test:args("syriac") %test:assertEquals("sample_lang_aggregation_syriac") + %test:args("arabic-karshuni") %test:assertXPath("count($result) = 2 and $result = 'sample_lang_aggregation_arabic' and $result = 'sample_lang_aggregation_karshuni'") +function t:get-uris($collection-type as xs:string) +as xs:string+ { + tapi-coll:get-uris($collection-type) +}; declare - %test:setUp -function tct:_test-setup(){ - let $collection := - <rdf:RDF xmlns:ore="http://www.openarchives.org/ore/terms/" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <rdf:Description rdf:about="textgrid:testapi-collection"> - <ore:aggregates rdf:resource="textgrid:test-aggregation-1"/> - <ore:aggregates rdf:resource="textgrid:test-aggregation-2"/> - </rdf:Description> - </rdf:RDF> - let $collection-meta := - <MetadataContainerType xmlns="http://textgrid.info/namespaces/metadata/core/2010" - xmlns:ns2="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <object> - <generic> - <provided> - <title>Beispieldatei zum Testen - text/tg.edition+tg.aggregation+xml - - - - - - let $agg1 := - - - - - - let $agg1-meta := - - - - - Beispielagg1 zum Testen - text/tg.edition+tg.aggregation+xml - - - - - - let $agg2 := - - - - - - let $agg2-meta := - - - - - Beispielagg2 zum Testen - text/tg.edition+tg.aggregation+xml - - - - - - - return - ( - xmldb:store($commons:agg, $tct:collection-uri, $collection), - xmldb:store($commons:agg, $tct:agg1-uri, $agg1), - xmldb:store($commons:agg, $tct:agg2-uri, $agg2), - xmldb:store($commons:meta, $tct:collection-uri, $collection-meta), - xmldb:store($commons:meta, $tct:agg1-uri, $agg1-meta), - xmldb:store($commons:meta, $tct:agg2-uri, $agg2-meta) - ) + %test:args("syriac") %test:assertEquals("Syriac") + %test:args("arabic-karshuni") %test:assertEquals("Arabic/Karshuni") + %test:args("misc") %test:assertError("D001") +function t:get-collection-string($collection-type as xs:string) +as xs:string { + tapi-coll:get-collection-string($collection-type) }; declare - %test:tearDown -function tct:_test-teardown() { - xmldb:remove($commons:agg, $tct:collection-uri), - xmldb:remove($commons:agg, $tct:agg1-uri), - xmldb:remove($commons:agg, $tct:agg2-uri), - xmldb:remove($commons:meta, $tct:collection-uri), - xmldb:remove($commons:meta, $tct:agg1-uri), - xmldb:remove($commons:meta, $tct:agg2-uri) + %test:args("syriac") %test:assertXPath("$result//description = 'Syriac collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen'") + %test:args("arabic-karshuni") %test:assertXPath("$result//description = 'Arabic/Karshuni collection for the Ahiqar project. Funded by DFG, 2019–2020. University of Göttingen'") +function t:get-json($collection-type as xs:string) { + tapi-coll:get-json($collection-type, $tc:server) }; + declare - %test:args("sample_main_edition") %test:assertXPath("$result//*[local-name(.) = 'aggregates']") -function tct:get-aggregation($uri as xs:string) { - tapi-coll:get-aggregation($uri) + %test:args("syriac") %test:assertXPath("$result//type[. = 'manifest']") + %test:args("syriac") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/syriac/sample_edition/manifest.json')]") + %test:args("arabic-karshuni") %test:assertXPath("$result//type[. = 'manifest']") + %test:args("arabic-karshuni") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/arabic-karshuni/sample_edition_arabic/manifest.json')]") + %test:args("arabic-karshuni") %test:assertXPath("$result//id[contains(., 'textapi/ahikar/arabic-karshuni/sample_edition_karshuni/manifest.json')]") +function t:make-sequence($collection-type as xs:string) { + tapi-coll:make-sequence($collection-type, $tc:server) +}; + +declare + %test:args("sample_lang_aggregation_syriac") %test:assertExists +function t:get-aggregations_syriac($uris as xs:string+) +as document-node()+ { + tapi-coll:get-aggregations($uris) +}; + +declare + %test:assertExists +function t:get-aggregations_arabic_karshuni() +as document-node()+ { + let $uris := + ( + "sample_lang_aggregation_arabic", + "sample_lang_aggregation_karshuni" + ) + return + tapi-coll:get-aggregations($uris) +}; + +declare + %test:args("textgrid:1234") %test:assertEquals("1234") + %test:args("1234") %test:assertEquals("1234") +function t:remove-textgrid-prefix($uri as xs:string) { + tapi-coll:remove-textgrid-prefix($uri) }; declare %test:assertTrue -function tct:get-allowed-manifest-uris-mock-up-input-included() { +function t:get-allowed-manifest-uris-mock-up-input-included() { let $collection-metadata := + ( + + + + + + + + , - + + ) return tapi-coll:get-allowed-manifest-uris($collection-metadata) = "3rx14" }; declare %test:assertFalse -function tct:get-allowed-manifest-uris-mock-up-input-excluded() { +function t:get-allowed-manifest-uris-mock-up-input-excluded() { let $collection-metadata := - + @@ -139,67 +114,32 @@ function tct:get-allowed-manifest-uris-mock-up-input-excluded() { tapi-coll:get-allowed-manifest-uris($collection-metadata) = "3vp38" }; - declare - %test:args("sample_main_edition", "sample_edition") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/sample_main_edition/sample_edition/manifest.json") -function tct:make-id($colletion-uri as xs:string, $manifest-uri as xs:string) + %test:args("syriac", "sample_edition") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/syriac/sample_edition/manifest.json") +function t:make-id($colletion-type as xs:string, $manifest-uri as xs:string) as xs:string { - tapi-coll:make-id($tc:server, $colletion-uri, $manifest-uri) -}; - - -declare - %test:assertEquals("sample_edition") -function tct:get-allowed-manifest-uris-sample-input() { - let $collection-metadata := tapi-coll:get-aggregation("sample_lang_aggregation_syriac") - return - tapi-coll:get-allowed-manifest-uris($collection-metadata) -}; - -declare - %test:args("textgrid:1234") %test:assertEquals("1234") - %test:args("1234") %test:assertEquals("1234") -function tct:remove-textgrid-prefix($uri as xs:string) { - tapi-coll:remove-textgrid-prefix($uri) + tapi-coll:make-id($tc:server, $colletion-type, $manifest-uri) }; declare %test:args("text/tg.aggregation+xml") %test:assertEquals("collection") %test:args("text/tg.edition+tg.aggregation+xml") %test:assertEquals("manifest") %test:args("test") %test:assertEquals("manifest") -function tct:make-format-type($tgmd-format as xs:string) { +function t:make-format-type($tgmd-format as xs:string) { tapi-coll:make-format-type($tgmd-format) }; declare %test:assertEquals("manifest") -function tct:get-format-type() { +function t:get-format-type() { let $metadata := commons:get-metadata-file("sample_edition") return tapi-coll:get-format-type($metadata) }; - declare - %test:args("sample_main_edition") %test:assertXPath("$result//type[. = 'manifest']") - %test:args("sample_lang_aggregation_syriac") %test:assertXPath("$result//id[matches(., 'sample_edition/manifest.json')]") - %test:args("testapi-collection") %test:assertXPath("$result//id[matches(., 'test-aggregation-1/manifest.json')]") - %test:args("testapi-collection") %test:assertXPath("$result//id[matches(., 'test-aggregation-2/manifest.json')]") -function tct:make-sequence($collection-uri as xs:string) { - tapi-coll:make-sequence($collection-uri, $tc:server) -}; - -declare - %test:args("sample_main_edition") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/sample_main_edition/annotationCollection.json") -function tct:make-annotationCollection-uri($collection-uri as xs:string) + %test:args("arabic-karshuni") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/arabic-karshuni/annotationCollection.json") +function t:make-annotationCollection-uri($collection-uri as xs:string) as xs:string { tapi-coll:make-annotationCollection-uri($tc:server, $collection-uri) }; - - -declare - %test:args("sample_lang_aggregation_syriac") %test:assertXPath("$result//title = 'The Story and Proverbs of Ahikar the Wise'") - %test:args("sample_lang_aggregation_syriac") %test:assertXPath("$result//*/string() = 'http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/sample_lang_aggregation_syriac/sample_edition/manifest.json' ") -function tct:get-json($collection-uri as xs:string) { - tapi-coll:get-json($collection-uri, $tc:server) -}; -- GitLab From ca7190359b61dc31bebae3d9dbf410e83b363e49 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 18 Jan 2021 06:55:19 +0100 Subject: [PATCH 134/155] fix: Title Object for items --- exist-app/modules/tapi-item.xqm | 15 +++++++++++---- exist-app/tests/tapi-item-tests.xqm | 13 ++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/exist-app/modules/tapi-item.xqm b/exist-app/modules/tapi-item.xqm index 4ad33f9..1115f3e 100644 --- a/exist-app/modules/tapi-item.xqm +++ b/exist-app/modules/tapi-item.xqm @@ -21,7 +21,7 @@ declare function tapi-item:get-json($collection-uri as xs:string, as element(object) { {$commons:version} - {tapi-item:make-title($manifest-uri)} + {tapi-item:make-title-object($manifest-uri)} page {$page} {$server}/api/content/{commons:get-xml-uri($manifest-uri)}-{$page}.html @@ -36,11 +36,18 @@ as element(object) { }; -declare function tapi-item:make-title($manifest-uri as xs:string) -as xs:string { +declare function tapi-item:make-title-object($manifest-uri as xs:string) +as element() { let $tei-xml := commons:get-tei-xml-for-manifest($manifest-uri) - return + let $title := $tei-xml//tei:title[@type = "main"]/string() + => normalize-space() + let $type := $tei-xml//tei:title/@type/string() + return + + <title>{$title} + {$type} + }; diff --git a/exist-app/tests/tapi-item-tests.xqm b/exist-app/tests/tapi-item-tests.xqm index 837f3c9..fc56427 100644 --- a/exist-app/tests/tapi-item-tests.xqm +++ b/exist-app/tests/tapi-item-tests.xqm @@ -44,19 +44,18 @@ as xs:string { declare - %test:args("sample_edition") %test:assertEquals("The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, - king of Assyria and Nineveh") -function titemt:make-title($manifest-uri as xs:string) -as xs:string { - tapi-item:make-title($manifest-uri) + %test:args("sample_edition") %test:assertXPath("$result//*[local-name(.) = 'title'] = 'The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, king of Assyria and Nineveh'") +function titemt:make-title-object($manifest-uri as xs:string) +as element() { + tapi-item:make-title-object($manifest-uri) }; declare %test:args("sample_main_edition", "sample_edition", "82a") (: checks if the correct file has been opened :) - %test:assertXPath("$result//*[local-name(.) = 'title'] = 'The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, - king of Assyria and Nineveh' ") + %test:assertXPath("$result//*[local-name(.) = 'title']/*[local-name(.) = 'title'] = 'The Proverbs or History of Aḥīḳar the wise, the scribe of Sanḥērībh, king of Assyria and Nineveh' ") + %test:assertXPath("$result//*[local-name(.) = 'title']/*[local-name(.) = 'type'] = 'main' ") (: checks if language assembling works correctly :) %test:assertXPath("$result//*[local-name(.) = 'lang'] = 'syc' ") %test:assertXPath("$result//*[local-name(.) = 'langAlt'] = 'karshuni' ") -- GitLab From 7a927f061d1b732ff348c18c7ab9d3f916e5b62c Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 18 Jan 2021 07:02:04 +0100 Subject: [PATCH 135/155] chore: update changelog, bump version number --- CHANGELOG.md | 9 ++++++++- exist-app/build.properties | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f48461..6e7fee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.1] - 2021-01-18 + +### Fixed + +- faulty implementation of the Item Object's title key: Provides now a Title Object according to the +TextAPI specs instead of a string. + ## [2.5.0] - 2021-01-14 -## Changed +### Changed - switched from SADE to TextGrid Connect Standalone as a means to get data from TextGrid diff --git a/exist-app/build.properties b/exist-app/build.properties index 1378932..c3507f3 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.5.0 +project.version=2.5.1 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From 7d82e4da572dcf4b259fac2f60c5b01e36c0c53a Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 18 Jan 2021 12:59:04 +0100 Subject: [PATCH 136/155] chose: bump version number, update CHANGELOG --- CHANGELOG.md | 12 +++++++++++- exist-app/build.properties | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f48461..2b2253e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,24 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.0] - 2021-01-18 + +### Changed + +- The Text- and AnnotationAPI no longer accept URIs as `collection` parameter. +Callers have to choose between `syriac` or `arabic-karshuni` as `collection`. +This satifies the requirement of having one separate endpoint for the TIDO instance serving the Syriac and the Arabic/Karshuni collections each. + ## [2.5.0] - 2021-01-14 -## Changed +### Changed - switched from SADE to TextGrid Connect Standalone as a means to get data from TextGrid ## [2.4.0] - 2021-01-13 +### Changed + - updated the eXist application's name since it was misleading ## [2.3.0] - 2021-01-13 diff --git a/exist-app/build.properties b/exist-app/build.properties index 1378932..cda5e5e 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.5.0 +project.version=3.0.0 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From 6283fe956a8e5b15bca81851444540932894dd02 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 18 Jan 2021 14:27:39 +0100 Subject: [PATCH 137/155] docs: update README --- README.md | 8 +++++--- .../data/ahiqar_backend_architecture.png | Bin 39781 -> 16039 bytes 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index daf0e06..e4fc4f0 100644 --- a/README.md +++ b/README.md @@ -114,14 +114,16 @@ docker-compose --env-file docker/.env --file docker/docker-compose.yml up --deta ## Connecting the Backend with the Frontend -The corresponding frontend for the Ahiqar backend is [Ahiqar's version of the TIDO viewer](https://gitlab.gwdg.de/subugoe/ahiqar/frontend). -In order to connect it with the simply has to expose a REST API that complies to the specification of the [SUB's generic TextAPI](https://subugoe.pages.gwdg.de/emo/text-api/) +The corresponding frontend for the Ahiqar backend is [Ahiqar's version of the TIDO viewer](https://gitlab.gwdg.de/subugoe/ahiqar/ahiqar-tido). +In order to connect the back end with the viewer, the former simply has to expose a REST API that complies to the specification of the [SUB's generic TextAPI](https://subugoe.pages.gwdg.de/emo/text-api/). +The specification of the project specific API can be found at the [API's documentation page](https://subugoe.pages.gwdg.de/ahiqar/api-documentation/). + The frontend takes care of the data transfer as described in [TIDO's README](https://gitlab.gwdg.de/subugoe/emo/Qviewer/-/blob/develop/README.md#connecting-the-viewer-with-a-backend). ## API documentation The backend comes shipped with an OpenAPI documentation of its API. -The docs are available at . +The docs are available at or at . ### Interplay of TextAPI and AnnotationAPI diff --git a/exist-app/data/ahiqar_backend_architecture.png b/exist-app/data/ahiqar_backend_architecture.png index 9cd45cd692ec1ae72ab204c2e2143473122d5c26..3fc4b1f82f4a307c9a698e98cb6b757871438d78 100644 GIT binary patch literal 16039 zcmeIZby$?&`!1>o(xP-D($dl`NJw{=4B^ny4LX#xfXE08Dc#*5-8eXOhja|xabEm< zzi0o>x%S?_>)P?pKIadvxtMv^dY<*f{oLz$*9ucpk;BCz$9nMK0j~U8X^jUD9xeiZ z5f~`IH(!Fs4IexZcaWEs)bcdhg<+;Bk3H(4!8h-YgMlh67raB@Pczu25?f(x@~7<2 zDmX2%`}p6ytstzhR3x?iEgP5pRl$Iv@$9ZyD5az^#f!&k4d!)p<<~-!b~Y?_mg0is zS@4*LdHkvq#p&RR{O0r>n>56XR7^^e2d4u}j+JCaDvMBq1HUDOK&(hZMtBK%f#-5E z(#b;1cyZB&xNx$pnZdvi#}7TjWuRgaFWU;gL6NFQP7l^pP=6K)vI={gdee% zh}T?hMHMCxYgLRN2TND}YQ}E3%-r%6NOA#3dtQ!g#%{JH%n)&uI2>@c?g6z8%q5Yq-_qhX zNXe9uBW|u)=WC)_mC3KB2 zQy2GM2j|(hEusAi*cbi!GMf!;&eO}hs&Xg7vc^S2Z}WGxVkt6!s?q$3&+28uUGaI^ zn*QMWR`Jx*{cj{?I$3Ku%^6A6z zt!dZW{icFS`k$wc4>=PXvm`X$eQRDWB>GkCQ!>$QawPtpX})2)#KGryB5VIPojvfi zr*vJuX&2Zj(zD^@k4{sE**n3gH?_EYyDBJ{_Y1?AK6k$J-kjhsoYpIRNcxnBYbdD2 ztV#f{#k!adHR@uACh?BzFITq5k2Ad6nu?Uo(5c z8kxcmU&d;4m^3pdps!1{B#>yGHq*)PGE_TyIlwMgz8*wLV>K*Qga}%Ua#!!@m@KQs z5ciySm`e2SaV3l2^jO={(Z5Rv0_juwf&SI^+O&u4x;344&ol}ft4byf%+;eltI|EW z_1y1tWa2^u4R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fWWni$;es_Jg)b-JIl$A^&t;ucLK6Th<#+o4 -- GitLab From 137095f98269dde2be442b6db32b0d5554e6ef03 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 18 Jan 2021 14:42:31 +0100 Subject: [PATCH 138/155] docs: update function docs, add return types --- .../modules/AnnotationAPI/annotations-rest.xqm | 16 +++++++++------- exist-app/modules/AnnotationAPI/annotations.xqm | 15 +++++++++------ exist-app/modules/tapi-collection.xqm | 4 ++-- exist-app/modules/tapi-item.xqm | 6 +++--- exist-app/modules/tapi-manifest.xqm | 15 +++++++-------- exist-app/modules/tapi.xqm | 14 +++++++------- 6 files changed, 37 insertions(+), 33 deletions(-) diff --git a/exist-app/modules/AnnotationAPI/annotations-rest.xqm b/exist-app/modules/AnnotationAPI/annotations-rest.xqm index 1e6b614..87090a2 100644 --- a/exist-app/modules/AnnotationAPI/annotations-rest.xqm +++ b/exist-app/modules/AnnotationAPI/annotations-rest.xqm @@ -35,7 +35,7 @@ declare variable $anno-rest:server := : For retrieving annotation information about other collections cf. the endpoint : /annotations/ahikar/{$collection}/{$document}/annotationCollection.json : - : @param $collection The URI of the collection, e.g. '3r132' + : @param $collection The type of the collection. Can either be `syriac` or `arabic-karshuni` : @return An Annotation Collecion for the given collection :) declare @@ -43,7 +43,8 @@ declare %rest:HEAD %rest:path("/annotations/ahikar/{$collection}/annotationCollection.json") %output:method("json") -function anno-rest:collection-rest($collection as xs:string) { +function anno-rest:collection-rest($collection as xs:string) +as item()+ { if (anno:are-resources-available($collection)) then ($commons:responseHeader200, anno:make-annotationCollection($collection, (), $anno-rest:server)) @@ -58,7 +59,7 @@ function anno-rest:collection-rest($collection as xs:string) { : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object : - : @param $collection The URI of the Collection Object + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of an aggregated Collection or Manifest Object :) declare @@ -67,7 +68,8 @@ declare %rest:path("/annotations/ahikar/{$collection}/{$document}/annotationPage.json") %output:method("json") function anno-rest:annotationPage-for-collection-rest($collection as xs:string, -$document as xs:string) { + $document as xs:string) +as item()+ { if (anno:are-resources-available(($collection, $document))) then ($commons:responseHeader200, anno:make-annotationPage($collection, $document, $anno-rest:server)) @@ -87,7 +89,7 @@ $document as xs:string) { : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object : - : @param $collection The URI of the Collection Object + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of an aggregated Collection or Manifest Object : @return An Annotation Collecion for the given Collection or Manifest Object :) @@ -118,7 +120,7 @@ as item()+ { : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object : - : @param $collection The URI of the Collection Object + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of an aggregated Collection or Manifest Object : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @return An Annotation Collection for the given Collection or Manifest Object @@ -151,7 +153,7 @@ as item()+ { : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object : - : @param $collection The URI of the Collection Object + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of an aggregated Collection or Manifest Object : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @return An Annotation Page for the given Collection or Manifest Object diff --git a/exist-app/modules/AnnotationAPI/annotations.xqm b/exist-app/modules/AnnotationAPI/annotations.xqm index e2425a8..70ca4a7 100644 --- a/exist-app/modules/AnnotationAPI/annotations.xqm +++ b/exist-app/modules/AnnotationAPI/annotations.xqm @@ -12,7 +12,6 @@ xquery version "3.1"; module namespace anno="http://ahikar.sub.uni-goettingen.de/ns/annotations"; -declare namespace err = "http://www.w3.org/2005/xqt-errors"; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace ore="http://www.openarchives.org/ore/terms/"; declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; @@ -30,6 +29,10 @@ declare variable $anno:annotationElements := "persName" ); +(: + : Determines the correct language aggregations. + : The ones starting with "sample_" are for testing only. + :) declare variable $anno:lang-aggs := map { "syriac": if (doc-available($commons:agg || "3r84g.xml")) then "3r84g" else "sample_lang_aggregation_syriac", @@ -83,7 +86,7 @@ as xs:string+ { : @see https://www.w3.org/TR/annotation-model/#annotation-collection : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : - : @param $collection The URI of a Collection Object + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of a Collection or Manifest Object. May be an empty sequence if only information about the $collection should be created : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection @@ -125,7 +128,7 @@ as map() { : @see https://www.w3.org/TR/annotation-model/#annotation-collection : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : - : @param $collection-type The type of the current Collection Object (syriac or arabic-karshuni) + : @param $collection-type The collection type. Can either be `syriac` or `arabic-karshuni` : @param The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection :) @@ -236,7 +239,7 @@ as xs:string { : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object : - : @param $collection The URI of a Collection Object, e.g. '3r132' + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of a Collection or Manifest Object, e.g. '3r84g' : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server : @return A map with all information necessary for the Annotation Collection @@ -288,7 +291,7 @@ as map() { : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object : - : @param $collection The URI of the Collection Object + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of an aggregated Collection or Manifest Object : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server @@ -325,7 +328,7 @@ as map() { : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#manifest-object : - : @param $collection The URI of the Collection Object + : @param $collection The collection type. Can either be `syriac` or `arabic-karshuni` : @param $document The URI of an aggregated Collection or Manifest Object : @param $page The page within an item, i.e. a tei:pb/@n within a TEI resource : @param $server The server we are currently on. This mainly serves testing purposes and usually defaults to $anno:server diff --git a/exist-app/modules/tapi-collection.xqm b/exist-app/modules/tapi-collection.xqm index f726ce4..810e3bd 100644 --- a/exist-app/modules/tapi-collection.xqm +++ b/exist-app/modules/tapi-collection.xqm @@ -37,7 +37,7 @@ as xs:string+ { : the XMLs and images in them. : : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object - : @param $collection-uri The unprefixed TextGrid URI of a collection. For Ahiqar's main collection this is '3r132'. + : @param $collection-type The collection type. Can either be `syriac` or `arabic-karshuni` : @param $server A string indicating the server. This parameter has been introduced to make this function testable. : @return An object element containing all necessary information :) @@ -96,7 +96,7 @@ as document-node()+ { : In order to not have them included in the list of "actual" editions, they : have to be explicitly excluded. : - : @param $doc The root element of an aggregation object + : @param $aggregatins The root element(s) of one or more aggregation objects : @return A list of ore:aggregates without the manifests to be excluded : :) diff --git a/exist-app/modules/tapi-item.xqm b/exist-app/modules/tapi-item.xqm index 4ad33f9..3c11ca0 100644 --- a/exist-app/modules/tapi-item.xqm +++ b/exist-app/modules/tapi-item.xqm @@ -3,7 +3,7 @@ xquery version "3.1"; (: : This module handles calls to the API on item level, e.g. : - : /textapi/ahikar/3r9ps/3rx15-8a/latest/item.json + : /textapi/ahikar/arabic-karshuni/3rx15-8a/latest/item.json :) module namespace tapi-item="http://ahikar.sub.uni-goettingen.de/ns/tapi/item"; @@ -14,7 +14,7 @@ import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" import module namespace tapi-img="http://ahikar.sub.uni-goettingen.de/ns/tapi/images" at "tapi-img.xqm"; -declare function tapi-item:get-json($collection-uri as xs:string, +declare function tapi-item:get-json($collection-type as xs:string, $manifest-uri as xs:string, $page as xs:string, $server as xs:string) @@ -31,7 +31,7 @@ as element(object) { {tapi-item:make-facsimile-id($manifest-uri, $page, $server)} - {$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}/{$page}/annotationCollection.json + {$server}/api/annotations/ahikar/{$collection-type}/{$manifest-uri}/{$page}/annotationCollection.json

}; diff --git a/exist-app/modules/tapi-manifest.xqm b/exist-app/modules/tapi-manifest.xqm index ea5fe07..1e44684 100644 --- a/exist-app/modules/tapi-manifest.xqm +++ b/exist-app/modules/tapi-manifest.xqm @@ -3,7 +3,7 @@ xquery version "3.1"; (: : This module handles calls to the API on manifest level, e.g. : - : /textapi/ahikar/3r9ps/3rx15/manifest.json + : /textapi/ahikar/arabic-karshuni/3rx15/manifest.json :) module namespace tapi-mani="http://ahikar.sub.uni-goettingen.de/ns/tapi/manifest"; @@ -14,13 +14,13 @@ declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010"; import module namespace commons="http://ahikar.sub.uni-goettingen.de/ns/commons" at "commons.xqm"; -declare function tapi-mani:get-json($collection-uri as xs:string, +declare function tapi-mani:get-json($collection-type as xs:string, $manifest-uri as xs:string, $server as xs:string) as element(object) { {$commons:version} - {$server || "/api/textapi/ahikar/" || $collection-uri || "/" || $manifest-uri || "/manifest.json"} + {$server || "/api/textapi/ahikar/" || $collection-type || "/" || $manifest-uri || "/manifest.json"} { tapi-mani:make-editors($manifest-uri), @@ -29,20 +29,20 @@ as element(object) { tapi-mani:make-current-location($manifest-uri) } CC0-1.0 - {$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}/annotationCollection.json - {tapi-mani:make-sequences($collection-uri, $manifest-uri, $server)} + {$server}/api/annotations/ahikar/{$collection-type}/{$manifest-uri}/annotationCollection.json + {tapi-mani:make-sequences($collection-type, $manifest-uri, $server)} }; -declare function tapi-mani:make-sequences($collection-uri as xs:string, +declare function tapi-mani:make-sequences($collection-type as xs:string, $manifest-uri as xs:string, $server as xs:string) as element(sequence)+ { let $valid-pages := tapi-mani:get-valid-page-ids($manifest-uri) return for $page in $valid-pages - let $uri := "/api/textapi/ahikar/" || $collection-uri || "/" || $manifest-uri || "-" || $page || "/latest/item.json" + let $uri := "/api/textapi/ahikar/" || $collection-type || "/" || $manifest-uri || "-" || $page || "/latest/item.json" return {$server}{$uri} @@ -133,5 +133,4 @@ element(x-location) { "unknown" return {$string} - }; diff --git a/exist-app/modules/tapi.xqm b/exist-app/modules/tapi.xqm index 32d9cab..63a5159 100644 --- a/exist-app/modules/tapi.xqm +++ b/exist-app/modules/tapi.xqm @@ -87,7 +87,7 @@ declare function tapi:remove-whitespaces($doc as document-node()) as document-no (:~ : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#collection-object - : @param $collection-uri The unprefixed TextGrid URI of a collection, e.g. '3r132' + : @param $collection-type The collection type. Can either be `syriac` or `arabic-karshuni` : @return A collection object as JSON :) declare @@ -124,10 +124,10 @@ as item()+ { : * the division number, 'n', is mandatory : * 'image' is mandatory since every page has a facsimile : - : Sample call to API: /api/textapi/ahikar/3r17c/3r1pq-147a/latest/item.json + : Sample call to API: /api/textapi/ahikar/syriac/3r1pq-147a/latest/item.json : : @see https://subugoe.pages.gwdg.de/emo/text-api/page/specs/#item - : @param $collection-uri The unprefixed TextGrid URI of a collection, e.g. '3r17c' + : @param $collection-type The collection type. Can either be `syriac` or `arabic-karshuni` : @param $manifest-uri The unprefixed TextGrid URI of a document, e.g. '3r1pq' : @param $page A page number as encoded in a tei:pb/@n, e.g. '147a' : @return Information about a page @@ -135,9 +135,9 @@ as item()+ { declare %rest:GET %rest:HEAD - %rest:path("/textapi/ahikar/{$collection-uri}/{$manifest-uri}-{$page}/latest/item.json") + %rest:path("/textapi/ahikar/{$collection-type}/{$manifest-uri}-{$page}/latest/item.json") %output:method("json") -function tapi:endpoint-item($collection-uri as xs:string, +function tapi:endpoint-item($collection-type as xs:string, $manifest-uri as xs:string, $page as xs:string) as item()+ { @@ -154,7 +154,7 @@ as item()+ { : : Sample call to API: /content/3rbmb-1a.html : - : @param $document The unprefixed TextGrid URI of a TEI/XML, e.g. '3rbmb' + : @param $tei-xml-uri The unprefixed TextGrid URI of a TEI/XML, e.g. '3rbmb' : @param $page The page to be rendered. This has to be the string value of a tei:pb/@n in the given document, e.g. '1a' : @return A response header as well as the rendered HTML page :) @@ -208,7 +208,7 @@ as item()+ { : function cannot be tested by unit tests. : : @param $uri The unprefixed TextGrid URI of an image, e.g. '3r1pr' - : @param $image-section Indicated the image section in percentage to be retured as defined by + : @param $image-section Indicates the image section in percentage to be retured as defined by : the IIIF Image API : @return The image as binary :) -- GitLab From a729b02ff497372266339fd5e0eb2142ea9711cb Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 18 Jan 2021 15:03:57 +0100 Subject: [PATCH 139/155] ci: get results of failing tests --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0703548..4432b58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,6 +54,7 @@ test_exist_app: - echo -e "\033[1;33mThere is/are currently $failures failures or errors.\033[0m" - if [[ "$failures" -gt 0 || ! -f "exist-app/test/ahikar-test-results.xml" ]]; then exit 1; else exit 0; fi artifacts: + when: always paths: - exist-app/test/ahikar-test-results.xml reports: -- GitLab From 1b57e2d97b84cdeacc944da3d912d51938d744e0 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 18 Jan 2021 15:12:39 +0100 Subject: [PATCH 140/155] refactor: rename variable --- exist-app/modules/tapi.xqm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exist-app/modules/tapi.xqm b/exist-app/modules/tapi.xqm index 63a5159..9fe4447 100644 --- a/exist-app/modules/tapi.xqm +++ b/exist-app/modules/tapi.xqm @@ -108,13 +108,13 @@ as item()+ { declare %rest:GET %rest:HEAD - %rest:path("/textapi/ahikar/{$collection-uri}/{$manifest-uri}/manifest.json") + %rest:path("/textapi/ahikar/{$collection-type}/{$manifest-uri}/manifest.json") %output:method("json") -function tapi:endpoint-manifest($collection-uri as xs:string, +function tapi:endpoint-manifest($collection-type as xs:string, $manifest-uri as xs:string) as item()+ { $commons:responseHeader200, - tapi-mani:get-json($collection-uri, $manifest-uri, $tapi:server) + tapi-mani:get-json($collection-type, $manifest-uri, $tapi:server) }; @@ -142,7 +142,7 @@ function tapi:endpoint-item($collection-type as xs:string, $page as xs:string) as item()+ { $commons:responseHeader200, - tapi-item:get-json($collection-uri, $manifest-uri, $page, $tapi:server) + tapi-item:get-json($collection-type, $manifest-uri, $page, $tapi:server) }; (:~ -- GitLab From 28f705f9447eb11a03882f4b23401d417b6458ff Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 22 Jan 2021 13:58:30 +0100 Subject: [PATCH 141/155] ci: fix path --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0703548..23c3e64 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,7 +80,7 @@ load_frontend-all: script: - 'curl --output frontend.zip --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$CI_API_V4_URL/projects/$FRONTEND_REPO_ID/jobs/artifacts/develop/download?job=build"' - unzip frontend.zip - - mkdir frontend + - mkdir -p docker/frontend - mv Qviewer/dist/* docker/frontend/ artifacts: paths: -- GitLab From f7e7fd9c82b257e7e058209e37c723b16949b1bb Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 22 Jan 2021 14:00:45 +0100 Subject: [PATCH 142/155] chore: update CHANGELOG, bump version number --- CHANGELOG.md | 8 +++++++- exist-app/build.properties | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f48461..4741dd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.1] - 2021-01-22 + +### Fixed + +- a broken path in the CI config + ## [2.5.0] - 2021-01-14 -## Changed +### Changed - switched from SADE to TextGrid Connect Standalone as a means to get data from TextGrid diff --git a/exist-app/build.properties b/exist-app/build.properties index 1378932..c3507f3 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.5.0 +project.version=2.5.1 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From 9ac7982fdbe1621c41c5cda1bbed956d1707f727 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 22 Jan 2021 14:10:43 +0100 Subject: [PATCH 143/155] ci: update API paths --- ci-scripts/.api_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/.api_tests.yml b/ci-scripts/.api_tests.yml index 34e178a..417e2d2 100644 --- a/ci-scripts/.api_tests.yml +++ b/ci-scripts/.api_tests.yml @@ -19,7 +19,7 @@ test_api_status-test: - tags - develop script: - - header=$(curl --head -s https://ahikar-test.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - header=$(curl --head -s https://ahikar-test.sub.uni-goettingen.de/api/textapi/ahikar/syriac/collection.json) - *check_HTTP_status test_api_status-develop: @@ -27,7 +27,7 @@ test_api_status-develop: only: - develop script: - - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) + - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/syriac/collection.json) - *check_HTTP_status test_api_status-main: -- GitLab From b7e62e558ea70978345eb8ae571b6b48c7da1141 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Fri, 22 Jan 2021 14:41:56 +0100 Subject: [PATCH 144/155] ci: fix API endpoint --- ci-scripts/.api_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/.api_tests.yml b/ci-scripts/.api_tests.yml index 417e2d2..c6c14e4 100644 --- a/ci-scripts/.api_tests.yml +++ b/ci-scripts/.api_tests.yml @@ -27,7 +27,7 @@ test_api_status-develop: only: - develop script: - - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/syriac/collection.json) + - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/3r9ps/collection.json) - *check_HTTP_status test_api_status-main: -- GitLab From 253bda9182f59a766b2ac21e45d2f2b13f3a7641 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 25 Jan 2021 15:30:41 +0100 Subject: [PATCH 145/155] ci: check if deployment is possible --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 23c3e64..2559698 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -173,6 +173,10 @@ deploy_app-dev: environment: name: ahikar-dev script: + - header=$(curl --head -s https://ahikar-dev.sub.uni-goettingen.de/api/deploy) + - status=$(echo $header | head -n 1 | cut -d" " -f 2) + - echo "Current HTTP status is $status." + - if [[ "$status" != "200" ]]; then exit 1; fi - curl --get --silent https://ahikar-dev.sub.uni-goettingen.de/api/deploy deploy_app-main: @@ -184,6 +188,10 @@ deploy_app-main: environment: name: ahikar script: + - header=$(curl --head -s https://ahikar.sub.uni-goettingen.de/api/deploy) + - status=$(echo $header | head -n 1 | cut -d" " -f 2) + - echo "Current HTTP status is $status." + - if [[ "$status" != "200" ]]; then exit 1; fi - curl --get --silent https://ahikar.sub.uni-goettingen.de/api/deploy # when a git flow release is made, a tag will be pushed starting this job. it -- GitLab From c725dd5800fb8e9260de7599a1815b266abef893 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 25 Jan 2021 15:33:54 +0100 Subject: [PATCH 146/155] chore: update CHANGELOG, bump version number --- CHANGELOG.md | 6 ++++++ exist-app/build.properties | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4741dd8..7a2bbdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.2] - 2021-01-25 + +### Changed + +- added API health check for deploy API + ## [2.5.1] - 2021-01-22 ### Fixed diff --git a/exist-app/build.properties b/exist-app/build.properties index c3507f3..e536862 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=2.5.1 +project.version=2.5.2 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From 3e0629168bcd09a98870ec8b80d96e7632242c7a Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 26 Jan 2021 09:27:31 +0100 Subject: [PATCH 147/155] ci: add test with dummy data --- .gitlab-ci.yml | 2 ++ test.html | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2559698..64fb465 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -82,6 +82,8 @@ load_frontend-all: - unzip frontend.zip - mkdir -p docker/frontend - mv Qviewer/dist/* docker/frontend/ + - mkdir docker/frontend/test + - mv test.html docker/frontend/test artifacts: paths: - docker/frontend/ diff --git a/test.html b/test.html new file mode 100644 index 0000000..9f5bbb9 --- /dev/null +++ b/test.html @@ -0,0 +1,13 @@ + + + + + Sample Page + + + + +

Sample page

+ Lorem ipsum, lorem ipsum. + + -- GitLab From 52e9ae05787be123b06d9df19fb7c5d499591801 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 26 Jan 2021 09:44:35 +0100 Subject: [PATCH 148/155] ci: generate two viewer instances --- .gitlab-ci.yml | 9 ++++++--- test.html | 13 ------------- 2 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 test.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64fb465..4001cce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,9 +81,12 @@ load_frontend-all: - 'curl --output frontend.zip --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$CI_API_V4_URL/projects/$FRONTEND_REPO_ID/jobs/artifacts/develop/download?job=build"' - unzip frontend.zip - mkdir -p docker/frontend - - mv Qviewer/dist/* docker/frontend/ - - mkdir docker/frontend/test - - mv test.html docker/frontend/test + - cp Qviewer/dist/* docker/frontend/ + - mkdir docker/frontend/syriac && mkdir docker/frontend/arabic-karshuni + - cp Qviewer/dist/* docker/frontend/syriac + - sed 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/syriac/' docker/frontend/syriac/index.html + - cp Qviewer/dist/* docker/frontend/arabic-karshuni + - sed 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/arabic-karshuni/' docker/frontend/arabic-karshuni/index.html artifacts: paths: - docker/frontend/ diff --git a/test.html b/test.html deleted file mode 100644 index 9f5bbb9..0000000 --- a/test.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Sample Page - - - - -

Sample page

- Lorem ipsum, lorem ipsum. - - -- GitLab From e90ea6be01308adab87afde3c72dfad5dc08a9df Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 26 Jan 2021 09:53:29 +0100 Subject: [PATCH 149/155] ci: fix regex --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4001cce..a9ef3f5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -84,9 +84,9 @@ load_frontend-all: - cp Qviewer/dist/* docker/frontend/ - mkdir docker/frontend/syriac && mkdir docker/frontend/arabic-karshuni - cp Qviewer/dist/* docker/frontend/syriac - - sed 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/syriac/' docker/frontend/syriac/index.html + - sed -i 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/syriac/' docker/frontend/syriac/index.html - cp Qviewer/dist/* docker/frontend/arabic-karshuni - - sed 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/arabic-karshuni/' docker/frontend/arabic-karshuni/index.html + - sed -i 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/arabic-karshuni/' docker/frontend/arabic-karshuni/index.html artifacts: paths: - docker/frontend/ -- GitLab From 9ad3be22cc29eda0e70fcb95683f03b605bf0b14 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 26 Jan 2021 13:24:23 +0100 Subject: [PATCH 150/155] chore: bump versoin number, update CHANGELOG --- CHANGELOG.md | 6 ++++++ exist-app/build.properties | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a617d3..35fb402 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.1.0] - 2021-01-26 + +### Changed + +- provide two instances of the viewer, one for Syriac and one for Arabic/Karshuni texts + ## [3.0.0] - 2021-01-18 ### Changed diff --git a/exist-app/build.properties b/exist-app/build.properties index cda5e5e..9ebefb1 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=3.0.0 +project.version=3.1.0 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab From e6ea5289d5d3c2655a87de75ce903e7acca8bc22 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 26 Jan 2021 15:14:22 +0100 Subject: [PATCH 151/155] ci: update regex --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c9d06c1..5b3dec4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -85,9 +85,8 @@ load_frontend-all: - cp Qviewer/dist/* docker/frontend/ - mkdir docker/frontend/syriac && mkdir docker/frontend/arabic-karshuni - cp Qviewer/dist/* docker/frontend/syriac - - sed -i 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/syriac/' docker/frontend/syriac/index.html + - sed -i 's/textapi\/ahikar\/arabic-karshuni/textapi\/ahikar\/syriac' docker/frontend/syriac/index.html - cp Qviewer/dist/* docker/frontend/arabic-karshuni - - sed -i 's/ahikar-dev.sub.uni-goettingen.de\/api\/textapi\/ahikar\/3r9ps/ahikar-test.sub.uni-goettingen.de\/api\/textapi\/ahikar\/arabic-karshuni/' docker/frontend/arabic-karshuni/index.html artifacts: paths: - docker/frontend/ -- GitLab From cd684c9a82b2d7b6ba3f0b22e9d7898c05fce3b4 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 26 Jan 2021 15:19:45 +0100 Subject: [PATCH 152/155] ci: fix typo --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b3dec4..9b932f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -85,7 +85,7 @@ load_frontend-all: - cp Qviewer/dist/* docker/frontend/ - mkdir docker/frontend/syriac && mkdir docker/frontend/arabic-karshuni - cp Qviewer/dist/* docker/frontend/syriac - - sed -i 's/textapi\/ahikar\/arabic-karshuni/textapi\/ahikar\/syriac' docker/frontend/syriac/index.html + - sed -i 's/textapi\/ahikar\/arabic-karshuni/textapi\/ahikar\/syriac/' docker/frontend/syriac/index.html - cp Qviewer/dist/* docker/frontend/arabic-karshuni artifacts: paths: -- GitLab From ea239457dda017091f5035dad1727c97ef417ef3 Mon Sep 17 00:00:00 2001 From: mrodzis Date: Wed, 27 Jan 2021 09:41:44 +0100 Subject: [PATCH 153/155] Bugfix/#87 tile follow up --- CHANGELOG.md | 6 ++++++ exist-app/build.properties | 2 +- exist-app/modules/tapi-img.xqm | 10 +++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a617d3..53e8333 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.1] - 2021-01-27 + +### Changed + +- `local:truncate` in `tapi-img.xqm` has been renamed to `local:round` to better grasp what the function does. + ## [3.0.0] - 2021-01-18 ### Changed diff --git a/exist-app/build.properties b/exist-app/build.properties index cda5e5e..fd1dd02 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=3.0.0 +project.version=3.0.1 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 diff --git a/exist-app/modules/tapi-img.xqm b/exist-app/modules/tapi-img.xqm index 032b45c..d5f1dd0 100644 --- a/exist-app/modules/tapi-img.xqm +++ b/exist-app/modules/tapi-img.xqm @@ -96,15 +96,15 @@ as element(svg:rect) { declare function tapi-img:get-svg-section-dimensions-as-string($svg as element(svg:rect)) as xs:string { - let $x-offset := local:truncate($svg/@x) - let $y-offset := local:truncate($svg/@y) - let $width := local:truncate($svg/@width) - let $height := local:truncate($svg/@height) + let $x-offset := local:round($svg/@x) + let $y-offset := local:round($svg/@y) + let $width := local:round($svg/@width) + let $height := local:round($svg/@height) return string-join(($x-offset, $y-offset, $width, $height), ",") }; -declare function local:truncate($number-as-string as attribute()) +declare function local:round($number-as-string as attribute()) as xs:string { $number-as-string => substring-before("%") -- GitLab From 9299657f132f68488cbb486e04990c2f55067cef Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 27 Jan 2021 13:15:42 +0100 Subject: [PATCH 154/155] chore: rename file --- exist-app/{master.build.properties => main.build.properties} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename exist-app/{master.build.properties => main.build.properties} (100%) diff --git a/exist-app/master.build.properties b/exist-app/main.build.properties similarity index 100% rename from exist-app/master.build.properties rename to exist-app/main.build.properties -- GitLab From d029325e5616dd5a5bc85e586aac85ba6e2873a5 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 27 Jan 2021 13:21:20 +0100 Subject: [PATCH 155/155] chore: update CHANGELOG, bump version numver --- CHANGELOG.md | 9 ++++++++- exist-app/build.properties | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af10032..5847bcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.1.0] - 2021-01-26 +## [3.1.1] - 2021-01-27 + +### Fixed + +- rename `master.build.properties` to `main.build.properties` to match the actual branch names. +This is necessary to build a package and upload it to our package store (ci.de.dariah.eu). + +## [3.1.0] - 2021-01-27 ### Changed diff --git a/exist-app/build.properties b/exist-app/build.properties index 9ebefb1..64529fb 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahikar-test.sub.uni-goettingen.de/ -project.version=3.1.0 +project.version=3.1.1 project.title=Ahiqar project.abbrev=ahikar-test project.processorversion=5.2.0 -- GitLab