Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER
4
			value="oaf2dc_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU=" />
5
		<RESOURCE_TYPE value="TransformationRuleDSResourceType" />
6
		<RESOURCE_KIND value="TransformationRuleDSResources" />
7
		<RESOURCE_URI value="" />
8
		<DATE_OF_CREATION value="2015-02-27T17:15:30+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_dc" />
15
			<IMPORTED />
16
			<SCRIPT>
17
				<TITLE>OAF to OAI_DC</TITLE>
18
				<CODE>
19
					<!-- (M): Mandatory (R): Reccomended (M w A): Mandatory when Applicable -->
20
					<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/"
21
						xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
22
						xmlns:oaf="http://namespace.openaire.eu/oaf" version="2.0"
23
						exclude-result-prefixes="oaf">
24

    
25

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

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

    
31
						<xsl:template match="//oaf:entity">
32
							<oai_dc:dc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
								xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
34
								<xsl:apply-templates />
35
							</oai_dc:dc>
36
						</xsl:template>
37

    
38
						<!-- Titles (M): based on title/@classname <dc:title>main title:subtitle</dc:title> 
39
							<dc:title>alternative title</dc:title> <dc:title>translated title</dc:title> 
40
							We have only "main title" for now: let's keep it simple here... -->
41
						<xsl:template match="oaf:result/title">
42
							<dc:title>
43
								<xsl:value-of select="normalize-space(./text())" />
44
							</dc:title>
45
						</xsl:template>
46

    
47
						<!-- Creators (M) -->
48
						<xsl:template match="oaf:result//rel[./to/@class='hasAuthor']">
49
							<dc:creator>
50
								<xsl:value-of select="./fullname" />
51
							</dc:creator>
52
						</xsl:template>
53

    
54
						<!-- Contributors (R) not currently available -->
55
						<xsl:template match="oaf:result//rel[./to/@class='hasContributor']">
56
							<dc:contributor>
57
								<xsl:value-of select="./fullname" />
58
							</dc:contributor>
59
						</xsl:template>
60

    
61
						<!-- projectId (M w A) <dc:relation>info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym]</dc:relation> 
62
							<dc:relation>info:eu-repo/grantAgreement/EC/FP7/12345//The project name/ACRO</dc:relation> 
63
							<dc:relation>info:eu-repo/grantAgreement/EC/FP7/67891/EU/The 2nd project 
64
							name/ACRO2</dc:relation> The rel to project: <rel> <to scheme="dnet:result_project_relations" 
65
							class="isProducedBy" type="project">project_openaireid</to> <code>249516</code> 
66
							<acronym>VOICE</acronym> <title>xxx</title> <contracttype schemename="ec:FP7contractTypes" 
67
							classname="aaa" schemeid="ec:FP7contractTypes" classid="aaa"/> <funding> 
68
							<funding_level_0>FP7</funding_level_0> <funding_level_1>FP7::SP2</funding_level_1> 
69
							<funding_level_2>FP7::SP2::ERC</funding_level_2> </funding> </rel> The funding 
70
							program is funding_level_0. The funder must be inferred from the contract 
71
							type - until the Funders won't be added explicitely in the record. -->
72
						<xsl:template match="oaf:result//rel[./to/@class='isProducedBy']">
73
							<xsl:variable name="funder">
74
								<xsl:choose>
75
									<xsl:when test="./contracttype/@schemeid = 'ec:FP7contractTypes'">
76
										<xsl:value-of select="string('EC')" />
77
									</xsl:when>
78
									<xsl:when test="./contracttype/@schemeid = 'wt:contractTypes'">
79
										<xsl:value-of select="string('WT')" />
80
									</xsl:when>
81
									<xsl:when test="./contracttype/@schemeid = 'fct:contractTypes'">
82
										<xsl:value-of select="string('FCT')" />
83
									</xsl:when>
84
								</xsl:choose>
85
							</xsl:variable>
86
							<xsl:variable name="fundingProgramme">
87
								<xsl:choose>
88
									<xsl:when test="$funder = 'EC'">
89
										<xsl:value-of select="./funding/funding_level_0" />
90
									</xsl:when>
91
									<xsl:when test="$funder = 'WT'">
