Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
subugoe
ahiqar
backend
Commits
3a0a3e37
Commit
3a0a3e37
authored
Jul 14, 2021
by
mrodzis
💪
Browse files
refactor: fix bug, change function interface
parent
eafd865a
Pipeline
#212352
failed with stages
in 2 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
exist-app/modules/AnnotationAPI/annotations-variants.xqm
View file @
3a0a3e37
...
...
@@ -40,10 +40,11 @@ import module namespace functx = "http://www.functx.com";
declare variable $vars:ns := "http://ahikar.sub.uni-goettingen.de/ns/annotations";
declare function vars:get-variants($teixml-uri as xs:string,
$pages as element(tei:TEI)+)
$pages as element(tei:TEI)+,
$pb-n as xs:string)
as map(*)* {
for $page in $pages return
let $variants := vars:get-variants-on-page-as-maps($teixml-uri, $page)
let $variants := vars:get-variants-on-page-as-maps($teixml-uri, $page
, $pb-n
)
for $map in $variants
let $id := map:get($map, "current") => map:get("id")
...
...
@@ -66,14 +67,15 @@ as map(*)* {
: @return A map with information about the current token and its variants
:)
declare function vars:get-variants-on-page-as-maps($teixml-uri as xs:string,
$page as element(tei:TEI))
$page as element(tei:TEI),
$pb-n as xs:string)
as map()* {
let $ms-id := vars:get-ms-id-from-idno($teixml-uri)
let $relevant-files-for-ms-id := vars:get-relevant-files($ms-id)
(: the MS identifier position is the same in all relevant files, so we simply
choose the first for looking it up :)
let $ms-id-position := vars:determine-id-position($ms-id, $relevant-files-for-ms-id[1])
let $tokens := vars:get-token-ids-on-page($teixml-uri, $p
age
)
let $tokens := vars:get-token-ids-on-page($teixml-uri, $p
b-n
)
let $files-relevant-for-page := vars:get-files-relevant-for-page($relevant-files-for-ms-id, $ms-id-position, $tokens)
for $file in $files-relevant-for-page return
...
...
@@ -125,7 +127,7 @@ declare function vars:determine-id-position($ms-id as xs:string,
as xs:integer {
let $witnesses := map:get($json, "witnesses")
return
index-of($witnesses?*, $ms-id)
index-of($witnesses?*,
"t_" ||
$ms-id)
};
(:~
...
...
@@ -136,9 +138,11 @@ as xs:integer {
: @param $page The current page as provided in tei:pb/@n
:)
declare function vars:get-token-ids-on-page($teixml-uri as xs:string,
$page as
element(tei:TEI)
)
$page as
xs:string
)
as xs:string+ {
$page//tei:w/@xml:id
let $page-chunks := commons:get-transcription-and-transliteration-per-page($teixml-uri, $page)
return
$page-chunks//tei:w/@xml:id
};
declare function vars:get-files-relevant-for-page($relevant-files-for-ms-id as map()+,
...
...
exist-app/modules/AnnotationAPI/save-annotations.xqm
View file @
3a0a3e37
...
...
@@ -55,7 +55,7 @@ as item()* {
return
(edit:get-annotations($pages, $teixml-uri),
motifs:get-motifs($pages, $teixml-uri),
vars:get-variants($teixml-uri, $page))
vars:get-variants($teixml-uri,
$pages,
$page))
};
declare function san:make-items-for-TEI($teixml-uri as xs:string,
...
...
mrodzis
💪
@mrodzis
mentioned in issue
#149
·
Jul 14, 2021
mentioned in issue
#149
mentioned in issue #149
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment