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:for-each select="./funding/funding_level_0">
74
								<xsl:variable name="funder" select="../funder/@shortname"/>
75
								<xsl:variable name="fundingProgramme" select="@name"/>
76
								<xsl:variable name="jurisdiction" select="../funder/@jurisdiction"/>
77
								<xsl:variable name="title" select="../../title"/>
78
								<xsl:variable name="acronym" select="../../acronym"/>
79
								<xsl:variable name="code" select="../../code"/>
80
								<dc:relation>
81
									<xsl:value-of select="concat('info:eu-repo/grantAgreement/', $funder, '/', $fundingProgramme, '/', $code, '/', $jurisdiction, '/' , $title, '/', $acronym)"/>
82
								</dc:relation>
83
							</xsl:for-each>
84
						</xsl:template>
85

    
86
						<!-- Access level (M) [from bestlicense@classid] : one of <dc:rights>info:eu-repo/semantics/closedAccess</dc:rights> 
87
							<dc:rights>info:eu-repo/semantics/embargoedAccess</dc:rights> <dc:rights>info:eu-repo/semantics/restrictedAccess</dc:rights> 
88
							<dc:rights>info:eu-repo/semantics/openAccess</dc:rights> -->
89
						<xsl:template match="oaf:result/bestlicense">
90
							<xsl:variable name="license">
91
								<xsl:choose>
92
									<xsl:when test="@classid='OPEN'">
93
										<xsl:value-of select="string('info:eu-repo/semantics/openAccess')" />
94
									</xsl:when>
95
									<xsl:when test="@classid='CLOSED'">
96
										<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')" />
97
									</xsl:when>
98
									<xsl:when test="@classid='RESTRICTED'">
99
										<xsl:value-of
100
											select="string('info:eu-repo/semantics/restrictedAccess')" />
101
									</xsl:when>
102
									<xsl:when test="@classid='EMBARGO'">
103
										<xsl:value-of
104
											select="string('info:eu-repo/semantics/embargoedAccess')" />
105
									</xsl:when>
106
									<xsl:otherwise>
107
										<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')" />
108
									</xsl:otherwise>
109
								</xsl:choose>
110
							</xsl:variable>
111
							<dc:rights>
112
								<xsl:value-of select="$license" />
113
							</dc:rights>
114
						</xsl:template>
115

    
116
						<!-- EmbargoEnd (M w A) (only when rights == info:eu-repo/semantics/embargoedAccess), 
117
							from embargoenddate <dc:date>info:eu-repo/date/embargoEnd/1960-01-01</dc:date> -->
118
						<xsl:template match="oaf:result/embargoenddate/text()">
119
							<dc:date>
120
								<xsl:value-of select="concat('info:eu-repo/date/embargoEnd/', .)" />
121
							</dc:date>
122
						</xsl:template>
123

    
124

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

    
128
						<!-- Alternative Identifier (R), idType from pid@classid <dc:relation> 
129
							info:eu-repo/semantics/altIdentifier/[idType]/[ID] </dc:relation> -->
130
						<xsl:template match="oaf:result/pid[./text()]">
131
							<dc:relation>
132
								<xsl:value-of
133
									select="concat('info:eu-repo/semantics/altIdentifier/', @classid, '/', ./text())" />
134
							</dc:relation>
135
						</xsl:template>
136

    
137
						<xsl:template
138
							match="oaf:result/children/instance/webresource/url/text()">
139
							<dc:identifier>
140
								<xsl:value-of select="." />
141
							</dc:identifier>
142
						</xsl:template>
143
						<!--Referenced Publication (R), from extraInfo[@typology='citations']/citation, 
144
							idType from citation/id/@type, ID from citation/id/@value <dc:relation> info:eu-repo/semantics/reference/[idType]/[ID] 
145
							</dc:relation> <dc:relation> info:eu-repo/semantics/reference/doi/10.1234/789.1 
146
							</dc:relation> <dc:relation> info:eu-repo/semantics/reference/pmid/1234567 
