Skip to content

Commit

Permalink
#550 Added class PublicationAccessTypeValue and uri related uri part
Browse files Browse the repository at this point in the history
  • Loading branch information
Possommi committed Jun 19, 2024
1 parent e1d1484 commit afcedb1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.uni_jena.thunibib.his.api.v1.cs.sys.values;

/**
* PublicationAccessType (Zugangsrecht nach KDSF)
*
* Path: <code>/api/v1/cs/sys/values/publicationAccessTypeValue</code>
* */
public class PublicationAccessTypeValue extends SysValue {
public static String getPath() {
return "cs/sys/values/publicationAccessTypeValue";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/**
* Usage:
* <br/><br/>
* <code>HISinOne:&lt;creatorType | documentType | genre | globalIdentifiers | language | researchAreaKdsf | subjectArea | state | thesisType | visibility&gt;:[value]</code>
* <code>HISinOne:&lt;creatorType | documentType | genre | globalIdentifiers | language | publicationAccessType | researchAreaKdsf | subjectArea | state | thesisType | visibility&gt;:[value]</code>
* */
public class HISinOneResolver implements URIResolver {

Expand All @@ -45,14 +45,24 @@ public class HISinOneResolver implements URIResolver {
private static Map<String, SysValue> DOCUMENT_TYPE_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> GENRE_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> IDENTIFIER_TYPE_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> PUBLICATION_ACCESS_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> RESEARCH_AREA_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> STATE_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> SUBJECT_AREA_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> THESIS_TYPE_MAP = new HashMap<>();
private static Map<String, SysValue> VISIBILITY_TYPE_MAP = new HashMap<>();

public enum SUPPORTED_URI_PARTS {
creatorType, documentType, genre, globalIdentifiers, language, researchAreaKdsf, state, subjectArea, thesisType,
creatorType,
documentType,
genre,
globalIdentifiers,
language,
publicationAccessType,
researchAreaKdsf,
state,
subjectArea,
thesisType,
visibility
}

Expand All @@ -75,6 +85,8 @@ public Source resolve(String href, String base) throws TransformerException {
new JDOMSource(new Element("int").setText(String.valueOf(resolveDocumentType(value).getHisKeyId())));
case genre -> new JDOMSource(new Element("int").setText(String.valueOf(resolveGenre(value).getId())));
case language -> new JDOMSource(new Element("int").setText(String.valueOf(resolveLanguage(value).getId())));
case publicationAccessType ->
new JDOMSource(new Element("int").setText(String.valueOf(resolvePublicationAccessType(value).getId())));
case researchAreaKdsf ->
new JDOMSource(new Element("int").setText(String.valueOf(resolveResearchAreaKdsf(value).getId())));
case state -> new JDOMSource(new Element("int").setText(String.valueOf(resolveState(value).getId())));
Expand All @@ -87,6 +99,14 @@ public Source resolve(String href, String base) throws TransformerException {
};
}

private SysValue resolvePublicationAccessType(String accessRights) {
if (PUBLICATION_ACCESS_TYPE_MAP.containsKey(accessRights)) {
return PUBLICATION_ACCESS_TYPE_MAP.get(accessRights);
}

return SysValue.EmptySysValue;
}

/**
* Resolves the his-id by the given research area id.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

<xsl:template match="mods:mods">
<xsl:copy>
<!-- PublicationAccessType (Zugangsrecht nach KDSF) -->
<xsl:call-template name="publicationAccessType"/>

<!-- Map identifiers like doi, urn, ... -->
<xsl:call-template name="globalIdentifiers"/>

<!-- Set research areas as of KDSF -->
Expand All @@ -46,6 +50,18 @@
</xsl:copy>
</xsl:template>

<xsl:template name="publicationAccessType">
<xsl:if test="mods:classification[fn:contains(@valueURI, 'accessrights#')]">

<xsl:variable name="categId" select="fn:substring-after(mods:classification[fn:contains(@valueURI, 'accessrights#')]/@valueURI, '#')"/>
<xsl:variable name="publication-access-type-his-id" select="fn:document(concat('hisinone:publicationAccessType:', $categId))"/>

<mods:classification authorityURI="{$ThUniBib.HISinOne.BaseURL}" valueURI="{$ThUniBib.HISinOne.BaseURL}{$ThUniBib.HISinOne.BaseURL.API.Path}cs/sys/values/publicationAccessTypeValue">
<xsl:value-of select="$publication-access-type-his-id"/>
</mods:classification>
</xsl:if>
</xsl:template>

<xsl:template name="globalIdentifiers">
<xsl:for-each select="mods:identifier[contains('doi scopus url', @type)]">
<xsl:variable name="global-identifier-type-id" select="fn:document(concat('hisinone:globalIdentifiers:', @type))"/>
Expand Down

0 comments on commit afcedb1

Please sign in to comment.