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:apply-templates select="./rel[./to/@class='hasAuthor']" />
113
							</datacite:creators>
114
							<datacite:contributors>
115
								<!-- person contributors: not yet available in openaire -->
116
								<xsl:apply-templates select="./rel[./to/@class='hasContributor']" />
117
								<!-- contributor fields is also used to model funding information -->
118
								<xsl:apply-templates select="./rel[./to/@class='isProducedBy']" />
119
							</datacite:contributors>
120
							<datacite:relatedIdentifiers>
121
								<!-- Links to publications -->
122
								<xsl:apply-templates
123
									select="./rel[./resulttype/@classid='publication']" />
124
							</datacite:relatedIdentifiers>
125

    
126
						</xsl:template>
127

    
128
						<!--Creator template -->
129
						<xsl:template match="rel[./to/@class='hasAuthor']">
130
							<datacite:creator>
131
								<datacite:creatorName>
132
									<xsl:value-of select="./fullname" />
133
								</datacite:creatorName>
134
							</datacite:creator>
135
						</xsl:template>
136

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

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

    
163
						<!-- Links to publication. The related id should be a DOI or similar, 
164
							but we only have the openaire id for now... -->
165
						<xsl:template match="rel[./resulttype/@classid='publication']">
166
							<datacite:relatedIdentifier
167
								relatedIdentifierType="openaire" relationType="IsReferencedBy">
168
								<xsl:value-of select="concat($openaireNamespace, ./to/text())" />
169
							</datacite:relatedIdentifier>
170
						</xsl:template>
171

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

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

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

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

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

    
206

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

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