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
2775f5cd
Commit
2775f5cd
authored
Oct 24, 2018
by
MRodz
Committed by
mrodzis
Feb 05, 2019
Browse files
Add more tests and improve code
parent
896fb7bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/fontane/teisimpleprint/index-info.xqm
View file @
2775f5cd
...
...
@@ -33,7 +33,7 @@ declare variable $index-info:org-map :=
return
map:entry(string($entry/@xml:id),
map {
"regular-name" : string-join($entry/tei:orgName, ", "),
"regular-name" : string-join($entry/tei:orgName
[not(@type)]
, ", "),
"occs-in-nbs" : ""
}
));
...
...
@@ -67,8 +67,7 @@ declare variable $index-info:wrk-map :=
return
map:entry(string($entry/@xml:id),
map {
"regular-name" : string-join($entry/tei:name, ", "),
"subref-of" : string-join($entry/parent::tei:item/tei:name, ", "),
"regular-name" : string-join($entry/tei:name[not(@type)], ", "),
"occs-in-nbs" : ""
}
));
...
...
modules/fontane/teisimpleprint/tests/index-info-test.xql
View file @
2775f5cd
...
...
@@ -27,13 +27,14 @@ declare
function index-info-test:places-full-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: EVENTS :)
declare
%test:name("Events: Full references - transformation result")
%test:args("<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""eve:Thesenanschlag""/>")
%test:assertEquals("<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""eve:Thesenanschlag"" regular-name-1=""Thesenanschlag"" place-1=""plc:Kirche_Wittenberg"" occs-1=""""/>")
function index-info-test:
place
s-full-reference-xml($node as element(*)) {
function index-info-test:
event
s-full-reference-xml($node as element(*)) {
fontaneSimple:transform($node)
};
...
...
@@ -42,10 +43,12 @@ declare
%test:args("eve:Thesenanschlag", "eve", "place")
%test:assertEquals("plc:Kirche_Wittenberg")
function index-info-test:
places-full-referen
ce($term as xs:string, $index-type as xs:string, $info as xs:string) {
function index-info-test:
events-pla
ce
s
($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: PLACES :)
declare
%test:name("Places: Full references")
%test:args("plc:Thueringen", "plc", "regular-name")
...
...
@@ -69,4 +72,63 @@ declare
function index-info-test:places-sub-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
\ No newline at end of file
};
(: ORGANIZATIONS :)
declare
%test:name("Organizations: Regular names")
%test:args("org:Garde_Grenadier_Regiment_IV", "org", "regular-name")
%test:assertEquals("Garde-Grenadier-Regiment Nr. 4")
function index-info-test:org-full-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: PERSONS :)
declare
%test:name("Persons: Regular names")
%test:args("psn:Papke", "psn", "regular-name")
%test:assertEquals("Papke, Herr")
function index-info-test:persons-full-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
declare
%test:name("Persons: Birth date")
%test:args("psn:Pape", "psn", "birth")
%test:assertEquals("1813")
function index-info-test:persons-birth($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
declare
%test:name("Persons: Death date")
%test:args("psn:Pape", "psn", "death")
%test:assertEquals("1895")
function index-info-test:persons-death($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
declare
%test:name("Persons: Occupation")
%test:args("psn:Pape", "psn", "occupation")
%test:assertEquals("preuß. General")
function index-info-test:persons-occupation($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: WORKS :)
declare
%test:name("Works: Regular names")
%test:args("wrk:Blechen_Gitarre", "wrk", "regular-name")
%test:assertEquals("Guitarrespielender Italiener")
function index-info-test:wrk-regular($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
\ No newline at end of file
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