Project

General

Profile

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
                <!-- Check for person emails and elixirNode if we can set the concept for ELIXIR-GR -->
272
                <xsl:variable name="authorMails" select="//contact/email"/>
273
                <xsl:if test="//elixirNode = 'Greece' or count(functx:value-intersect($authorMails, $elixirGRAuthorMails)) > 0">
274
                    <oaf:concept>
275
                        <xsl:attribute name="id" select="'elixir-gr'"/>
276
                    </oaf:concept>
277
                </xsl:if>
278

    
279

    
280
                <!-- date -->
281
                <oaf:dateAccepted>
282
                    <xsl:value-of
283
                        select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
284
                </oaf:dateAccepted>
285

    
286
            </metadata>
287
            <xsl:copy-of select="//*[local-name() = 'about']"/>
288
        </record>
289

    
290
    </xsl:template>
291

    
292
    <xsl:template match="node() | @*">
293
        <xsl:copy>
294
            <xsl:apply-templates select="node() | @*"/>
295
        </xsl:copy>
296
    </xsl:template>
297

    
298
    <xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
299
        <xsl:copy>
300
            <xsl:apply-templates select="node() | @*"/>
301
        </xsl:copy>
302
    </xsl:template>
303

    
304
    <xsl:template match="//*[local-name() = 'header']">
305
        <xsl:copy>
306
            <xsl:apply-templates select="node() | @*"/>
307
            <xsl:element name="dr:dateOfTransformation">
308
                <xsl:value-of select="$transDate"/>
309
            </xsl:element>
310
        </xsl:copy>
311
    </xsl:template>
312

    
313
    <!--
314
						<xsl:template match="//*[local-name() = 'authors']">
315
						-->
316
    <xsl:template name="authors">
317
        <xsl:choose>
318
            <xsl:when
319
                test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']][./*[local-name() = 'name' and not(. = 'null')]])">
320
                <xsl:call-template name="terminate"/>
321
            </xsl:when>
322
            <xsl:otherwise>
323
                <datacite:creators>
324
                    <xsl:for-each
325
                        select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']]/*[local-name() = 'name' and not(. = 'null')]">
326
                        <xsl:for-each select="tokenize(., ', ')">
327
                            <xsl:variable name="varDeveloperName"
328
                                select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
329
                            <datacite:creator>
330
                                <datacite:creatorName>
331
                                    <xsl:value-of select="$varDeveloperName"/>
332
                                </datacite:creatorName>
333
                                <datacite:givenName>
334
                                    <xsl:value-of select="substring-after($varDeveloperName, ', ')"
335
                                    />
336
                                </datacite:givenName>
337
                                <datacite:familyName>
338
                                    <xsl:value-of select="substring-before($varDeveloperName, ', ')"
339
                                    />
340
                                </datacite:familyName>
341
                                <!--
342
													<xsl:if test="string-length(./*[local-name() = 'orcid']) > 0">
343
													<xsl:element name="datacite:nameIdentifier">
344
													<xsl:attribute name="nameIdentifierScheme" select="'ORCID'"/>
345
													<xsl:attribute name="schemeURI" select="'http://orcid.org'"/>
346
													<xsl:value-of select="./*[local-name()='orcid']"/>
347
													</xsl:element>
348
													</xsl:if>
349
													<xsl:for-each select="./*[local-name() = 'affiliations'][string-length(.) > 0]">
350
													<xsl:element name="datacite:affiliation">
351
													<xsl:value-of select="."/>
352
													</xsl:element>
353
													</xsl:for-each>
354
													-->
355
                            </datacite:creator>
356
                        </xsl:for-each>
357
                    </xsl:for-each>
358
                </datacite:creators>
359
            </xsl:otherwise>
360
        </xsl:choose>
361
    </xsl:template>
362

    
363
    <!--
364
						<xsl:template match="//*[local-name() = 'DOI']">
365
						-->
366
    <xsl:template name="relatedPaper">
367
        <xsl:for-each
368
            select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
369
            <xsl:element name="datacite:relatedIdentifier">
370
                <xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
371
                <xsl:attribute name="relationType">
372
                    <xsl:choose>
373
                        <xsl:when test="../*[local-name() = 'type'] = 'Primary'">
374
                            <xsl:value-of select="'isSupplementTo'"/>
375
                        </xsl:when>
376
                        <xsl:when
377
                            test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
378
                            <xsl:value-of select="'isReviewedBy'"/>
379
                        </xsl:when>
380
                        <xsl:when test="../*[local-name() = 'type'] = 'Usage'">
381
                            <xsl:value-of select="'isReferencedBy'"/>
382
                        </xsl:when>
383
                        <xsl:when test="../*[local-name() = 'type'] = 'Method'">
384
                            <xsl:value-of select="'references'"/>
385
                        </xsl:when>
386
                        <xsl:otherwise>
387
                            <xsl:value-of select="'isReferencedBy'"/>
388
                        </xsl:otherwise>
389
                    </xsl:choose>
390
                </xsl:attribute>
391
                <xsl:value-of select="."/>
392
            </xsl:element>
393
        </xsl:for-each>
394
    </xsl:template>
395

    
396
</xsl:stylesheet>
397
]]>
398
				</CODE>
399
			</SCRIPT>
400
		</CONFIGURATION>
401
		<STATUS/>
402
		<SECURITY_PARAMETERS/>
403
	</BODY>
404
</RESOURCE_PROFILE>
(51-51/54)