147
							</dc:relation> -->
148
						<xsl:template
149
							match="extraInfo[@typology='citations']//citation/id[./@type]">
150
							<xsl:choose>
151
								<xsl:when test="@type='openaire'">
152
									<dc:relation>
153
										<xsl:value-of
154
											select="concat('info:eu-repo/semantics/reference/', @type, '/', $openaireNamespace, @value)" />
155
									</dc:relation>
156

    
157
								</xsl:when>
158
								<xsl:otherwise>
159
									<dc:relation>
160
										<xsl:value-of
161
											select="concat('info:eu-repo/semantics/reference/', @type, '/', @value)" />
162
									</dc:relation>
163
								</xsl:otherwise>
164
							</xsl:choose>
165

    
166
						</xsl:template>
167

    
168
						<!-- Dataset reference (R), from: rel[./resulttyype/@classname='dataset'] 
169
							<dc:relation>info:eu-repo/semantics/dataset/[idType]/[ID]</dc:relation> only 
170
							available when we'll expand the PIDs in the relationship <dc:relation>info:eu-repo/semantics/dataset/doi/10.1234/789.1</dc:relation> 
171
							For now we can only use openaire ids, from rel[./resulttyype/@classname='dataset']/to/text() 
172
							<dc:relation>info:eu-repo/semantics/dataset/openaire/oai:dnet:[OPENAIRE_ID]</dc:relation> -->
173
						<xsl:template match="oaf:result//rel[./resulttype/@classid='dataset']">
174
							<dc:relation>
175
								<xsl:value-of
176
									select="concat('info:eu-repo/semantics/dataset/openaire/', $openaireNamespace, ./to/text())" />
177
							</dc:relation>
178
						</xsl:template>
179

    
180

    
181
						<!-- Subjects (M w A) <dc:subject>bag of words</dc:subject> If subject@classname 
182
							!= keywords, then we have a classification scheme to encode <dc:subject>info:eu-repo/classification/[scheme]/[value]</dc:subject> 
183
							<dc:subject>info:eu-repo/classification/dcc/whatever</dc:subject> -->
184
						<xsl:template match="oaf:result/subject[@classname='keyword']">
185
							<dc:subject>
186
								<xsl:value-of select="normalize-space(./text())" />
187
							</dc:subject>
188
						</xsl:template>
189
						<xsl:template
190
							match="oaf:result/subject[not(@classname='keyword') and @classid != '']">
191
							<dc:subject>
192
								<xsl:value-of
193
									select="concat('info:eu-repo/classification/', @classid, '/', normalize-space(./text()))" />
194
							</dc:subject>
195
						</xsl:template>
196

    
197
						<!--description (M w A) from description -->
198
						<xsl:template match="oaf:result/description/text()">
199
							<dc:description>
200
								<xsl:value-of select="normalize-space(.)" />
201
							</dc:description>
202
						</xsl:template>
203
						<!--publisher (M w A) from publisher -->
204
						<xsl:template match="oaf:result/publisher/text()">
205
							<dc:publisher>
206
								<xsl:value-of select="normalize-space(.)" />
207
							</dc:publisher>
208
						</xsl:template>
209
						<!-- Publication date (M) from dateofacceptance -->
210
						<xsl:template match="oaf:result/dateofacceptance/text()">
211
							<dc:date>
212
								<xsl:value-of select="normalize-space(.)" />
213
							</dc:date>
214
						</xsl:template>
215

    
216
						<!-- Publication type (M) where [type] is /instancetype[1]/classname 
217
							(dnet:publication_resource vocabulary). A second dc:type (uncontrolled) can 
218
							be used. <dc:type>info:eu-repo/semantics/[type]</dc:type> -->
219
						<xsl:template
220
							match="oaf:result/children/instance/instancetype">
221
							<xsl:variable name="theInstanceType">
222
								<xsl:choose>
223
									<xsl:when test="@classname='Unknown'">
