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
e4cc5aa6
Commit
e4cc5aa6
authored
Oct 24, 2018
by
MRodz
Committed by
mrodzis
Feb 05, 2019
Browse files
Add new draft for indices
parent
2775f5cd
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
modules/fontane/teisimpleprint/tei2teisimple.xqm
View file @
e4cc5aa6
...
...
@@ -641,7 +641,7 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
return
element tei:rs {
$node/@*,
fontaneSimple:make-index-
attribute
s($node, $index-type),
fontaneSimple:make-index-
info
s($node, $index-type),
fontaneSimple:transform($node/node())
}
...
...
@@ -874,29 +874,46 @@ as xs:boolean {
or contains($prev/@next, $node/following::*/@xml:id)
};
declare function fontaneSimple:make-index-
attribute
s($node as element(tei:rs),
$index-type as xs:string) as
attribute
()* {
declare function fontaneSimple:make-index-
info
s($node as element(tei:rs),
$index-type as xs:string) as
element
()* {
let $refs := tokenize($node/@ref, " ")
let $no-of-refs := count($refs)
return
for $iii in 1 to $no-of-refs
let $ref := $refs[$iii]
return
(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-info-about($index-type, $ref, "place")}
case "eve" return ()
case "org" return
()
case "plc" return
attribute {"subref-of-" || $iii} {index-info:get-info-about($index-type, $ref, "subref-of")}
case "plc" return ()
case "psn" return
(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")})
element tei:person {
element tei:name {text{index-info:get-info-about($index-type, $ref, "regular-name")}},
element tei:birth {text{index-info:get-info-about($index-type, $ref, "birth")}},
element tei:death {text{index-info:get-info-about($index-type, $ref, "death")}},
element tei:occupation {text{index-info:get-info-about($index-type, $ref, "occupation")}}
}
case "wrk" return
()
default return
())
()
(: (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-info-about($index-type, $ref, "place")}:)
(: case "org" return :)
(: ():)
(: case "plc" return :)
(: attribute {"subref-of-" || $iii} {index-info:get-info-about($index-type, $ref, "subref-of")}:)
(: case "psn" return :)
(: (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 :)
(: ()):)
};
\ No newline at end of file
modules/fontane/teisimpleprint/tests/index-info-test.xql
View file @
e4cc5aa6
...
...
@@ -29,15 +29,6 @@ declare
};
(: 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:events-full-reference-xml($node as element(*)) {
fontaneSimple:transform($node)
};
declare
%test:name("Events: Places")
%test:args("eve:Thesenanschlag", "eve", "place")
...
...
@@ -122,6 +113,14 @@ declare
index-info:get-info-about($index-type, $term, $info)
};
declare
%test:name("Persons: Transformation result")
%test:args("<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""/>")
%test:assertEquals("<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><person xmlns=""http://www.tei-c.org/ns/1.0""><name xmlns=""http://www.tei-c.org/ns/1.0"">Luther, Martin</name><birth xmlns=""http://www.tei-c.org/ns/1.0"">1483</birth><death xmlns=""http://www.tei-c.org/ns/1.0"">1546</death><occupation xmlns=""http://www.tei-c.org/ns/1.0"">dt. Reformator</occupation></person></rs>")
function index-info-test:events-full-reference-xml($node as element(*)) {
fontaneSimple:transform($node)
};
(: WORKS :)
declare
...
...
modules/fontane/teisimpleprint/tests/teisimple-test.xql
View file @
e4cc5aa6
...
...
@@ -1311,13 +1311,13 @@ declare
declare
%test:name("Persons")
%test:args("<line xmlns=""http://www.tei-c.org/ns/1.0""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>Luther</rs></line>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane"" script="""" medium=""""/>Luther</rs>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><
person xmlns=""http://www.tei-c.org/ns/1.0""><name xmlns=""http://www.tei-c.org/ns/1.0"">Luther, Martin</name><birth xmlns=""http://www.tei-c.org/ns/1.0"">1483</birth><death xmlns=""http://www.tei-c.org/ns/1.0"">1546</death><occupation xmlns=""http://www.tei-c.org/ns/1.0"">dt. Reformator</occupation></person><
handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane"" script="""" medium=""""/>Luther</rs>")
%test:args("<line xmlns=""http://www.tei-c.org/ns/1.0""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luebke""><choice xmlns=""http://www.tei-c.org/ns/1.0""><abbr xmlns=""http://www.tei-c.org/ns/1.0""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>W.</abbr><expan xmlns=""http://www.tei-c.org/ns/1.0"">Wilhelm</expan></choice> Lübke</rs></line>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luebke""><choice xmlns=""http://www.tei-c.org/ns/1.0""><abbr xmlns=""http://www.tei-c.org/ns/1.0""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane"" script="""" medium=""""/>W.</abbr><expan xmlns=""http://www.tei-c.org/ns/1.0"">Wilhelm</expan></choice> Lübke</rs>")
%test:args("<line xmlns=""http://www.tei-c.org/ns/1.0""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""indirect"" ref=""psn:Luther""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>Luther</rs></line>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""indirect"" ref=""psn:Luther""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane"" script="""" medium=""""/>Luther</rs>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""indirect"" ref=""psn:Luther""><
person xmlns=""http://www.tei-c.org/ns/1.0""><name xmlns=""http://www.tei-c.org/ns/1.0"">Luther, Martin</name><birth xmlns=""http://www.tei-c.org/ns/1.0"">1483</birth><death xmlns=""http://www.tei-c.org/ns/1.0"">1546</death><occupation xmlns=""http://www.tei-c.org/ns/1.0"">dt. Reformator</occupation></person><
handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane"" script="""" medium=""""/>Luther</rs>")
(: this is a case where actually this tei:rs and its corresponding @next should be merged into one element.for convenience we do that in the second processing step :)
%test:args("<line xmlns=""http://www.tei-c.org/ns/1.0""><rs xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C07_12r_m"" next=""#C07_12r_n"" type=""indirect"" ref=""psn:Balthasar psn:Wilhelm_I_Graf""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>ſeinen</rs></line>")
...
...
@@ -1400,4 +1400,4 @@ declare
function teisimple-test:genetical-information($node as element(*)) {
fontaneSimple:transform($node)
};
};
\ No newline at end of file
resources/xml/tei-simple-pre.xml
View file @
e4cc5aa6
This diff is collapsed.
Click to expand it.
resources/xml/tei-simple-tmp.xml
View file @
e4cc5aa6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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