Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="e7884036-e8e2-4dfa-a976-233f13058f54_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2019-03-27T10:02:19+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>xslt_cleaning_ORP-neurovault</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() = 'results']"/>
50
									-->
51

    
52
									<datacite:resource>
53

    
54

    
55
										<!-- NeuroVault does not state: languages, projects,
56
										-->
57

    
58

    
59
										<!-- landing page -->
60
										<xsl:if test="//*[local-name() = 'datasourceprefix'][.='NeuroVault__']">
61
											<datacite:alternateIdentifiers>
62
												<datacite:alternateIdentifier>
63
													<xsl:attribute name="alternateIdentifierType">
64
														<xsl:value-of select="'LandingPage'"/>
65
													</xsl:attribute>
66
													<xsl:value-of select="//*[local-name() = 'url']"/>
67
												</datacite:alternateIdentifier>
68
											</datacite:alternateIdentifiers>
69
										</xsl:if>
70

    
71
										<!-- identifier; could be simplified with baseURL and id -->
72
										<xsl:if test="//*[local-name() = 'datasourceprefix'][.='NeuroVault__']">
73
											<datacite:identifier>
74
												<xsl:attribute name="identifierType">
75
													<xsl:value-of select="'URL'"/>
76
												</xsl:attribute>
77
												<xsl:value-of select="concat('https://neurovault.org/api/', substring-after(//*[local-name() = 'url'], 'https://neurovault.org/'))"/>
78
											</datacite:identifier>
79
										</xsl:if>
80

    
81
										<!-- title -->
82
										<xsl:if test="//*[local-name() = 'datasourceprefix'][.='NeuroVault__']">
83
											<datacite:titles>
84
												<datacite:title>
85
													<xsl:value-of select="//*[local-name() = 'name']"/>
86
												</datacite:title>
87
											</datacite:titles>
88
										</xsl:if>
89

    
90
										<xsl:call-template name="authors"/>
91

    
92
										<xsl:call-template name="relatedPaper"/>
93

    
94
										<datacite:description>
95
											<xsl:attribute name="descriptionType">
96
												<xsl:value-of select="'Abstract'"/>
97
											</xsl:attribute>
98
											<xsl:value-of select="//*[local-name() = 'description']"/>
99
										</datacite:description>
100

    
101
										<!-- subject -->
102
										<datacite:subjects>
103
											<datacite:subject>
104
												<xsl:attribute name="subjectScheme" select="'lcsh'"/>
105
												<xsl:value-of select="'Brain'"/>
106
											</datacite:subject>
107
										</datacite:subjects>
108

    
109
										<!-- date -->
110
										<xsl:if test="//*[local-name() = 'datasourceprefix'][.='NeuroVault__']">
111
											<datacite:dates>
112
												<datacite:date>
113
													<xsl:attribute name="dateType">
114
														<xsl:value-of select="'Created'"/>
115
													</xsl:attribute>
116
													<xsl:value-of select="substring-before(//*[local-name() = 'add_date'], 'T')"/>
117
												</datacite:date>
118
											</datacite:dates>
119
										</xsl:if>
120

    
121
									</datacite:resource>
122

    
123
									<xsl:choose>
124

    
125
										<xsl:when test="//*[local-name()='download_url'][starts-with(., 'https://neurovault.org/collections/')]">
126
											<xsl:variable name='varCobjCategory'
127
											              select="'0025'"/>
128
											<dr:CobjCategory>
129
												<xsl:attribute name="type">
130
													<xsl:value-of select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
131
												</xsl:attribute>
132
												<xsl:value-of
133
														select="$varCobjCategory"/>
134
											</dr:CobjCategory>
135
										</xsl:when>
136

    
137
										<xsl:otherwise>
138
											<!--
139
											<xsl:call-template name="terminate"/>
140
											-->
141
										</xsl:otherwise>
142
									</xsl:choose>
143

    
144
									<!--
145
									NEUROVAULT FAQ 13: All data in NeuroVault (with exclusion of private collections) is distributed under CC0 license.
146
									-->
147
									<xsl:choose>
148
										<xsl:when test="//*[local-name()='private' and .='false']">
149
											<oaf:accessrights>
150
												<xsl:text>OPEN</xsl:text>
151
											</oaf:accessrights>
152
											<oaf:license>
153
												<xsl:text>https://creativecommons.org/publicdomain/zero/1.0/</xsl:text>
154
											</oaf:license>
155
										</xsl:when>
156
										<xsl:otherwise>
157
											<oaf:accessrights>
158
												<xsl:text>CLOSED</xsl:text>
159
											</oaf:accessrights>
160
										</xsl:otherwise>
161
									</xsl:choose>
162

    
163
									<xsl:if test="//*[local-name() = 'datasourceprefix'][.='NeuroVault__']">
164
										<oaf:concept>
165
											<xsl:attribute name="id">
