MENDELU/Update OAI-PMH to fix CitacePRO composing#1311
Closed
milanmajchrak wants to merge 2 commits into
Closed
Conversation
…fier> for Citace PRO DSpace 9 nemá pôvodné dc.identifier.citation z DSpace 6, takže oai_dc crosswalk teraz citáciu zostavuje priamo z metadát (autor; rok; názov; periodikum; ročník(číslo), strany; ISSN/ISBN; URL). Bez tejto úpravy Citace PRO dostávalo iba okliesťovaný text 'Myslivost. 2024, vol. 72, č. 11, s. 0.' a generovalo nesprávny iframe.
…itace PRO format) Citace PRO parser ocakava format z DSpace 6: 'PRIEZVISKO, Krstne; PRIEZVISKO2, Krstne2; YEAR. Title. ...' Bez uppercase priezvisk a so separatorom '. ' pred rokom Citace PRO citaciu nerozozna.
There was a problem hiding this comment.
Pull request overview
This PR updates the OAI-PMH oai_dc crosswalk to emit a composed bibliographic citation (targeted at Citace PRO) as an additional dc:identifier value.
Changes:
- Replaces the previous “formatted identifier” logic with a new citation composer driven by authors/title/year and type-dependent formatting.
- Adds DOI/URI selection logic and includes ISSN/ISBN when present.
- Introduces uppercase surname formatting (via XSLT
translate) for author strings.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+120
to
+127
| <xsl:variable name="citType"> | ||
| <xsl:choose> | ||
| <xsl:when test="doc:metadata/doc:element[@name='dc']/doc:element[@name='type']/doc:element[@name='none']/doc:field[@name='value']"> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='type']/doc:element[@name='none']/doc:field[@name='value'][1]" /> | ||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='type']/doc:element/doc:field[@name='value'][1]" /> | ||
| </xsl:otherwise> |
Comment on lines
+130
to
+163
| <xsl:variable name="hasAuthors" select="boolean(doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='author']/doc:element/doc:field[@name='value'])" /> | ||
| <xsl:variable name="hasTitle" select="boolean(doc:metadata/doc:element[@name='dc']/doc:element[@name='title']/doc:element/doc:field[@name='value'])" /> | ||
| <xsl:variable name="hasYear" select="boolean(doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='issued']/doc:element/doc:field[@name='value'])" /> | ||
| <!-- Lower→upper mapy pre uppercase priezvisk vrátane českej diakritiky (XSLT 1.0 translate funguje na úrovni Unicode codepointov) --> | ||
| <xsl:variable name="lc">abcdefghijklmnopqrstuvwxyzáäčďéěíĺľňóôöřšťúůýžàâãåæçèêëìîïðñòõøùûüýÿ</xsl:variable> | ||
| <xsl:variable name="uc">ABCDEFGHIJKLMNOPQRSTUVWXYZÁÄČĎÉĚÍĹĽŇÓÔÖŘŠŤÚŮÝŽÀÂÃÅÆÇÈÊËÌÎÏÐÑÒÕØÙÛÜÝŸ</xsl:variable> | ||
| <xsl:if test="$hasAuthors or $hasTitle or $hasYear"> | ||
| <dc:identifier> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='relation']/doc:element[@name='ispartof']/doc:element/doc:field[@name='value']" /> | ||
| <xsl:text>. </xsl:text> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='issued']/doc:element/doc:field[@name='value']" /> | ||
| <xsl:text>, vol. </xsl:text> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='local']/doc:element[@name='volume']/doc:element/doc:field[@name='value']" /> | ||
| <xsl:text>, č. </xsl:text> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='local']/doc:element[@name='number']/doc:element/doc:field[@name='value']" /> | ||
| <!-- We do not have any information about pages, so it is `s. 0` by default --> | ||
| <xsl:text>, s. 0.</xsl:text> | ||
| <!-- AUTHORS: "PRIEZVISKO, Krstné; PRIEZVISKO2, Krstné2; " (priezvisko VEĽKÝM PÍSMOM, ako v DSpace 6 pre Citace PRO) --> | ||
| <xsl:if test="$hasAuthors"> | ||
| <xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='author']/doc:element/doc:field[@name='value']"> | ||
| <xsl:choose> | ||
| <xsl:when test="contains(., ',')"> | ||
| <xsl:value-of select="translate(substring-before(., ','), $lc, $uc)" /> | ||
| <xsl:text>,</xsl:text> | ||
| <xsl:value-of select="substring-after(., ',')" /> | ||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:value-of select="translate(., $lc, $uc)" /> | ||
| </xsl:otherwise> | ||
| </xsl:choose> | ||
| <xsl:text>; </xsl:text> | ||
| </xsl:for-each> | ||
| </xsl:if> | ||
| <!-- YEAR: "2024. " --> | ||
| <xsl:if test="$hasYear"> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='issued']/doc:element/doc:field[@name='value']" /> | ||
| <xsl:text>. </xsl:text> | ||
| </xsl:if> | ||
| <!-- TITLE: "Title. " --> | ||
| <xsl:if test="$hasTitle"> | ||
| <xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='title']/doc:element/doc:field[@name='value'][1]" /> | ||
| <xsl:text>. </xsl:text> | ||
| </xsl:if> |
Comment on lines
+140
to
+152
| <xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='author']/doc:element/doc:field[@name='value']"> | ||
| <xsl:choose> | ||
| <xsl:when test="contains(., ',')"> | ||
| <xsl:value-of select="translate(substring-before(., ','), $lc, $uc)" /> | ||
| <xsl:text>,</xsl:text> | ||
| <xsl:value-of select="substring-after(., ',')" /> | ||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:value-of select="translate(., $lc, $uc)" /> | ||
| </xsl:otherwise> | ||
| </xsl:choose> | ||
| <xsl:text>; </xsl:text> | ||
| </xsl:for-each> |
Comment on lines
+172
to
+176
| <xsl:when test="$citType = 'article' or $citType = 'conferenceObject' or contains($citType, 'J_')"> | ||
| <xsl:variable name="vol" select="doc:metadata/doc:element[@name='local']/doc:element[@name='volume']/doc:element/doc:field[@name='value']" /> | ||
| <xsl:variable name="num" select="doc:metadata/doc:element[@name='local']/doc:element[@name='number']/doc:element/doc:field[@name='value']" /> | ||
| <xsl:variable name="pages" select="doc:metadata/doc:element[@name='dc']/doc:element[@name='format']/doc:element[@name='none']/doc:field[@name='value'] | doc:metadata/doc:element[@name='dc']/doc:element[@name='format']/doc:element[not(@name='none')]/doc:field[@name='value']" /> | ||
| <xsl:if test="$vol != ''"> |
| <!-- Book / bookPart / workingPaper / other: publisher, pages --> | ||
| <xsl:otherwise> | ||
| <xsl:variable name="publisher" select="doc:metadata/doc:element[@name='dc']/doc:element[@name='publisher']/doc:element/doc:field[@name='value']" /> | ||
| <xsl:variable name="pages2" select="doc:metadata/doc:element[@name='dc']/doc:element[@name='format']/doc:element/doc:field[@name='value']" /> |
Collaborator
Author
|
Continuing here: #1312 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem description
Analysis
(Write here, if there is needed describe some specific problem. Erase it, when it is not needed.)
Problems
(Write here, if some unexpected problems occur during solving issues. Erase it, when it is not needed.)
Manual Testing (if applicable)
Copilot review