Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving issue #240 #487

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions add/data/xql/getAnnotationsInText.xql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace request = "http://exist-db.org/xquery/request";
declare namespace xlink = "http://www.w3.org/1999/xlink";
declare namespace xmldb = "http://exist-db.org/xquery/xmldb";
import module namespace eutil = "http://www.edirom.de/xquery/eutil" at "../xqm/eutil.xqm";


(: OPTION DECLARATIONS ===================================================== :)

Expand All @@ -29,10 +31,10 @@ declare option output:media-type "application/json";
@param $elems The elements to check (most likely measures and zones)
@returns A sequence of annotation elements
:)
declare function local:findAnnotations($uri as xs:string) as element(mei:annot)* {
declare function local:findAnnotations($uri as xs:string, $edition as xs:string) as element(mei:annot)* {

(: TODO: check if annotations hold URIs or IDRefs :)
collection('/db/contents')//mei:annot[matches(@plist, $uri)]
edition:collection($edition)//mei:annot[matches(@plist, $uri)]
};

declare function local:getAnnotations($uriSharp as xs:string, $annotations as element()*) as array(*)* {
Expand Down Expand Up @@ -65,9 +67,10 @@ declare function local:getAnnotations($uriSharp as xs:string, $annotations as el
}
};

let $edition := request:get-parameter('edition', '')
let $uri := request:get-parameter('uri', '')
let $uriSharp := concat($uri, '#')
let $annotations := local:findAnnotations($uri)
let $annotations := local:findAnnotations($uri,$edition)

return
local:getAnnotations($uriSharp, $annotations)
Loading