166
												<xsl:value-of select="'ni'"/>
167
											</xsl:attribute>
168
										</oaf:concept>
169
									</xsl:if>
170

    
171
									<oaf:hostedBy>
172
										<xsl:attribute name="name">
173
											<xsl:value-of select="$varOfficialName"/>
174
										</xsl:attribute>
175
										<xsl:attribute name="id">
176
											<xsl:value-of select="$varDataSourceId"/>
177
										</xsl:attribute>
178
									</oaf:hostedBy>
179
									<oaf:collectedFrom>
180
										<xsl:attribute name="name">
181
											<xsl:value-of select="$varOfficialName"/>
182
										</xsl:attribute>
183
										<xsl:attribute name="id">
184
											<xsl:value-of select="$varDataSourceId"/>
185
										</xsl:attribute>
186
									</oaf:collectedFrom>
187

    
188
									<oaf:fulltext>
189
										<xsl:value-of select="//*[local-name() = 'download_url'][//*[local-name() = 'datasourceprefix'] = 'NeuroVault__']"/>
190
									</oaf:fulltext>
191

    
192
									<!-- date -->
193
									<xsl:if test="//*[local-name() = 'datasourceprefix'][.='NeuroVault__']">
194
										<oaf:dateAccepted>
195
											<xsl:value-of select="substring-before(//*[local-name() = 'doi_add_date'], 'T')"/>
196
										</oaf:dateAccepted>
197
									</xsl:if>
198

    
199
								</metadata>
200
								<xsl:copy-of select="//*[local-name() = 'about']"/>
201
							</record>
202

    
203
						</xsl:template>
204

    
205
						<xsl:template match="node()|@*">
206
							<xsl:copy>
207
								<xsl:apply-templates select="node()|@*"/>
208
							</xsl:copy>
209
						</xsl:template>
210

    
211
						<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
212
							<xsl:copy>
213
								<xsl:apply-templates select="node()|@*"/>
214
							</xsl:copy>
215
						</xsl:template>
216

    
217
						<xsl:template match="//*[local-name() = 'header']">
218
							<xsl:copy>
219
								<xsl:apply-templates select="node()|@*"/>
220
								<xsl:element name="dr:dateOfTransformation">
221
									<xsl:value-of select="$transDate"/>
222
								</xsl:element>
223
							</xsl:copy>
224
						</xsl:template>
225

    
226
						<!--
227
						<xsl:template match="//*[local-name() = 'authors']">
228
						-->
229
						<xsl:template name="authors">
230
							<xsl:choose>
231
								<xsl:when test="not(//*[local-name() = 'authors'][string-length(normalize-space(.)) > 0 and not(. = 'null')])">
232
									<xsl:call-template name="terminate"/>
233
								</xsl:when>
234
								<xsl:otherwise>
235

    
236
									<datacite:creators>
237

    
238
										<xsl:for-each select="tokenize(//*[local-name() = 'authors'], '(, and |,| and )')">
239

    
240
											<xsl:element name="datacite:creator">
241

    
242
												<xsl:element name="datacite:creatorName">
243
													<xsl:value-of select="TransformationFunction:convertString($tf, ., 'Person')"/>
244
												</xsl:element>
245

    
246
												<xsl:element name="datacite:givenName">
247
													<xsl:value-of select="normalize-space(substring-after(TransformationFunction:convertString($tf, ., 'Person'), ','))"/>
248
												</xsl:element>
249
												<xsl:element name="datacite:familyName">
250
													<xsl:value-of select="substring-before(TransformationFunction:convertString($tf, ., 'Person'), ',')"/>
251
												</xsl:element>
252

    
253
											</xsl:element>
254
										</xsl:for-each>
255

    
256
									</datacite:creators>
257

    
258
								</xsl:otherwise>
259
							</xsl:choose>
260
						</xsl:template>
261

    
262
						<!--
263
						<xsl:template match="//*[local-name() = 'DOI']">
264
						-->
265
						<xsl:template name="relatedPaper">
266
							<datacite:relatedIdentifiers>
267
								<xsl:element name="datacite:relatedIdentifier">
268
									<xsl:attribute name="relatedIdentifierType">
269
										<xsl:value-of select="'DOI'"/>
270
									</xsl:attribute>
271
									<xsl:attribute name="relationType">
272
										<xsl:value-of select="'isReferencedBy'"/>
273
									</xsl:attribute>
274
									<xsl:value-of select="//*[local-name() = 'DOI']"/>
275
								</xsl:element>
276
							</datacite:relatedIdentifiers>
277
						</xsl:template>
278

    
279
					</xsl:stylesheet>
280
				</CODE>
281
			</SCRIPT>
282
		</CONFIGURATION>
283
		<STATUS/>
284
		<SECURITY_PARAMETERS/>
285
	</BODY>
286
</RESOURCE_PROFILE>
(8-8/9)