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>
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:datacite="http://datacite.org/schema/kernel-4"
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:param name="varOfficialName"/>
24
						<xsl:param name="varDsType"/>
25
						<xsl:param name="varDataSourceId"/>
26
						<xsl:param name="index" select="0"/>
27
						<xsl:param name="transDate" select="current-dateTime()"/>
28
						<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
29

    
30
						<xsl:template match="/">
31
							<xsl:variable name="datasourcePrefix"
32
							              select="normalize-space(//oaf:datasourceprefix)"/>
33
							<xsl:call-template name="validRecord"/>
34
						</xsl:template>
35

    
36
						<xsl:template name="terminate">
37
							<xsl:message terminate="yes">
38
								record is not compliant, transformation is interrupted.
39
							</xsl:message>
40
						</xsl:template>
41

    
42
						<xsl:template name="validRecord">
43
							<record>
44
								<xsl:apply-templates select="//*[local-name() = 'header']"/>
45

    
46
								<metadata>
47

    
48
									<!--
49
									<xsl:apply-templates select="//*[local-name() = 'metadata']//*[local-name() = 'list']"/>
50
									-->
51

    
52
									<datacite:resource>
53

    
54

    
55
										<datacite:resourceType>
56
											<xsl:attribute name="resourceTypeGeneral" select="'Software'"/>
57
											<xsl:value-of select="//*[local-name() = 'toolType']"/>
58
										</datacite:resourceType>
59

    
60
										<xsl:for-each select="//*[local-name() = 'language']">
61
											<datacite:format>
62
												<xsl:value-of select="."/>
63
											</datacite:format>
64
										</xsl:for-each>
65

    
66
										<!-- DOE CODE does not state languages; projects/funding: funders not known to OpenAIRE
67
										-->
68

    
69
										<datacite:publisher>
70
											<xsl:value-of select="$varOfficialName"/>
71
										</datacite:publisher>
72

    
73
										<datacite:relatedIdentifiers>
74
											<xsl:for-each select="//*[local-name() = 'documentation'][not(./*[local-name() = 'type'] = ('Terms of use', 'Citation instructions', 'Contributions policy', 'Governance'))]">
75
												<datacite:relatedIdentifier>
76
													<xsl:attribute name="relatedIdentifierType" select="'URL'"/>
77
													<xsl:attribute name="relationType" select="'IsDocumentedBy'"/>
78
													<xsl:value-of select="./*[local-name() = 'url']"/>
79
												</datacite:relatedIdentifier>
80
											</xsl:for-each>
81
											<!-- paper references -->
82
											<xsl:call-template name="relatedPaper"/>
83
										</datacite:relatedIdentifiers>
84

    
85
										<datacite:alternateIdentifiers>
86
											<!-- landing page, documentation, distribution -->
87
											<datacite:alternateIdentifier>
88
												<xsl:attribute name="alternateIdentifierType" select="'LandingPage'"/>
89
												<xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
90
											</datacite:alternateIdentifier>
91

    
92
											<!--
93
											<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')))">
94
											-->
95
											<xsl:for-each 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')))">
96
												<datacite:alternateIdentifier>
97
													<xsl:attribute name="alternateIdentifierType" select="'DistributionLocation'"/>
98
													<xsl:value-of select="."/>
99
												</datacite:alternateIdentifier>
100
											</xsl:for-each>
101

    
102
											<!-- identifier -->
103
											<datacite:alternateIdentifier>
104
												<xsl:attribute name="alternateIdentifierType" select="'local accession id'"/>
105
												<xsl:value-of select="//*[local-name() = 'id']"/>
106
											</datacite:alternateIdentifier>
107
										</datacite:alternateIdentifiers>
108

    
109
										<datacite:identifier>
110
											<xsl:attribute name="identifierType" select="'URL'"/>
111
											<xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
112
										</datacite:identifier>
113

    
114
										<!-- title -->
115
										<datacite:titles>
116
											<datacite:title>
117
												<xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'name']"/>
118
											</datacite:title>
119
										</datacite:titles>
120

    
121
										<!-- version -->
122
										<xsl:if test="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]">
123
											<datacite:version>
124
												<xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]"/>
125
											</datacite:version>
126
										</xsl:if>
127

    
128
										<!-- bio.tools' credit/typeRole Developer/... is not identical with statements on GitHub ??? (Scoary) -->
129
										<xsl:call-template name="authors"/>
130

    
131
										<datacite:contributors>
132
											<xsl:for-each select="//*[local-name() = 'contact']/*[local-name() = 'name' and not(. = 'null')]">
133
												<xsl:variable name="varContributorName" select="TransformationFunction:convertString($tf, ., 'Person')"/>
134
												<datacite:contributor>
135
													<xsl:attribute name="contributorType" select="'ContactPerson'"/>
