- add iso19139 metadata schema for oai interface

- modified licence file
- npm updates
This commit is contained in:
Arno Kaimbacher 2022-11-16 13:30:56 +01:00
parent b754f02210
commit 15f3572ef9
14 changed files with 2283 additions and 624 deletions

View File

@ -20,3 +20,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
====
Files located in the node_modules directory, and certain utilities used to build or test the software in the test and dist directories,
are externally maintained libraries used by this software which have their own licenses;
we recommend you read them, as their terms may differ from the terms above.

905
assets/functions.xslt Normal file
View File

@ -0,0 +1,905 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://example.com/functions"
xmlns:gml="http://www.opgeris.net/gml/3.2"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
exclude-result-prefixes="#all"
expand-text="yes"
version="3.0">
<xsl:variable name="resourcetype">
<!-- <xsl:value-of select="//*[local-name() = 'resourceType']/@resourceTypeGeneral"/> -->
<xsl:text>Dataset</xsl:text>
</xsl:variable>
<xsl:variable name="MDScopecode">
<xsl:choose>
<xsl:when test="$resourcetype = 'Dataset'">dataset</xsl:when>
<xsl:when test="$resourcetype = 'Software'">software</xsl:when>
<xsl:when test="$resourcetype = 'Service'">service</xsl:when>
<xsl:when test="$resourcetype = 'Model'">model</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$resourcetype"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="MDScopelist">
<xsl:choose>
<xsl:when test="$resourcetype = 'Dataset' or $resourcetype = 'Software' or $resourcetype = 'Service' or $resourcetype = 'Model'">http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode</xsl:when>
<xsl:otherwise>http://datacite.org/schema/kernel-4</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- <xsl:function name="fn:FormatDate" as="xs:string">
<xsl:param name="DateTime" as="xs:string" />
<xsl:variable name="date">
<xsl:value-of select="substring-before($DateTime,'T')" />
</xsl:variable>
<xsl:if test="string-length($date) = 10">
<xsl:value-of select="$date"/>
</xsl:if>
</xsl:function> -->
<!--gmd:hierarchyLevel template-->
<xsl:template name="hierarchylevel">
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode>
<xsl:attribute name="codeList">
<xsl:value-of select="$MDScopelist"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="$MDScopecode"/>
</xsl:attribute>
<xsl:value-of select="$MDScopecode"/>
</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
</xsl:template>
<!-- gmd:contact template-->
<xsl:template name="metadatacontact">
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Research Data Repository</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Neulinggasse 38</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>Vienna</gco:CharacterString>
</gmd:city>
<gmd:administrativeArea>
<gco:CharacterString>Vienna</gco:CharacterString>
</gmd:administrativeArea>
<gmd:postalCode>
<gco:CharacterString>1030</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>AT</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>repository@geologie.ac.at</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<!-- only allow one online resource; choose the logo...-->
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://tethys.at</gmd:URL>
</gmd:linkage>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="information">information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
</xsl:template>
<!-- retrieves basic reference dates of the resource
Handles created date, publication (Available) date, and revision date-->
<!-- stower 2022, Created auf created geändert -->
<xsl:template name="resourcedates">
<xsl:if test="*[name() = 'CreatedAt']">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<!-- <xsl:variable name="theDate" select="normalize-space(*[name() = 'CreatedAt'])"/> -->
<xsl:variable name="theDate">
<xsl:value-of select="normalize-space(concat(
CreatedAt/@Year, '-',
format-number(number(CreatedAt/@Month),'00'), '-',
format-number(number(CreatedAt/@Day),'00'), 'T',
format-number(number(CreatedAt/@Hour),'00'), ':',
format-number(number(CreatedAt/@Minute),'00'), ':',
format-number(number(CreatedAt/@Second),'00'), 'Z'
))"/>
</xsl:variable>
<!-- ieda dataCite labels metadata update date in the date string to avoid ambiguity -->
<xsl:choose>
<xsl:when test="$theDate != ''">
<xsl:choose>
<xsl:when test="contains($theDate, 'T')">
<gco:DateTime>
<xsl:value-of select="$theDate"/>
</gco:DateTime>
</xsl:when>
<xsl:when test="contains($theDate, ' ')">
<gco:DateTime>
<xsl:value-of select="translate($theDate, ' ', 'T')"/>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:value-of select="$theDate"/>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- other write the output of missing -->
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="string('created date missing')"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:if>
<xsl:choose>
<!-- Take 'Available' (embargo) date first because that is YYYY-MM-DD -->
<xsl:when test="*[local-name() = 'EmbargoDate']">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="embargoDate" select="concat(
EmbargoDate/@Year, '-',
format-number(number(EmbargoDate/@Month),'00'), '-',
format-number(number(EmbargoDate/@Day),'00')
)" />
<gco:Date>
<xsl:value-of select="$embargoDate"/>
</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:when>
<xsl:when test="*[local-name() = 'ServerDatePublished']">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="publicationDate" select="concat(
ServerDatePublished/@Year, '-',
format-number(number(ServerDatePublished/@Month),'00'), '-',
format-number(number(ServerDatePublished/@Day),'00'), 'T',
format-number(number(ServerDatePublished/@Hour),'00'), ':',
format-number(number(ServerDatePublished/@Minute),'00'), ':',
format-number(number(ServerDatePublished/@Second),'00'), 'Z'
)" />
<gco:DateTime>
<xsl:value-of select="$publicationDate"/>
</gco:DateTime>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:when>
<xsl:otherwise>
<gmd:date gco:nilReason="missing"/>
</xsl:otherwise>
</xsl:choose>
<!-- the following test is designed to filter out update-metadata dates if these follow the convention
that metadata update date strings are prefixed with 'metadata'-->
<xsl:if test="@ServerDateModified">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="updateDate" select="normalize-space(@ServerDateModified)"/>
<!-- ieda dataCite labels metadata update date in the date string to avoid ambiguity -->
<xsl:choose>
<xsl:when test="$updateDate != ''">
<xsl:choose>
<xsl:when test="contains($updateDate, 'T')">
<gco:DateTime>
<xsl:value-of select="$updateDate"/>
</gco:DateTime>
</xsl:when>
<xsl:when test="contains($updateDate, ' ')">
<gco:DateTime>
<xsl:value-of select="translate($updateDate, ' ', 'T')"/>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:value-of select="$updateDate"/>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="string('missing')"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:if>
</xsl:template>
<xsl:template name="ci_responsibleparty">
<xsl:param name="individual"/>
<xsl:param name="httpuri"/>
<xsl:param name="personidtype"/>
<xsl:param name="organisation"/>
<xsl:param name="position"/>
<xsl:param name="role"/>
<xsl:param name="email"/>
<xsl:param name="datacite-creatorname"/>
<!-- <xsl:variable name="datacite-creatorname" select="//*[name() = 'creatorName'][@nameType = 'Organizational']"/> -->
<gmd:CI_ResponsibleParty>
<!-- stower 2022, wenn Autor oder Creator nur Organisation und Individual = missing -->
<xsl:if test="$individual != ''">
<xsl:choose>
<xsl:when test="$individual = 'missing'">
<gmd:individualName gco:nilReason="missing"/>
</xsl:when>
<xsl:otherwise>
<gmd:individualName>
<gco:CharacterString>
<xsl:value-of select="$individual"/>
</gco:CharacterString>
</gmd:individualName>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- stower 2022, wenn Autor oder Creator nur Organisation -->
<xsl:if test="$individual = 'missing' or ''">
<gmd:organisationName>
<gco:CharacterString>
<xsl:value-of select="$datacite-creatorname"/>
</gco:CharacterString>
</gmd:organisationName>
</xsl:if>
<xsl:if test="$organisation != ''">
<gmd:organisationName>
<gco:CharacterString>
<xsl:value-of select="$organisation"/>
</gco:CharacterString>
</gmd:organisationName>
</xsl:if>
<xsl:if test="$position != ''">
<gmd:positionName>
<gco:CharacterString>
<xsl:value-of select="$position"/>
</gco:CharacterString>
</gmd:positionName>
</xsl:if>
<gmd:contactInfo>
<gmd:CI_Contact>
<!-- gmd:address -->
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<xsl:choose>
<xsl:when test="$email != ''">
<gco:CharacterString>
<xsl:value-of select="$email"/>
</gco:CharacterString>
</xsl:when>
<xsl:otherwise>
<!-- stower 2022 -->
<gco:CharacterString>
<xsl:value-of select="string('repository@geologie.ac.at')"/>
</gco:CharacterString>
</xsl:otherwise>
</xsl:choose>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<xsl:if test="$httpuri != ''">
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:value-of select="$httpuri"/>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>
<xsl:value-of select="$personidtype"/>
</gco:CharacterString>
</gmd:protocol>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</xsl:if>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- <gmd:role> -->
<gmd:role>
<gmd:CI_RoleCode>
<xsl:attribute name="codeList">http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="$role"/>
</xsl:attribute>
<xsl:value-of select="$role"/>
</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</xsl:template>
<!-- <gmd:pointOfContact> -->
<xsl:template name="pointofcontact_custodian">
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>repository@geologie.ac.at</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://www.tethys.at/</gmd:URL>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- <gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role> -->
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="custodian">custodian</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
</xsl:template>
<!-- <gmd:pointOfContact> -->
<xsl:template name="pointofcontact_originator">
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>repository@geologie.ac.at</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://www.tethys.at/</gmd:URL>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- <gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role> -->
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="originator">originator</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
</xsl:template>
<!-- gmd:graphicOverview - retrieves tethys logo as browse graphic, stower 2022 -->
<xsl:template name="browseGraphictethys">
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>https://www.tethys.at/img/TETHYS-Logo.f04915ca.svg</gco:CharacterString>
</gmd:fileName>
<gmd:fileDescription>
<gco:CharacterString>TETHYS RDR</gco:CharacterString>
</gmd:fileDescription>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
</xsl:template>
<!-- gmd:descriptiveKeywords - retrieves non-thesaurus keywords -->
<xsl:template name="freekeywords">
<xsl:if test="//*[name() = 'Subject' and normalize-space(@Type) = 'Uncontrolled']">
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<xsl:for-each select="*[name() = 'Subject' and normalize-space(@Type) = 'Uncontrolled']">
<gmd:keyword>
<gco:CharacterString>
<xsl:value-of select="normalize-space(@Value)"/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<gmd:type>
<MD_KeywordTypeCode xmlns="http://www.isotc211.org/2005/gmd" codeList="https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_KeywordTypeCode" codeListValue="theme">theme</MD_KeywordTypeCode>
</gmd:type>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:if>
</xsl:template>
<!-- gmd:descriptiveKeywords - for datacenter -->
<xsl:template name="datacenter_keyword">
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>
<xsl:value-of select="$datacentre"/>
</gco:CharacterString>
</gmd:keyword>
<gmd:type>
<gmd:MD_KeywordTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode" codeListValue="dataCentre">Tethys RDR</gmd:MD_KeywordTypeCode>
</gmd:type>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:template>
<!-- <gmd:extent> -->
<xsl:template name="spatialcoverage">
<gmd:extent>
<gmd:EX_Extent>
<xsl:if test="//*[name() = 'Coverage']">
<xsl:variable name="thebox" select="//*[name() = 'Coverage']"/>
<xsl:variable name="sLat">
<xsl:choose>
<xsl:when test="string($thebox/@YMin) != ''">
<xsl:value-of select="number($thebox/@YMin)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="wLong">
<xsl:choose>
<xsl:when test="string($thebox/@XMin) != ''">
<xsl:value-of select="number($thebox/@XMin)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nLat">
<xsl:choose>
<xsl:when test="string($thebox/@YMax) != ''">
<xsl:value-of select="number($thebox/@YMax)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="eLong">
<xsl:choose>
<xsl:when test="string($thebox/@XMax) != ''">
<xsl:value-of select="number($thebox/@XMax)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="
string($nLat) != 'NaN' and string($wLong) != 'NaN' and
string($sLat) != 'NaN' and string($eLong) != 'NaN'">
<!-- <xsl:value-of select="$nLat"/> -->
<xsl:choose>
<!-- check for degenerate bbox -->
<xsl:when test="$nLat = $sLat and $eLong = $wLong">
<gmd:geographicElement>
<gmd:EX_BoundingPolygon>
<gmd:polygon>
<gml:Point>
<!-- generate a unique id of the source xml node -->
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id(.)"/>
</xsl:attribute>
<gml:pos>
<xsl:value-of select="$sLat"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$wLong"/>
</gml:pos>
</gml:Point>
</gmd:polygon>
</gmd:EX_BoundingPolygon>
</gmd:geographicElement>
</xsl:when>
<!-- check to see if box crosses 180 with west side either in east long (positive) or <-180, or east side
>180. If so, create two bounding box geographicElements-->
<xsl:when test="($wLong &gt;0 and $eLong &lt;0)">
<!-- use east longitude coordinates -->
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$wLong"/>
</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>
<xsl:value-of select="180"/>
</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$sLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$nLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$sLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>
<xsl:value-of select="-180"/>
</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$eLong"/>
</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$sLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$nLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$sLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</xsl:when>
<xsl:otherwise>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:extentTypeCode>
<gco:Boolean>true</gco:Boolean>
</gmd:extentTypeCode>
<gmd:westBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$wLong"/>
</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$eLong"/>
</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$sLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$nLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$sLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
</gmd:EX_Extent>
</gmd:extent>
</xsl:template>
<!-- <gmd:onLine> -->
<xsl:template name="datacite_identifier">
<xsl:if test="
starts-with($datacite-identifier/@Value, 'doi:') or
$datacite-identifier/@Type = 'Doi' or
starts-with($datacite-identifier/@Value, 'http://')">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:choose>
<xsl:when test="starts-with($datacite-identifier/@Value, 'doi:')">
<!-- stower http auf https gesetzt -->
<xsl:value-of select="concat('http://dx.doi.org/', substring-after($datacite-identifier/@Value, 'doi:'))"/>
</xsl:when>
<xsl:when test="$datacite-identifier/@Type = 'Doi'">
<xsl:value-of select="concat('http://dx.doi.org/', normalize-space($datacite-identifier/@Value))"/>
</xsl:when>
<xsl:when test="starts-with($datacite-identifier/@Value, 'http://')">
<xsl:value-of select="normalize-space($datacite-identifier/@Value)"/>
</xsl:when>
</xsl:choose>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>Landing Page</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(
'Link to DOI landing page or data facility landing page if no DOI is assigned.'))"/>
</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="information">information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:if>
</xsl:template>
<!-- <gmd:onLine> -->
<xsl:template name="alternate_identifier">
<xsl:if test="@landingpage != '' and starts-with(normalize-space(string(@landingpage)), 'http')">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:value-of select="string(@landingpage)"/>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string('url'))"/>
</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>Link to a web page related to the resource.</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="information">information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:if>
</xsl:template>
<!-- <gmd:dataQualityInfo> -->
<xsl:template name="data_quality">
<gmd:dataQualityInfo>
<gmd:DQ_DataQuality>
<gmd:scope>
<gmd:DQ_Scope>
<gmd:level>
<MD_ScopeCode xmlns="http://www.isotc211.org/2005/gmd" codeList="http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" />
</gmd:level>
<gmd:levelDescription xmlns:gco="http://www.isotc211.org/2005/gco" gco:nilReason="inapplicable" />
</gmd:DQ_Scope>
</gmd:scope>
<gmd:report>
<gmd:DQ_DomainConsistency>
<gmd:result>
<gmd:DQ_ConformanceResult>
<gmd:specification>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString xmlns:gco="http://www.isotc211.org/2005/gco">VERORDNUNG (EG) Nr. 1089/2010 DER KOMMISSION vom 23. November 2010 zur Durchführung der Richtlinie 2007/2/EG des Europäischen Parlaments und des Rates hinsichtlich der Interoperabilität von Geodatensätzen und -diensten</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date xmlns:gco="http://www.isotc211.org/2005/gco">2010-12-08</gco:Date>
</gmd:date>
<gmd:dateType>
<CI_DateTypeCode xmlns="http://www.isotc211.org/2005/gmd" codeList="https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication" />
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:specification>
<gmd:explanation>
<gco:CharacterString xmlns:gco="http://www.isotc211.org/2005/gco">Datenstruktur entspricht INSPIRE</gco:CharacterString>
</gmd:explanation>
<gmd:pass>
<gco:Boolean xmlns:gco="http://www.isotc211.org/2005/gco">true</gco:Boolean>
</gmd:pass>
</gmd:DQ_ConformanceResult>
</gmd:result>
</gmd:DQ_DomainConsistency>
</gmd:report>
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString xmlns:gco="http://www.isotc211.org/2005/gco">Digitalisierung</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
</gmd:DQ_DataQuality>
</gmd:dataQualityInfo>
</xsl:template>
<!-- <gmd:distributor> -->
<xsl:variable name="distributorOrganisation" select="string('Geological Survey of Austria')"/>
<xsl:variable name="distributorContactEmail" select="string('repository@geologie.ac.at')"/>
<xsl:template name="distributor">
<gmd:distributor>
<gmd:MD_Distributor>
<gmd:distributorContact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString>
<xsl:value-of select="$distributorOrganisation"/>
</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>
<xsl:value-of select="$distributorContactEmail"/>
</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="distributor" codeSpace="ISOTC211/19115">distributor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:distributorContact>
</gmd:MD_Distributor>
</gmd:distributor>
</xsl:template>
<xsl:variable name="maintenanceContactID" select="string('https://www.re3data.org/repository/r3d100013400')"/>
<xsl:variable name="maintenanceContactName" select="string('Tethys RDR')"/>
<xsl:variable name="maintenanceContactEmail" select="string('repository@geologie.ac.at')"/>
<xsl:template name="metadata_maintenance">
<gmd:metadataMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">asNeeded</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
<gmd:contact>
<xsl:if test="$maintenanceContactID != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$maintenanceContactID"/>
</xsl:attribute>
</xsl:if>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>
<xsl:value-of select="$maintenanceContactName"/>
</gco:CharacterString>
</gmd:individualName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>
<xsl:value-of select="$maintenanceContactEmail"/>
</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="processor">processor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
</gmd:MD_MaintenanceInformation>
</gmd:metadataMaintenance>
</xsl:template>
</xsl:stylesheet>

