Skip to content

Commit

Permalink
Get parent title from archive/fond or collection to avoid missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
yngwi committed May 24, 2024
1 parent 12a1529 commit 0161a20
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
16 changes: 12 additions & 4 deletions my/XRX/src/mom/app/mom/platform-oai.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,18 @@ declare function platform-oai:transform($verb as xs:string, $document as node()*
let $data-provider := local:search-for-data-provider($document//atom:entry/atom:id/text())
let $tokens := local:object-uri-tokens($document//atom:entry/atom:id/text())
let $fondid := $tokens[2]
(: Value is needed for the EDM transformation as the XSLT doesn’t seem to be able to query the values itself; only query if a collection charter and for EDM transformations :)
let $opt-collection-title := if(count($tokens) != 2 or $metadata-prefix != "edm") then
()
(: The name of the parent object for archival and collection charters to be used in EDM :)
let $parent-title := if ($metadata-prefix != "edm") then
()
else
if(count($tokens) = 3) then
(: Archival charter :)
let $archive := collection("/db/mom-data/metadata.archive.public")//atom:entry[./atom:id = "tag:www.monasterium.net,2011:/archive/" || $tokens[1]]//eag:autform
let $fond := collection("/db/mom-data/metadata.fond.public")//atom:entry[./atom:id = "tag:www.monasterium.net,2011:/fond/" || $tokens[1] || "/" || $tokens[2]]//ead:unittitle
return
concat(normalize-space($archive), '; ', normalize-space($fond))
else
(: Collection charter :)
let $collection-id := $tokens[1]
let $mycollection := collection("/db/mom-data/metadata.mycollection.public")//atom:entry[./atom:id = "tag:www.monasterium.net,2011:/mycollection/" || $collection-id]
let $coll-document := if (exists($mycollection)) then
Expand All @@ -57,7 +65,7 @@ declare function platform-oai:transform($verb as xs:string, $document as node()*
<param name="data-provider" value="{ $data-provider }"/>
<param name="base-image-url" value="{ $base-image-url}"/>
<param name="fond-id" value="{ $fondid }"/>
<param name="opt-collection-title" value="{ $opt-collection-title }"/>
<param name="parent-title" value="{ $parent-title }"/>
</parameters>
let $xsl-header-params := <parameters>
<param name="platform-id" value="{ $conf:project-name }"/>
Expand Down
18 changes: 6 additions & 12 deletions my/XRX/src/mom/app/mom/xsl/cei2edm.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<xsl:param name="data-provider" />
<xsl:param name="base-image-url" />
<xsl:param name="fond-id" />
<xsl:param name="opt-collection-title" />
<xsl:param name="parent-title" />
<xsl:template match="/">
<!-- Create the ids that the elements will use -->
<xsl:variable name="provided-cho-id" select="concat('#', .//atom:id)" />
Expand All @@ -28,7 +28,6 @@
<xsl:variable name="dc-edm-rights">
<xsl:variable name="license-target" select=".//cei:license/@target" />
<xsl:variable name="license-text" select="normalize-space(.//cei:license)" />
<xsl:variable name="archive" select="normalize-space(//cei:witnessOrig/cei:archIdentifier/cei:arch)" />
<xsl:choose>
<xsl:when test="$license-target and $license-text">
<edm:rights rdf:resource="{$license-target}" />
Expand All @@ -39,15 +38,7 @@
<xsl:otherwise>
<edm:rights rdf:resource="http://creativecommons.org/licenses/by-nc/4.0/" />
<dc:rights>
<xsl:choose>
<xsl:when test="$opt-collection-title">
<xsl:value-of select="$opt-collection-title" />
</xsl:when>
<xsl:when test="$archive">
<xsl:value-of select="$archive" />
</xsl:when>
<xsl:otherwise><xsl:text>Monasterium.net</xsl:text></xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$parent-title" />
</dc:rights>
</xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -130,8 +121,11 @@
<edm:type>TEXT</edm:type>
<!-- Identifier -->
<dc:identifier>
<xsl:value-of select=".//cei:idno" />
<xsl:value-of select=".//atom:id" />
</dc:identifier>
<dcterms:isPartOf>
<xsl:value-of select="$parent-title" />
</dcterms:isPartOf>
<!-- Description -->
<xsl:copy-of select="$dc-description" />
<!-- Language -->
Expand Down

0 comments on commit 0161a20

Please sign in to comment.