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

Ftr/358 grayout goto movement #398

Merged
merged 61 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
089e6d9
rename workflow
bwbohl Jun 25, 2024
607e919
create deve release
bwbohl Jun 25, 2024
1d9e7fd
update artifact path
bwbohl Jun 25, 2024
86c1686
XQuery update to styleguide
bwbohl Jun 27, 2024
8e8ce56
fix JS indentation
bwbohl Jun 27, 2024
a85ead7
Ignore annotation category or priority filter if not defined
bwbohl Jun 27, 2024
897dd7b
OpenSeadragonViewer: remove duplicate funtion definition
bwbohl Jun 27, 2024
d5cba22
fix tip target
bwbohl Jun 27, 2024
d4f8750
add some code comments
bwbohl Jun 27, 2024
4d08448
ad some code comments
bwbohl Jun 27, 2024
47d3b33
View OpenSeaDragonView: fix what is pushed to me.shapes annotations
bwbohl Jun 27, 2024
c16012e
Viw OpenSeaDragonView: fix alternative retrieval of shape element
bwbohl Jun 27, 2024
79c0036
View OpenSeaDargonViewer: push to array instead of insert
bwbohl Jun 27, 2024
4d1ace3
View OpenSeaDragonViewer: stick to standard annotation ID scheme for…
bwbohl Jun 27, 2024
df98a4c
View OpenSeadragonViewer: add some ode comment
bwbohl Jun 27, 2024
f6e1429
View SourceView: do not iterate over PrioritiesMenu if it is null
bwbohl Jun 27, 2024
d846306
getAnnotationsOnPage: element name as fallback for annotation type
bwbohl Jun 27, 2024
1825bec
XQdoc
bwbohl Jun 28, 2024
6ca8684
Styleguide: improve conformity
bwbohl Jun 28, 2024
22a395e
add som e code comments
bwbohl Jun 28, 2024
c23a9eb
XQuery: style conformance improve and TODO comment
bwbohl Jun 28, 2024
90e676b
View SourceView: check if categroeis menu exists when populating visi…
bwbohl Jun 28, 2024
c3ccb19
fix indentation
bwbohl Jun 28, 2024
765b009
View SourceView: only add annotation filter menu entries if respectiv…
bwbohl Jun 28, 2024
2e812b3
View SourceView: fix JS syntax error
bwbohl Jun 28, 2024
a62afee
ADD SOME DEBUG console logging
bwbohl Jun 28, 2024
d489432
View SourceView: add some TODOs
bwbohl Jun 28, 2024
7c3f555
whitespace
bwbohl Jun 28, 2024
b39095b
Controller SourceView: remove lang parameter as not available
bwbohl Jun 28, 2024
065bc44
whitespace
bwbohl Jun 28, 2024
0c613b8
ADD SOME DEBUG console logging
bwbohl Jun 28, 2024
3d14008
code comments
bwbohl Jun 28, 2024
72fb2ac
ADD SOME DEBUG console logging
bwbohl Jun 28, 2024
43921f7
ADD SOME DEBUG console logging
bwbohl Jun 28, 2024
d473cd9
View PageBasedView: use annotation.id to retrieve element
bwbohl Jun 28, 2024
d534d7a
whitespace
bwbohl Jun 28, 2024
fecbada
whitespace
bwbohl Jun 28, 2024
a91a5a1
View OpenSeaDragonViewer: add a html template from ImageViewer
bwbohl Jun 28, 2024
e32d30a
View OpenSeaDragonVirwer: add some code comments
bwbohl Jun 28, 2024
77864e2
ADD SOME DEBUG console logging
bwbohl Jun 28, 2024
72535ef
View MeasureBasedView HorizontalMeasureViewer: fix retrieval of annot…
bwbohl Jun 28, 2024
fca2adb
whitespace
bwbohl Jun 28, 2024
7afd0d8
View PageBasedView: fix annotation filer
bwbohl Jun 28, 2024
24da899
View OpenSeadragonViewer: fix annotation IDs
bwbohl Jun 28, 2024
257fb2c
View PageBasedView: fix annotation filters
bwbohl Jun 30, 2024
6e769b4
Update add/index.xql
bwbohl Jul 3, 2024
b45eeb6
Merge branch 'develop' into fix/annotations-on-page
bwbohl Jul 3, 2024
a422ba6
View TextFacsimileSplitView: add openseadragon as alternative viewer
bwbohl Jul 3, 2024
72fb478
Merge branch 'develop' into fix/annotations-on-page
bwbohl Jul 11, 2024
554fd88
View SourceView: gray-out go to movement menu if number of movements …
bwbohl Jul 11, 2024
88506b7
View SourceView GotoMsg: gray-out movement combobox if number of move…
bwbohl Jul 11, 2024
038f369
View VerovioView: gray-out gotoMovement menu if number of movements 1…
bwbohl Jul 12, 2024
8461f4e
View MeasureBasedView: refine a TODO comment
bwbohl Jul 12, 2024
b48c420
View MeasureBasedView: disable movement-comboBox on one or lesser mov…
bwbohl Jul 12, 2024
e3108a7
Merge branch 'develop' into ftr/358-grayout-gotoMovement
bwbohl Jul 12, 2024
a8e4f6f
Merge branch 'develop' into fix/annotations-on-page
bwbohl Jul 15, 2024
0809e00
Merge branch 'develop' into fix/339-facsimile-view-with-tei-documents
bwbohl Jul 16, 2024
282ae2b
Merge branch 'develop' into bazga/dev
bwbohl Aug 12, 2024
98f15db
Merge pull request #26 from Edirom/fix/annotations-on-page
bwbohl Aug 12, 2024
62aad2d
Merge pull request #27 from Edirom/fix/339-facsimile-view-with-tei-do…
bwbohl Aug 15, 2024
9b09664
Merge branch 'bazga/dev' into ftr/358-grayout-gotoMovement
bwbohl Aug 15, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: pre-release

