Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="1a3aa34f-51ef-44a2-8bc8-7c13aa2b6383_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2020-03-20T08:33:04+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>xslt_d4science-catalog_datacite</TITLE>
14
				<CODE>
15

    
16
					<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
									xmlns:date="http://exslt.org/dates-and-times" xmlns:oaf="http://namespace.openaire.eu/oaf"
18
									xmlns:oai="http://www.openarchives.org/OAI/2.0/"
19
									xmlns:dri="http://www.driver-repository.eu/namespace/dri"
20
									xmlns:dr="http://www.driver-repository.eu/namespace/dr" exclude-result-prefixes="xsl"
21
									extension-element-prefixes="date" version="2.0">
22

    
23

    
24
						<xsl:output indent="yes"/>
25
						<xsl:param name="varOfficialName"/>
26
						<xsl:param name="varDataSourceId"/>
27

    
28
						<xsl:template match="/">
29
							<xsl:call-template name="createRecord"/>
30
						</xsl:template>
31

    
32
						<xsl:template name="createRecord">
33
							<xsl:variable name="type" select="//extras[./key = 'system:type']/value"/>
34
							<xsl:variable name="publishedDate">
35
								<xsl:choose>
36
									<xsl:when test="$type = 'Experiment'">
37
										<xsl:value-of select="substring-before(//metadata_created, ' ' )"/>
38
									</xsl:when>
39
									<xsl:otherwise>
40
										<xsl:value-of select="substring-before(//extras[./key = 'CreationDate']/value, ' ')"/>
41
									</xsl:otherwise>
42
								</xsl:choose>
43
							</xsl:variable>
44
							<oai:record>
45
								<oai:header>
46
									<xsl:copy-of copy-namespaces="no" select="//*[local-name() = 'header']/*"/>
47
									<dr:dateOfTransformation>
48
										<xsl:value-of select="date:date-time()"/>
49
									</dr:dateOfTransformation>
50
								</oai:header>
51
								<oai:metadata>
52
									<datacite:resource xmlns:datacite="http://datacite.org/schema/kernel-4"
53
													   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
54
													   xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
55
										<datacite:identifier identifierType="URL">
56
											<xsl:value-of select="//data/extras[./key = 'Item URL']/value"/>
57
										</datacite:identifier>
58
										<datacite:alternateIdentifiers/>
59
										<datacite:creators>
60
											<xsl:choose>
61
												<xsl:when test="$type = 'Experiment'">
62
													<xsl:for-each
63
															select="//data/extras[./key = 'Involved People']/value">
64
														<xsl:variable name="tokenizedCreator" select="tokenize(., ',')"/>
65
														<datacite:creator>
66
															<datacite:creatorName>
67
																<xsl:value-of
68
																		select="concat($tokenizedCreator[1], ',', $tokenizedCreator[2])"
69
																/>
70
															</datacite:creatorName>
71
															<datacite:affiliation/>
72
															<xsl:if test="count($tokenizedCreator) = 4">
73
																<datacite:nameIdentifier nameIdentifierScheme="ORCID"
74
																						 schemeURI="http://orcid.org">
75
																	<xsl:value-of
76
																			select="tokenize($tokenizedCreator[4], '/')[last()]"
77
																	/>
78
																</datacite:nameIdentifier>
79
															</xsl:if>
80
														</datacite:creator>
81
													</xsl:for-each>
82
												</xsl:when>
83
												<xsl:otherwise>
84
													<xsl:for-each select="//data/extras[./key = 'Creator']/value">
85
														<xsl:variable name="tokenizedCreator" select="tokenize(., ',')"/>
86
														<datacite:creator>
87
															<datacite:creatorName>
88
																<xsl:value-of
89
																		select="concat($tokenizedCreator[1], ',', $tokenizedCreator[2])"
90
																/>
91
															</datacite:creatorName>
92
															<datacite:affiliation/>
93
															<xsl:if test="count($tokenizedCreator) = 4">
94
																<datacite:nameIdentifier nameIdentifierScheme="ORCID"
95
																						 schemeURI="http://orcid.org">
96
																	<xsl:value-of
97
																			select="tokenize($tokenizedCreator[4], '/')[last()]"/>
98
																</datacite:nameIdentifier>
99
															</xsl:if>
100
														</datacite:creator>
101
													</xsl:for-each>
102
												</xsl:otherwise>
103
											</xsl:choose>
104

    
105
										</datacite:creators>
106
										<datacite:titles>
107
											<xsl:for-each select="//data/title">
108
												<datacite:title>