92
										<xsl:value-of
93
											select="substring-after(./funding_level_1/text(), 'WT::')" />
94
									</xsl:when>
95
									<xsl:when test="$funder = 'FCT'">
96
										<xsl:value-of
97
											select="substring-after(./funding_level_1/text(), 'FCT::')" />
98
									</xsl:when>
99
								</xsl:choose>
100
							</xsl:variable>
101
							<xsl:variable name="jurisdiction">
102
								<xsl:choose>
103
									<xsl:when test="$funder = 'EC'">
104
										<xsl:value-of select="string('EU')" />
105
									</xsl:when>
106
									<xsl:when test="$funder = 'WT'">
107
										<xsl:value-of select="string('')" />
108
									</xsl:when>
109
									<xsl:when test="$funder = 'FCT'">
110
										<xsl:value-of select="string('PT')" />
111
									</xsl:when>
112
									<xsl:otherwise />
113
								</xsl:choose>
114
							</xsl:variable>
115
							<dc:relation>
116
								<xsl:value-of
117
									select="concat('info:eu-repo/grantAgreement/', $funder, '/', $fundingProgramme, '/', ./code, '/', $jurisdiction, '/' , ./title, '/', ./acronym)" />
118
							</dc:relation>
119
						</xsl:template>
120

    
121
						<!-- Access level (M) [from bestlicense@classid] : one of <dc:rights>info:eu-repo/semantics/closedAccess</dc:rights> 
122
							<dc:rights>info:eu-repo/semantics/embargoedAccess</dc:rights> <dc:rights>info:eu-repo/semantics/restrictedAccess</dc:rights> 
123
							<dc:rights>info:eu-repo/semantics/openAccess</dc:rights> -->
124
						<xsl:template match="oaf:result/bestlicense">
125
							<xsl:variable name="license">
126
								<xsl:choose>
127
									<xsl:when test="@classid='OPEN'">
128
										<xsl:value-of select="string('info:eu-repo/semantics/openAccess')" />
129
									</xsl:when>
130
									<xsl:when test="@classid='CLOSED'">
131
										<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')" />
132
									</xsl:when>
133
									<xsl:when test="@classid='RESTRICTED'">
134
										<xsl:value-of
135
											select="string('info:eu-repo/semantics/restrictedAccess')" />
136
									</xsl:when>
137
									<xsl:when test="@classid='EMBARGO'">
138
										<xsl:value-of
139
											select="string('info:eu-repo/semantics/embargoedAccess')" />
140
									</xsl:when>
141
									<xsl:otherwise>
142
										<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')" />
143
									</xsl:otherwise>
144
								</xsl:choose>
145
							</xsl:variable>
146
							<dc:rights>
147
								<xsl:value-of select="$license" />
148
							</dc:rights>
149
						</xsl:template>
150

    
151
						<!-- EmbargoEnd (M w A) (only when rights == info:eu-repo/semantics/embargoedAccess), 
152
							from embargoenddate <dc:date>info:eu-repo/date/embargoEnd/1960-01-01</dc:date> -->
153
						<xsl:template match="oaf:result/embargoenddate/text()">
154
							<dc:date>
155
								<xsl:value-of select="concat('info:eu-repo/date/embargoEnd/', .)" />
156
							</dc:date>
157
						</xsl:template>
158

    
159

    
160
						<!-- <xsl:template match="oaf:result/originalId/text()"> <dc:identifier> 
161
							<xsl:value-of select="normalize-space(.)"/> </dc:identifier> </xsl:template> -->
162

    
163
						<!-- Alternative Identifier (R), idType from pid@classid <dc:relation> 
164
							info:eu-repo/semantics/altIdentifier/[idType]/[ID] </dc:relation> -->
165
						<xsl:template match="oaf:result/pid[./text()]">
166
							<dc:relation>
167
								<xsl:value-of
168
									select="concat('info:eu-repo/semantics/altIdentifier/', @classid, '/', ./text())" />
169
							</dc:relation>
170
						</xsl:template>
171

    
172
						<xsl:template
173
							match="oaf:result/children/instance/webresource/url/text()">
174
							<dc:identifier>
175
								<xsl:value-of select="." />