224
										<xsl:value-of select="string('other')" />
225
									</xsl:when>
226
									<xsl:when test="@classname=''">
227
										<xsl:value-of select="string('other')" />
228
									</xsl:when>
229
									<xsl:otherwise>
230
										<xsl:call-template name="ConvertWordsToCamelCase">
231
											<xsl:with-param name="text">
232
												<xsl:value-of select="lower-case(./@classname)" />
233
											</xsl:with-param>
234
										</xsl:call-template>
235
									</xsl:otherwise>
236
								</xsl:choose>
237

    
238
							</xsl:variable>
239
							<dc:type>
240
								<xsl:value-of
241
									select="concat('info:eu-repo/semantics/',$theInstanceType)" />
242
							</dc:type>
243
						</xsl:template>
244
						<!-- <xsl:template match="oaf:result/resulttype"> <dc:type> <xsl:value-of 
245
							select="./@classname"/> </dc:type> </xsl:template> -->
246

    
247
						<!-- Format (R), in theory from format, not sure we are filling it 
248
							<dc:format>mediaType of the digital manifestation of the resource</dc:format> 
249
							<dc:format>application/pdf</dc:format> -->
250
						<xsl:template match="oaf:result/format/text()">
251
							<dc:format>
252
								<xsl:value-of select="normalize-space(.)" />
253
							</dc:format>
254
						</xsl:template>
255

    
256
						<!-- source (R) from source -->
257
						<xsl:template match="oaf:result/source/text()">
258
							<dc:source>
259
								<xsl:value-of select="normalize-space(.)" />
260
							</dc:source>
261
						</xsl:template>
262

    
263
						<xsl:template match="oaf:result/collectedfrom">
264
							<dc:source>
265
								<xsl:value-of select="normalize-space(@name)" />
266
							</dc:source>
267
						</xsl:template>
268

    
269
						<!-- Language (R) from language@classid -->
270
						<xsl:template match="oaf:result/language">
271
							<dc:language>
272
								<xsl:value-of select="./@classid" />
273
							</dc:language>
274
						</xsl:template>
275

    
276
						<!-- Override default template -->
277
						<xsl:template match="text()|@*" />
278

    
279
						<!-- =========================================================================== -->
280
						<!-- === Convert camel case text to cameCaseText === -->
281
						<!-- === Modified from http://blog.inventic.eu/2013/08/xslt-snippet-to-convert-string-from-hyphens-to-camelcase/ 
282
							=== -->
283
						<!-- === (c) Inventic s.r.o. ORM Designer team (http://www.orm-designer.com) 
284
							=== -->
285
						<!-- =========================================================================== -->
286
						<xsl:template name="ConvertWordsToCamelCase">
287
							<xsl:param name="text" />
288
							<xsl:param name="firstLower" select="true()" />
289

    
290
							<xsl:variable name="Upper">
291
								ABCDEFGHIJKLMNOPQRSTUVQXYZ
292
							</xsl:variable>
293
							<xsl:variable name="Lower">
294
								abcdefghijklmnopqrstuvwxyz
295
							</xsl:variable>
296

    
297
							<xsl:for-each select="tokenize($text,' ')">
298
								<xsl:choose>
299
									<xsl:when test="position()=1 and $firstLower = true()">
300
										<xsl:value-of select="substring(.,1,1)" />
301
									</xsl:when>
302
									<xsl:otherwise>
303
										<xsl:value-of select="translate(substring(.,1,1),$Lower,$Upper)" />
304
									</xsl:otherwise>
305
								</xsl:choose>
306
								<xsl:value-of select="substring(.,2,string-length(.))" />
307
							</xsl:for-each>
308
						</xsl:template>
309

    
310
					</xsl:stylesheet>
311
				</CODE>
312
			</SCRIPT>
313
		</CONFIGURATION>
314
		<STATUS />
315
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
316
	</BODY>
317
</RESOURCE_PROFILE>
(53-53/73)