diff --git a/CHANGELOG.md b/CHANGELOG.md index a7d31c6e6407aa64df3f8115ad09e39a724dfb51..ece274d99128cb49c9278ceff804c11eea7e8fc9 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). -## [12.0.1] - 2025-01-29 +## [12.1.0] - 2025-01-29 + +### Added + +- Endpoint predenting the structure (`tei:milestone`) for each text node ### Fixed diff --git a/exist-app/build.properties b/exist-app/build.properties index 71e1e5f1a4fadea8bcccdb210af370ccca83a030..709dadef651246b4a6ed499d626684eb631407c7 100644 --- a/exist-app/build.properties +++ b/exist-app/build.properties @@ -1,5 +1,5 @@ project.name=https://ahiqar-test.sub.uni-goettingen.de/ -project.version=12.0.1 +project.version=12.1.0 project.title=Ahiqar project.abbrev=ahiqar-test project.processorversion=6.3.0 diff --git a/exist-app/modules/structure.xqm b/exist-app/modules/structure.xqm new file mode 100644 index 0000000000000000000000000000000000000000..204933f5aa332334e1378e6bd91d54533fe3ba7c --- /dev/null +++ b/exist-app/modules/structure.xqm @@ -0,0 +1,46 @@ +xquery version "3.1"; + +(:~ + : Giving specific structural information on database content. + : + : @author Mathias Göbel + : @version 0.1.0 + : @since 12.1.0 + :) + +module namespace structure="http://ahiqar.uni-goettingen.de/ns/structure"; +import module namespace commons="http://ahiqar.uni-goettingen.de/ns/commons" at "/db/apps/ahiqar/modules/commons.xqm"; +import module namespace rest="http://exquery.org/ns/restxq"; + +declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; +declare namespace tei="http://www.tei-c.org/ns/1.0"; + +(:~ + : Create a list of tei:milestone elements mapped together with useful metadata. + : @return map(*) + : :) +declare + %rest:GET + %rest:HEAD + %rest:path("/structure") + %rest:produces("application/json") + %output:method("json") +function structure:main() +as map(*){ + +for $text in collection( $commons:data )//tei:text +let $baseUri := $text/base-uri() +where not( contains($baseUri, "sample") ) +order by $baseUri +return + map{ + "doc": $baseUri, + "attributes": array{ for $attrib in $text/@* return map{local-name($attrib): string($attrib)}}, + "idnos" : $text/ancestor::tei:TEI//tei:idno/string(), + "milestones": array{ + for $milestone in $text//tei:milestone[@unit] + return + string($milestone/@unit) + } + } +};