176
							</dc:identifier>
177
						</xsl:template>
178
						<!--Referenced Publication (R), from extraInfo[@typology='citations']/citation, 
179
							idType from citation/id/@type, ID from citation/id/@value <dc:relation> info:eu-repo/semantics/reference/[idType]/[ID] 
180
							</dc:relation> <dc:relation> info:eu-repo/semantics/reference/doi/10.1234/789.1 
181
							</dc:relation> <dc:relation> info:eu-repo/semantics/reference/pmid/1234567 
182
							</dc:relation> -->
183
						<xsl:template
184
							match="extraInfo[@typology='citations']//citation/id[./@type]">
185
							<xsl:choose>
186
								<xsl:when test="@type='openaire'">
187
									<dc:relation>
188
										<xsl:value-of
189
											select="concat('info:eu-repo/semantics/reference/', @type, '/', $openaireNamespace, @value)" />
190
									</dc:relation>
191

    
192
								</xsl:when>
193
								<xsl:otherwise>
194
									<dc:relation>
195
										<xsl:value-of
196
											select="concat('info:eu-repo/semantics/reference/', @type, '/', @value)" />
197
									</dc:relation>
198
								</xsl:otherwise>
199
							</xsl:choose>
200

    
201
						</xsl:template>
202

    
203
						<!-- Dataset reference (R), from: rel[./resulttyype/@classname='dataset'] 
204
							<dc:relation>info:eu-repo/semantics/dataset/[idType]/[ID]</dc:relation> only 
205
							available when we'll expand the PIDs in the relationship <dc:relation>info:eu-repo/semantics/dataset/doi/10.1234/789.1</dc:relation> 
206
							For now we can only use openaire ids, from rel[./resulttyype/@classname='dataset']/to/text() 
207
							<dc:relation>info:eu-repo/semantics/dataset/openaire/oai:dnet:[OPENAIRE_ID]</dc:relation> -->
208
						<xsl:template match="oaf:result//rel[./resulttype/@classid='dataset']">
209
							<dc:relation>
210
								<xsl:value-of
211
									select="concat('info:eu-repo/semantics/dataset/openaire/', $openaireNamespace, ./to/text())" />
212
							</dc:relation>
213
						</xsl:template>
214

    
215

    
216
						<!-- Subjects (M w A) <dc:subject>bag of words</dc:subject> If subject@classname 
217
							!= keywords, then we have a classification scheme to encode <dc:subject>info:eu-repo/classification/[scheme]/[value]</dc:subject> 
218
							<dc:subject>info:eu-repo/classification/dcc/whatever</dc:subject> -->
219
						<xsl:template match="oaf:result/subject[@classname='keyword']">
220
							<dc:subject>
221
								<xsl:value-of select="normalize-space(./text())" />
222
							</dc:subject>
223
						</xsl:template>
224
						<xsl:template
225
							match="oaf:result/subject[not(@classname='keyword') and @classid != '']">
226
							<dc:subject>
227
								<xsl:value-of
228
									select="concat('info:eu-repo/classification/', @classid, '/', normalize-space(./text()))" />
229
							</dc:subject>
230
						</xsl:template>
231

    
232
						<!--description (M w A) from description -->
233
						<xsl:template match="oaf:result/description/text()">
234
							<dc:description>
235
								<xsl:value-of select="normalize-space(.)" />
236
							</dc:description>
237
						</xsl:template>
238
						<!--publisher (M w A) from publisher -->
239
						<xsl:template match="oaf:result/publisher/text()">
240
							<dc:publisher>
241
								<xsl:value-of select="normalize-space(.)" />
242
							</dc:publisher>
243
						</xsl:template>
244
						<!-- Publication date (M) from dateofacceptance -->
245
						<xsl:template match="oaf:result/dateofacceptance/text()">
246
							<dc:date>
247
								<xsl:value-of select="normalize-space(.)" />
248
							</dc:date>
249
						</xsl:template>
250

    
251
						<!-- Publication type (M) where [type] is /instancetype[1]/classname 
252
							(dnet:publication_resource vocabulary). A second dc:type (uncontrolled) can 
253
							be used. <dc:type>info:eu-repo/semantics/[type]</dc:type> -->
