Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="c65bf3ca-1a77-42c4-92a1-f902a4d752a7_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2017-06-30T17:01:32+02:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>claims_openaire_2_ODF</TITLE>
14
				<CODE><![CDATA[
15
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
16
    xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:oaf="http://namespace.openaire.eu/oaf"
17
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
18
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
    xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:date="http://exslt.org/dates-and-times"
20
    extension-element-prefixes="date" exclude-result-prefixes="xsl">
21

    
22
    <xsl:output indent="yes"/>
23

    
24
    <xsl:template match="/">
25
        <xsl:choose>
26
            <xsl:when test="string-length(//*[local-name() ='objIdentifier']) = 46 and matches(//*[local-name() ='objIdentifier'], '\w{12}') and (//instance/webresource/url != '' or //pid[@classid = 'doi'] != '')">
27
                <xsl:call-template name="createRecord"/>
28
            </xsl:when>
29
            <xsl:otherwise>
30
                <xsl:call-template name="skipRecord"/>
31
            </xsl:otherwise>
32
        </xsl:choose>
33

    
34
    </xsl:template>
35

    
36
    <xsl:template name="skipRecord">
37
        <oai:record>
38
            <oai:header>
39
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
40
                    copy-namespaces="no"/>
41
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
42
                    copy-namespaces="no"/>
43
                <dri:recordIdentifier>
44
                    <xsl:value-of select="//*[local-name() = 'header']/dri:objIdentifier"/>
45
                </dri:recordIdentifier>
46
                <dr:dateOfTransformation>
47
                   <xsl:value-of select="date:date-time()"/>
48
                </dr:dateOfTransformation>
49
            </oai:header>
50
            <oai:metadata>
51
                <xsl:copy-of select="//*[local-name() = 'metadata']/*"/>
52
            </oai:metadata>
53
        </oai:record>
54
    </xsl:template>
55

    
56
    <xsl:template name="createRecord">
57
        <oai:record>
58
            <oai:header>
59
                <xsl:copy-of select="//*[local-name() = 'header']/dri:objIdentifier"
60
                    copy-namespaces="no"/>
61
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
62
                    copy-namespaces="no"/>
63
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
64
                    copy-namespaces="no"/>
65
                <dr:dateOfTransformation>
66
                    <xsl:value-of select="date:date-time()"/>
67
                </dr:dateOfTransformation>
68
            </oai:header>
69
            <oai:metadata>
70
                <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
71
                    xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
72
                    xmlns="http://datacite.org/schema/kernel-3">
73

    
74
                    <xsl:choose>
75
                        <xsl:when test="//webresource/url != ''">
76
                            <identifier identifierType="URL">
77
                                <xsl:value-of select="./text()"/>
78
                            </identifier>
79
                        </xsl:when>
80
                        <xsl:otherwise>
81
                            <identifier identifierType="URL">
82
                                <xsl:value-of
83
                                    select="concat('http://dx.doi.org', '/', //pid[@classid = 'doi'][1])"
84
                                />
85
                            </identifier>
86
                        </xsl:otherwise>
87
                    </xsl:choose>
88

    
89
                    <alternateIdentifiers>
90
                        <xsl:for-each select="//oaf:result/pid[./text()]">
91
                            <alternateIdentifier alternateIdentifierType="{@classid}">
92
                                <xsl:value-of select="."/>
93
                            </alternateIdentifier>
94
                        </xsl:for-each>
95
                        <xsl:for-each select="//oaf:result/originalId">
96
                            <alternateIdentifier>
97
                                <xsl:value-of select="."/>
98
                            </alternateIdentifier>
99
                        </xsl:for-each>
100
                    </alternateIdentifiers>
101

    
102
                    <xsl:apply-templates/>
103

    
104
                    <titles>
105
                        <xsl:for-each select="//oaf:result/title/text()">
106
                            <title>
107
                                <xsl:value-of select="normalize-space(.)"/>
108
                            </title>
109
                        </xsl:for-each>
110
                    </titles>
111
                    <descriptions>
112
                        <xsl:for-each select="//oaf:result/description/text()">
113
                            <description descriptionType="Abstract">
114
                                <xsl:value-of select="normalize-space(.)"/>
115
                            </description>
116
                        </xsl:for-each>
117
                    </descriptions>
118
                    <subjects>
119
                        <xsl:for-each select="//oaf:result/subject[./text()]">
120
                            <xsl:choose>
121
                                <xsl:when test="@classname = 'keyword'">
122
                                    <subject>
123
                                        <xsl:value-of select="normalize-space(./text())"/>
124
                                    </subject>
125
                                </xsl:when>
126
                                <xsl:otherwise>
127
                                    <subject subjectScheme="{@classid}">
128
                                        <xsl:value-of select="normalize-space(./text())"/>
129
                                    </subject>
130
                                </xsl:otherwise>
131
                            </xsl:choose>
132
                        </xsl:for-each>
133
                    </subjects>
134
                    <!-- Size (O) -->
135
                    <sizes>
136
                        <xsl:for-each select="//oaf:result/size/text()">
137
                            <size>
138
                                <xsl:value-of select="."/>
139
                            </size>
140
                        </xsl:for-each>
141
                    </sizes>
142
                </resource>
143
                <xsl:call-template name="oafFields"/>
144
            </oai:metadata>
145
            <xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/>
146
        </oai:record>
147
    </xsl:template>
148

    
149
    <!-- Handling relationships -->
150
    <xsl:template match="//oaf:result/rels">
151
        <!-- Creators (M) -->
152
        <creators xmlns="http://datacite.org/schema/kernel-3">
153
            <xsl:for-each select="./rel[./to/@class = 'hasAuthor']">
154
                <xsl:sort select="ranking"/>
155
                <creator>
156
                    <creatorName>
157
                        <xsl:value-of select="./fullname"/>
158
                    </creatorName>
159
                </creator>
160
            </xsl:for-each>
161
            <!-- creators can also come from the new creator field with rank attribute. -->
162
            <xsl:for-each select="../creator">
163
                <xsl:sort select="./@rank"/>
164
                <creator>
165
                    <creatorName>
166
                        <xsl:value-of select="./text()"/>
167
                    </creatorName>
168
                </creator>
169
            </xsl:for-each>
170
        </creators>
171
        <contributors xmlns="http://datacite.org/schema/kernel-3">
172
            <!-- person contributors -->
173
            <xsl:apply-templates select="./rel[./to/@class = 'hasContributor']" mode="rel"/>
174
            <xsl:apply-templates select="../contributor" mode="rel"/>
175
        </contributors>
176
        <relatedIdentifiers xmlns="http://datacite.org/schema/kernel-3">
177
            <!-- Links to publications: TODO: how to pass existing links to OpenAIRE pubs?-->
178
            <!--<xsl:apply-templates select="./rel[./resulttype/@classid = 'publication']"/> -->
179
        </relatedIdentifiers>
180

    
181
    </xsl:template>
182

    
183
    <!-- Person Contributor template -->
184
    <xsl:template match="rel[./to/@class = 'hasContributor']" mode="rel">
185
        <contributor xmlns="http://datacite.org/schema/kernel-3">
186
            <contributorName>
187
                <xsl:value-of select="./fullname"/>
188
            </contributorName>
189
        </contributor>
190
    </xsl:template>
191
    <xsl:template match="contributor" mode="rel">
192
        <contributor xmlns="http://datacite.org/schema/kernel-3">
193
            <contributorName>
194
                <xsl:value-of select="./text()"/>
195
            </contributorName>
196
        </contributor>
197
    </xsl:template>
198

    
199

    
200
    <!--publisher (M) from publisher -->
201
    <xsl:template match="//oaf:result/publisher/text()">
202
        <publisher xmlns="http://datacite.org/schema/kernel-3">
203
            <xsl:value-of select="normalize-space(.)"/>
204
        </publisher>
205
    </xsl:template>
206

    
207
    <!-- Publication year (M) -->
208
    <xsl:template match="//oaf:result/dateofacceptance/text()">
209
        <publicationYear xmlns="http://datacite.org/schema/kernel-3">
210
            <xsl:value-of select="normalize-space(substring-before(., '-'))"/>
211
        </publicationYear>
212
    </xsl:template>
213

    
214
    <!-- Language (R) from language@classid -->
215
    <xsl:template match="//oaf:result/language/@classid">
216
        <language xmlns="http://datacite.org/schema/kernel-3">
217
            <xsl:value-of select="."/>
218
        </language>
219
    </xsl:template>
220

    
221
    <!-- ResourceType (R)  -->
222
    <xsl:template match="//oaf:result/resourcetype[./@classname != '']">
223
        <resourceType resourceTypeGeneral="{./@classname}" xmlns="http://datacite.org/schema/kernel-3"/>
224
    </xsl:template>
225

    
226

    
227
    <!-- Version (O) -->
228
    <xsl:template match="//oaf:result/version/text()">
229
        <version xmlns="http://datacite.org/schema/kernel-3">
230
            <xsl:value-of select="."/>
231
        </version>
232
    </xsl:template>
233

    
234
    <!-- Oaf:fields -->
235
    <xsl:template name="oafFields">
236
        <dr:CobjCategory>0021</dr:CobjCategory>
237
        <oaf:dateAccepted>
238
            <xsl:value-of select="//oaf:result/dateofacceptance/text()"/>
239
        </oaf:dateAccepted>
240
        <xsl:if test="//oaf:result/bestlicense/@classid">
241
            <oaf:accessrights>
242
                <xsl:value-of select="//oaf:result/bestlicense/@classid"/>
243
            </oaf:accessrights>
244
        </xsl:if>
245
        <xsl:if test="//oaf:result/bestaccessright/@classid">
246
            <oaf:accessrights>
247
                <xsl:value-of select="//oaf:result/bestaccessright/@classid"/>
248
            </oaf:accessrights>
249
        </xsl:if>
250
        <oaf:language>
251
            <xsl:value-of select="//oaf:result/language/@classid"/>
252
        </oaf:language>
253
        <oaf:hostedby id="infrastruct_::openaire" name="OpenAIRE"/>
254
        <oaf:collectedfrom id="infrastruct_::openaire" name="OpenAIRE"/>
255
        <xsl:if test="//oaf:journal">
256
	        <oaf:journal eissn="{//oaf:result/journal/@eissn}" ep="{//oaf:result/journal/@ep}"
257
	            iss="{//oaf:result/journal/@issn}" issn="{//oaf:result/journal/@issn}"
258
	            lissn="{//oaf:result/journal/@lissn}" sp="{//oaf:result/journal/@sp}"
259
	            vol="{//oaf:result/journal/@vol}">
260
	            <xsl:value-of select="//oaf:result/journal/text()"/>
261
	        </oaf:journal>
262
        </xsl:if>
263
    </xsl:template>
264

    
265
    <!-- Override default template -->
266
    <xsl:template match="text() | @*"/>
267
</xsl:stylesheet>
268

    
269

    
270

    
271
]]></CODE>
272
			</SCRIPT>
273
		</CONFIGURATION>
274
		<STATUS/>
275
		<SECURITY_PARAMETERS/>
276
	</BODY>
277
</RESOURCE_PROFILE>
(4-4/5)