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
|
<!-- Ordered creators (M) -->
|
36
|
<xsl:call-template name="orderedAuthors" />
|
37
|
</oai_dc:dc>
|
38
|
</xsl:template>
|
39
|
|
40
|
<!-- Creators (M) -->
|
41
|
<xsl:template name="orderedAuthors">
|
42
|
<xsl:for-each select="oaf:result//rel[./to/@class='hasAuthor']">
|
43
|
<xsl:sort select="ranking" />
|
44
|
<dc:creator>
|
45
|
<xsl:value-of select="./fullname" />
|
46
|
</dc:creator>
|
47
|
</xsl:for-each>
|
48
|
</xsl:template>
|
49
|
|
50
|
<!-- Titles (M): based on title/@classname <dc:title>main title:subtitle</dc:title>
|
51
|
<dc:title>alternative title</dc:title> <dc:title>translated title</dc:title>
|
52
|
We have only "main title" for now: let's keep it simple here... -->
|
53
|
<xsl:template match="oaf:result/title">
|
54
|
<dc:title>
|
55
|
<xsl:value-of select="normalize-space(./text())" />
|
56
|
</dc:title>
|
57
|
</xsl:template>
|
58
|
|
59
|
<!-- Contributors (R) not currently available -->
|
60
|
<xsl:template match="oaf:result//rel[./to/@class='hasContributor']">
|
61
|
<dc:contributor>
|
62
|
<xsl:value-of select="./fullname" />
|
63
|
</dc:contributor>
|
64
|
</xsl:template>
|
65
|
|
66
|
<!-- projectId (M w A) <dc:relation>info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym]</dc:relation>
|
67
|
<dc:relation>info:eu-repo/grantAgreement/EC/FP7/12345//The project name/ACRO</dc:relation>
|
68
|
<dc:relation>info:eu-repo/grantAgreement/EC/FP7/67891/EU/The 2nd project
|
69
|
name/ACRO2</dc:relation> The rel to project: <rel> <to scheme="dnet:result_project_relations"
|
70
|
class="isProducedBy" type="project">project_openaireid</to> <code>249516</code>
|
71
|
<acronym>VOICE</acronym> <title>xxx</title> <contracttype schemename="ec:FP7contractTypes"
|
72
|
classname="aaa" schemeid="ec:FP7contractTypes" classid="aaa"/> <funding>
|
73
|
<funding_level_0>FP7</funding_level_0> <funding_level_1>FP7::SP2</funding_level_1>
|
74
|
<funding_level_2>FP7::SP2::ERC</funding_level_2> </funding> </rel> The funding
|
75
|
program is funding_level_0. The funder must be inferred from the contract
|
76
|
type - until the Funders won't be added explicitely in the record. -->
|
77
|
<xsl:template match="oaf:result//rel[./to/@class='isProducedBy']">
|
78
|
<xsl:for-each select="./funding/funding_level_0">
|
79
|
<xsl:variable name="funder" select="../funder/@shortname"/>
|
80
|
<xsl:variable name="fundingProgramme" select="@name"/>
|
81
|
<xsl:variable name="jurisdiction" select="../funder/@jurisdiction"/>
|
82
|
<xsl:variable name="title" select="../../title"/>
|
83
|
<xsl:variable name="acronym" select="../../acronym"/>
|
84
|
<xsl:variable name="code" select="../../code"/>
|
85
|
<dc:relation>
|
86
|
<xsl:value-of select="concat('info:eu-repo/grantAgreement/', $funder, '/', $fundingProgramme, '/', $code, '/', $jurisdiction, '/' , $title, '/', $acronym)"/>
|
87
|
</dc:relation>
|
88
|
</xsl:for-each>
|
89
|
</xsl:template>
|
90
|
|
91
|
<!-- Access level (M) [from bestlicense@classid] : one of <dc:rights>info:eu-repo/semantics/closedAccess</dc:rights>
|
92
|
<dc:rights>info:eu-repo/semantics/embargoedAccess</dc:rights> <dc:rights>info:eu-repo/semantics/restrictedAccess</dc:rights>
|
93
|
<dc:rights>info:eu-repo/semantics/openAccess</dc:rights> -->
|
94
|
<xsl:template match="oaf:result/bestlicense">
|
95
|
<xsl:variable name="license">
|
96
|
<xsl:choose>
|
97
|
<xsl:when test="@classid='OPEN'">
|
98
|
<xsl:value-of select="string('info:eu-repo/semantics/openAccess')" />
|
99
|
</xsl:when>
|
100
|
<xsl:when test="@classid='CLOSED'">
|
101
|
<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')" />
|
102
|
</xsl:when>
|
103
|
<xsl:when test="@classid='RESTRICTED'">
|
104
|
<xsl:value-of
|
105
|
select="string('info:eu-repo/semantics/restrictedAccess')" />
|
106
|
</xsl:when>
|
107
|
<xsl:when test="@classid='EMBARGO'">
|
108
|
<xsl:value-of
|
109
|
select="string('info:eu-repo/semantics/embargoedAccess')" />
|
110
|
</xsl:when>
|
111
|
<xsl:otherwise>
|
112
|
<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')" />
|
113
|
</xsl:otherwise>
|
114
|
</xsl:choose>
|
115
|
</xsl:variable>
|
116
|
<dc:rights>
|
117
|
<xsl:value-of select="$license" />
|
118
|
</dc:rights>
|
119
|
</xsl:template>
|
120
|
|
121
|
<!-- EmbargoEnd (M w A) (only when rights == info:eu-repo/semantics/embargoedAccess),
|
122
|
from embargoenddate <dc:date>info:eu-repo/date/embargoEnd/1960-01-01</dc:date> -->
|
123
|
<xsl:template match="oaf:result/embargoenddate/text()">
|
124
|
<dc:date>
|
125
|
<xsl:value-of select="concat('info:eu-repo/date/embargoEnd/', .)" />
|
126
|
</dc:date>
|
127
|
</xsl:template>
|
128
|
|
129
|
|
130
|
<!-- <xsl:template match="oaf:result/originalId/text()"> <dc:identifier>
|
131
|
<xsl:value-of select="normalize-space(.)"/> </dc:identifier> </xsl:template> -->
|
132
|
|
133
|
<!-- Alternative Identifier (R), idType from pid@classid <dc:relation>
|
134
|
info:eu-repo/semantics/altIdentifier/[idType]/[ID] </dc:relation> -->
|
135
|
<xsl:template match="oaf:result/pid[./text()]">
|
136
|
<dc:relation>
|
137
|
<xsl:value-of
|
138
|
select="concat('info:eu-repo/semantics/altIdentifier/', @classid, '/', ./text())" />
|
139
|
</dc:relation>
|
140
|
</xsl:template>
|
141
|
|
142
|
<xsl:template
|
143
|
match="oaf:result/children/instance/webresource/url/text()">
|
144
|
<dc:identifier>
|
145
|
<xsl:value-of select="." />
|
146
|
</dc:identifier>
|
147
|
</xsl:template>
|
148
|
<!--Referenced Publication (R), from extraInfo[@typology='citations']/citation,
|
149
|
idType from citation/id/@type, ID from citation/id/@value <dc:relation> info:eu-repo/semantics/reference/[idType]/[ID]
|
150
|
</dc:relation> <dc:relation> info:eu-repo/semantics/reference/doi/10.1234/789.1
|
151
|
</dc:relation> <dc:relation> info:eu-repo/semantics/reference/pmid/1234567
|
152
|
</dc:relation> -->
|
153
|
<xsl:template
|
154
|
match="extraInfo[@typology='citations']//citation/id[./@type]">
|
155
|
<xsl:choose>
|
156
|
<xsl:when test="@type='openaire'">
|
157
|
<dc:relation>
|
158
|
<xsl:value-of
|
159
|
select="concat('info:eu-repo/semantics/reference/', @type, '/', $openaireNamespace, @value)" />
|
160
|
</dc:relation>
|
161
|
|
162
|
</xsl:when>
|
163
|
<xsl:otherwise>
|
164
|
<dc:relation>
|
165
|
<xsl:value-of
|
166
|
select="concat('info:eu-repo/semantics/reference/', @type, '/', @value)" />
|
167
|
</dc:relation>
|
168
|
</xsl:otherwise>
|
169
|
</xsl:choose>
|
170
|
|
171
|
</xsl:template>
|
172
|
|
173
|
<!-- Dataset reference (R), from: rel[./resulttyype/@classname='dataset']
|
174
|
<dc:relation>info:eu-repo/semantics/dataset/[idType]/[ID]</dc:relation> only
|
175
|
available when we'll expand the PIDs in the relationship <dc:relation>info:eu-repo/semantics/dataset/doi/10.1234/789.1</dc:relation>
|
176
|
For now we can only use openaire ids, from rel[./resulttyype/@classname='dataset']/to/text()
|
177
|
<dc:relation>info:eu-repo/semantics/dataset/openaire/oai:dnet:[OPENAIRE_ID]</dc:relation> -->
|
178
|
<xsl:template match="oaf:result//rel[./resulttype/@classid='dataset']">
|
179
|
<dc:relation>
|
180
|
<xsl:value-of
|
181
|
select="concat('info:eu-repo/semantics/dataset/openaire/', $openaireNamespace, ./to/text())" />
|
182
|
</dc:relation>
|
183
|
</xsl:template>
|
184
|
|
185
|
|
186
|
<!-- Subjects (M w A) <dc:subject>bag of words</dc:subject> If subject@classname
|
187
|
!= keywords, then we have a classification scheme to encode <dc:subject>info:eu-repo/classification/[scheme]/[value]</dc:subject>
|
188
|
<dc:subject>info:eu-repo/classification/dcc/whatever</dc:subject> -->
|
189
|
<xsl:template match="oaf:result/subject[@classname='keyword']">
|
190
|
<dc:subject>
|
191
|
<xsl:value-of select="normalize-space(./text())" />
|
192
|
</dc:subject>
|
193
|
</xsl:template>
|
194
|
<xsl:template
|
195
|
match="oaf:result/subject[not(@classname='keyword') and @classid != '']">
|
196
|
<dc:subject>
|
197
|
<xsl:value-of
|
198
|
select="concat('info:eu-repo/classification/', @classid, '/', normalize-space(./text()))" />
|
199
|
</dc:subject>
|
200
|
</xsl:template>
|
201
|
|
202
|
<!--description (M w A) from description -->
|
203
|
<xsl:template match="oaf:result/description/text()">
|
204
|
<dc:description>
|
205
|
<xsl:value-of select="normalize-space(.)" />
|
206
|
</dc:description>
|
207
|
</xsl:template>
|
208
|
<!--publisher (M w A) from publisher -->
|
209
|
<xsl:template match="oaf:result/publisher/text()">
|
210
|
<dc:publisher>
|
211
|
<xsl:value-of select="normalize-space(.)" />
|
212
|
</dc:publisher>
|
213
|
</xsl:template>
|
214
|
<!-- Publication date (M) from dateofacceptance -->
|
215
|
<xsl:template match="oaf:result/dateofacceptance/text()">
|
216
|
<dc:date>
|
217
|
<xsl:value-of select="normalize-space(.)" />
|
218
|
</dc:date>
|
219
|
</xsl:template>
|
220
|
|
221
|
<!-- Publication type (M) where [type] is /instancetype[1]/classname
|
222
|
(dnet:publication_resource vocabulary). A second dc:type (uncontrolled) can
|
223
|
be used. <dc:type>info:eu-repo/semantics/[type]</dc:type> -->
|
224
|
<xsl:template
|
225
|
match="oaf:result/children/instance/instancetype">
|
226
|
<xsl:variable name="theInstanceType">
|
227
|
<xsl:choose>
|
228
|
<xsl:when test="@classname='Unknown'">
|
229
|
<xsl:value-of select="string('other')" />
|
230
|
</xsl:when>
|
231
|
<xsl:when test="@classname=''">
|
232
|
<xsl:value-of select="string('other')" />
|
233
|
</xsl:when>
|
234
|
<xsl:otherwise>
|
235
|
<xsl:call-template name="ConvertWordsToCamelCase">
|
236
|
<xsl:with-param name="text">
|
237
|
<xsl:value-of select="lower-case(./@classname)" />
|
238
|
</xsl:with-param>
|
239
|
</xsl:call-template>
|
240
|
</xsl:otherwise>
|
241
|
</xsl:choose>
|
242
|
|
243
|
</xsl:variable>
|
244
|
<dc:type>
|
245
|
<xsl:value-of
|
246
|
select="concat('info:eu-repo/semantics/',$theInstanceType)" />
|
247
|
</dc:type>
|
248
|
</xsl:template>
|
249
|
<!-- <xsl:template match="oaf:result/resulttype"> <dc:type> <xsl:value-of
|
250
|
select="./@classname"/> </dc:type> </xsl:template> -->
|
251
|
|
252
|
<!-- Format (R), in theory from format, not sure we are filling it
|
253
|
<dc:format>mediaType of the digital manifestation of the resource</dc:format>
|
254
|
<dc:format>application/pdf</dc:format> -->
|
255
|
<xsl:template match="oaf:result/format/text()">
|
256
|
<dc:format>
|
257
|
<xsl:value-of select="normalize-space(.)" />
|
258
|
</dc:format>
|
259
|
</xsl:template>
|
260
|
|
261
|
<!-- source (R) from source -->
|
262
|
<xsl:template match="oaf:result/source/text()">
|
263
|
<dc:source>
|
264
|
<xsl:value-of select="normalize-space(.)" />
|
265
|
</dc:source>
|
266
|
</xsl:template>
|
267
|
|
268
|
<xsl:template match="oaf:result/collectedfrom">
|
269
|
<dc:source>
|
270
|
<xsl:value-of select="normalize-space(@name)" />
|
271
|
</dc:source>
|
272
|
</xsl:template>
|
273
|
|
274
|
<!-- Language (R) from language@classid -->
|
275
|
<xsl:template match="oaf:result/language">
|
276
|
<dc:language>
|
277
|
<xsl:value-of select="./@classid" />
|
278
|
</dc:language>
|
279
|
</xsl:template>
|
280
|
|
281
|
<!-- Override default template -->
|
282
|
<xsl:template match="text()|@*" />
|
283
|
|
284
|
<!-- =========================================================================== -->
|
285
|
<!-- === Convert camel case text to cameCaseText === -->
|
286
|
<!-- === Modified from http://blog.inventic.eu/2013/08/xslt-snippet-to-convert-string-from-hyphens-to-camelcase/
|
287
|
=== -->
|
288
|
<!-- === (c) Inventic s.r.o. ORM Designer team (http://www.orm-designer.com)
|
289
|
=== -->
|
290
|
<!-- =========================================================================== -->
|
291
|
<xsl:template name="ConvertWordsToCamelCase">
|
292
|
<xsl:param name="text" />
|
293
|
<xsl:param name="firstLower" select="true()" />
|
294
|
|
295
|
<xsl:variable name="Upper">
|
296
|
ABCDEFGHIJKLMNOPQRSTUVQXYZ
|
297
|
</xsl:variable>
|
298
|
<xsl:variable name="Lower">
|
299
|
abcdefghijklmnopqrstuvwxyz
|
300
|
</xsl:variable>
|
301
|
|
302
|
<xsl:for-each select="tokenize($text,' ')">
|
303
|
<xsl:choose>
|
304
|
<xsl:when test="position()=1 and $firstLower = true()">
|
305
|
<xsl:value-of select="substring(.,1,1)" />
|
306
|
</xsl:when>
|
307
|
<xsl:otherwise>
|
308
|
<xsl:value-of select="translate(substring(.,1,1),$Lower,$Upper)" />
|
309
|
</xsl:otherwise>
|
310
|
</xsl:choose>
|
311
|
<xsl:value-of select="substring(.,2,string-length(.))" />
|
312
|
</xsl:for-each>
|
313
|
</xsl:template>
|
314
|
|
315
|
</xsl:stylesheet>
|
316
|
</CODE>
|
317
|
</SCRIPT>
|
318
|
</CONFIGURATION>
|
319
|
<STATUS />
|
320
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
321
|
</BODY>
|
322
|
</RESOURCE_PROFILE>
|