254
						<xsl:template
255
							match="oaf:result/children/instance/instancetype">
256
							<xsl:variable name="theInstanceType">
257
								<xsl:choose>
258
									<xsl:when test="@classname='Unknown'">
259
										<xsl:value-of select="string('other')" />
260
									</xsl:when>
261
									<xsl:when test="@classname=''">
262
										<xsl:value-of select="string('other')" />
263
									</xsl:when>
264
									<xsl:otherwise>
265
										<xsl:call-template name="ConvertWordsToCamelCase">
266
											<xsl:with-param name="text">
267
												<xsl:value-of select="lower-case(./@classname)" />
268
											</xsl:with-param>
269
										</xsl:call-template>
270
									</xsl:otherwise>
271
								</xsl:choose>
272

    
273
							</xsl:variable>
274
							<dc:type>
275
								<xsl:value-of
276
									select="concat('info:eu-repo/semantics/',$theInstanceType)" />
277
							</dc:type>
278
						</xsl:template>
279
						<!-- <xsl:template match="oaf:result/resulttype"> <dc:type> <xsl:value-of 
280
							select="./@classname"/> </dc:type> </xsl:template> -->
281

    
282
						<!-- Format (R), in theory from format, not sure we are filling it 
283
							<dc:format>mediaType of the digital manifestation of the resource</dc:format> 
284
							<dc:format>application/pdf</dc:format> -->
285
						<xsl:template match="oaf:result/format/text()">
286
							<dc:format>
287
								<xsl:value-of select="normalize-space(.)" />
288
							</dc:format>
289
						</xsl:template>
290

    
291
						<!-- source (R) from source -->
292
						<xsl:template match="oaf:result/source/text()">
293
							<dc:source>
294
								<xsl:value-of select="normalize-space(.)" />
295
							</dc:source>
296
						</xsl:template>
297

    
298
						<xsl:template match="oaf:result/collectedfrom">
299
							<dc:source>
300
								<xsl:value-of select="normalize-space(@name)" />
301
							</dc:source>
302
						</xsl:template>
303

    
304
						<!-- Language (R) from language@classid -->
305
						<xsl:template match="oaf:result/language">
306
							<dc:language>
307
								<xsl:value-of select="./@classid" />
308
							</dc:language>
309
						</xsl:template>
310

    
311
						<!-- Override default template -->
312
						<xsl:template match="text()|@*" />
313

    
314
						<!-- =========================================================================== -->
315
						<!-- === Convert camel case text to cameCaseText === -->
316
						<!-- === Modified from http://blog.inventic.eu/2013/08/xslt-snippet-to-convert-string-from-hyphens-to-camelcase/ 
317
							=== -->
318
						<!-- === (c) Inventic s.r.o. ORM Designer team (http://www.orm-designer.com) 
319
							=== -->
320
						<!-- =========================================================================== -->
321
						<xsl:template name="ConvertWordsToCamelCase">
322
							<xsl:param name="text" />
323
							<xsl:param name="firstLower" select="true()" />
324

    
325
							<xsl:variable name="Upper">
326
								ABCDEFGHIJKLMNOPQRSTUVQXYZ
327
							</xsl:variable>
328
							<xsl:variable name="Lower">
329
								abcdefghijklmnopqrstuvwxyz
330
							</xsl:variable>
331

    
332
							<xsl:for-each select="tokenize($text,' ')">
333
								<xsl:choose>
334
									<xsl:when test="position()=1 and $firstLower = true()">
335
										<xsl:value-of select="substring(.,1,1)" />
336
									</xsl:when>
337
									<xsl:otherwise>
338
										<xsl:value-of select="translate(substring(.,1,1),$Lower,$Upper)" />
339
									</xsl:otherwise>
340
								</xsl:choose>
341
								<xsl:value-of select="substring(.,2,string-length(.))" />
342
							</xsl:for-each>
343
						</xsl:template>
344

    
345
					</xsl:stylesheet>
346
				</CODE>
347
			</SCRIPT>
348
		</CONFIGURATION>
349
		<STATUS />
350
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
351
	</BODY>
352
</RESOURCE_PROFILE>
(43-43/49)