Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Edirom-Online
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Edirom
Edirom-Online
Commits
230c54e2
Commit
230c54e2
authored
1 year ago
by
Alexander Nguyen
Browse files
Options
Downloads
Patches
Plain Diff
#31
other relevant cases
parent
d2d76593
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
add/data/xql/getAnnotationMeta.xql
+3
-1
3 additions, 1 deletion
add/data/xql/getAnnotationMeta.xql
add/data/xqm/annotation.xqm
+8
-5
8 additions, 5 deletions
add/data/xqm/annotation.xqm
add/data/xqm/source.xqm
+11
-9
11 additions, 9 deletions
add/data/xqm/source.xqm
with
22 additions
and
15 deletions
add/data/xql/getAnnotationMeta.xql
+
3
−
1
View file @
230c54e2
...
...
@@ -28,6 +28,7 @@ xquery version "1.0";
import module namespace annotation="http://www.edirom.de/xquery/annotation" at "../xqm/annotation.xqm";
import module namespace source="http://www.edirom.de/xquery/source" at "../xqm/source.xqm";
import module namespace eutil="http://www.edirom.de/xquery/util" at "../xqm/util.xqm";
import module namespace functx = "http://www.functx.com" at "../xqm/functx-1.0-nodoc-2007-01.xq";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace mei="http://www.music-encoding.org/ns/mei";
...
...
@@ -43,6 +44,7 @@ let $docUri := substring-before($uri, '#')
let $internalId := substring-after($uri, '#')
let $doc := doc($docUri)
let $annot := $doc/id($internalId)
let $workID := substring-before(functx:substring-after-last($docUri, '/'), '.xml')
let $participants := annotation:getParticipants($annot)
...
...
@@ -61,7 +63,7 @@ let $sourcesLabel := if ($lang = 'de')
then (if(count($sources) gt 1)then('Quellen')else('Quelle'))
else(if(count($sources) gt 1)then('Sources')else('Source'))
let $sigla := source:getSiglaAsArray($participants)
let $sigla := source:getSiglaAsArray($participants
, $workID
)
let $siglaLabel := if ($lang = 'de')
then (if(count($sigla) gt 1)then('Siglen')else('Siglum'))
else(if(count($sigla) gt 1)then('Sources')else('Source'))
...
...
This diff is collapsed.
Click to expand it.
add/data/xqm/annotation.xqm
+
8
−
5
View file @
230c54e2
...
...
@@ -152,6 +152,7 @@ declare function annotation:toJSON($anno as element()) as xs:string {
let
$id
:=
$anno
/
@xml:id
let
$title
:=
normalize-space
(
local:getLocalizedTitle
(
$anno
))
let
$doc
:=
$anno
/
root
()
let
$workID
:=
$doc
/
mei:mei
/
@xml:id
/
string
()
let
$prio
:=
local:getLocalizedName
(
$doc
/
id
(
substring
(
$anno
/
mei:ptr
[
@type
=
'priority'
]
/
@target
,
2
)))
let
$pList
:=
distinct-values
(
tokenize
(
$anno
/
@plist
,
' '
))
let
$pList
:=
for
$p
in
$pList
...
...
@@ -162,11 +163,13 @@ declare function annotation:toJSON($anno as element()) as xs:string {
for
$p
in
distinct-values
(
$pList
)
let
$pDoc
:=
doc
(
$p
)
where
not
(
$pDoc
//
mei:availability
[
@type
=
'rwaOnline'
]
=
'hidden'
)
return
if
(
$pDoc
//
mei:sourceDesc
/
mei:source
/
mei:identifier
[
@type
=
'siglum'
])
then
$pDoc
//
mei:sourceDesc
/
mei:source
/
mei:identifier
[
@type
=
'siglum'
]
/
text
()
else
if
(
exists
(
$pDoc
//
mei:manifestation
//
mei:relation
[
@rel
=
'isEmbodimentOf'
]))
then
string-join
(
$pDoc
//
mei:manifestation
//
mei:relation
[
@rel
=
'isEmbodimentOf'
]
/
@label
,
','
)
else
(
'ERROR'
)
return
if
(
$pDoc
//
mei:sourceDesc
/
mei:source
/
mei:identifier
[
@type
eq
'siglum'
])
then
(
$pDoc
//
mei:sourceDesc
/
mei:source
/
mei:identifier
[
@type
eq
'siglum'
][
1
]
//
text
())
else
if
(
exists
(
$pDoc
//
mei:manifestation
//
mei:relation
[
@target
=
$workID
]))
then
if
(
$pDoc
//
mei:manifestation
//
mei:relation
[
@target
=
$workID
]
/
@label
=
'null'
)
then
()
else
$pDoc
//
mei:manifestation
//
mei:relation
[
@target
=
$workID
]
/
@label
/
string
()
else
(
$workID
)
,
', '
)
let
$catURIs
:=
tokenize
(
replace
(
$anno
/
mei:ptr
[
@type
=
'categories'
]
/
@target
,
'#'
,
''
)
,
' '
)
let
$cats
:=
string-join
(
...
...
This diff is collapsed.
Click to expand it.
add/data/xqm/source.xqm
+
11
−
9
View file @
230c54e2
...
...
@@ -78,9 +78,9 @@ declare function source:getLabel($source as xs:string) as xs:string {
: @param $sources The URIs of the Sources' documents to process
: @return The sigla
:)
declare
function
source:getSigla
(
$sources
as
xs:string
*
)
as
xs:string
{
declare
function
source:getSigla
(
$sources
as
xs:string
*
,
$workID
as
xs:string
)
as
xs:string
{
string-join
(
source:getSiglaAsArray
(
$sources
)
source:getSiglaAsArray
(
$sources
,
$workID
)
,
', '
)
};
...
...
@@ -90,11 +90,11 @@ declare function source:getSigla($sources as xs:string*) as xs:string {
: @param $sources The URIs of the Sources' documents to process
: @return The sigla
:)
declare
function
source:getSiglaAsArray
(
$sources
as
xs:string
*
)
as
xs:string
*
{
declare
function
source:getSiglaAsArray
(
$sources
as
xs:string
*
,
$workID
as
xs:string
)
as
xs:string
*
{
for
$source
in
$sources
where
not
(
doc
(
$source
)
//
mei:availability
[
@type
=
'rwaOnline'
]
=
'hidden'
)
return
source:getSiglum
(
$source
)
source:getSiglum
(
$source
,
$workID
)
};
(::)
(:~
...
...
@@ -103,12 +103,14 @@ declare function source:getSiglaAsArray($sources as xs:string*) as xs:string* {
: @param $source The URIs of the Source's document to process
: @return The siglum
:)
declare
function
source:getSiglum
(
$source
as
xs:string
)
as
xs:string
?
{
declare
function
source:getSiglum
(
$source
as
xs:string
,
$workID
as
xs:string
)
as
xs:string
?
{
let
$sourceDoc
:=
doc
(
$source
)
return
if
(
$sourceDoc
//
mei:source
/
mei:identifier
[
@type
eq
'siglum'
])
then
(
$sourceDoc
//
mei:source
/
mei:identifier
[
@type
eq
'siglum'
][
1
]
//
text
())
else
if
(
exists
(
$sourceDoc
//
mei:manifestation
//
mei:relation
[
@rel
=
'isEmbodimentOf'
]))
then
string-join
(
$sourceDoc
//
mei:manifestation
//
mei:relation
[
@rel
=
'isEmbodimentOf'
]
/
@label
,
','
)
else
(
'ERROR'
)
then
(
$sourceDoc
//
mei:source
/
mei:identifier
[
@type
eq
'siglum'
][
1
]
//
text
())
else
if
(
exists
(
$sourceDoc
//
mei:manifestation
//
mei:relation
[
@target
=
$workID
]))
then
if
(
$sourceDoc
//
mei:manifestation
//
mei:relation
[
@target
=
$workID
]
/
@label
=
'null'
)
then
()
else
$sourceDoc
//
mei:manifestation
//
mei:relation
[
@target
=
$workID
]
/
@label
/
string
()
else
(
'ERROR'
)
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment