Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0"
3
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/"
4
                xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:oai="http://www.openarchives.org/OAI/2.0/"
5
                xmlns:datetime="http://exslt.org/dates-and-times"
6
                xmlns:dri="http://www.driver-repository.eu/namespace/dri"
7
                xmlns:md="http://www.pangaea.de/MetaData" xmlns:oaa="http://namespace.openaire.eu/oaa"
8
                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions"
9
                xmlns:dnet="eu.dnetlib.data.transform.xml.DNetMdStoreToHbaseXsltFunctions"
10
                xmlns:stringUtils="org.apache.commons.lang.StringUtils"
11
                exclude-result-prefixes="xsl dnet oaa fn stringUtils datetime">
12
    <xsl:param name="namespacePrefix"/>
13
    <xsl:param name="dataSourceId"/>
14
    <xsl:param name="parentDatasourceId"/>
15
    <xsl:param name="dataprovider_name"/>
16
    <xsl:param name="dataprovider_id"/>
17

    
18
    <xsl:template match="/">
19

    
20

    
21
        <xsl:variable name="identifier_datacite">
22
            <xsl:value-of select="oai:record/oai:header/dri:objIdentifier"/>
23
        </xsl:variable>
24

    
25
        <xsl:variable name="dataset_identifier">
26
            <xsl:value-of
27
                    select="stringUtils:substringAfter(//md:citation/md:URI,'doi:')"/>
28
        </xsl:variable>
29
        <xsl:variable name="openaire_dataset_identifier">
30
            <xsl:value-of
31
                    select="concat($namespacePrefix,'::', dnet:md5($dataset_identifier))"/>
32
        </xsl:variable>
33

    
34
        <xsl:variable name="parentURI">
35
            <xsl:value-of select="//md:citation/md:parentURI"/>
36
        </xsl:variable>
37

    
38
        <xsl:call-template name="CreateRecord">
39
            <xsl:with-param name="openaire_dataset_identifier" select="$openaire_dataset_identifier"/>
40
            <xsl:with-param name="dataset_identifier" select="$dataset_identifier"/>
41
            <xsl:with-param name="parent_uri" select="$parentURI" />
42
        </xsl:call-template>
43

    
44

    
45
    </xsl:template>
46
    <xsl:template name="CreateRecord">
47
        <xsl:param name="openaire_dataset_identifier"/>
48
        <xsl:param name="dataset_identifier"/>
49
        <xsl:param name="parent_uri" />
50
        <oai:record>
51
            <oai:header>
52
                <dri:objIdentifier>
53
                    <xsl:value-of select="$openaire_dataset_identifier"/>
54
                </dri:objIdentifier>
55
                <dri:recordIdentifier>
56
                    <xsl:value-of select="$dataset_identifier"/>
57
                </dri:recordIdentifier>
58
                <dri:dateOfCollection>
59
                    <xsl:value-of select="datetime:dateTime()"/>
60
                </dri:dateOfCollection>
61
                <dri:repositoryId>
62
                    <xsl:value-of select="$dataprovider_id"/>
63
                </dri:repositoryId>
64
                <oaf:datasourceprefix>
65
                    <xsl:value-of select="$namespacePrefix"/>
66
                </oaf:datasourceprefix>
67
            </oai:header>
68
            <oai:metadata>
69
                <resource
70
                        xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
71
                        xmlns="http://datacite.org/schema/kernel-3"
72
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
73
                    <identifier identifierType="DOI">
74
                        <xsl:value-of
75
                                select="$dataset_identifier"/>
76
                    </identifier>
77
                    <creators>
78
                        <xsl:for-each select="//md:citation/md:author">
79
                            <creator>
80
                                <creatorName>
81
                                    <xsl:value-of select="concat(./md:firstName, ' ', ./md:lastName)"/>
82
                                </creatorName>
83
                                <nameIdentifier schemeURI="http://www.pangaea.de"
84
                                                nameIdentifierScheme="PANGAEA">
85
                                    <xsl:value-of select="./@id"/>
86
                                </nameIdentifier>
87

    
88
                            </creator>
89
                        </xsl:for-each>
90
                    </creators>
91
                    <titles>
92
                        <xsl:for-each select="//md:citation/md:title">
93
                            <title xml:lang="en-us">
94
                                <xsl:value-of select="."/>
95
                            </title>
96
                        </xsl:for-each>
97
                    </titles>
98
                    <publisher>PANGAEA</publisher>
99
                    <publicationYear>
100
                        <xsl:value-of select="//md:citation/md:year"/>
101
                    </publicationYear>
102
                    <resourceType resourceTypeGeneral="Dataset"/>
103
                    <xsl:variable name="description">
104
                        <xsl:value-of select="//md:citation/md:abstract"/>
105
                    </xsl:variable>
106
                    <xsl:if test="$description">
107
                        <descriptions>
108
                            <description descriptionType="Abstract">
109
                                <xsl:value-of select="$description"/>
110
                            </description>
111
                        </descriptions>
112
                    </xsl:if>
113
                    <rights>info:eu-repo/semantics/openAccess</rights>
114
                    <contributors>
115
                        <contributor contributorType="Funder">
116
                            <contributorName>European Commission</contributorName>
117
                            <nameIdentifier nameIdentifierScheme="info">
118
                                <xsl:value-of
119
                                        select="//oaf:projectid"/>
120
                            </nameIdentifier>
121
                        </contributor>
122
                    </contributors>
123
                </resource>
124
                 <xsl:variable name="journalName"><xsl:value-of select="//*[local-name() ='journal']/@name"/></xsl:variable>
125
                    <xsl:variable name="journalISSN"><xsl:value-of select="//*[local-name() ='journal']/@issn"/></xsl:variable>
126
                    <xsl:variable name="journalDSId"><xsl:value-of select="//*[local-name() ='journal']/@datasourceid"/></xsl:variable>
127
                    
128
                    <xsl:choose>
129
                        <xsl:when test="string-length($journalISSN) &gt; 0">
130
                            <oaf:journal issn="{$journalISSN}" eissn="" >                                                              
131
                               <xsl:value-of select="$journalName"/>
132
                            </oaf:journal>                          
133
                            <oaf:hostedBy>
134
                                <xsl:attribute name="id"><xsl:value-of select="$journalDSId"/></xsl:attribute>
135
                                <xsl:attribute name="name"><xsl:value-of select="$journalName"/></xsl:attribute>
136
                            </oaf:hostedBy>                                        
137
                        </xsl:when>
138
                        <xsl:otherwise>                            
139
                            <oaf:hostedBy
140
                                id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
141
                                name="Unknown Repository"/>      
142
                        </xsl:otherwise>                        
143
                    </xsl:choose>
144
                <xsl:for-each select="//md:citation/md:supplementTo/@id">
145
                    <xsl:variable name="publicationID">
146
                        <xsl:value-of select="."/>
147
                    </xsl:variable>
148
                    <xsl:choose>
149
                        <xsl:when test="string-length($publicationID) &gt; 0">
150
                            <oaf:relatedPublication>
151
                                <xsl:attribute name="id">
152
                                    <xsl:value-of
153
                                            select="concat($namespacePrefix,'::', dnet:md5($publicationID))"/>
154
                                </xsl:attribute>
155
                            </oaf:relatedPublication>
156
                        </xsl:when>
157
                    </xsl:choose>
158
                </xsl:for-each>
159

    
160
               <xsl:choose>
161
                   <xsl:when test="string-length($parent_uri) &gt; 0">
162
                       <xsl:variable name="dataset_relate_ID">
163
                           <xsl:value-of select="stringUtils:substringAfter($parent_uri,'doi:')"/>
164
                       </xsl:variable>
165
                       <xsl:choose>
166
                           <xsl:when test="string-length($dataset_relate_ID) &gt; 0">
167
                               <oaf:relatedDataSet>
168
                                   <xsl:attribute name="id">
169
                                       <xsl:value-of
170
                                               select="concat($namespacePrefix,'::', dnet:md5($dataset_relate_ID))"/>
171
                                   </xsl:attribute>
172
                               </oaf:relatedDataSet>
173
                           </xsl:when>
174
                       </xsl:choose>
175

    
176
                   </xsl:when>
177
               </xsl:choose>
178

    
179
                <oaf:about>
180
                    <oaf:datainfo>
181
                        <oaf:inferred>false</oaf:inferred>
182
                        <oaf:deletedbyinference>false</oaf:deletedbyinference>
183
                        <oaf:trust>0.9</oaf:trust>
184
                        <oaf:inferenceprovenance/>
185
                        <oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive"
186
                                              classname="sysimport:crosswalk:datasetarchive"
187
                                              schemeid="dnet:provenanceActions"
188
                                              schemename="dnet:provenanceActions"/>
189
                    </oaf:datainfo>
190
                </oaf:about>
191
            </oai:metadata>
192
        </oai:record>
193
    </xsl:template>
194
</xsl:stylesheet>
(1-1/3)