109
													<xsl:value-of select="./text()"/>
110
												</datacite:title>
111
											</xsl:for-each>
112
										</datacite:titles>
113
										<datacite:publisher>
114
											<xsl:value-of select="string('SoBigData++')"/>
115
										</datacite:publisher>
116
										<datacite:publicationYear/>
117
										<datacite:dates>
118
											<datacite:date dateType="Issued">
119
												<xsl:value-of select="$publishedDate"/>
120
											</datacite:date>
121
										</datacite:dates>
122

    
123
										<datacite:resourceType resourceTypeGeneral="{$type}">
124
											<xsl:value-of select="$type"/>
125
										</datacite:resourceType>
126
										<datacite:descriptions>
127
											<xsl:for-each select="//data/notes">
128
												<xsl:if test="string-length(.) &gt; 0">
129
													<datacite:description descriptionType="Abstract">
130
														<xsl:value-of select="."/>
131
													</datacite:description>
132
												</xsl:if>
133
											</xsl:for-each>
134
										</datacite:descriptions>
135

    
136
										<datacite:subjects>
137
											<xsl:for-each select="//data/tags">
138
												<datacite:subject>
139
													<xsl:value-of select="./name"/>
140
												</datacite:subject>
141
											</xsl:for-each>
142
										</datacite:subjects>
143
										<datacite:formats>
144
											<xsl:for-each select="//resources/format">
145
												<datacite:format>
146
													<xsl:value-of select="."/>
147
												</datacite:format>
148
											</xsl:for-each>
149
										</datacite:formats>
150

    
151
									</datacite:resource>
152
									<xsl:choose>
153
										<xsl:when test="//data/private = 'false'">
154
											<oaf:accessrights>OPEN</oaf:accessrights>
155
										</xsl:when>
156
										<xsl:otherwise>
157
											<oaf:accessrights>RESTRICTED</oaf:accessrights>
158
										</xsl:otherwise>
159
									</xsl:choose>
160
									<xsl:choose>
161
										<xsl:when test="$type = ('Experiment', ' Method')">
162
											<dr:CobjCategory type="software">0029</dr:CobjCategory>
163
										</xsl:when>
164
										<xsl:when test="$type = 'Application'">
165
											<dr:CobjCategory type="software">0029</dr:CobjCategory>
166
										</xsl:when>
167
										<xsl:when test="$type = 'Dataset'">
168
											<dr:CobjCategory type="dataset">0021</dr:CobjCategory>
169
										</xsl:when>
170
										<xsl:otherwise>
171
											<dr:CobjCategory type="other">0020</dr:CobjCategory>
172
										</xsl:otherwise>
173
									</xsl:choose>
174

    
175
									<oaf:dateAccepted>
176
										<xsl:value-of select="$publishedDate"/>
177
									</oaf:dateAccepted>
178
									<oaf:hostedBy>
179
										<xsl:attribute name="name">
180
											<xsl:value-of select="$varOfficialName"/>
181
										</xsl:attribute>
182
										<xsl:attribute name="id">
183
											<xsl:value-of select="$varDataSourceId"/>
184
										</xsl:attribute>
185
									</oaf:hostedBy>
186
									<oaf:collectedFrom>
187
										<xsl:attribute name="name">
188
											<xsl:value-of select="$varOfficialName"/>
189
										</xsl:attribute>
190
										<xsl:attribute name="id">
191
											<xsl:value-of select="$varDataSourceId"/>
192
										</xsl:attribute>
193
									</oaf:collectedFrom>
194
									<xsl:for-each select="//data/license_id">
195
										<oaf:license>
196
											<xsl:value-of select="."/>
197
										</oaf:license>
198
									</xsl:for-each>
199

    
200
									<oaf:projectid>corda__h2020::871042</oaf:projectid>
201
									<xsl:for-each select="//resources/url">
202
										<xsl:if test="starts-with(., 'https://doi.org/')">
203
											<oaf:identifier identifierType="doi">
204
												<xsl:value-of select="substring-after(., 'https://doi.org/')"/>
205
											</oaf:identifier>
206
										</xsl:if>
207
									</xsl:for-each>
208
								</oai:metadata>
209
								<xsl:copy-of select="//*[local-name() = 'about']"/>
210
							</oai:record>
211
						</xsl:template>
212
					</xsl:stylesheet>
213

    
214
				</CODE>
215
			</SCRIPT>
216
		</CONFIGURATION>
217
		<STATUS/>
218
		<SECURITY_PARAMETERS/>
219
	</BODY>
220
</RESOURCE_PROFILE>
(5-5/17)