1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="754faf14-fe72-46b3-a219-e0423f8bb732_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2019-04-12T13:51:38+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>xslt_cleaning_datacite</TITLE>
|
14
|
<CODE>
|
15
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
|
16
|
xmlns:oaf="http://namespace.openaire.eu/oaf"
|
17
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
18
|
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
|
19
|
extension-element-prefixes="TransformationFunction"
|
20
|
exclude-result-prefixes="TransformationFunction">
|
21
|
|
22
|
<xsl:param name="varOfficialName"/>
|
23
|
<xsl:param name="varDsType"/>
|
24
|
<xsl:param name="varDataSourceId"/>
|
25
|
<xsl:param name="varFP7" select="'corda_______::'"/>
|
26
|
<xsl:param name="varH2020" select="'corda__h2020::'"/>
|
27
|
<xsl:param name="varHostedByOfficialName" select="'Unknown Repository'"/>
|
28
|
<xsl:param name="varHostedByDataSourceId" select="'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'"/>
|
29
|
|
30
|
<xsl:param name="index" select="0"/>
|
31
|
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
|
32
|
|
33
|
<!-- with the re-change of the CAP, those filters can be turned off -->
|
34
|
<!-- conditions whether content acquisitions are met -->
|
35
|
<!--
|
36
|
<xsl:variable name="varCap1AccRhts" select="TransformationFunction:convertString($tf, subsequence(//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('OPEN', 'OPEN SOURCE')],1,1), 'AccessRights') = ('OPEN', 'OPEN SOURCE')"/>
|
37
|
<xsl:variable name="varCap2LinkPub" select="exists(//*[local-name()='relatedIdentifier'][@relationType = ('IsCitedBy', 'IsDescribedBy','IsDocumentedBy', 'IsReferencedBy', 'Cites', 'Describes', 'Documents', 'References')])"/>
|
38
|
<xsl:variable name="varCap3Project" select="exists(//*[local-name()='fundingReference'][string-length(normalize-space(./*[local-name()='awardNumber']))> 0])"/>
|
39
|
<xsl:variable name="varCap4Comnty" />
|
40
|
-->
|
41
|
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, //*[local-name()='resourceType']/@resourceTypeGeneral, 'TextTypologies')"/>
|
42
|
<xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
|
43
|
|
44
|
<xsl:template match="/">
|
45
|
<xsl:variable name="datasourcePrefix"
|
46
|
select="normalize-space(//oaf:datasourceprefix)"/>
|
47
|
<xsl:call-template name="validRecord"/>
|
48
|
</xsl:template>
|
49
|
|
50
|
<xsl:template name="terminate">
|
51
|
<xsl:message terminate="yes">
|
52
|
record is not compliant, transformation is interrupted.
|
53
|
</xsl:message>
|
54
|
</xsl:template>
|
55
|
|
56
|
<xsl:template name="validRecord">
|
57
|
<record>
|
58
|
<xsl:copy-of select="//*[local-name() = 'header']"/>
|
59
|
|
60
|
<metadata>
|
61
|
|
62
|
<xsl:apply-templates select="//*[local-name() = 'metadata']/*[local-name() = 'resource']"/>
|
63
|
|
64
|
<xsl:if test="//*[local-name()='date']/@dateType='Available'">
|
65
|
<xsl:variable name='varEmbargoEndDate'
|
66
|
select="TransformationFunction:convertString($tf, normalize-space(//*[local-name()='date'][@dateType='Available']), 'DateISO8601')"/>
|
67
|
<xsl:choose>
|
68
|
<xsl:when test="string-length($varEmbargoEndDate) > 0">
|
69
|
<oaf:embargoenddate>
|
70
|
<xsl:value-of select="$varEmbargoEndDate"/>
|
71
|
</oaf:embargoenddate>
|
72
|
</xsl:when>
|
73
|
<xsl:otherwise>
|
74
|
<xsl:call-template name="terminate"/>
|
75
|
</xsl:otherwise>
|
76
|
</xsl:choose>
|
77
|
</xsl:if>
|
78
|
|
79
|
<!--
|
80
|
<xsl:choose>
|
81
|
|
82
|
<xsl:when test="//*[local-name()='resourceType']/@resourceTypeGeneral='Dataset' or //*[local-name()='resourceType']/@resourceTypeGeneral='Software' or //*[local-name()='resourceType']/@resourceTypeGeneral='Film' or //*[local-name()='resourceType']/@resourceTypeGeneral='Sound' or //*[local-name()='resourceType']/@resourceTypeGeneral='PhysicalObject' or //*[local-name()='resourceType']/@resourceTypeGeneral='Audiovisual' or //*[local-name()='resourceType'][@resourceTypeGeneral='Other' and .='Study']">
|
83
|
|
84
|
<xsl:when test="//*[local-name()='resourceType'][lower-case(.)='article'] or lower-case(//*[local-name()='resourceType']/@resourceTypeGeneral)=('dataset', 'software', 'collection', 'film', 'sound', 'physicalobject', 'audiovisual', 'model', 'workflow', 'service', 'image') or //*[local-name()='resourceType'][lower-case(@resourceTypeGeneral)='other' and lower-case(.)='study']">
|
85
|
|
86
|
<dr:CobjCategory>
|
87
|
<xsl:variable name='varCobjCategory'
|
88
|
select="TransformationFunction:convertString($tf, //*[local-name()='resourceType']/@resourceTypeGeneral, 'TextTypologies')" />
|
89
|
<xsl:attribute name="type">
|
90
|
<xsl:value-of select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
|
91
|
</xsl:attribute>
|
92
|
<xsl:value-of
|
93
|
select="$varCobjCategory" />
|
94
|
</dr:CobjCategory>
|
95
|
</xsl:when>
|
96
|
<xsl:otherwise>
|
97
|
<xsl:call-template name="terminate"/>
|
98
|
</xsl:otherwise>
|
99
|
</xsl:choose>
|
100
|
-->
|
101
|
|
102
|
<dr:CobjCategory>
|
103
|
<xsl:attribute name="type">
|
104
|
<xsl:value-of select="$varSuperType"/>
|
105
|
</xsl:attribute>
|
106
|
<xsl:value-of select="$varCobjCategory"/>
|
107
|
</dr:CobjCategory>
|
108
|
|
109
|
<oaf:dateAccepted>
|
110
|
<xsl:value-of select="TransformationFunction:convertString($tf, normalize-space(//*[local-name()='publicationYear']), 'DateISO8601')"/>
|
111
|
</oaf:dateAccepted>
|
112
|
|
113
|
|
114
|
<!--
|
115
|
<xsl:if test="//*[local-name() = 'datasourceprefix'][.='r310e4cd113d'] and not(boolean(//*[local-name() = 'rights']/@rightsURI ) )]">
|
116
|
<xsl:call-template name="terminate"/>
|
117
|
</xsl:if>
|
118
|
-->
|
119
|
|
120
|
<!--
|
121
|
<xsl:choose>
|
122
|
<xsl:when test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')][1]">
|
123
|
<oaf:accessrights>
|
124
|
<xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')][1], 'AccessRights')"/>
|
125
|
</oaf:accessrights>
|
126
|
</xsl:when>
|
127
|
<xsl:when test="//*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
|
128
|
<oaf:accessrights>
|
129
|
<xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"/>
|
130
|
</oaf:accessrights>
|
131
|
</xsl:when>
|
132
|
<xsl:otherwise>
|
133
|
<xsl:choose>
|
134
|
<xsl:when test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'http://creativecommons.org') or starts-with(normalize-space(.), 'Creative Commons')]">
|
135
|
<oaf:accessrights>
|
136
|
<xsl:text>OPEN</xsl:text>
|
137
|
</oaf:accessrights>
|
138
|
</xsl:when>
|
139
|
<xsl:when test="//*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'http://creativecommons.org') or starts-with(normalize-space(.), 'http://opendatacommons.org')]">
|
140
|
<oaf:accessrights>
|
141
|
<xsl:text>OPEN</xsl:text>
|
142
|
</oaf:accessrights>
|
143
|
</xsl:when>
|
144
|
<xsl:otherwise>
|
145
|
<oaf:accessrights>
|
146
|
<xsl:text>UNKNOWN</xsl:text>
|
147
|
</oaf:accessrights>
|
148
|
</xsl:otherwise>
|
149
|
</xsl:choose>
|
150
|
</xsl:otherwise>
|
151
|
</xsl:choose>
|
152
|
-->
|
153
|
|
154
|
<!-- avoiding to check access rights 'synonyms' which are listed in dnet:access_modes -->
|
155
|
<oaf:accessrights>
|
156
|
<xsl:choose>
|
157
|
<xsl:when test="//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('OPEN', 'OPEN SOURCE')]">
|
158
|
<xsl:value-of select="TransformationFunction:convertString($tf, subsequence(//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('OPEN', 'OPEN SOURCE')],1,1), 'AccessRights')"/>
|
159
|
</xsl:when>
|
160
|
<xsl:when test="//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('EMBARGO', '6MONTHS', '12MONTHS')]">
|
161
|
<xsl:value-of select="TransformationFunction:convertString($tf, subsequence(//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('EMBARGO', '6MONTHS', '12MONTHS')],1,1), 'AccessRights')"/>
|
162
|
</xsl:when>
|
163
|
<xsl:when test="//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('RESTRICTED')]">
|
164
|
<xsl:value-of select="TransformationFunction:convertString($tf, subsequence(//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('RESTRICTED')],1,1), 'AccessRights')"/>
|
165
|
</xsl:when>
|
166
|
<xsl:when test="//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('CLOSED', 'OTHER')]">
|
167
|
<xsl:value-of select="TransformationFunction:convertString($tf, subsequence(//*[local-name() = 'rights']/(., @rightsURI)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('CLOSED', 'OTHER')],1,1), 'AccessRights')"/>
|
168
|
</xsl:when>
|
169
|
<xsl:otherwise>
|
170
|
<xsl:value-of select="TransformationFunction:convertString($tf, subsequence(//*[local-name() = 'rights']/(., @rightsURI),1,1), 'AccessRights')"/>
|
171
|
</xsl:otherwise>
|
172
|
</xsl:choose>
|
173
|
</oaf:accessrights>
|
174
|
|
175
|
<xsl:for-each select="//*[local-name()='rights']/@rightsURI[starts-with(normalize-space(.), 'http') and matches(., '.*(/licenses|/publicdomain|unlicense.org/|/legal-and-data-protection-notices|/download/license|/open-government-licence).*')]">
|
176
|
<oaf:license>
|
177
|
<xsl:copy-of select="normalize-space(.)"/>
|
178
|
</oaf:license>
|
179
|
</xsl:for-each>
|
180
|
|
181
|
<oaf:language>
|
182
|
<xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')"/>
|
183
|
</oaf:language>
|
184
|
|
185
|
<!--
|
186
|
<xsl:if test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics/embargoedAccess')]">
|
187
|
<oaf:embargoenddate>
|
188
|
<xsl:value-of select="//*[local-name()='date']/@dateType='Available'"/>
|
189
|
</oaf:embargoenddate>
|
190
|
</xsl:if>
|
191
|
-->
|
192
|
|
193
|
<xsl:for-each select="//*[local-name()='nameIdentifier']">
|
194
|
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')">
|
195
|
<oaf:projectid>
|
196
|
<xsl:value-of select="concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
|
197
|
</oaf:projectid>
|
198
|
</xsl:if>
|
199
|
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')">
|
200
|
<oaf:projectid>
|
201
|
<xsl:value-of select="concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
|
202
|
</oaf:projectid>
|
203
|
</xsl:if>
|
204
|
</xsl:for-each>
|
205
|
|
206
|
<oaf:hostedBy>
|
207
|
<xsl:attribute name="name">
|
208
|
<xsl:value-of select="$varHostedByOfficialName"/>
|
209
|
</xsl:attribute>
|
210
|
<xsl:attribute name="id">
|
211
|
<xsl:value-of select="$varHostedByDataSourceId"/>
|
212
|
</xsl:attribute>
|
213
|
</oaf:hostedBy>
|
214
|
<oaf:collectedFrom>
|
215
|
<xsl:attribute name="name">
|
216
|
<xsl:value-of select="$varOfficialName"/>
|
217
|
</xsl:attribute>
|
218
|
<xsl:attribute name="id">
|
219
|
<xsl:value-of select="$varDataSourceId"/>
|
220
|
</xsl:attribute>
|
221
|
</oaf:collectedFrom>
|
222
|
|
223
|
<!-- with the re-change of the CAP, those filters can be turned off -->
|
224
|
<!--
|
225
|
<xsl:call-template name="cap" />
|
226
|
-->
|
227
|
|
228
|
</metadata>
|
229
|
<xsl:copy-of select="//*[local-name() = 'about']"/>
|
230
|
</record>
|
231
|
</xsl:template>
|
232
|
|
233
|
<xsl:template match="node()|@*">
|
234
|
<xsl:copy>
|
235
|
<xsl:apply-templates select="node()|@*"/>
|
236
|
</xsl:copy>
|
237
|
</xsl:template>
|
238
|
|
239
|
<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
|
240
|
<xsl:copy>
|
241
|
<xsl:apply-templates select="node()|@*"/>
|
242
|
</xsl:copy>
|
243
|
</xsl:template>
|
244
|
|
245
|
<xsl:template match="//*[local-name() = 'resource']/*[local-name()='alternateIdentifiers']">
|
246
|
<xsl:element name="alternateIdentifiers" namespace="http://www.openarchives.org/OAI/2.0/">
|
247
|
|
248
|
<xsl:copy-of select="./*"/>
|
249
|
|
250
|
<xsl:if test="//*[local-name() = 'resource']/*[local-name()='identifier'][@identifierType='Handle']">
|
251
|
<xsl:element name="alternateIdentifier" namespace="http://www.openarchives.org/OAI/2.0/">
|
252
|
<xsl:attribute name="alternateIdentifierType">
|
253
|
<xsl:value-of select="'URL'"/>
|
254
|
</xsl:attribute>
|
255
|
<xsl:value-of
|
256
|
select="concat('http://hdl.handle.net/', //*[local-name() = 'resource']/*[local-name()='identifier'])"/>
|
257
|
</xsl:element>
|
258
|
</xsl:if>
|
259
|
|
260
|
<xsl:if test="//*[local-name() = 'resource']/*[local-name()='identifier'][@identifierType='URN']">
|
261
|
<xsl:element name="alternateIdentifier" namespace="http://www.openarchives.org/OAI/2.0/">
|
262
|
<xsl:attribute name="alternateIdentifierType">
|
263
|
<xsl:value-of select="'URL'"/>
|
264
|
</xsl:attribute>
|
265
|
<xsl:value-of
|
266
|
select="concat('http://nbn-resolving.org/', //*[local-name() = 'resource']/*[local-name()='identifier'])"/>
|
267
|
</xsl:element>
|
268
|
</xsl:if>
|
269
|
|
270
|
<xsl:if test="//*[local-name() = 'resource']/*[local-name()='identifier'][@identifierType='DOI']">
|
271
|
<xsl:element name="alternateIdentifier" namespace="http://www.openarchives.org/OAI/2.0/">
|
272
|
<xsl:attribute name="alternateIdentifierType">
|
273
|
<xsl:value-of select="'URL'"/>
|
274
|
</xsl:attribute>
|
275
|
<xsl:value-of
|
276
|
select="concat('http://dx.doi.org/', //*[local-name() = 'resource']/*[local-name()='identifier'])"/>
|
277
|
</xsl:element>
|
278
|
</xsl:if>
|
279
|
|
280
|
</xsl:element>
|
281
|
|
282
|
</xsl:template>
|
283
|
|
284
|
<xsl:template match="//*[local-name() = 'resource']/*[local-name()='identifier']">
|
285
|
<xsl:copy-of select="."/>
|
286
|
<xsl:if test="not(//*[local-name() = 'resource']/*[local-name()='alternateIdentifiers'])">
|
287
|
<xsl:element name="alternateIdentifiers" namespace="http://www.openarchives.org/OAI/2.0/">
|
288
|
<xsl:if test=".[@identifierType='Handle']">
|
289
|
<xsl:element name="alternateIdentifier" namespace="http://www.openarchives.org/OAI/2.0/">
|
290
|
<xsl:attribute name="alternateIdentifierType">
|
291
|
<xsl:value-of select="'URL'"/>
|
292
|
</xsl:attribute>
|
293
|
<xsl:value-of
|
294
|
select="concat('http://hdl.handle.net/', .)"/>
|
295
|
</xsl:element>
|
296
|
</xsl:if>
|
297
|
<xsl:if test=".[@identifierType='URN']">
|
298
|
<xsl:element name="alternateIdentifier" namespace="http://www.openarchives.org/OAI/2.0/">
|
299
|
<xsl:attribute name="alternateIdentifierType">
|
300
|
<xsl:value-of select="'URL'"/>
|
301
|
</xsl:attribute>
|
302
|
<xsl:value-of
|
303
|
select="concat('http://nbn-resolving.org/', .)"/>
|
304
|
</xsl:element>
|
305
|
</xsl:if>
|
306
|
<xsl:if test=".[@identifierType='DOI']">
|
307
|
<xsl:element name="alternateIdentifier" namespace="http://www.openarchives.org/OAI/2.0/">
|
308
|
<xsl:attribute name="alternateIdentifierType">
|
309
|
<xsl:value-of select="'URL'"/>
|
310
|
</xsl:attribute>
|
311
|
<xsl:value-of
|
312
|
select="concat('http://dx.doi.org/', .)"/>
|
313
|
</xsl:element>
|
314
|
</xsl:if>
|
315
|
|
316
|
</xsl:element>
|
317
|
</xsl:if>
|
318
|
|
319
|
</xsl:template>
|
320
|
|
321
|
<!--
|
322
|
<xsl:template match="//*[local-name()='language']">
|
323
|
<oaf:language>
|
324
|
<xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
|
325
|
</oaf:language>
|
326
|
</xsl:template>
|
327
|
-->
|
328
|
|
329
|
<!-- with the re-change of the CAP, those filters can be turned off -->
|
330
|
<!-- drop record if content acquisition policy is not met -->
|
331
|
<!--
|
332
|
<xsl:template name="cap">
|
333
|
<xsl:if test="not($varSuperType = 'publication' or ($varCap1AccRhts or $varCap2LinkPub or $varCap3Project or $varCap4Comnty))">
|
334
|
<xsl:call-template name="terminate"/>
|
335
|
</xsl:if>
|
336
|
</xsl:template>
|
337
|
-->
|
338
|
|
339
|
</xsl:stylesheet>
|
340
|
</CODE>
|
341
|
</SCRIPT>
|
342
|
</CONFIGURATION>
|
343
|
<STATUS/>
|
344
|
<SECURITY_PARAMETERS/>
|
345
|
</BODY>
|
346
|
</RESOURCE_PROFILE>
|