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
fontane-notizbuecher
SADE
Commits
cfe00a35
Commit
cfe00a35
authored
Oct 24, 2018
by
MRodz
Committed by
mrodzis
Feb 05, 2019
Browse files
Generic approach for info retrieval from indices
parent
657177c4
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
modules/fontane/teisimpleprint/index-info.xqm
View file @
cfe00a35
...
...
@@ -57,7 +57,7 @@ declare variable $index-info:psn-map :=
"regular-name" : string-join($entry/tei:persName[not(@type)], ", "),
"birth" : string($entry/tei:birth),
"death" : string($entry/tei:death),
"occup
u
ation"
: string($entry/tei:occupation),
"occupation" : string($entry/tei:occupation),
"occs-in-nbs" : ""
}
));
...
...
@@ -74,55 +74,18 @@ declare variable $index-info:wrk-map :=
));
(: generic functions :)
declare function index-info:get-full-ref($ref as xs:string,
$index-type as xs:string) as xs:string {
let $main-entry := local:get-main-entry($ref, $index-type)
return map:get($main-entry, "regular-name")
declare function index-info:get-info-about($index-type as xs:string,
$term as xs:string, $info as xs:string) as xs:string* {
local:get-main-entry($term, $index-type) => map:get($info)
};
declare function index-info:get-occs($ref as xs:string,
$index-type as xs:string) as xs:string* {
let $main-entry := local:get-main-entry($ref, $index-type)
return map:get($main-entry, "occs-in-nbs")
};
(: index specific functions :)
(: events :)
declare function index-info:get-event-place($ref as xs:string) as xs:string {
let $main-entry := local:get-main-entry($ref, "eve")
return map:get($main-entry, "place")
};
(: places :)
declare function index-info:get-place-sub-ref($ref as xs:string) as xs:string* {
let $main-entry := local:get-main-entry($ref, "plc")
return map:get($main-entry, "subref-of")
};
(: persons :)
declare function index-info:get-birth-date($ref as xs:string) as xs:string* {
local:get-main-entry($ref, "psn") => map:get("birth")
};
declare function index-info:get-death-date($ref as xs:string) as xs:string* {
let $main-entry := local:get-main-entry($ref, "psn")
return map:get($main-entry, "death")
};
declare function index-info:get-occupation($ref as xs:string) as xs:string* {
let $main-entry := local:get-main-entry($ref, "psn")
return map:get($main-entry, "occupation")
};
(: auxiliary functions :)
declare function index-info:get-full-maps() {
$index-info:wrk-map
};
declare function local:get-main-entry($ref as xs:string,
$index-type as xs:string) as map()* {
let $key := substring-after($ref, ":")
...
...
modules/fontane/teisimpleprint/tei2teisimple.xqm
View file @
cfe00a35
...
...
@@ -882,19 +882,19 @@ $index-type as xs:string) as attribute()* {
for $iii in 1 to $no-of-refs
let $ref := $refs[$iii]
return
(attribute {"
full-ref
-" || $iii} {index-info:get-
full-ref($ref, $index-type
)},
attribute {"occs-" || $iii} {index-info:get-
occs($ref, $index-type
)},
(attribute {"
regular-name
-" || $iii} {index-info:get-
info-about($index-type, $ref, "regular-name"
)},
attribute {"occs-" || $iii} {index-info:get-
info-about($index-type, $ref, "occs-in-nbs"
)},
switch ($index-type)
case "eve" return
attribute {"place-" || $iii} {index-info:get-
event-place($ref
)}
attribute {"place-" || $iii} {index-info:get-
info-about($index-type, $ref, "place"
)}
case "org" return
()
case "plc" return
attribute {"subref-of-" || $iii} {index-info:get-
place-
sub
-
ref
($ref
)}
attribute {"subref-of-" || $iii} {index-info:get-
info-about($index-type, $ref, "
subref
-of"
)}
case "psn" return
(attribute {"birth-" || $iii} {index-info:get-
birth-date($ref
)},
attribute {"death-" || $iii} {index-info:get-
death-date($ref
)},
attribute {"occupation-" || $iii} {index-info:get-occupation
($ref
)})
(attribute {"birth-" || $iii} {index-info:get-
info-about($index-type, $ref, "birth"
)},
attribute {"death-" || $iii} {index-info:get-
info-about($index-type, $ref, "death"
)},
attribute {"occupation-" || $iii} {index-info:get-
info-about($index-type, $ref, "
occupation
"
)})
case "wrk" return
()
default return
...
...
resources/xml/tei-simple-pre.xml
View file @
cfe00a35
This diff is collapsed.
Click to expand it.
resources/xml/tei-simple-tmp.xml
View file @
cfe00a35
This diff is collapsed.
Click to expand it.
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