Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER
4
			value="oaf2oaidatacite_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU=" />
5
		<RESOURCE_TYPE value="TransformationRuleDSResourceType" />
6
		<RESOURCE_KIND value="TransformationRuleDSResources" />
7
		<RESOURCE_URI value="" />
8
		<DATE_OF_CREATION value="2001-12-31T12:00:00" />
9
	</HEADER>
10
	<BODY>
11
		<CONFIGURATION>
12
			<SOURCE_METADATA_FORMAT name="oaf" layout="index"
13
				interpretation="openaire" />
14
			<SINK_METADATA_FORMAT name="oai_datacite" />
15
			<IMPORTED />
16
			<SCRIPT>
17
				<TITLE>OAF to OAI_DATACITE</TITLE>
18
				<CODE>
19
					<!-- (M): Mandatory (R): Reccomended (M w A): Mandatory when Applicable -->
20
					<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
21
						xmlns:datacite="http://datacite.org/schema/kernel-3" xmlns:oaf="http://namespace.openaire.eu/oaf"
22
						version="1.0" exclude-result-prefixes="oaf">
23

    
24
						<xsl:output method="xml" indent="yes"
25
							omit-xml-declaration="yes" />
26

    
27
						<xsl:variable name="openaireNamespace" select="string('oai:dnet:')" />
28

    
29
						<xsl:template match="//oaf:entity">
30
							<datacite:resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
31
								xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
32
								<xsl:apply-templates />
33
									<datacite:alternateIdentifiers>
34
										<xsl:for-each select="oaf:result/pid[./text()]">
35
											<datacite:alternateIdentifier alternateIdentifierType="{@classid}">
36
												<xsl:value-of select="." />
37
											</datacite:alternateIdentifier>
38
										</xsl:for-each>
39
										<xsl:for-each select="oaf:result/originalId">
40
											<datacite:alternateIdentifier><xsl:value-of select="." /></datacite:alternateIdentifier>
41
										</xsl:for-each>
42
										</datacite:alternateIdentifiers>
43
								<datacite:titles>
44
									<xsl:for-each select="oaf:result/title/text()">
45
										<datacite:title>
46
											<xsl:value-of select="normalize-space(.)" />
47
										</datacite:title>
48
									</xsl:for-each>
49
								</datacite:titles>
50
								<datacite:descriptions>
51
									<xsl:for-each select="oaf:result/description/text()">
52
										<datacite:description descriptionType="Abstract">
53
											<xsl:value-of select="normalize-space(.)" />
54
										</datacite:description>
55
									</xsl:for-each>
56
								</datacite:descriptions>
57
								<datacite:subjects>
58
									<xsl:for-each select="oaf:result/subject[./text()]">
59
										<xsl:choose>
60
											<xsl:when test="@classname='keyword'">
61
												<datacite:subject>
62
													<xsl:value-of select="normalize-space(./text())" />
63
												</datacite:subject>
64
											</xsl:when>
65
											<xsl:otherwise>
66
												<datacite:subject subjectScheme="{@classid}">
67
													<xsl:value-of select="normalize-space(./text())" />
68
												</datacite:subject>
69
											</xsl:otherwise>
70
										</xsl:choose>
71
									</xsl:for-each>
72
								</datacite:subjects>
73
								<!-- Dates are mandatory but we do not always have them... -->
74
								<datacite:dates>
75
									<datacite:date dateType="Issued">
76
										<xsl:value-of select="oaf:result/dateofacceptance/text()" />
77
									</datacite:date>
78
									<xsl:variable name="embargoEndDate">
79
										<xsl:value-of select="oaf:result/embargoenddate/text()" />
80
									</xsl:variable>
81
									<xsl:if test="$embargoEndDate != ''">
82
										<datacite:date dateType="Available">
83
											<xsl:value-of select="$embargoEndDate" />
84
										</datacite:date>
85
									</xsl:if>
86
								</datacite:dates>
87
								<!-- Size (O) -->
88
								<datacite:sizes>
89
									<xsl:for-each select="oaf:result/size/text()">
90
										<datacite:size>
91
											<xsl:value-of select="." />
92
										</datacite:size>
93
									</xsl:for-each>
94
								</datacite:sizes>
95

    
96
							</datacite:resource>
97
						</xsl:template>
98

    
99

    
100
						<!--Identifier (M) -->
101
						<xsl:template match="oaf:result//webresource/url ">
102
							<datacite:identifier identifierType="URL">
103
								<xsl:value-of select="./text()" />
104
							</datacite:identifier>
105
						</xsl:template>
106

    
107

    
108
						<!-- Handling relationships -->
109
						<xsl:template match="oaf:result/rels">
110
							<!-- Creators (M) -->
111
							<datacite:creators>
112
									<xsl:for-each select="./rel[./to/@class='hasAuthor']">
113
										<xsl:sort select="ranking" />
114
										<datacite:creator>
115
											<datacite:creatorName>
116
												<xsl:value-of select="./fullname" />
117
											</datacite:creatorName>
118
										</datacite:creator>
119
									</xsl:for-each>
120
							</datacite:creators>
121
							<datacite:contributors>
122
								<!-- person contributors: not yet available in openaire -->
123
								<xsl:apply-templates select="./rel[./to/@class='hasContributor']" />
124
								<!-- contributor fields is also used to model funding information -->
125
								<xsl:apply-templates select="./rel[./to/@class='isProducedBy']" />