on:
push:
Expand All @@ -18,6 +18,8 @@ jobs:
build:
name: Build Edirom Online
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Chekout repository
Expand All @@ -42,3 +44,23 @@ jobs:
path: ${{ github.workspace }}/build-xar/Edirom-Online-*.xar
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
#optional retention-days: 1 to 90

- name: Delete dev-release
if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }}
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: dev
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create dev-release
if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }}
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: ${{ github.workspace }}/build-xar/Edirom-Online-*.xar
commit: ${{ github.sha }}
name: "Development Build"
prerelease: true
replacesArtifacts: true
tag: dev
99 changes: 68 additions & 31 deletions add/data/xql/getAnnotationInfos.xql
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,123 @@ xquery version "3.1";
: Copyright: For LICENSE-Details please refer to the LICENSE file in the root directory of this repository.
:)


(: IMPORTS ================================================================= :)

import module namespace annotation = "http://www.edirom.de/xquery/annotation" at "../xqm/annotation.xqm";

import module namespace eutil = "http://www.edirom.de/xquery/util" at "../xqm/util.xqm";


(: NAMESPACE DECLARATIONS ================================================== :)

declare namespace mei = "http://www.music-encoding.org/ns/mei";

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

declare namespace request = "http://exist-db.org/xquery/request";


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

declare option output:method "json";

declare option output:media-type "application/json";


(: VARIABLE DECLARATIONS =================================================== :)

declare variable $uri := request:get-parameter('uri', '');

declare variable $edition := request:get-parameter('edition', '');

declare variable $edition_path := eutil:getPreference('edition_path', $edition);


(: FUNCTION DECLARATIONS =================================================== :)

(:~
: Returns distinct list of catagories
: Returns distinct list of catagories used be the submitted annotations
:
: @param $annots a sequence of annotation elements (usually mei:annot)
:
: @return a sequence of strings
:)
declare function local:getDistinctCategories($annots as element()*) as xs:string* {

(: older Edirom Online models (pre MEI 4) :)
let $oldCats := distinct-values($annots/mei:ptr[@type = "categories"]/replace(@target, '#', ''))
let $newCats := distinct-values(for $annot in $annots
return
tokenize(replace(normalize-space($annot/@class), '#', ''), ' '))[contains(., 'annotation.category')]

(: MEI 4 and above Edirom Online model using @class and mei:taxonomy :)
let $newCats :=
distinct-values(
for $annot in $annots
return
tokenize(replace(normalize-space($annot/@class), '#', ''), ' '))[contains(., 'annotation.category')]

return
distinct-values(($oldCats, $newCats)[string-length() gt 0])
};

(:~
: Returns distinct list of annotation priorities
: Returns distinct list of annotation priorities used by the submitted annotations
:
: @param $annots a sequence of annotation elements (usually mei:annot)
:
: @return a sequence of strings
:)
declare function local:getDistinctPriorities($annots as element()*) as xs:string* {

distinct-values(
for $annot in $annots
let $oldLink := $annot/mei:ptr[@type = "priority"]/replace(@target, '#', '')
let $classes := tokenize(replace(normalize-space($annot/@class), '#', ''), ' ')
let $newLink := $classes[starts-with(., 'ediromAnnotPrio')]
return
distinct-values(($oldLink, $newLink))[string-length(.) gt 0]
for $annot in $annots

(: older Edirom Online models (pre MEI 4) :)
let $oldLink := $annot/mei:ptr[@type = "priority"]/replace(@target, '#', '')

(: MEI 4 and above Edirom Online model using @class and mei:taxonomy :)
let $classes := tokenize(replace(normalize-space($annot/@class), '#', ''), ' ')

let $newLink := $classes[starts-with(., 'ediromAnnotPrio')]

return
distinct-values(($oldLink, $newLink))[string-length(.) gt 0]
)
};


