1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="b703be53-e2e9-4de3-ba94-210ea4a96b82_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2019-03-27T09:42:01+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>xslt_cleaning_ORP-biotools</TITLE>
|
14
|
<CODE><![CDATA[
|
15
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
|
16
|
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
17
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
18
|
xmlns:datacite="http://datacite.org/schema/kernel-4" xmlns:functx="http://www.functx.com"
|
19
|
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
|
20
|
extension-element-prefixes="TransformationFunction"
|
21
|
exclude-result-prefixes="TransformationFunction">
|
22
|
|
23
|
<xsl:function xmlns:functx="http://www.functx.com" name="functx:value-intersect" as="xs:anyAtomicType*">
|
24
|
<xsl:param name="arg1" as="xs:anyAtomicType*"/>
|
25
|
<xsl:param name="arg2" as="xs:anyAtomicType*"/>
|
26
|
<xsl:sequence select=" distinct-values($arg1[.=$arg2]) "/>
|
27
|
</xsl:function>
|
28
|
|
29
|
<xsl:param name="varOfficialName"/>
|
30
|
<xsl:param name="varDsType"/>
|
31
|
<xsl:param name="varDataSourceId"/>
|
32
|
<xsl:param name="index" select="0"/>
|
33
|
<xsl:param name="transDate" select="current-dateTime()"/>
|
34
|
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
|
35
|
|
36
|
<!-- TODO: ADD HERE THE LIST OF AUTHORS' EMAILS-->
|
37
|
<xsl:variable name="elixirGRAuthorMails"
|
38
|
select="()"/>
|
39
|
<xsl:template match="/">
|
40
|
<xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
|
41
|
<xsl:call-template name="validRecord"/>
|
42
|
</xsl:template>
|
43
|
|
44
|
<xsl:template name="terminate">
|
45
|
<xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
|
46
|
</xsl:message>
|
47
|
</xsl:template>
|
48
|
|
49
|
<xsl:template name="validRecord">
|
50
|
<record>
|
51
|
<xsl:apply-templates select="//*[local-name() = 'header']"/>
|
52
|
|
53
|
<metadata>
|
54
|
|
55
|
<!--
|
56
|
<xsl:apply-templates select="//*[local-name() = 'metadata']//*[local-name() = 'list']"/>
|
57
|
-->
|
58
|
|
59
|
<datacite:resource>
|
60
|
|
61
|
|
62
|
<datacite:resourceType>
|
63
|
<xsl:attribute name="resourceTypeGeneral" select="'Software'"/>
|
64
|
<xsl:value-of select="//*[local-name() = 'toolType']"/>
|
65
|
</datacite:resourceType>
|
66
|
|
67
|
<xsl:for-each select="//*[local-name() = 'language']">
|
68
|
<datacite:format>
|
69
|
<xsl:value-of select="."/>
|
70
|
</datacite:format>
|
71
|
</xsl:for-each>
|
72
|
|
73
|
<!-- DOE CODE does not state languages; projects/funding: funders not known to OpenAIRE
|
74
|
-->
|
75
|
|
76
|
<datacite:publisher>
|
77
|
<xsl:value-of select="$varOfficialName"/>
|
78
|
</datacite:publisher>
|
79
|
|
80
|
<datacite:relatedIdentifiers>
|
81
|
<xsl:for-each
|
82
|
select="//*[local-name() = 'documentation'][not(./*[local-name() = 'type'] = ('Terms of use', 'Citation instructions', 'Contributions policy', 'Governance'))]">
|
83
|
<datacite:relatedIdentifier>
|
84
|
<xsl:attribute name="relatedIdentifierType" select="'URL'"/>
|
85
|
<xsl:attribute name="relationType" select="'IsDocumentedBy'"/>
|
86
|
<xsl:value-of select="./*[local-name() = 'url']"/>
|
87
|
</datacite:relatedIdentifier>
|
88
|
</xsl:for-each>
|
89
|
<!-- paper references -->
|
90
|
<xsl:call-template name="relatedPaper"/>
|
91
|
</datacite:relatedIdentifiers>
|
92
|
|
93
|
<datacite:alternateIdentifiers>
|
94
|
<!-- landing page, documentation, distribution -->
|
95
|
<datacite:alternateIdentifier>
|
96
|
<xsl:attribute name="alternateIdentifierType" select="'LandingPage'"/>
|
97
|
<xsl:value-of
|
98
|
select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
|
99
|
</datacite:alternateIdentifier>
|
100
|
|
101
|
<!--
|
102
|
<xsl:for-each select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[local-name() = 'link'][./*[local-name() = 'url' and starts-with(., 'https://github.com/')]]/*[local-name() = 'url']/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
|
103
|
-->
|
104
|
<xsl:for-each
|
105
|
select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[starts-with(., 'https://github.com/') and contains(., concat('/', //*[local-name() = 'id']))]/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
|
106
|
<datacite:alternateIdentifier>
|
107
|
<xsl:attribute name="alternateIdentifierType"
|
108
|
select="'DistributionLocation'"/>
|
109
|
<xsl:value-of select="."/>
|
110
|
</datacite:alternateIdentifier>
|
111
|
</xsl:for-each>
|
112
|
|
113
|
<!-- identifier -->
|
114
|
<datacite:alternateIdentifier>
|
115
|
<xsl:attribute name="alternateIdentifierType"
|
116
|
select="'local accession id'"/>
|
117
|
<xsl:value-of select="//*[local-name() = 'id']"/>
|
118
|
</datacite:alternateIdentifier>
|
119
|
</datacite:alternateIdentifiers>
|
120
|
|
121
|
<datacite:identifier>
|
122
|
<xsl:attribute name="identifierType" select="'URL'"/>
|
123
|
<xsl:value-of
|
124
|
select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
|
125
|
</datacite:identifier>
|
126
|
|
127
|
<!-- title -->
|
128
|
<datacite:titles>
|
129
|
<datacite:title>
|
130
|
<xsl:value-of
|
131
|
select="//*[local-name() = 'list']/*[local-name() = 'name']"/>
|
132
|
</datacite:title>
|
133
|
</datacite:titles>
|
134
|
|
135
|
<!-- version -->
|
136
|
<xsl:if
|
137
|
test="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]">
|
138
|
<datacite:version>
|
139
|
<xsl:value-of
|
140
|
select="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]"
|
141
|
/>
|
142
|
</datacite:version>
|
143
|
</xsl:if>
|
144
|
|
145
|
<!-- bio.tools' credit/typeRole Developer/... is not identical with statements on GitHub ??? (Scoary) -->
|
146
|
<xsl:call-template name="authors"/>
|
147
|
|
148
|
<datacite:contributors>
|
149
|
<xsl:for-each
|
150
|
select="//*[local-name() = 'contact']/*[local-name() = 'name' and not(. = 'null')]">
|
151
|
<xsl:variable name="varContributorName"
|
152
|
select="TransformationFunction:convertString($tf, ., 'Person')"/>
|
153
|
<datacite:contributor>
|
154
|
<xsl:attribute name="contributorType" select="'ContactPerson'"/>
|
155
|
<datacite:contributorName>
|
156
|
<xsl:value-of select="$varContributorName"/>
|
157
|
</datacite:contributorName>
|
158
|
<datacite:givenName>
|
159
|
<xsl:value-of
|
160
|
select="substring-after($varContributorName, ', ')"/>
|
161
|
</datacite:givenName>
|
162
|
<datacite:familyName>
|
163
|
<xsl:value-of
|
164
|
select="substring-before($varContributorName, ', ')"/>
|
165
|
</datacite:familyName>
|
166
|
</datacite:contributor>
|
167
|
</xsl:for-each>
|
168
|
</datacite:contributors>
|
169
|
|
170
|
<datacite:descriptions>
|
171
|
<datacite:description>
|
172
|
<xsl:attribute name="descriptionType">
|
173
|
<xsl:value-of select="'Abstract'"/>
|
174
|
</xsl:attribute>
|
175
|
<xsl:value-of select="//*[local-name() = 'description']"/>
|
176
|
</datacite:description>
|
177
|
|
178
|
<!--
|
179
|
<xsl:for-each select="//*[local-name() = 'operatingSystem'], //*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
|
180
|
-->
|
181
|
|
182
|
<xsl:for-each
|
183
|
select="//*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
|
184
|
<datacite:description>
|
185
|
<xsl:attribute name="descriptionType" select="'Abstract'"/>
|
186
|
<xsl:value-of select="."/>
|
187
|
</datacite:description>
|
188
|
</xsl:for-each>
|
189
|
|
190
|
<xsl:for-each select="//*[local-name() = 'operatingSystem']">
|
191
|
<datacite:description>
|
192
|
<xsl:attribute name="descriptionType" select="'TechnicalInfo'"/>
|
193
|
<xsl:value-of select="."/>
|
194
|
</datacite:description>
|
195
|
</xsl:for-each>
|
196
|
|
197
|
</datacite:descriptions>
|
198
|
|
199
|
<!-- subject -->
|
200
|
<!-- dropping duplicate topics - funny that this seemingly works -->
|
201
|
<datacite:subjects>
|
202
|
<xsl:for-each
|
203
|
select="//*[local-name() = 'topic'][index-of(distinct-values(//*[local-name() = 'topic']/*[local-name() = 'uri']), ./*[local-name() = 'uri'])]">
|
204
|
<xsl:if test=".">
|
205
|
<datacite:subject>
|
206
|
<xsl:attribute name="subjectScheme" select="'EDAM Ontology'"/>
|
207
|
<xsl:attribute name="schemeURI"
|
208
|
select="'http://edamontology.org'"/>
|
209
|
<xsl:attribute name="valueURI"
|
210
|
select="./*[local-name() = 'uri']"/>
|
211
|
<xsl:value-of select="./*[local-name() = 'term']"/>
|
212
|
</datacite:subject>
|
213
|
</xsl:if>
|
214
|
</xsl:for-each>
|
215
|
</datacite:subjects>
|
216
|
|
217
|
</datacite:resource>
|
218
|
|
219
|
<!--
|
220
|
CobjCategory, SuperType
|
221
|
-->
|
222
|
<xsl:variable name="varCobjCategory" select="'0029'"/>
|
223
|
<xsl:variable name="varSuperType"
|
224
|
select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
|
225
|
<dr:CobjCategory>
|
226
|
<xsl:attribute name="type" select="$varSuperType"/>
|
227
|
<xsl:value-of select="$varCobjCategory"/>
|
228
|
</dr:CobjCategory>
|
229
|
|
230
|
<!--
|
231
|
access rights, licenses
|
232
|
-->
|
233
|
<xsl:for-each
|
234
|
select="//*[local-name() = ('license', 'accessibility') and not(. = 'null')]">
|
235
|
<oaf:accessrights>
|
236
|
<xsl:variable name="varAccessRights"
|
237
|
select="TransformationFunction:convertString($tf, ., 'AccessRights')"/>
|
238
|
<xsl:choose>
|
239
|
<xsl:when
|
240
|
test="$varAccessRights = ('OPEN', 'OPEN SOURCE') and $varSuperType = 'software'">
|
241
|
<xsl:value-of select="'OPEN SOURCE'"/>
|
242
|
</xsl:when>
|
243
|
<xsl:otherwise>
|
244
|
<xsl:value-of select="$varAccessRights"/>
|
245
|
</xsl:otherwise>
|
246
|
</xsl:choose>
|
247
|
</oaf:accessrights>
|
248
|
</xsl:for-each>
|
249
|
|
250
|
<xsl:for-each select="//*[local-name() = 'license' and not(. = 'null')]">
|
251
|
<oaf:license>
|
252
|
<xsl:value-of select="."/>
|
253
|
</oaf:license>
|
254
|
</xsl:for-each>
|
255
|
|
256
|
<oaf:hostedBy>
|
257
|
<xsl:attribute name="name" select="$varOfficialName"/>
|
258
|
<xsl:attribute name="id" select="$varDataSourceId"/>
|
259
|
</oaf:hostedBy>
|
260
|
<oaf:collectedFrom>
|
261
|
<xsl:attribute name="name" select="$varOfficialName"/>
|
262
|
<xsl:attribute name="id" select="$varDataSourceId"/>
|
263
|
</oaf:collectedFrom>
|
264
|
|
265
|
<!--
|
266
|
<oaf:identifier>
|
267
|
<xsl:value-of select="//*[local-name() = 'id']"/>
|
268
|
</oaf:identifier>
|
269
|
-->
|
270
|
|
271
|
<xsl:variable name="authorMails" select="//contact/email"/>
|
272
|
<xsl:if test="count(functx:value-intersect($authorMails, $elixirGRAuthorMails)) > 0">
|
273
|
<oaf:concept>
|
274
|
<xsl:attribute name="id" select="'elixir-gr'"/>
|
275
|
</oaf:concept>
|
276
|
</xsl:if>
|
277
|
|
278
|
|
279
|
<!-- date -->
|
280
|
<oaf:dateAccepted>
|
281
|
<xsl:value-of
|
282
|
select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
|
283
|
</oaf:dateAccepted>
|
284
|
|
285
|
</metadata>
|
286
|
<xsl:copy-of select="//*[local-name() = 'about']"/>
|
287
|
</record>
|
288
|
|
289
|
</xsl:template>
|
290
|
|
291
|
<xsl:template match="node() | @*">
|
292
|
<xsl:copy>
|
293
|
<xsl:apply-templates select="node() | @*"/>
|
294
|
</xsl:copy>
|
295
|
</xsl:template>
|
296
|
|
297
|
<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
|
298
|
<xsl:copy>
|
299
|
<xsl:apply-templates select="node() | @*"/>
|
300
|
</xsl:copy>
|
301
|
</xsl:template>
|
302
|
|
303
|
<xsl:template match="//*[local-name() = 'header']">
|
304
|
<xsl:copy>
|
305
|
<xsl:apply-templates select="node() | @*"/>
|
306
|
<xsl:element name="dr:dateOfTransformation">
|
307
|
<xsl:value-of select="$transDate"/>
|
308
|
</xsl:element>
|
309
|
</xsl:copy>
|
310
|
</xsl:template>
|
311
|
|
312
|
<!--
|
313
|
<xsl:template match="//*[local-name() = 'authors']">
|
314
|
-->
|
315
|
<xsl:template name="authors">
|
316
|
<xsl:choose>
|
317
|
<xsl:when
|
318
|
test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']][./*[local-name() = 'name' and not(. = 'null')]])">
|
319
|
<xsl:call-template name="terminate"/>
|
320
|
</xsl:when>
|
321
|
<xsl:otherwise>
|
322
|
<datacite:creators>
|
323
|
<xsl:for-each
|
324
|
select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']]/*[local-name() = 'name' and not(. = 'null')]">
|
325
|
<xsl:for-each select="tokenize(., ', ')">
|
326
|
<xsl:variable name="varDeveloperName"
|
327
|
select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
|
328
|
<datacite:creator>
|
329
|
<datacite:creatorName>
|
330
|
<xsl:value-of select="$varDeveloperName"/>
|
331
|
</datacite:creatorName>
|
332
|
<datacite:givenName>
|
333
|
<xsl:value-of select="substring-after($varDeveloperName, ', ')"
|
334
|
/>
|
335
|
</datacite:givenName>
|
336
|
<datacite:familyName>
|
337
|
<xsl:value-of select="substring-before($varDeveloperName, ', ')"
|
338
|
/>
|
339
|
</datacite:familyName>
|
340
|
<!--
|
341
|
<xsl:if test="string-length(./*[local-name() = 'orcid']) > 0">
|
342
|
<xsl:element name="datacite:nameIdentifier">
|
343
|
<xsl:attribute name="nameIdentifierScheme" select="'ORCID'"/>
|
344
|
<xsl:attribute name="schemeURI" select="'http://orcid.org'"/>
|
345
|
<xsl:value-of select="./*[local-name()='orcid']"/>
|
346
|
</xsl:element>
|
347
|
</xsl:if>
|
348
|
<xsl:for-each select="./*[local-name() = 'affiliations'][string-length(.) > 0]">
|
349
|
<xsl:element name="datacite:affiliation">
|
350
|
<xsl:value-of select="."/>
|
351
|
</xsl:element>
|
352
|
</xsl:for-each>
|
353
|
-->
|
354
|
</datacite:creator>
|
355
|
</xsl:for-each>
|
356
|
</xsl:for-each>
|
357
|
</datacite:creators>
|
358
|
</xsl:otherwise>
|
359
|
</xsl:choose>
|
360
|
</xsl:template>
|
361
|
|
362
|
<!--
|
363
|
<xsl:template match="//*[local-name() = 'DOI']">
|
364
|
-->
|
365
|
<xsl:template name="relatedPaper">
|
366
|
<xsl:for-each
|
367
|
select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
|
368
|
<xsl:element name="datacite:relatedIdentifier">
|
369
|
<xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
|
370
|
<xsl:attribute name="relationType">
|
371
|
<xsl:choose>
|
372
|
<xsl:when test="../*[local-name() = 'type'] = 'Primary'">
|
373
|
<xsl:value-of select="'isSupplementTo'"/>
|
374
|
</xsl:when>
|
375
|
<xsl:when
|
376
|
test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
|
377
|
<xsl:value-of select="'isReviewedBy'"/>
|
378
|
</xsl:when>
|
379
|
<xsl:when test="../*[local-name() = 'type'] = 'Usage'">
|
380
|
<xsl:value-of select="'isReferencedBy'"/>
|
381
|
</xsl:when>
|
382
|
<xsl:when test="../*[local-name() = 'type'] = 'Method'">
|
383
|
<xsl:value-of select="'references'"/>
|
384
|
</xsl:when>
|
385
|
<xsl:otherwise>
|
386
|
<xsl:value-of select="'isReferencedBy'"/>
|
387
|
</xsl:otherwise>
|
388
|
</xsl:choose>
|
389
|
</xsl:attribute>
|
390
|
<xsl:value-of select="."/>
|
391
|
</xsl:element>
|
392
|
</xsl:for-each>
|
393
|
</xsl:template>
|
394
|
|
395
|
</xsl:stylesheet>
|
396
|
]]>
|
397
|
</CODE>
|
398
|
</SCRIPT>
|
399
|
</CONFIGURATION>
|
400
|
<STATUS/>
|
401
|
<SECURITY_PARAMETERS/>
|
402
|
</BODY>
|
403
|
</RESOURCE_PROFILE>
|