From 1602ea379fcb340ebe27c5c78f11da5ba6ab5485 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 24 Jun 2024 08:13:00 +0200 Subject: [PATCH 1/6] add dedicated function `bibl:edited-by#2` --- modules/bibl.xqm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/bibl.xqm b/modules/bibl.xqm index b77028fdd..7909aadd0 100644 --- a/modules/bibl.xqm +++ b/modules/bibl.xqm @@ -91,7 +91,7 @@ declare function bibl:printBookCitation($biblStruct as element(tei:biblStruct), else if(exists($editors)) then ($editors, concat(' (', lang:get-language-string('ed', $lang), '), ')) else (), $title, - if(exists($editors) and exists($authors)) then (concat(', ', lang:get-language-string('edBy', $lang), ' '), $editors) else (), + if(exists($editors) and exists($authors)) then bibl:edited-by($biblStruct, $lang), if(exists($series)) then (' (', $series, '), ') else ', ', if($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'vol']) then bibl:print-single-biblScope-unit((), $biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'vol'], $lang) || ', ' else (), $pubPlaceNYear, @@ -139,7 +139,6 @@ declare function bibl:printArticleCitation($biblStruct as element(tei:biblStruct :) declare function bibl:printIncollectionCitation($biblStruct as element(tei:biblStruct), $wrapperElement as element(), $lang as xs:string) as element() { let $authors := bibl:printCitationAuthors($biblStruct/tei:analytic/tei:author, $lang) - let $editor := bibl:printCitationAuthors($biblStruct/tei:monogr/tei:editor, $lang) let $articleTitle := bibl:printTitles($biblStruct/tei:analytic/tei:title, ()) let $bookTitle := {bibl:printTitles($biblStruct/tei:monogr/tei:title, $biblStruct/tei:monogr/tei:edition)/node()} let $pubPlaceNYear := bibl:printpubPlaceNYear($biblStruct/tei:monogr/tei:imprint, $biblStruct/tei:monogr/tei:edition, $lang) @@ -152,7 +151,7 @@ declare function bibl:printIncollectionCitation($biblStruct as element(tei:biblS $articleTitle, ', in: ', $bookTitle, - if(exists($editor)) then (concat(', ', lang:get-language-string('edBy', $lang), ' '), $editor) else (), + bibl:edited-by($biblStruct, $lang), if(exists($series)) then (' ',({$series})) else (), if(exists($pubPlaceNYear)) then (', ', $pubPlaceNYear) else(), if($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'pp']) then concat(', ', lang:get-language-string('pp', $lang), ' ', bibl:normalize-hyphen($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'pp'])) else (), @@ -374,3 +373,14 @@ declare %private function bibl:idno($idnos as element(tei:idno)*) as element(xht case 'WeGA' return , Volltext verfügbar unter {$idno => data()} default return , online unter {$idno => data(), ' '} }; + +(:~ + : + :) +declare %private function bibl:edited-by($biblStruct as element(tei:biblStruct), $lang as xs:string) as item()* { + let $editors := bibl:printCitationAuthors($biblStruct/tei:monogr/tei:editor, $lang) + return + if(exists($editors)) + then (concat(', ', lang:get-language-string('edBy', $lang), ' '), $editors) + else () +}; From 374bdbe24e4a83a361e510d438508c35d882a322 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 24 Jun 2024 08:34:37 +0200 Subject: [PATCH 2/6] update tests --- testing/xqsuite/biblio-tests.xqm | 3 +++ testing/xqsuite/run-unit-tests.xql | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/testing/xqsuite/biblio-tests.xqm b/testing/xqsuite/biblio-tests.xqm index 12d79c1d2..7ec26853a 100644 --- a/testing/xqsuite/biblio-tests.xqm +++ b/testing/xqsuite/biblio-tests.xqm @@ -71,6 +71,8 @@ declare declare %test:args('A111057') %test:assertXPath("$result//xhtml:span[@class='idno_DOI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='placeNYear']") + %test:args('A112745') %test:assertEquals("Ferdinand Zehentreiter, „Dem folgt deutscher Gesang“. Adornos Physiognomik des Freischütz (Caprices, Bd. 1), Hofheim am Taunus 2019") + %test:args('A110124') %test:assertEquals("Joachim Veit, Eveline Bartlitz und Dagmar Beck (Hg.), „...die Hoffnung muß das Beste thun.“ Die Emser Briefe Carl Maria von Webers an seine Frau, München 2003") function bt:test-printBookCitation($a as xs:string) as element() { let $doc := crud:doc($a) return @@ -110,6 +112,7 @@ declare declare %test:args('A113081') %test:assertXPath("$result//xhtml:span[@class='idno_DOI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='collectionTitle'] and $result//xhtml:span[@class='editor'] and $result//xhtml:span[@class='placeNYear'] and $result//xhtml:span[@class='seriesTitle']") + %test:args('A110779') %test:assertEquals("Joachim Veit, Zum Formproblem in den Kopfsätzen der Sinfonien Carl Maria von Webers, in: Festschrift Arno Forchert zum 60. Gebrutstag, hg. von Gerhard Allroggen und Detlef Altenburg, Kassel 1986, S. 184–199") function bt:test-printIncollectionCitation($a as xs:string) as element() { let $doc := crud:doc($a) return diff --git a/testing/xqsuite/run-unit-tests.xql b/testing/xqsuite/run-unit-tests.xql index 2fb9af612..1b61104b7 100644 --- a/testing/xqsuite/run-unit-tests.xql +++ b/testing/xqsuite/run-unit-tests.xql @@ -3,11 +3,7 @@ xquery version "3.1"; (: the following line must be added to each of the modules that include unit tests :) import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -(:import module namespace wust="http://xquery.weber-gesamtausgabe.de/modules/wega-util-shared-tests" at "wega-util-shared-tests.xqm"; -import module namespace dt="http://xquery.weber-gesamtausgabe.de/modules/date-tests" at "date-tests.xqm"; -import module namespace st="http://xquery.weber-gesamtausgabe.de/modules/str-tests" at "str-tests.xqm"; -import module namespace mt="http://xquery.weber-gesamtausgabe.de/modules/math-tests" at "math-tests.xqm"; -import module namespace geot="http://xquery.weber-gesamtausgabe.de/modules/geo-tests" at "geo-tests.xqm";:) +import module namespace bt="http://weber-gesamtausgabe.de/xqsuite/biblio-tests" at "biblio-tests.xqm"; (: the test:suite() function will run all the test-annotated functions in the module whose namespace URI you provide :) test:suite(( From 7825a338e531fbb7fa5145b014b760ae22b15771 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 24 Jun 2024 14:23:59 +0200 Subject: [PATCH 3/6] fix conditional --- modules/bibl.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bibl.xqm b/modules/bibl.xqm index 7909aadd0..36349a2ab 100644 --- a/modules/bibl.xqm +++ b/modules/bibl.xqm @@ -91,7 +91,7 @@ declare function bibl:printBookCitation($biblStruct as element(tei:biblStruct), else if(exists($editors)) then ($editors, concat(' (', lang:get-language-string('ed', $lang), '), ')) else (), $title, - if(exists($editors) and exists($authors)) then bibl:edited-by($biblStruct, $lang), + if(exists($editors) and exists($authors)) then bibl:edited-by($biblStruct, $lang) else (), if(exists($series)) then (' (', $series, '), ') else ', ', if($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'vol']) then bibl:print-single-biblScope-unit((), $biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'vol'], $lang) || ', ' else (), $pubPlaceNYear, From 32a395ec758026b437652a79a511a3be6ca5ce8b Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 24 Jun 2024 22:59:54 +0200 Subject: [PATCH 4/6] process editors as "dies." #470 if identical with authors --- catalogues/dictionary_de.xml | 2 ++ catalogues/dictionary_en.xml | 2 ++ modules/bibl.xqm | 22 ++++++++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/catalogues/dictionary_de.xml b/catalogues/dictionary_de.xml index 7d752b748..32acd7f99 100644 --- a/catalogues/dictionary_de.xml +++ b/catalogues/dictionary_de.xml @@ -459,6 +459,8 @@ Bl. Heft hg. von + dems. + ders. Hg. Details verfügbar Zu dieser Filtereinstellung wurden keine Einträge gefunden. diff --git a/catalogues/dictionary_en.xml b/catalogues/dictionary_en.xml index 1a9fbf8a0..9018e2f35 100644 --- a/catalogues/dictionary_en.xml +++ b/catalogues/dictionary_en.xml @@ -429,6 +429,8 @@ f issue ed. by + idem + idem Ed. more details No entries found for this filter setting. diff --git a/modules/bibl.xqm b/modules/bibl.xqm index 36349a2ab..b732d55c1 100644 --- a/modules/bibl.xqm +++ b/modules/bibl.xqm @@ -7,6 +7,7 @@ declare namespace mei="http://www.music-encoding.org/ns/mei"; declare namespace xhtml="http://www.w3.org/1999/xhtml"; declare namespace exist="http://exist.sourceforge.net/NS/exist"; import module namespace config="http://xquery.weber-gesamtausgabe.de/modules/config" at "config.xqm"; +import module namespace crud="http://xquery.weber-gesamtausgabe.de/modules/crud" at "crud.xqm"; import module namespace lang="http://xquery.weber-gesamtausgabe.de/modules/lang" at "lang.xqm"; import module namespace str="http://xquery.weber-gesamtausgabe.de/modules/str" at "xmldb:exist:///db/apps/WeGA-WebApp-lib/xquery/str.xqm"; import module namespace wega-util="http://xquery.weber-gesamtausgabe.de/modules/wega-util" at "wega-util.xqm"; @@ -375,12 +376,29 @@ declare %private function bibl:idno($idnos as element(tei:idno)*) as element(xht }; (:~ - : + : Process editors + : Helper function for bibl:printBookCitation and bibl:printIncollectionCitation :) declare %private function bibl:edited-by($biblStruct as element(tei:biblStruct), $lang as xs:string) as item()* { let $editors := bibl:printCitationAuthors($biblStruct/tei:monogr/tei:editor, $lang) + let $ders as xs:boolean := + count($biblStruct/tei:monogr/tei:editor) eq 1 and + count($biblStruct/tei:analytic/tei:author) eq 1 and + exists($biblStruct/tei:monogr/tei:editor/@key) and + exists($biblStruct/tei:analytic/tei:author/@key) and + $biblStruct/tei:monogr/tei:editor/@key = $biblStruct/tei:analytic/tei:author/@key + let $sex := + if($ders) + then crud:doc($biblStruct/tei:monogr/tei:editor/@key)//tei:sex + else () return if(exists($editors)) - then (concat(', ', lang:get-language-string('edBy', $lang), ' '), $editors) + then + if($sex = 'm') + then (concat(', ', lang:get-language-string('edBy', $lang), ' '), {lang:get-language-string('edByIdemM', $lang)}) + else + if($sex = 'f') + then (concat(', ', lang:get-language-string('edBy', $lang), ' '), {lang:get-language-string('edByIdemF', $lang)}) + else (concat(', ', lang:get-language-string('edBy', $lang), ' '), $editors) else () }; From 935f9e9e9b61999d0a50e4b7820a0a1a03f5d95d Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 24 Jun 2024 23:00:09 +0200 Subject: [PATCH 5/6] update tests #470 --- testing/xqsuite/biblio-tests.xqm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/xqsuite/biblio-tests.xqm b/testing/xqsuite/biblio-tests.xqm index 7ec26853a..fb76b956c 100644 --- a/testing/xqsuite/biblio-tests.xqm +++ b/testing/xqsuite/biblio-tests.xqm @@ -73,6 +73,7 @@ declare %test:args('A111057') %test:assertXPath("$result//xhtml:span[@class='idno_DOI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='placeNYear']") %test:args('A112745') %test:assertEquals("Ferdinand Zehentreiter, „Dem folgt deutscher Gesang“. Adornos Physiognomik des Freischütz (Caprices, Bd. 1), Hofheim am Taunus 2019") %test:args('A110124') %test:assertEquals("Joachim Veit, Eveline Bartlitz und Dagmar Beck (Hg.), „...die Hoffnung muß das Beste thun.“ Die Emser Briefe Carl Maria von Webers an seine Frau, München 2003") + %test:args('A111337') %test:assertEquals("August Apel, Die Freischützsage und ihre Wandlungen. Vom Gespensterbuch zur Oper, Neuausgabe der Freischützsage aus dem Gespensterbuch, hg. von Otto Daube, Detmold 1941") function bt:test-printBookCitation($a as xs:string) as element() { let $doc := crud:doc($a) return @@ -81,6 +82,7 @@ declare declare %test:args('A112915') %test:assertXPath("$result//xhtml:span[@class='idno_URI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='journalTitle']") + %test:args('A112660') %test:assertEquals("Kurt Mey, Richard Wagners Webertrauermarsch, in: Die Musik. Illustrierte Halbmonatsschrift, Jg. 6 (1907), Heft 12, S. 331–336") function bt:test-printArticleCitation($a as xs:string) as element() { let $doc := crud:doc($a) return @@ -113,6 +115,8 @@ declare declare %test:args('A113081') %test:assertXPath("$result//xhtml:span[@class='idno_DOI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='collectionTitle'] and $result//xhtml:span[@class='editor'] and $result//xhtml:span[@class='placeNYear'] and $result//xhtml:span[@class='seriesTitle']") %test:args('A110779') %test:assertEquals("Joachim Veit, Zum Formproblem in den Kopfsätzen der Sinfonien Carl Maria von Webers, in: Festschrift Arno Forchert zum 60. Gebrutstag, hg. von Gerhard Allroggen und Detlef Altenburg, Kassel 1986, S. 184–199") + %test:args('A112665') %test:assertEquals("Romy Donath, Deutsche Nationaloper oder romantische Gruselstory?, in: 200 Jahre Freischütz. Festschrift des Carl-Maria-von-Weber-Museums, hg. von ders., Niederjahna 2021, S. 7–29") + %test:args('A111266') %test:assertEquals("Günter Haußwald, Zur Dramaturgie des „Freischütz“, in: Carl Maria von Weber. Eine Gedenkschrift, hg. von dems., Dresden 1951, S. 139–151") function bt:test-printIncollectionCitation($a as xs:string) as element() { let $doc := crud:doc($a) return From 3ee236889ad4aacd6921e93287ae23683bb08bd4 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 1 Jul 2024 10:45:21 +0200 Subject: [PATCH 6/6] process multiple editors as "dens." #470 --- catalogues/dictionary_de.xml | 1 + catalogues/dictionary_en.xml | 1 + modules/bibl.xqm | 21 +++++++++++++++------ testing/xqsuite/biblio-tests.xqm | 12 ++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/catalogues/dictionary_de.xml b/catalogues/dictionary_de.xml index 32acd7f99..925ad2f8a 100644 --- a/catalogues/dictionary_de.xml +++ b/catalogues/dictionary_de.xml @@ -461,6 +461,7 @@ hg. von dems. ders. + dens. Hg. Details verfügbar Zu dieser Filtereinstellung wurden keine Einträge gefunden. diff --git a/catalogues/dictionary_en.xml b/catalogues/dictionary_en.xml index 9018e2f35..3576ee320 100644 --- a/catalogues/dictionary_en.xml +++ b/catalogues/dictionary_en.xml @@ -431,6 +431,7 @@ ed. by idem idem + idem Ed. more details No entries found for this filter setting. diff --git a/modules/bibl.xqm b/modules/bibl.xqm index b732d55c1..e025924ad 100644 --- a/modules/bibl.xqm +++ b/modules/bibl.xqm @@ -387,6 +387,12 @@ declare %private function bibl:edited-by($biblStruct as element(tei:biblStruct), exists($biblStruct/tei:monogr/tei:editor/@key) and exists($biblStruct/tei:analytic/tei:author/@key) and $biblStruct/tei:monogr/tei:editor/@key = $biblStruct/tei:analytic/tei:author/@key + let $dens as xs:boolean := + count($biblStruct/tei:monogr/tei:editor) gt 1 and + count($biblStruct/tei:analytic/tei:author) gt 1 and + count($biblStruct/tei:analytic/tei:author) eq count($biblStruct/tei:monogr/tei:editor) and + (every $i in ($biblStruct/tei:analytic/tei:author | $biblStruct/tei:monogr/tei:editor) satisfies $i/@key) and + (every $i in $biblStruct/tei:analytic/tei:author/@key satisfies $i = $biblStruct/tei:monogr/tei:editor/@key) let $sex := if($ders) then crud:doc($biblStruct/tei:monogr/tei:editor/@key)//tei:sex @@ -394,11 +400,14 @@ declare %private function bibl:edited-by($biblStruct as element(tei:biblStruct), return if(exists($editors)) then - if($sex = 'm') - then (concat(', ', lang:get-language-string('edBy', $lang), ' '), {lang:get-language-string('edByIdemM', $lang)}) - else - if($sex = 'f') - then (concat(', ', lang:get-language-string('edBy', $lang), ' '), {lang:get-language-string('edByIdemF', $lang)}) - else (concat(', ', lang:get-language-string('edBy', $lang), ' '), $editors) + if($dens) + then (concat(', ', lang:get-language-string('edBy', $lang), ' '), {lang:get-language-string('edByIdemPl', $lang)}) + else + if($sex = 'm') + then (concat(', ', lang:get-language-string('edBy', $lang), ' '), {lang:get-language-string('edByIdemM', $lang)}) + else + if($sex = 'f') + then (concat(', ', lang:get-language-string('edBy', $lang), ' '), {lang:get-language-string('edByIdemF', $lang)}) + else (concat(', ', lang:get-language-string('edBy', $lang), ' '), $editors) else () }; diff --git a/testing/xqsuite/biblio-tests.xqm b/testing/xqsuite/biblio-tests.xqm index fb76b956c..f2fb03836 100644 --- a/testing/xqsuite/biblio-tests.xqm +++ b/testing/xqsuite/biblio-tests.xqm @@ -122,3 +122,15 @@ declare return bibl:printIncollectionCitation($doc/tei:biblStruct, , 'de') }; + +declare + %test:args('A110779') %test:assertEquals("Gerhard Allroggen", "Detlef Altenburg") + %test:args('A110211') %test:assertEquals("Bernhard R. Appel", "Joachim Veit") + %test:args('A112665') %test:assertEquals("ders.") + %test:args('A111266') %test:assertEquals("dems.") + %test:args('A110035') %test:assertEquals("dens.") + function bt:test-ed-by($a as xs:string) as element()* { + let $doc := crud:doc($a) + return + bibl:printIncollectionCitation($doc/tei:biblStruct, , 'de')//xhtml:span[@class='editor'] +};