126
							</datacite:contributors>
127
							<datacite:relatedIdentifiers>
128
								<!-- Links to publications -->
129
								<xsl:apply-templates
130
									select="./rel[./resulttype/@classid='publication']" />
131
							</datacite:relatedIdentifiers>
132

    
133
						</xsl:template>
134

    
135
						<!-- Person Contributor template -->
136
						<xsl:template match="rel[./to/@class='hasContributor']">
137
							<datacite:contributor>
138
								<datacite:contributorName>
139
									<xsl:value-of select="./fullname" />
140
								</datacite:contributorName>
141
							</datacite:contributor>
142
						</xsl:template>
143

    
144
						<!-- Funding template, goes into contributors -->
145
						<xsl:template match="rel[./to/@class='isProducedBy']">
146
							<xsl:variable name="funder" select="./funding/funder/@shortname" />
147
							<xsl:variable name="fundingProgramme" select="./funding/funding_level_0/@name"/>
148
							<xsl:variable name="jurisdiction" select = "./funding/funder/@jurisdiction"/>
149
							<datacite:contributor contributorType="Funder">
150
								<datacite:contributorName>
151
									<xsl:value-of select="$funder" />
152
								</datacite:contributorName>
153
								<datacite:nameIdentifier
154
									nameIdentifierScheme="info">
155
									<xsl:value-of
156
										select="concat('info:eu-repo/grantAgreement/', $funder, '/', $fundingProgramme, '/', ./code, '/', $jurisdiction, '/' , ./title, '/', ./acronym)" />
157
								</datacite:nameIdentifier>
158
							</datacite:contributor>
159
						</xsl:template>
160

    
161
						<!-- Links to publication. The related id should be a pid, we give it if we have it, but we always give at least the openaire id -->
162
						<xsl:template match="rel[./resulttype/@classid='publication']">
163
							<datacite:relatedIdentifier relatedIdentifierType="openaire" relationType="IsReferencedBy">
164
								<xsl:value-of select="concat($openaireNamespace, ./to/text())" />
165
							</datacite:relatedIdentifier>
166
							<xsl:for-each select="./pid[./text()]">
167
								<datacite:relatedIdentifier relatedIdentifierType="{@classid}" relationType="IsReferencedBy">
168
									<xsl:value-of select="." />
169
								</datacite:relatedIdentifier>
170
							</xsl:for-each>
171
						</xsl:template>
172

    
173
						<!--publisher (M) from publisher -->
174
						<xsl:template match="oaf:result/publisher/text()">
175
							<datacite:publisher>
176
								<xsl:value-of select="normalize-space(.)" />
177
							</datacite:publisher>
178
						</xsl:template>
179

    
180
						<!-- Publication year (M) -->
181
						<xsl:template match="oaf:result/dateofacceptance/text()">
182
							<datacite:publicationYear>
183
								<xsl:value-of select="normalize-space(substring-before(.,'-'))" />
184
							</datacite:publicationYear>
185
						</xsl:template>
186

    
187
						<!-- Language (R) from language@classid -->
188
						<xsl:template match="oaf:result/language/@classid">
189
							<datacite:language>
190
								<xsl:value-of select="." />
191
							</datacite:language>
192
						</xsl:template>
193

    
194
						<!-- ResourceType (R) -->
195
						<xsl:template
196
							match="oaf:result/children/instance/instancetype[./@classname!='Unknown'] | oaf:result/resourcetype[./@classname != '']">
197
							<datacite:resourceType resourceTypeGeneral="{./@classname}" />
198
						</xsl:template>
199

    
200
						<!-- Version (O) -->
201
						<xsl:template match="oaf:result/version/text()">
202
							<datacite:version>
203
								<xsl:value-of select="." />
204
							</datacite:version>
205
						</xsl:template>
206

    
207

    
208
						<!-- Rights list (M) -->
209
						<xsl:template match="oaf:result/bestlicense">
210
							<xsl:variable name="license">
211
								<xsl:choose>
212
									<xsl:when test="@classid='OPEN'">
213
										<xsl:value-of select="string('info:eu-repo/semantics/openAccess')" />
214
									</xsl:when>
215
									<xsl:when test="@classid='CLOSED'">
216
										<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')" />
217
									</xsl:when>
218
									<xsl:when test="@classid='RESTRICTED'">
219
										<xsl:value-of
220
											select="string('info:eu-repo/semantics/restrictedAccess')" />
221
									</xsl:when>
222
									<xsl:when test="@classid='EMBARGO'">
223
										<xsl:value-of
224
											select="string('info:eu-repo/semantics/embargoedAccess')" />
225
									</xsl:when>
226
									<xsl:otherwise>
227
										<xsl:value-of select="string('info:eu-repo/semantics/unknownAccess')" />
228
									</xsl:otherwise>
229
								</xsl:choose>
230
							</xsl:variable>
231
							<datacite:rightsList>
232
								<datacite:rights rightsURI="{$license}">
233
									<xsl:value-of select="./@classname" />
234
								</datacite:rights>
235
							</datacite:rightsList>
236
						</xsl:template>
237

    
238
						<!-- Override default template -->
239
						<xsl:template match="text()|@*" />
240
					</xsl:stylesheet>
241
				</CODE>
242
			</SCRIPT>
243
		</CONFIGURATION>
244
		<STATUS />
245
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
246
	</BODY>
247
</RESOURCE_PROFILE>
(1-1/2)