136
													<datacite:contributorName>
137
														<xsl:value-of select="$varContributorName"/>
138
													</datacite:contributorName>
139
													<datacite:givenName>
140
														<xsl:value-of select="substring-after($varContributorName, ', ')"/>
141
													</datacite:givenName>
142
													<datacite:familyName>
143
														<xsl:value-of select="substring-before($varContributorName, ', ')"/>
144
													</datacite:familyName>
145
												</datacite:contributor>
146
											</xsl:for-each>
147
										</datacite:contributors>
148

    
149
										<datacite:descriptions>
150
											<datacite:description>
151
												<xsl:attribute name="descriptionType">
152
													<xsl:value-of select="'Abstract'"/>
153
												</xsl:attribute>
154
												<xsl:value-of select="//*[local-name() = 'description']"/>
155
											</datacite:description>
156

    
157
											<!--
158
											<xsl:for-each select="//*[local-name() = 'operatingSystem'], //*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
159
											-->
160

    
161
											<xsl:for-each select="//*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
162
												<datacite:description>
163
													<xsl:attribute name="descriptionType" select="'Abstract'"/>
164
													<xsl:value-of select="."/>
165
												</datacite:description>
166
											</xsl:for-each>
167

    
168
											<xsl:for-each select="//*[local-name() = 'operatingSystem']">
169
												<datacite:description>
170
													<xsl:attribute name="descriptionType" select="'TechnicalInfo'"/>
171
													<xsl:value-of select="."/>
172
												</datacite:description>
173
											</xsl:for-each>
174

    
175
										</datacite:descriptions>
176

    
177
										<!-- subject -->
178
										<!-- dropping duplicate topics - funny that this seemingly works -->
179
										<datacite:subjects>
180
											<xsl:for-each select="//*[local-name() = 'topic'][index-of(distinct-values(//*[local-name() = 'topic']/*[local-name() = 'uri']), ./*[local-name() = 'uri'])]">
181
												<xsl:if test=".">
182
													<datacite:subject>
183
														<xsl:attribute name="subjectScheme" select="'EDAM Ontology'"/>
184
														<xsl:attribute name="schemeURI" select="'http://edamontology.org'"/>
185
														<xsl:attribute name="valueURI" select="./*[local-name() = 'uri']"/>
186
														<xsl:value-of select="./*[local-name() = 'term']"/>
187
													</datacite:subject>
188
												</xsl:if>
189
											</xsl:for-each>
190
										</datacite:subjects>
191

    
192
									</datacite:resource>
193

    
194
									<!--
195
									CobjCategory, SuperType
196
									-->
197
									<xsl:variable name='varCobjCategory' select="'0029'"/>
198
									<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
199
									<dr:CobjCategory>
200
										<xsl:attribute name="type" select="$varSuperType"/>
201
										<xsl:value-of select="$varCobjCategory"/>
202
									</dr:CobjCategory>
203

    
204
									<!--
205
									access rights, licenses
206
									-->
207
									<xsl:for-each select="//*[local-name() = ('license', 'accessibility') and not(. = 'null')]">
208
										<oaf:accessrights>
209
											<xsl:variable name='varAccessRights' select="TransformationFunction:convertString($tf, ., 'AccessRights')"/>
210
											<xsl:choose>
211
												<xsl:when test="$varAccessRights = ('OPEN', 'OPEN SOURCE') and $varSuperType = 'software'">
212
													<xsl:value-of select="'OPEN SOURCE'"/>
213
												</xsl:when>
214
												<xsl:otherwise>
215
													<xsl:value-of select="$varAccessRights"/>
216
												</xsl:otherwise>
217
											</xsl:choose>
218
										</oaf:accessrights>
219
									</xsl:for-each>
220

    
221
									<xsl:for-each select="//*[local-name() = 'license' and not(. = 'null')]">
222
										<oaf:license>
223
											<xsl:value-of select="."/>
224
										</oaf:license>
225
									</xsl:for-each>
226

    
227
									<oaf:hostedBy>
228
										<xsl:attribute name="name" select="$varOfficialName"/>
229
										<xsl:attribute name="id" select="$varDataSourceId"/>
230
									</oaf:hostedBy>
231
									<oaf:collectedFrom>
232
										<xsl:attribute name="name" select="$varOfficialName"/>
233
										<xsl:attribute name="id" select="$varDataSourceId"/>
234
									</oaf:collectedFrom>
235

    
236
									<!--
237
									<oaf:identifier>
238
									<xsl:value-of select="//*[local-name() = 'id']"/>
239
									</oaf:identifier>
240
									-->
241

    
242

    
243
									<oaf:concept>
244
										<xsl:attribute name="id" select="'elixir-gr'"/>
