Skip to content

Commit 2ac07d5

Browse files
authored
fix some annotations-in-text issues (#532)
## Description, Context and related Issue There surfaced two issues when testing with the Open-Faust data which might be connected to #460. 1. JSONification of the `local:getAnnotations` function was not complete. The function returned a map object `plist` as string, causing some Javascript function to fail. 2. `teitext:getLabel#2` would return a sequence of strings (under some circumstances) which was not allowed by the return value of the function signature. <!--- This project only accepts pull requests related to open issues. Please link to the issue here: --> Refs #460 ## Types of changes - Bug fix (non-breaking change which fixes an issue) - Improvement - Refactoring ## Overview - I have performed a self-review of my code, according to the [style guide](https://github.com/Edirom/Edirom-Online/blob/develop/STYLE-GUIDE.md) - I have read the [CONTRIBUTING](https://github.com/Edirom/Edirom-Online/blob/develop/CONTRIBUTING.md) document. - All new and existing tests passed.
2 parents a8a5c8f + 17ee9d5 commit 2ac07d5

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

add/data/xql/getAnnotationsInText.xql

+4-5
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@ declare function local:getAnnotations($uriSharp as xs:string, $annotations as el
4949
let $plist as array(*) :=
5050
array {
5151
for $p in tokenize($annotation/@plist, '\s+')
52+
where starts-with($p, $uriSharp)
5253
return
53-
if (starts-with($p, $uriSharp)) then
54-
(concat('{id:"', $id, '__', substring-after($p, $uriSharp), '"}'))
55-
else
56-
()
54+
map {
55+
'id': concat( $id, '__', substring-after($p, $uriSharp))
56+
}
5757
}
58-
let $plist := string-join($plist, ',')
5958
return
6059
map {
6160
'id': $id,

add/data/xqm/teitext.xqm

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ declare namespace tei="http://www.tei-c.org/ns/1.0";
2828
:)
2929
declare function teitext:isText($uri as xs:string) as xs:boolean {
3030

31-
exists(doc($uri)/tei:TEI)
31+
exists(eutil:getDoc($uri)/tei:TEI)
3232

3333
};
3434

@@ -40,8 +40,6 @@ declare function teitext:isText($uri as xs:string) as xs:boolean {
4040
:)
4141
declare function teitext:getLabel($uri as xs:string, $edition as xs:string) as xs:string {
4242

43-
let $language := eutil:getLanguage($edition)
44-
45-
return doc($uri)//tei:titleStmt/data(tei:title[not(@xml:lang) or @xml:lang = $language])
43+
eutil:getLocalizedTitle(eutil:getDoc($uri), eutil:getLanguage($edition))
4644

4745
};

0 commit comments

Comments
 (0)