Skip to content

Commit

Permalink
Merge pull request #345 from Edirom/update2MEI4
Browse files Browse the repository at this point in the history
Update Webapp to cope with recent schema changes
  • Loading branch information
peterstadler committed Mar 26, 2020
2 parents eeaf337 + 517d58d commit c107611
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ RUN ant -lib /usr/share/java
#########################
FROM stadlerpeter/existdb:3.3.0

ADD --chown=wegajetty https://weber-gesamtausgabe.de/downloads/WeGA-data-testing-22662.xar ${EXIST_HOME}/autodeploy/
ADD --chown=wegajetty https://weber-gesamtausgabe.de/downloads/WeGA-data-testing-22662_updatedWorks.xar ${EXIST_HOME}/autodeploy/
COPY --chown=wegajetty --from=builder /opt/wega-lib/build/*.xar ${EXIST_HOME}/autodeploy/
COPY --chown=wegajetty --from=builder /opt/wega/build/*.xar ${EXIST_HOME}/autodeploy/

HEALTHCHECK --interval=20s --timeout=5s \
CMD curl -iLfsS http://localhost:8080${EXIST_CONTEXT_PATH}/apps/WeGA-WebApp | grep home \
&& curl -iLfsS http://localhost:8080${EXIST_CONTEXT_PATH}/apps/WeGA-WebApp | (! grep "HILFE DER GÖTTLICHEN") \
|| exit 1
|| exit 1
14 changes: 7 additions & 7 deletions modules/app.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ declare
let $anonymusID := config:get-option('anonymusID')
let $authorElem :=
(: NB: there might be multiple anonymous authors :)
if ($authorID = $anonymusID) then (query:get-author-element($model?doc)[(count(@key | @dbkey) = 0) or ((@key, @dbkey) = $anonymusID)])[1]
if ($authorID = $anonymusID) then (query:get-author-element($model?doc)[(count(@key | @codedval) = 0) or ((@key, @codedval) = $anonymusID)])[1]
(: NB: there might be multiple occurences of the same person as e.g. composer and lyricist :)
else (query:get-author-element($model?doc)[(@key, @dbkey) = $authorID])[1]
else (query:get-author-element($model?doc)[(@key, @codedval) = $authorID])[1]
let $href :=
if ($authorID = $anonymusID) then ()
else app:createUrlForDoc(core:doc($authorID), $lang)
Expand Down Expand Up @@ -804,7 +804,7 @@ declare
map {
'ids' : $model?doc//mei:altId[not(@type='gnd')],
'relators' : query:relators($model?doc),
'workType' : $model?doc//mei:term/data(@classcode),
'workType' : $model?doc//mei:term/data(@class),
'titles' : $print-titles($model?doc, false()),
'altTitles' : $print-titles($model?doc, true())
}
Expand Down Expand Up @@ -1779,7 +1779,7 @@ declare
'docType' : config:get-doctype-by-id($model('result-page-entry')/root()/*/data(@xml:id)),
'relators' : query:relators($model('result-page-entry')),
'biblioType' : $model('result-page-entry')/tei:biblStruct/data(@type),
'workType' : $model('result-page-entry')//mei:term/data(@classcode),
'workType' : $model('result-page-entry')//mei:term/data(@class),
'newsDate' : date:printDate($model('result-page-entry')//tei:date[parent::tei:publicationStmt], $lang, lang:get-language-string#3, $config:default-date-picture-string)
}
};
Expand Down Expand Up @@ -1889,8 +1889,8 @@ declare
%templates:wrap
%templates:default("lang", "en")
function app:preview-creation($node as node(), $model as map(*), $lang as xs:string) as xs:string? {
if($model('doc')/mei:source/mei:pubStmt) then string-join($model('doc')/mei:source/mei:pubStmt/*, ', ')
else if($model('doc')/mei:source/mei:creation) then str:normalize-space($model('doc')/mei:source/mei:creation)
if($model('doc')/mei:manifestation/mei:pubStmt) then string-join($model('doc')/mei:manifestation/mei:pubStmt/*, ', ')
else if($model('doc')/mei:manifestation/mei:creation) then str:normalize-space($model('doc')/mei:manifestation/mei:creation)
else ()
};

Expand All @@ -1899,7 +1899,7 @@ declare
%templates:default("lang", "en")
%templates:default("popover", "false")
function app:preview-relator-name($node as node(), $model as map(*), $lang as xs:string, $popover as xs:string) as element() {
let $key := $model('relator')/@dbkey | $model('relator')/@key
let $key := $model('relator')/@codedval | $model('relator')/@key
let $myPopover :=
if($popover castable as xs:boolean) then xs:boolean($popover)
else false()
Expand Down
2 changes: 1 addition & 1 deletion modules/gl.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ declare
'docURL' : app:createUrlForDoc($doc, $lang),
'relators' : $doc//mei:fileDesc/mei:titleStmt/mei:respStmt/mei:persName[@role],
'biblioType' : $doc/tei:biblStruct/data(@type),
'workType' : $doc//mei:term/data(@classcode),
'workType' : $doc//mei:term/data(@class),
'codeSample' : $codeSample?codeSample,
'icon-src' : '$resources/img/icons/icon_' || $docType || '.png'
}
Expand Down
4 changes: 2 additions & 2 deletions modules/img.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ declare %private function img:get-generic-portrait($model as map(*), $lang as xs
let $sex :=
if(config:is-org($model('docID'))) then 'org'
else if(config:is-place($model('docID'))) then 'place'
else if($model('doc')//mei:term/data(@classcode) = 'http://d-nb.info/standards/elementset/gnd#MusicalWork') then 'musicalWork'
else if(config:is-work($model('docID')) and not($model('doc')//mei:term/data(@classcode) = 'http://d-nb.info/standards/elementset/gnd#MusicalWork')) then 'otherWork'
else if($model('doc')//mei:term/data(@class) = 'http://d-nb.info/standards/elementset/gnd#MusicalWork') then 'musicalWork'
else if(config:is-work($model('docID')) and not($model('doc')//mei:term/data(@class) = 'http://d-nb.info/standards/elementset/gnd#MusicalWork')) then 'otherWork'
else $model('doc')//tei:sex/text()
return
map {
Expand Down
10 changes: 5 additions & 5 deletions modules/query.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ declare function query:title($key as xs:string) as xs:string {
:)
declare function query:get-authorID($doc as document-node()?) as xs:string* {
let $author-element := query:get-author-element($doc)
let $id := $author-element/@key | $author-element/@dbkey
let $id := $author-element/@key | $author-element/@codedval
return
if(exists($doc) and count($id) gt 0) then $id ! string(.)
else if(exists($doc)) then config:get-option('anonymusID')
Expand Down Expand Up @@ -304,10 +304,10 @@ declare function query:get-facets($collection as node()*, $facet as xs:string) a
case 'placeOfAddressee' return $collection//tei:settlement[parent::tei:correspAction/@type='received']/@key
case 'journals' return $collection//tei:title[@level='j'][not(@type='sub')][ancestor::tei:sourceDesc]
case 'places' return $collection//tei:settlement[ancestor::tei:text or ancestor::tei:ab]/@key
case 'dedicatees' return $collection//mei:persName[@role='dte']/@dbkey
case 'lyricists' return $collection//mei:persName[@role='lyr']/@dbkey
case 'librettists' return $collection//mei:persName[@role='lbt']/@dbkey
case 'composers' return $collection//mei:persName[@role='cmp']/@dbkey
case 'dedicatees' return $collection//mei:persName[@role='dte']/@codedval
case 'lyricists' return $collection//mei:persName[@role='lyr']/@codedval
case 'librettists' return $collection//mei:persName[@role='lbt']/@codedval
case 'composers' return $collection//mei:persName[@role='cmp']/@codedval
case 'docSource' return $collection/tei:person/@source
case 'occupations' return $collection//tei:occupation
case 'residences' return $collection//tei:settlement[parent::tei:residence]/@key
Expand Down
20 changes: 10 additions & 10 deletions modules/wdt.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ declare function wdt:works($item as item()*) as map(*) {
$item/root()[mei:mei][descendant::mei:meiHead]
},
'filter-by-person' : function($personID as xs:string) as document-node()* {
$item/root()/descendant::mei:persName[@dbkey = $personID][@role=('cmp', 'lbt', 'lyr', 'aut', 'trl')][ancestor::mei:fileDesc]/root()
$item/root()/descendant::mei:persName[@codedval = $personID][@role=('cmp', 'lbt', 'lyr', 'aut', 'trl')][ancestor::mei:fileDesc]/root()
},
'filter-by-date' : function($dateFrom as xs:date?, $dateTo as xs:date?) as document-node()* {
if(empty(($dateFrom, $dateTo))) then $item/root()
Expand Down Expand Up @@ -743,11 +743,11 @@ declare function wdt:sources($item as item()*) as map(*) {
else false()
},
'filter' : function() as document-node()* {
$item/root()[mei:source][descendant::mei:titleStmt][not(descendant::mei:annot[@type='no-ordinary-record'])]
$item/root()[mei:manifestation][descendant::mei:titleStmt][not(descendant::mei:annot[@type='no-ordinary-record'])]
},
'filter-by-person' : function($personID as xs:string) as document-node()* {
if(config:is-person($personID) or config:is-org($personID)) then $item/root()/descendant::mei:persName[@dbkey = $personID][@role=('cmp', 'lbt', 'lyr', 'aut', 'trl')][ancestor::mei:titleStmt]/root()
else if(config:is-work($personID)) then $item/root()/descendant::mei:identifier[.=$personID][@type = 'WeGA']/root()
if(config:is-person($personID) or config:is-org($personID)) then $item/root()/descendant::mei:persName[@codedval = $personID][@role=('cmp', 'lbt', 'lyr', 'aut', 'trl')][ancestor::mei:titleStmt]/root()
else if(config:is-work($personID)) then $item/root()/descendant::mei:identifier[.=$personID][@type = 'WeGA']/root() | $item/root()/descendant::mei:relation[@target=concat('wega:', $personID)]/root()
else ()
},
'filter-by-date' : function($dateFrom as xs:date?, $dateTo as xs:date?) as document-node()* {
Expand All @@ -765,10 +765,10 @@ declare function wdt:sources($item as item()*) as map(*) {
'title' : function($serialization as xs:string) as item()? {
let $source :=
typeswitch($item)
case xs:string return core:doc($item)/mei:source
case xdt:untypedAtomic return core:doc($item)/mei:source
case document-node() return $item/mei:source
default return $item/root()/mei:source
case xs:string return core:doc($item)/mei:manifestation
case xdt:untypedAtomic return core:doc($item)/mei:manifestation
case document-node() return $item/mei:manifestation
default return $item/root()/mei:manifestation
let $title-element := ($source/mei:titleStmt/mei:title[not(@type)])[1]
return
switch($serialization)
Expand Down Expand Up @@ -1019,7 +1019,7 @@ declare function wdt:backlinks($item as item()*) as map(*) {
core:data-collection('news')//tei:author[@key = $personID][ancestor::tei:fileDesc]/root() |
core:data-collection('thematicCommentaries')//tei:author[@key = $personID][ancestor::tei:fileDesc]/root() |
core:data-collection('documents')//tei:author[@key = $personID][ancestor::tei:fileDesc]/root() |
core:data-collection('works')//mei:persName[@dbkey = $personID][@role=('cmp', 'lbt', 'lyr', 'aut', 'trl')][ancestor::mei:fileDesc]/root()
core:data-collection('works')//mei:persName[@codedval = $personID][@role=('cmp', 'lbt', 'lyr', 'aut', 'trl')][ancestor::mei:fileDesc]/root()
let $docsMentioned :=
core:data-collection('letters')//tei:*[contains(@key,$personID)][not(ancestor::tei:publicationStmt)]/root() |
core:data-collection('diaries')//tei:*[contains(@key,$personID)]/root() |
Expand All @@ -1032,7 +1032,7 @@ declare function wdt:backlinks($item as item()*) as map(*) {
core:data-collection('thematicCommentaries')//tei:*[contains(@key,$personID)][not(ancestor::tei:publicationStmt)]/root() |
core:data-collection('documents')//tei:*[contains(@key,$personID)][not(ancestor::tei:publicationStmt)]/root() |
core:data-collection('var')//tei:*[contains(@key,$personID)][not(ancestor::tei:publicationStmt)]/root() |
core:data-collection('works')//mei:*[contains(@dbkey,$personID)][not(ancestor::mei:revisionDesc)]/root() |
core:data-collection('works')//mei:*[contains(@codedval,$personID)][not(ancestor::mei:revisionDesc)]/root() |
(: <ref target="wega:A002068"/> :)
core:data-collection('letters')//tei:*[contains(@target, 'wega:' || $personID)]/root() |
core:data-collection('diaries')//tei:*[contains(@target,'wega:' || $personID)]/root() |
Expand Down
2 changes: 1 addition & 1 deletion modules/wega-util.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ declare function wega-util:check-if-update-necessary($currentDateTimeOfFile as x
: @return xs:string
:)
declare function wega-util:print-forename-surname-from-nameLike-element($nameLikeElement as element()?) as xs:string? {
let $id := $nameLikeElement/(@key, @dbkey)
let $id := $nameLikeElement/(@key, @codedval)
return
(: the most specific case first: a reg-name with leading forename, e.g. `<persName type="reg"><forename>Eugen</forename> <forename>Friedrich</forename>…` :)
if(($nameLikeElement/element()[1])[self::tei:forename]) then str:normalize-space($nameLikeElement)
Expand Down
4 changes: 2 additions & 2 deletions xsl/common_funcs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<xsl:choose>
<xsl:when test="wega:isWork($docID) and exists($doc)">
<xsl:choose>
<xsl:when test="$doc//mei:titleStmt/mei:respStmt/mei:persName[@role = 'cmp'][1]/@dbkey">
<xsl:value-of select="$doc//mei:titleStmt/mei:respStmt/mei:persName[@role = 'cmp'][1]/string(@dbkey)"/>
<xsl:when test="$doc//mei:titleStmt/mei:respStmt/mei:persName[@role = 'cmp'][1]/@codedval">
<xsl:value-of select="$doc//mei:titleStmt/mei:respStmt/mei:persName[@role = 'cmp'][1]/string(@codedval)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="wega:getOption('anonymusID')"/>
Expand Down
18 changes: 9 additions & 9 deletions xsl/common_link.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<!-- ********************************************* -->
<xsl:template match="tei:persName | tei:author | tei:orgName | mei:persName | tei:workName | tei:settlement | mei:geogName" mode="#all">
<xsl:choose>
<xsl:when test="@key or @dbkey">
<xsl:when test="@key or @codedval">
<xsl:call-template name="createLink"/>
</xsl:when>
<xsl:otherwise>
Expand Down Expand Up @@ -108,19 +108,19 @@
</xsl:attribute>
</xsl:template>

<xsl:template match="@key[not(matches(., '\s'))] | @dbkey[not(matches(., '\s'))]">
<xsl:template match="@key[not(matches(., '\s'))] | @codedval[not(matches(., '\s'))]">
<xsl:attribute name="href" select="wega:createLinkToDoc(., $lang)"/>
</xsl:template>

<xsl:template name="createLink">
<xsl:choose>
<xsl:when test="exists((@key, @dbkey, @target)) and not(descendant::*[local-name(.) = $linkableElements])">
<xsl:when test="exists((@key, @codedval, @target)) and not(descendant::*[local-name(.) = $linkableElements])">
<xsl:element name="a">
<xsl:attribute name="class">
<xsl:value-of select="wega:preview-class(.)"/>
</xsl:attribute>
<!--<xsl:attribute name="href" select="wega:createLinkToDoc((@key, @dbkey), $lang)"/>-->
<xsl:apply-templates select="@key | @dbkey | @target"/>
<!--<xsl:attribute name="href" select="wega:createLinkToDoc((@key, @codedval), $lang)"/>-->
<xsl:apply-templates select="@key | @codedval | @target"/>
<xsl:apply-templates mode="#current"/>
</xsl:element>
</xsl:when>
Expand All @@ -136,7 +136,7 @@
<xsl:apply-templates select="@xml:id"/>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="exists((@key, @dbkey, @target))">
<xsl:when test="exists((@key, @codedval, @target))">
<xsl:value-of select="wega:preview-class(.)"/>
</xsl:when>
<xsl:otherwise>
Expand All @@ -147,9 +147,9 @@
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="exists((@key, @dbkey, @target))">
<xsl:if test="exists((@key, @codedval, @target))">
<xsl:variable name="urls" as="xs:string+">
<xsl:for-each select="descendant-or-self::*/@key | descendant-or-self::*/@dbkey | descendant-or-self::*/@target[starts-with(., 'wega:')]">
<xsl:for-each select="descendant-or-self::*/@key | descendant-or-self::*/@codedval | descendant-or-self::*/@target[starts-with(., 'wega:')]">
<xsl:for-each select="tokenize(normalize-space(.), '\s+')">
<xsl:choose>
<xsl:when test="starts-with(.,'wega:')">
Expand All @@ -174,7 +174,7 @@
<xsl:function name="wega:preview-class" as="xs:string">
<xsl:param name="myNode" as="element()"/>
<xsl:variable name="keys" select="
for $key in tokenize(($myNode/@key, $myNode/@dbkey, $myNode/@target/replace(., 'wega:', '')), '\s+')
for $key in tokenize(($myNode/@key, $myNode/@codedval, $myNode/@target/replace(., 'wega:', '')), '\s+')
return substring($key, 1, 7)
" as="xs:string+"/>
<xsl:variable name="class" as="xs:string">
Expand Down

0 comments on commit c107611

Please sign in to comment.