Skip to content

Commit

Permalink
OA-336 Verbesserung der Autorenrollen im Index (#52)
Browse files Browse the repository at this point in the history
* OA-336 Autorenrollenfelder multivalued

* OA-336 Verbesserte Namensgenerierung

---------

Co-authored-by: Paul Borchert <[email protected]>
  • Loading branch information
kkrebs and PaulBorchert authored Aug 15, 2024
1 parent cda570b commit a164a7c
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,60 +121,76 @@
"multiValued":true
}
},
{
"replace-field": {
"name": "mods.mainAuthor",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false,
"multiValued":true
}
},
{
"add-field": {
"name": "mods.mainAuthor.affiliation",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false
"stored": false,
"multiValued":true
}
},
{
"add-field": {
"name": "mods.coAuthor",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false
"stored": false,
"multiValued":true
}
},
{
"add-field": {
"name": "mods.coAuthor.affiliation",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false
"stored": false,
"multiValued":true
}
},
{
"add-field": {
"name": "mods.correspondingAuthor",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false
"stored": false,
"multiValued":true
}
},
{
"add-field": {
"name": "mods.correspondingAuthor.affiliation",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false
"stored": false,
"multiValued":true
}
},
{
"add-field": {
"name": "mods.lastAuthor",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false
"stored": false,
"multiValued":true
}
},
{
"add-field": {
"name": "mods.lastAuthor.affiliation",
"type": "mods.collatedGERMAN",
"indexed": true,
"stored": false
"stored": false,
"multiValued":true
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,8 @@
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xlink="http://www.w3.org/1999/xlink">

<xsl:template match="mods:mods/mods:*[string-length(@altRepGroup) &gt; 0]">
<xsl:variable name="altRepGroup" select="@altRepGroup"/>
<xsl:choose>
<xsl:when test="count(../*[@altRepGroup = $altRepGroup]) = 1">
<xsl:copy >
<xsl:apply-templates select="node()|@*[local-name() != 'altRepGroup']"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy >
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
<xsl:template match="classification[@classid='mir_access']">

</xsl:template>

<!-- copy from copynodes.xsl -->
Expand Down
75 changes: 57 additions & 18 deletions src/main/resources/xsl/openagrar-solr.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,50 @@
<xsl:value-of select="." />
</field>
</xsl:for-each>
<xsl:for-each
select="mods:name[mods:role/mods:roleTerm[@authority='marcrelator' and (@type='text' and text()='author') or (@type='code' and text()='aut')]]">
<xsl:for-each select="mods:name[mods:role/mods:roleTerm[@authority='marcrelator' and (@type='text' and text()='author') or (@type='code' and text()='aut')]]">
<xsl:choose>
<xsl:when test="not(../mods:name/mods:role/mods:roleTerm[contains(@valueURI, '#')])">
<xsl:variable name="autrole">
<xsl:choose>
<xsl:when test="position()=1">
<xsl:text>mainAuthor</xsl:text>
</xsl:when>
</xsl:when>
<xsl:when test="position()=last()">
<xsl:text>lastAuthor</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>noRole</xsl:text>
<xsl:text>noRole</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:variable>
<xsl:if test="$autrole != 'noRole'">
<field name="{concat('mods.', $autrole)}">
<xsl:for-each select="mods:displayForm | mods:namePart | text()">
<xsl:value-of select="concat(' ',mcrxsl:normalizeUnicode(.))" />
</xsl:for-each>
</field>
<field name="{concat('mods.', $autrole, '.affiliation')}">
<xsl:value-of select="mods:affiliation" />
<xsl:choose>
<xsl:when test="mods:displayForm">
<xsl:value-of select="mcrxsl:normalizeUnicode(mods:displayForm)" />
</xsl:when>
<xsl:when test="mods:namePart">
<xsl:for-each select="mods:namePart">
<xsl:choose>
<xsl:when test="@type='family'">
<xsl:value-of select="concat(mcrxsl:normalizeUnicode(.), ',')" />
</xsl:when>
<xsl:when test="@type='given'">
<xsl:value-of select="concat(' ',mcrxsl:normalizeUnicode(.))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(mcrxsl:normalizeUnicode(.), ' ')" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</field>
<xsl:if test="mods:affiliation">
<field name="{concat('mods.', $autrole, '.affiliation')}">
<xsl:value-of select="mods:affiliation" />
</field>
</xsl:if>
</xsl:if>
</xsl:when>
<xsl:otherwise>
Expand All @@ -94,17 +112,38 @@
</xsl:choose>
</xsl:variable>
<field name="{concat('mods.', $autrole)}">
<xsl:for-each select="../../mods:displayForm | ../../mods:namePart | ../../text()">
<xsl:value-of select="concat(' ',mcrxsl:normalizeUnicode(.))" />
</xsl:for-each>
</field>
<field name="{concat('mods.', $autrole, '.affiliation')}">
<xsl:value-of select="../../mods:affiliation" />
<xsl:choose>
<xsl:when test="../../mods:displayForm">
<xsl:value-of select="mcrxsl:normalizeUnicode(../../mods:displayForm)" />
</xsl:when>
<xsl:when test="../../mods:namePart[@type='family'] and ../../mods:namePart[@type='given']">
<xsl:for-each select="../../mods:namePart[@type='family']">
<xsl:value-of select="concat(mcrxsl:normalizeUnicode(.), ' ')" />
<xsl:if test="position() != last()">
<xsl:value-of select="' '" />
</xsl:if>
</xsl:for-each>
<xsl:value-of select="','" />
<xsl:for-each select="../../mods:namePart[@type='given']">
<xsl:value-of select="concat(' ',mcrxsl:normalizeUnicode(.))" />
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="../../mods:namePart[@type='family' or @type='given']">
<xsl:value-of select="concat(mcrxsl:normalizeUnicode(.), ' ')" />
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</field>
<xsl:if test="../../mods:affiliation">
<field name="{concat('mods.', $autrole, '.affiliation')}">
<xsl:value-of select="../../mods:affiliation" />
</field>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="mods:genre[contains(@authorityURI,'classifications/genres')]">
<xsl:variable name="genre" select="."/>
<xsl:if test="not(../mods:relatedItem[@type='host'])">
Expand Down

0 comments on commit a164a7c

Please sign in to comment.