245
									</oaf:concept>
246

    
247

    
248
									<!-- date -->
249
									<oaf:dateAccepted>
250
										<xsl:value-of select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
251
									</oaf:dateAccepted>
252

    
253
								</metadata>
254
								<xsl:copy-of select="//*[local-name() = 'about']"/>
255
							</record>
256

    
257
						</xsl:template>
258

    
259
						<xsl:template match="node()|@*">
260
							<xsl:copy>
261
								<xsl:apply-templates select="node()|@*"/>
262
							</xsl:copy>
263
						</xsl:template>
264

    
265
						<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
266
							<xsl:copy>
267
								<xsl:apply-templates select="node()|@*"/>
268
							</xsl:copy>
269
						</xsl:template>
270

    
271
						<xsl:template match="//*[local-name() = 'header']">
272
							<xsl:copy>
273
								<xsl:apply-templates select="node()|@*"/>
274
								<xsl:element name="dr:dateOfTransformation">
275
									<xsl:value-of select="$transDate"/>
276
								</xsl:element>
277
							</xsl:copy>
278
						</xsl:template>
279

    
280
						<!--
281
						<xsl:template match="//*[local-name() = 'authors']">
282
						-->
283
						<xsl:template name="authors">
284
							<xsl:choose>
285
								<xsl:when test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']][./*[local-name() = 'name' and not(. = 'null')]])">
286
									<xsl:call-template name="terminate"/>
287
								</xsl:when>
288
								<xsl:otherwise>
289
									<datacite:creators>
290
										<xsl:for-each select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']]/*[local-name() = 'name' and not(. = 'null')]">
291
											<xsl:for-each select="tokenize(., ', ')">
292
												<xsl:variable name="varDeveloperName" select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
293
												<datacite:creator>
294
													<datacite:creatorName>
295
														<xsl:value-of select="$varDeveloperName"/>
296
													</datacite:creatorName>
297
													<datacite:givenName>
298
														<xsl:value-of select="substring-after($varDeveloperName, ', ')"/>
299
													</datacite:givenName>
300
													<datacite:familyName>
301
														<xsl:value-of select="substring-before($varDeveloperName, ', ')"/>
302
													</datacite:familyName>
303
													<!--
304
													<xsl:if test="string-length(./*[local-name() = 'orcid']) > 0">
305
													<xsl:element name="datacite:nameIdentifier">
306
													<xsl:attribute name="nameIdentifierScheme" select="'ORCID'"/>
307
													<xsl:attribute name="schemeURI" select="'http://orcid.org'"/>
308
													<xsl:value-of select="./*[local-name()='orcid']"/>
309
													</xsl:element>
310
													</xsl:if>
311
													<xsl:for-each select="./*[local-name() = 'affiliations'][string-length(.) > 0]">
312
													<xsl:element name="datacite:affiliation">
313
													<xsl:value-of select="."/>
314
													</xsl:element>
315
													</xsl:for-each>
316
													-->
317
												</datacite:creator>
318
											</xsl:for-each>
319
										</xsl:for-each>
320
									</datacite:creators>
321
								</xsl:otherwise>
322
							</xsl:choose>
323
						</xsl:template>
324

    
325
						<!--
326
						<xsl:template match="//*[local-name() = 'DOI']">
327
						-->
328
						<xsl:template name="relatedPaper">
329
							<xsl:for-each select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
330
								<xsl:element name="datacite:relatedIdentifier">
331
									<xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
332
									<xsl:attribute name="relationType">
333
										<xsl:choose>
334
											<xsl:when test="../*[local-name() = 'type'] = 'Primary'">
335
												<xsl:value-of select="'isSupplementTo'"/>
336
											</xsl:when>
337
											<xsl:when test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
338
												<xsl:value-of select="'isReviewedBy'"/>
339
											</xsl:when>
340
											<xsl:when test="../*[local-name() = 'type'] = 'Usage'">
341
												<xsl:value-of select="'isReferencedBy'"/>
342
											</xsl:when>
343
											<xsl:when test="../*[local-name() = 'type'] = 'Method'">
344
												<xsl:value-of select="'references'"/>
345
											</xsl:when>
346
											<xsl:otherwise>
347
												<xsl:value-of select="'isReferencedBy'"/>
348
											</xsl:otherwise>
349
										</xsl:choose>
350
									</xsl:attribute>
351
									<xsl:value-of select="."/>
352
								</xsl:element>
353
							</xsl:for-each>
354
						</xsl:template>
355

    
356
					</xsl:stylesheet>
357
				</CODE>
358
			</SCRIPT>
359
		</CONFIGURATION>
360
		<STATUS/>
361
		<SECURITY_PARAMETERS/>
362
	</BODY>
363
</RESOURCE_PROFILE>
(51-51/54)