740
assets/oai_2_iso19139.xslt Normal file
View File

@ -0,0 +1,740 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* This file is part of TETHYS.
*
* LICENCE
* TETHYS is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or any later version.
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Application
* @package Module Oai
* @author Arno Kaimbacher <arno.kaimbacher@geologie.ac.at>
* @copyright Copyright (c) 2022, GBA TETHYS development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://example.com/functions"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
expand-text="yes"
version="3.0">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:mode on-no-match="shallow-copy"/>
<xsl:import href="functions.xslt"/>
<!-- variables -->
<xsl:variable name="datacite-identifier_org" select="//*[name() = 'Identifier']"/>
<xsl:variable name="datacite-identifier" select="//*[name() = 'Identifier'][@Type = 'Doi']"/>
<xsl:variable name="fileIdentifierPrefix" select="string('at.tethys.dataset')"/>
<xsl:variable name="datacentre">
<xsl:choose>
<xsl:when test="string-length(normalize-space(@CreatingCorporation)) > 0">
<xsl:value-of select="normalize-space(@CreatingCorporation)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('Tethys RDR')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- main template for is 19139 -->
<xsl:template match="Rdr_Dataset" mode="iso19139">
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opgeris.net/gml/3.2" xmlns:gmx="http://www.isotc211.org/2005/gmx"
xsi:schemaLocation="http://www.isotc211.org/2005/gmd https://www.isotc211.org/2005/gmd/metadataApplication.xsd http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd http://www.isotc211.org/2005/gmx http://schemas.opengis.net/iso/19139/20060504/gmx/gmx.xsd">
<!-- gmd:fileIdentifier -->
<xsl:if test="Identifier">
<xsl:apply-templates select="Identifier" mode="iso19139" />
</xsl:if>
<!-- Ressourensprache in der Eingabemaske von Tethys nicht erfasst-->
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/" codeListValue="ger"/>
</gmd:language>
<gmd:characterSet>
<gmd:MD_CharacterSetCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_CharacterSetCode" codeListValue="utf8"/>
</gmd:characterSet>
<!--gmd:hierarchyLevel template-->
<xsl:call-template name="hierarchylevel"/>
<gmd:hierarchyLevelName>
<gco:CharacterString>
<xsl:text>Dataset</xsl:text>
</gco:CharacterString>
</gmd:hierarchyLevelName>
<!-- gmd:contact - The contact for the metadata - static value assigned in template at the top of this file; -->
<xsl:call-template name="metadatacontact"/>
<!-- gmd:dateStamp -->
<xsl:call-template name="datestamp"/>
<gmd:metadataStandardName>
<gco:CharacterString>ISO 19139 Geographic Information - Metadata - Implementation Specification</gco:CharacterString>
</gmd:metadataStandardName>
<gmd:metadataStandardVersion>
<gco:CharacterString>2007</gco:CharacterString>
</gmd:metadataStandardVersion>
<gmd:referenceSystemInfo>
<gmd:MD_ReferenceSystem>
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<!-- <gmx:Anchor xlink:href="https://www.opengis.net/def/crs/EPSG/0/25832">EPSG:25832</gmx:Anchor> -->
<gco:CharacterString>https://www.opengis.net/def/crs/EPSG/0/25832</gco:CharacterString>
</gmd:code>
<gmd:version>
<gco:CharacterString>6.11.2</gco:CharacterString>
</gmd:version>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
</gmd:MD_ReferenceSystem>
</gmd:referenceSystemInfo>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<!-- gmd:citation> -->
<gmd:citation>
<gmd:CI_Citation>
<!-- gmd:title -->
<xsl:call-template name="title"/>
<!-- <gmd:alternateTitle -->
<xsl:apply-templates select="TitleAdditional" mode="iso19139" />
<!-- gmd:date -->
<xsl:call-template name="resourcedates"/>
<!-- gmd:identifier -->
<!-- stower 2022, identifer gba https://doi.org/10.24341/tethys.53 -->
<gmd:identifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:choose>
<xsl:when test="starts-with($datacite-identifier/@Value, 'doi:') or contains($datacite-identifier/@Value, 'doi.org')">
<xsl:value-of select="$datacite-identifier/@Value"/>
</xsl:when>
<xsl:when test="count($datacite-identifier[@Type = 'Doi']) &gt; 0 and $datacentre='Tethys RDR'">
<xsl:value-of select="concat(
'https://doi.org/',
string($datacite-identifier/@Value)
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$datacite-identifier/@Value"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:identifier>
<!-- gmd:citedResponsibleParty - creator -->
<xsl:apply-templates select="PersonAuthor" mode="iso19139" />
<!-- gmd:citedResponsibleParty - contributor -->
<xsl:apply-templates select="PersonContributor" mode="iso19139" />
<!-- publisher -->
<gmd:citedResponsibleParty>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="organisation">
<xsl:value-of select="@CreatingCorporation"/>
</xsl:with-param>
<xsl:with-param name="role">publisher</xsl:with-param>
</xsl:call-template>
</gmd:citedResponsibleParty>
</gmd:CI_Citation>
</gmd:citation>
<!-- gmd:abstract -->
<xsl:call-template name="abstract"/>
<gmd:status>
<gmd:MD_ProgressCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ProgressCode" codeListValue="Complete" codeSpace="ISOTC211/19115"/>
</gmd:status>
<!-- gmd:pointOfContact custodian -->
<xsl:call-template name="pointofcontact_custodian"/>
<!-- gmd:pointOfContact originator -->
<xsl:call-template name="pointofcontact_originator"/>
<!-- gmd:resourceMaintenance -->
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">asNeeded</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
<!-- gmd:credit -->
<!-- <xsl:if test="count(//*[name() = 'fundingReferences']) &gt; 0">
<xsl:for-each select="//*[local-name() = 'fundingReferences']/*[name() = 'fundingReference']">
<gmd:credit>
<gco:CharacterString>
<xsl:value-of select="normalize-space(concat(string('funderName:'), string(*[name() = 'funderName'])))"/>
<xsl:if test="count(*[local-name() = 'funderIdentifier']) &gt; 0">
<xsl:text>
</xsl:text>
<xsl:value-of select="normalize-space(concat(string('funderIdentifier:'), string(*[name() = 'funderIdentifier'])))"/>
<xsl:value-of select="normalize-space(concat(string('; IDType:'), string(*[name() = 'funderIdentifier']/@funderIdentifierType)))"/>
</xsl:if>
<xsl:if test="count(*[name() = 'awardNumber']) &gt; 0">
<xsl:text>
</xsl:text>
<xsl:value-of select="normalize-space(concat(string('awardNumber:'), string(*[name() = 'awardNumber'])))"/>
</xsl:if>
<xsl:if test="count(*[name() = 'awardTitle']) &gt; 0">
<xsl:text>
</xsl:text>
<xsl:value-of select="normalize-space(concat(string('awardTitle:'), string(*[name() = 'awardTitle'])))"/>
</xsl:if>
</gco:CharacterString>
</gmd:credit>
</xsl:for-each>
</xsl:if> -->
<!-- <gmd:graphicOverview> -->
<xsl:call-template name="browseGraphictethys"/>
<!-- gmd:descriptiveKeywords without thesaurus-->
<xsl:call-template name="freekeywords"/>
<xsl:call-template name="datacenter_keyword"/>
<!-- gmd:resourceConstraints -->
<xsl:apply-templates select="Licence" mode="iso19139" />
<gmd:resourceConstraints>
<gmd:MD_SecurityConstraints>
<gmd:classification>
<gmd:MD_ClassificationCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ClassificationCode" codeListValue="unclassified"/>
</gmd:classification>
</gmd:MD_SecurityConstraints>
</gmd:resourceConstraints>
<!-- relatedresources mapped to gmd:aggregationInfo, -->
<!-- <xsl:call-template name="relatedResources">
<xsl:with-param name="relres" select="//*[local-name() = 'relatedIdentifiers']"/>
</xsl:call-template> -->
<!-- <gmd:aggregationInfo> -->
<xsl:apply-templates select="Reference" mode="iso19139" />
<gmd:spatialResolution>
<xsl:variable name="mainTitle">
<!-- <xsl:for-each select="$datacite-titles/*[name() = 'title']"> -->
<xsl:for-each select="*[name() = 'TitleMain']">
<xsl:if test="normalize-space(@Type) = 'Main'">
<xsl:value-of select="@Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<gmd:MD_Resolution>
<xsl:choose>
<xsl:when test="contains($mainTitle, '50.000')">
<gmd:equivalentScale>
<gmd:MD_RepresentativeFraction>
<gmd:denominator>
<!-- <gco:Integer>{$mainTitle}</gco:Integer> -->
<gco:Integer>50000</gco:Integer>
</gmd:denominator>
</gmd:MD_RepresentativeFraction>
</gmd:equivalentScale>
</xsl:when>
<xsl:otherwise>
<gmd:distance>
<gco:Distance uom="m">-1</gco:Distance>
</gmd:distance>
</xsl:otherwise>
</xsl:choose>
</gmd:MD_Resolution>
</gmd:spatialResolution>
<!-- assume ger for now, stower 2022 -->
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/" codeListValue="ger"/>
</gmd:language>
<!-- ISOTopic19115, stower 2022 -->
<gmd:topicCategory>
<gmd:MD_TopicCategoryCode>geoscientificInformation</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
<!-- gmd:geographicElement> -->
<xsl:call-template name="spatialcoverage"/>
<!-- <xsl:call-template name="temporalcoverage"/> -->
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<!-- gmd:distributionInfo -->
<gmd:distributionInfo>
<gmd:MD_Distribution>
<!-- kaiarn 2022 gmd:distributionFormat -->
<xsl:apply-templates select="File" mode="iso19139" />
<!-- gmd:distributor -->
<xsl:call-template name="distributor" />
<!-- gmd:transferOptions -->
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<!-- <xsl:call-template name="size"/> -->
<!-- <gmd:onLine> -->
<xsl:call-template name="datacite_identifier" />
<!-- <gmd:onLine> -->
<xsl:call-template name="alternate_identifier" />
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
<!-- gmd:dataQualityInfo -->
<xsl:call-template name="data_quality"/>
<!-- <gmd:metadataMaintenance> -->
<xsl:call-template name="metadata_maintenance" />
</gmd:MD_Metadata>
</xsl:template>
<!-- further helper templates -->
<!-- gmd:resourceConstraints -->
<xsl:template match="Licence" mode="iso19139">
<gmd:resourceConstraints xlink:href="https://creativecommons.org/licenses/by/4.0/deed.en">
<gmd:MD_Constraints>
<gmd:useLimitation>
<gco:CharacterString>
<xsl:value-of select="string(@NameLong)"/>
</gco:CharacterString>
</gmd:useLimitation>
</gmd:MD_Constraints>
</gmd:resourceConstraints>
<gmd:resourceConstraints>
<gmd:MD_LegalConstraints>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode" codeListValue="otherRestrictions"/>
</gmd:accessConstraints>
<gmd:otherConstraints>
<gco:CharacterString>
<xsl:value-of select="string(@NameLong)"/>
</gco:CharacterString>
</gmd:otherConstraints>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
</xsl:template>
<!-- gmd:fileIdentifier -->
<xsl:template match="Identifier" mode="iso19139">
<gmd:fileIdentifier>
<gco:CharacterString>
<!-- <xsl:value-of select="@Value" /> -->
<xsl:choose>
<xsl:when test="string-length(@Value) &gt; 0 and count([@Type = 'Doi']) &gt; 0">
<xsl:value-of select="concat($fileIdentifierPrefix, normalize-space(substring-after(@Value, '/tethys.')))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(@Value)"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:fileIdentifier>
</xsl:template>
<!-- gmd:dateStamp template-->
<xsl:template name="datestamp">
<gmd:dateStamp>
<!-- define vriable theDate -->
<xsl:variable name="theDate">
<xsl:choose>
<xsl:when test="ServerDateModified">
<xsl:value-of select="concat(
ServerDateModified/@Year, '-',
format-number(number(ServerDateModified/@Month),'00'), '-',
format-number(number(ServerDateModified/@Day),'00')
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(
ServerDatePublished/@Year, '-',
format-number(number(ServerDatePublished/@Month),'00'), '-',
format-number(number(ServerDatePublished/@Day),'00')
)" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<gco:Date>
<xsl:value-of select="string($theDate)"/>
</gco:Date>
</gmd:dateStamp>
</xsl:template>
<!-- gmd:title -->
<xsl:template name="title">
<gmd:title>
<gco:CharacterString>
<xsl:for-each select="*[name() = 'TitleMain' or name() = 'TitleAdditional']">
<xsl:choose>
<xsl:when test="string(@Type) = 'Main'">
<xsl:value-of select="@Value"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Sub' and @Value != ''">
<xsl:value-of select="concat('; Subtitle: ', @Value)"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Translated' and @Value != ''">
<xsl:value-of select="concat('; Translated title: ', @Value)"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Other' and @Value != ''">
<xsl:value-of select="concat('; Other title: ', @Value)"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</gco:CharacterString>
</gmd:title>
</xsl:template>
<!-- <gmd:alternateTitle> -->
<xsl:template match="TitleAdditional" mode="iso19139">
<xsl:if test="string(@Type) = 'Alternative' and @Value != ''">
<gmd:alternateTitle>
<gco:CharacterString>
<xsl:value-of select="string(@Value)"/>
</gco:CharacterString>
</gmd:alternateTitle>
</xsl:if>
</xsl:template>
<!-- <gmd:citedResponsibleParty> -->
<xsl:template match="PersonAuthor" mode="iso19139">
<gmd:citedResponsibleParty>
<xsl:variable name="http-uri">
<xsl:choose>
<xsl:when test="string-length(@IdentifierOrcid) > 0">
<xsl:value-of select="concat(
'http://orcid.org/',
string(@IdentifierOrcid)
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- set attribute xlink:href -->
<xsl:if test="$http-uri != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$http-uri"/>
</xsl:attribute>
</xsl:if>
<xsl:variable name="nameidscheme">
<xsl:choose>
<xsl:when test="starts-with($http-uri, 'http://orcid.org/')">
<xsl:value-of select="string('ORCID')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="email">
<xsl:choose>
<xsl:when test="@Email != ''">
<xsl:value-of select="@Email"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="affiliation">
<xsl:choose>
<xsl:when test="@NameType = 'Personal'">
<xsl:value-of select="string('GBA')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="creatorname">
<xsl:value-of select="@LastName" />
<xsl:if test="@FirstName != ''">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@FirstName" />
<xsl:if test="@AcademicTitle != ''">
<xsl:text> (</xsl:text>
<xsl:value-of select="@AcademicTitle" />
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="namestring">
<xsl:choose>
<xsl:when test="normalize-space(@LastName) != ''">
<xsl:value-of select="
concat(
normalize-space(@LastName),
', ',
normalize-space(@FirstName))"/>
</xsl:when>
<!-- <xsl:when test="normalize-space(*[local-name() = 'creatorName']) != ''">
<xsl:value-of select="normalize-space(*[local-name() = 'creatorName'])"/>
</xsl:when> -->
<xsl:otherwise>
<xsl:value-of select="string('missing')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="individual">
<xsl:value-of select="$namestring"/>
</xsl:with-param>
<xsl:with-param name="personidtype">
<xsl:value-of select="$nameidscheme"/>
</xsl:with-param>
<xsl:with-param name="organisation">
<xsl:value-of select="$affiliation"/>
</xsl:with-param>
<xsl:with-param name="role">author</xsl:with-param>
<xsl:with-param name="email">
<xsl:value-of select="$email"/>
</xsl:with-param>
<xsl:with-param name="datacite-creatorname">
<xsl:value-of select="$creatorname"/>
</xsl:with-param>
</xsl:call-template>
<!-- <xsl:value-of select="$namestring"/> -->
</gmd:citedResponsibleParty>
</xsl:template>
<xsl:template match="PersonContributor" mode="iso19139">
<xsl:variable name="dcrole" select="normalize-space(./@ContributorType)"/>
<xsl:variable name="role">
<xsl:choose>
<xsl:when test="$dcrole = 'ContactPerson'">pointOfContact</xsl:when>
<xsl:when test="$dcrole = 'DataCollector'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'DataCurator'">custodian</xsl:when>
<xsl:when test="$dcrole = 'DataManager'">custodian</xsl:when>
<xsl:when test="$dcrole = 'Distributor'">originator</xsl:when>
<xsl:when test="$dcrole = 'Editor'">editor</xsl:when>
<xsl:when test="$dcrole = 'Funder'">funder</xsl:when>
<xsl:when test="$dcrole = 'HostingInstitution'">distributor</xsl:when>
<xsl:when test="$dcrole = 'ProjectLeader'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'ProjectManager'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'ProjectMember'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'ResearchGroup'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'Researcher'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'RightsHolder'">rightsHolder</xsl:when>
<xsl:when test="$dcrole = 'Sponsor'">funder</xsl:when>
<xsl:when test="$dcrole = 'WorkPackageLeader'">collaborator</xsl:when>
<xsl:otherwise>contributor</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<gmd:citedResponsibleParty>
<xsl:variable name="http-uri">
<xsl:choose>
<xsl:when test="string-length(@IdentifierOrcid) > 0">
<xsl:value-of select="concat(
'http://orcid.org/',
string(@IdentifierOrcid)
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- set attribute xlink:href -->
<xsl:if test="$http-uri != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$http-uri"/>
</xsl:attribute>
</xsl:if>
<xsl:variable name="nameidscheme">
<xsl:choose>
<xsl:when test="starts-with($http-uri, 'http://orcid.org/')">
<xsl:value-of select="string('ORCID')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="email">
<xsl:choose>
<xsl:when test="@Email != ''">
<xsl:value-of select="@Email"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="affiliation">
<xsl:choose>
<xsl:when test="@NameType = 'Personal'">
<xsl:value-of select="string('GBA')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="contrnamestring">
<xsl:choose>
<xsl:when test="normalize-space(@LastName) != ''">
<xsl:value-of select="
concat(
normalize-space(@LastName),
', ',
normalize-space(@FirstName))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('missing')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="individual">
<xsl:value-of select="$contrnamestring"/>
</xsl:with-param>
<xsl:with-param name="httpuri">
<xsl:value-of select="$http-uri"/>
</xsl:with-param>
<xsl:with-param name="personidtype">
<xsl:value-of select="$nameidscheme"/>
</xsl:with-param>
<xsl:with-param name="organisation">
<xsl:value-of select="$affiliation"/>
</xsl:with-param>
<xsl:with-param name="position">
<xsl:value-of select="$dcrole"/>
</xsl:with-param>
<xsl:with-param name="email">
<xsl:value-of select="$email"/>
</xsl:with-param>
<xsl:with-param name="role" select="$role"/>
</xsl:call-template>
</gmd:citedResponsibleParty>
</xsl:template>
<xsl:variable name="nl" select="string('&#10;')"/>
<!-- gmd:abstract -->
<xsl:template name="abstract">
<gmd:abstract>
<gco:CharacterString>
<xsl:for-each select="*[name() = 'TitleAbstract' or name() = 'TitleAbstractAdditional']">
<!-- <xsl:text>&#10;</xsl:text> -->
<xsl:choose>
<xsl:when test="string(@Type) = 'Abstract'">
<!-- <xsl:value-of select="@Value"/> -->
<xsl:value-of select="concat('&#10;Abstract: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Translated'">
<xsl:value-of select="concat('&#10;Translated Description: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'SeriesInformation' and @Value != ''">
<xsl:value-of select="concat('&#10;Series Information: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'TableOfContents' and @Value != ''">
<xsl:value-of select="concat('&#10;Table of Contents: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'TechnicalInfo' and @Value != ''">
<xsl:value-of select="concat('&#10;Technical Info: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Methods' and @Value != ''">
<xsl:value-of select="concat('&#10;Methods: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Other' and @Value != ''">
<xsl:if test="not(contains(string(@Value), 'Related publications:'))">
<xsl:value-of select="concat('&#10;Other Description: ', string(@Value))"/>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- <xsl:value-of select="$nl" disable-output-escaping="no"/> -->
</gco:CharacterString>
</gmd:abstract>
</xsl:template>
<!-- <gmd:aggregationInfo> -->
<xsl:template match="Reference" mode="iso19139">
<xsl:if test="
not(contains(normalize-space(string(@Value)), 'missing')) and
not(contains(normalize-space(string(@Value)), 'unknown'))">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(@Value))"/>
</gco:CharacterString>
</gmd:code>
<gmd:codeSpace>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(@Type))"/>
</gco:CharacterString>
</gmd:codeSpace>
</gmd:RS_Identifier>
</gmd:aggregateDataSetIdentifier>
<gmd:associationType>
<xsl:element name="gmd:DS_AssociationTypeCode">
<xsl:attribute name="codeList">
<xsl:value-of select="string('http://datacite.org/schema/kernel-4')"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="normalize-space(string(@Type))"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(string(@Type))"/>
</xsl:element>
</gmd:associationType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:if>
</xsl:template>
<xsl:template match="File" mode="iso19139">
<xsl:if test="string-length(normalize-space(string(@MimeType))) > 0">
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(@MimeType))"/>
</gco:CharacterString>
</gmd:name>
<gmd:version gco:nilReason="missing"/>
</gmd:MD_Format>
</gmd:distributionFormat>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ https://github.com/Saxonica/SaxonJS-Tutorial-2021/tree/main/exercises/ex03
https://www.saxonica.com/saxon-js/documentation2/index.html#!starting/export/compiling-using-XX
npm install --save-dev xslt3
xslt3 -xsl:datasetxml2oai-pmh.xslt -export:datasetxml2oai.sef.json -t
./node_modules/xslt3/xslt3.js -xsl:datasetxml2oai-pmh.xslt -export:src/controllers/datasetxml2oai.sef.json -t
./node_modules/xslt3/xslt3.js -xsl:datasetxml2oai-pmh.xslt -export:src/controllers/datasetxml2oai.sef.json -t -nogo "-ns:##html5"
npm install --save saxon-js
=============================================================================================

