From b99aea746ee7e6314e2ed5caefc4a5a9ed5204fe Mon Sep 17 00:00:00 2001 From: mrodzis Date: Tue, 9 Jul 2019 11:43:34 +0200 Subject: [PATCH] Add info about short titles to interformat --- modules/fontane/edited-text/index-info.xqm | 74 ++++++++++--------- modules/fontane/edited-text/tei2teisimple.xqm | 12 ++- 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/modules/fontane/edited-text/index-info.xqm b/modules/fontane/edited-text/index-info.xqm index fad19897..1bfb05c0 100644 --- a/modules/fontane/edited-text/index-info.xqm +++ b/modules/fontane/edited-text/index-info.xqm @@ -85,50 +85,54 @@ declare variable $index-info:wrk-map := else "false" + let $same-as := + if($periodical) then + $entry/ancestor::tei:list[@type = "periodicals"]//tei:item[not(@xml:id)][descendant::tei:ptr[@target = concat("#", $entry/@xml:id)]]/tei:name + else + () + let $same-as := + if(count($same-as) gt 1) then + string-join($same-as/string(), ", ") + else if(count($same-as) = 1) then + $same-as/string() + else + () + + let $general-map := + map { + "regular-name" : string-join($entry/tei:name[not(@type)], ", "), + "periodical" : $is-periodical, + "type" : "work" + } + return - if($creators and $periodical) then - map:entry(string($entry/@xml:id), - map { - "regular-name" : string-join($entry/tei:name[not(@type)], ", "), - "creator-ids" : string-join($creator-ids, " "), - "periodical" : $is-periodical, - "type" : "work" - } - ) - else if($creators) then - map:entry(string($entry/@xml:id), - map { - "regular-name" : string-join($entry/tei:name[not(@type)], ", "), - "creator-ids" : string-join($creator-ids, " "), - "periodical" : $is-periodical, - "type" : "work" - } - ) + if($creators and $periodical + or $creators) then + let $updated-map := map:put($general-map, "creator-ids", string-join($creator-ids, " ")) + + return + map:entry(string($entry/@xml:id), + if($same-as) then + map:put($updated-map, "same-as", $same-as) + else + $updated-map + ) + else if($created-by-fontane) then map:entry(string($entry/@xml:id), - map { - "regular-name" : string-join($entry/tei:name[not(@type)], ", "), - "creator" : "Fontane", - "periodical" : $is-periodical, - "type" : "work" - } + map:put($general-map, "creator", "Fontane") ) + else if($periodical) then map:entry(string($entry/@xml:id), - map { - "regular-name" : string-join($entry/tei:name[not(@type)], ", "), - "periodical" : $is-periodical, - "type" : "work" - } + if($same-as) then + map:put($general-map, "same-as", $same-as) + else + $general-map ) else map:entry(string($entry/@xml:id), - map { - "regular-name" : string-join($entry/tei:name[not(@type)], ", "), - "creator" : "Anonym/nicht ermittelt", - "periodical" : $is-periodical, - "type" : "work" - } + map:put($general-map, "creator", "Anonym/nicht ermittelt") ), (: (fictional) characters mentioned/depicted in works :) for $person in doc($config:data-root || "/data/253t3.xml")//tei:person diff --git a/modules/fontane/edited-text/tei2teisimple.xqm b/modules/fontane/edited-text/tei2teisimple.xqm index 8140e341..01060af7 100644 --- a/modules/fontane/edited-text/tei2teisimple.xqm +++ b/modules/fontane/edited-text/tei2teisimple.xqm @@ -365,7 +365,8 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a and $node/following::*[1][self::tei:hi]) then text{"@"} else - ()) + () + ) (: TODO if $node/@type = "highlighted" then make a hi[@type = "vertical-mark"] in the second stage of creating the @@ -775,7 +776,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a }, if(not($node//tei:abbr/text()[ends-with(., ":")] or ($node//text()[last()][ends-with(., "-")] or $node/following-sibling::*[1][self::tei:rs]) - or $node/following::text()[1][starts-with(., "-") or starts-with(., ".")] + or $node/following::text()[1][starts-with(., "-") or starts-with(., ".") or starts-with(., ")")] or $node/following::text()[1][matches(substring(., 1, 1), "[\w]")] or $node/following::*[1][self::tei:handShift]) (: or $node/following-sibling::node()[1][starts-with(., "-") or starts-with(., ".")]):) @@ -1209,11 +1210,18 @@ as xs:string) as element(tei:term)+ { $creator-id let $type := index-info:get-info-about($index-type, $ref, "periodical") + let $same-as := index-info:get-info-about($index-type, $ref, "same-as") let $no-of-ids := count($creators) return ( fontaneSimple:make-term("periodical", $type), + + if($same-as) then + fontaneSimple:make-term("same-as", $same-as) + else + (), + if($subref-ids) then for $iii in 1 to $no-of-ids return let $subref := index-info:get-info-about("psn", $creators[$iii], "regular-name") -- GitLab