(: QUERY BODY ============================================================== :)

let $mei := doc($uri)/root()

let $annots := collection($edition_path)//mei:annot[matches(@plist, $uri)] | $mei//mei:annot

let $categories :=
for $category in local:getDistinctCategories($annots)
let $categoryElement := (collection($edition_path)/id($category)[mei:label or mei:name])[1]
let $name := annotation:category_getName($categoryElement, eutil:getLanguage($edition))
for $category in local:getDistinctCategories($annots)
let $categoryElement := (collection($edition_path)/id($category)[mei:label or mei:name])[1]
let $name := annotation:category_getName($categoryElement, eutil:getLanguage($edition))
order by $name
return
map {
'id': $category,
'name': $name
}
return
map {
'id': $category,
'name': $name
}

let $prios :=
for $priority in local:getDistinctPriorities($annots)
let $name := annotation:getPriorityLabel((collection($edition_path)//id($priority)[mei:label or mei:name])[1])
for $priority in local:getDistinctPriorities($annots)
let $name := annotation:getPriorityLabel((collection($edition_path)//id($priority)[mei:label or mei:name])[1])
order by $name
return
map {
'id': $priority,
'name': $name
}
return
map {
'id': $priority,
'name': $name
}

let $map :=
map {
'categories': array {$categories},
'priorities': array {$prios},
'count': count($annots)
}
map {
'categories': array {$categories},
'priorities': array {$prios},
'count': count($annots)
}

return
$map
83 changes: 64 additions & 19 deletions add/data/xql/getAnnotationsOnPage.xql
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,40 @@ xquery version "3.1";
: @author <a href="mailto:[email protected]">Benjamin W. Bohl</a>
:)


(: IMPORTS ================================================================= :)

import module namespace functx = "http://www.functx.com";

import module namespace eutil = "http://www.edirom.de/xquery/util" at "../xqm/util.xqm";


(: NAMESPACE DECLARATIONS ================================================== :)

declare namespace ft = "http://exist-db.org/xquery/lucene";

declare namespace mei = "http://www.music-encoding.org/ns/mei";

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

declare namespace request = "http://exist-db.org/xquery/request";

declare namespace svg = "http://www.w3.org/2000/svg";

declare namespace xlink = "http://www.w3.org/1999/xlink";

declare namespace xmldb = "http://exist-db.org/xquery/xmldb";


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

declare option output:method "json";

declare option output:media-type "application/json";


(: FUNCTION DECLARATIONS =================================================== :)

(:~
: Returns a JSON array of annotations
:
Expand All @@ -41,24 +54,32 @@ declare option output:media-type "application/json";
: @returns a JSON array of annotations
:)
declare function local:getAnnotations($sourceUriSharp as xs:string, $surfaceId as xs:string, $annotations as element()*, $elems as element()*) as map(*)* {

for $annotation in $annotations

let $id := $annotation/string(@xml:id)

let $uri := concat('xmldb:exist://', document-uri($annotation/root()), '#', $id)

let $classes := tokenize(replace(normalize-space($annotation/@class), '#', ''), ' ')

let $prio := $annotation/mei:ptr[@type = "priority"]/replace(@target, '#', '') || $classes[starts-with(., 'ediromAnnotPrio')]

let $cat := $annotation/mei:ptr[@type = "categories"]/replace(@target, '#', '') || string-join($classes[contains(., 'annotation.category.')], ' ')

let $plist.raw :=
for $p in tokenize(normalize-space($annotation/@plist), ' ')
let $p.noSharp := replace($p, '#', '')
return
if (starts-with($p, $sourceUriSharp)) then
(substring-after($p, $sourceUriSharp))
else if ($elems/@xml:id[. = $p.noSharp] or $elems/@id[. = $p.noSharp]) then
($p.noSharp)
else
if ($elems/@xml:id[. = $p.noSharp] or $elems/@id[. = $p.noSharp]) then
($p.noSharp)
else
()
()

let $svgList := local:getAnnotSVGs($id, $plist.raw, $elems)

let $plist := local:getParticipants($id, $plist.raw, $elems)

return
Expand All @@ -74,30 +95,35 @@ declare function local:getAnnotations($sourceUriSharp as xs:string, $surfaceId a
};

(:~
: Returns all annotations in all works of a edirom-edition containing references to a list of IDs from one source
: Returns all annotations in all works of an edirom-edition containing references to a list of IDs from one source
:
: @param $edition The xmldb-uri to the edirom-edition file
: @param $uri The xmldb-uri to the source-file
: @param $elemIds The element-IDs to check (most likely measures and zones)
:
: @returns A sequence of mei:annot elements
:)
declare function local:findAnnotations($edition as xs:string, $uri as xs:string, $elemIds as xs:string*) as element()* {

(: TODO: search in other documents and in other collections :)
(: TODO: check if annotations hold URIs or IDRefs :)
functx:distinct-deep(
for $id in $elemIds
let $uriPlusId := concat($uri, '#', $id)
let $hashId := '#' || $id
let $annots := collection(eutil:getPreference('edition_path', $edition))//mei:annot

return
(:
: The first predicate with `contains` is just a rough estimate to narrow down the result set.
: It uses the index and is fast while the second (exact) predicate is generally too slow
:)
$annots[contains(@plist, $uriPlusId)][$uriPlusId = tokenize(@plist, '\s')] |
$annots[contains(@plist, $hashId)][$hashId = tokenize(@plist, '\s')]
for $id in $elemIds

let $uriPlusId := concat($uri, '#', $id)

let $hashId := '#' || $id

(: all mei:annot elements in the editions 'edition_path' collection :)
let $annots := collection(eutil:getPreference('edition_path', $edition))//mei:annot

return
(:
: The first predicate with `contains` is just a rough estimate to narrow down the result set.
: It uses the index and is fast while the second (exact) predicate is generally too slow
:)
$annots[contains(@plist, $uriPlusId)][$uriPlusId = tokenize(@plist, '\s')] |
$annots[contains(@plist, $hashId)][$hashId = tokenize(@plist, '\s')]
)
};

Expand All @@ -113,13 +139,16 @@ declare function local:findAnnotations($edition as xs:string, $uri as xs:string,
declare function local:getParticipants($annoId as xs:string, $plist as xs:string*, $elems as element()*) as map(*)* {

let $participants := $elems[@xml:id = $plist]

return
for $p in $participants

let $coord := local:getCoordinates($p)

return
map {
'id': 'annotation__' || string($p/@xml:id),
'type': string($p/@type),
'type': if($p/@type != '') then string($p/@type) else local-name($p),
'ulx': $coord[1],
'uly': $coord[2],
'lrx': $coord[3],
Expand All @@ -142,7 +171,9 @@ declare function local:getAnnotSVGs($annoId as xs:string, $plist as xs:string*,

return
for $svg in $participants

let $id := $svg/@id

return
map {
'id': $annoId || '__' || $id,
Expand All @@ -168,23 +199,35 @@ declare function local:getCoordinates($participant as element()) as xs:integer+
if (name($participant) = 'measure' or name($participant) = 'staff') then
($participant/root()/id(substring($participant/@facs, 2)))
else
($participant)
($participant)

return
if ($zone/@ulx) then
(number($zone/@ulx), number($zone/@uly), number($zone/@lrx), number($zone/@lry))
else
(-1, -1, -1, -1)
};


(: QUERY BODY ============================================================== :)

let $edition := request:get-parameter('edition', '')

let $sourceUri := request:get-parameter('uri', '')

let $sourceUriSharp := concat($sourceUri, '#')

let $mei := doc($sourceUri)/root()

let $surfaceId := request:get-parameter('pageId', '')

let $surface := $mei/id($surfaceId)

let $zones := $surface//mei:zone

(: all children of the source’s MEI file that in their @facs contain a token matching any xml:id of $zones,
e.g., mei:measure elements pointing to an mei:zone that is a child of $surface
:)
let $measureLike :=
for $id in $zones[@type = 'measure' or @type = 'staff']/string(@xml:id)
let $ref := concat('#', $id)
Expand All @@ -194,9 +237,11 @@ let $measureLike :=
let $svgLike := $surface//svg:svg

let $targetLike := $zones | $measureLike | $svgLike

let $targetLikeIds := $zones/@xml:id | $measureLike/@xml:id | $svgLike/@id

let $annotations := local:findAnnotations($edition, $sourceUri, $targetLikeIds)

let $annots := local:getAnnotations($sourceUriSharp, $surfaceId, $annotations, $targetLike)

return
Expand Down
Loading