View File

@ -8,7 +8,7 @@
"babel-node": "npx babel-node --extensions \".ts,.tsx,.js\" -- src/server.ts",
"dev": "nodemon ./src/server.ts --exec babel-node --extensions \".ts,.tsx,.js\"",
"build:types": "tsc --emitDeclarationOnly",
"compress:xslt": "./node_modules/xslt3/xslt3.js -xsl:datasetxml2oai-pmh.xslt -export:dist/controllers/datasetxml2oai.sef.json -t",
"compress:xslt": "./node_modules/xslt3/xslt3.js -xsl:datasetxml2oai-pmh.xslt -export:dist/controllers/datasetxml2oai.sef.json -t -nogo '-ns:##html5'",
"build:js": "rm -rf dist && babel src --out-dir dist --extensions \".ts,.tsx,.js\" & npm run compress:xslt",
"build": "rm -rf dist && tsc --build",
"start": "node dist/server.js",

View File

@ -6,7 +6,7 @@ import { initDB } from "./config/db.config";
import { DatasetController } from "./controllers/dataset.controller";
import { OaiController } from "./controllers/oai.controller";
import { FileController } from "./controllers/file.controller";
import * as path from 'path';
import * as path from "path";
export class App extends Server {
// private app;
@ -14,7 +14,7 @@ export class App extends Server {
constructor() {
super();
// this.app = express();
this.app.use('/assets', express.static(path.join(__dirname, '../assets')));
this.app.use("/assets", express.static(path.join(__dirname, "../assets")));
this.applyMiddleWares();
// init db and add routes
this.boostrap();

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@ import * as fs from "fs";
@Controller("file")
export class FileController {
constructor() {}
// constructor() {}
@Get("download/:id")
public async findOne(req: Request, res: Response) {
@ -16,9 +16,9 @@ export class FileController {
where: { id: id },
});
if (file) {
let filePath = "/storage/app/public/" + file.path_name;
const filePath = "/storage/app/public/" + file.path_name;
const ext = path.extname(filePath);
let fileName = file.label + ext;
const fileName = file.label + ext;
try {
fs.accessSync(filePath, fs.constants.R_OK | fs.constants.W_OK);
// console.log("can read/write:", path);

View File

@ -416,7 +416,7 @@ export class OaiController {
}
} else if (setArray[0] == "open_access") {
const openAccessLicences = ["CC-BY-4.0", "CC-BY-SA-4.0"];
let icncludeFilter = {
const icncludeFilter = {
model: License,
as: "licenses",
required: true, //return only records which have an associated model INNER JOIN

View File

@ -36,7 +36,7 @@ export default class ResumptionToken {
//#region properties
get Key(): string{
get Key(): string {
return this.MetadataPrefix + this.StartPosition + this.TotalIds;
}

View File

@ -15,7 +15,7 @@ export default class TokenWorker {
private cache: RedisClientType;
private ttl: number;
private url: string;
private connected: boolean = false;
private connected = false;
constructor(ttl: number) {
// if (resPath) {
@ -122,17 +122,17 @@ export default class TokenWorker {
this.connected = false;
}
private checksum(str: string, algorithm?: string, encoding?: string): string {
private checksum(str: string, algorithm?: string): string {
/**
* @type {BinaryToTextEncoding}
*/
const ENCODING_OUT = "hex"; // Initializer type string is not assignable to variable type BinaryToTextEncoding
return crypto
.createHash(algorithm || 'md5')
.update(str, 'utf8')
.digest(ENCODING_OUT)
}
.createHash(algorithm || "md5")
.update(str, "utf8")
.digest(ENCODING_OUT);
}
/**
* Set resumption path where the resumption token files are stored.

View File

@ -56,7 +56,6 @@ File.init(
allowNull: false,
},
created_at: DataTypes.DATE,
updated_at: DataTypes.DATE,
},