1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="5a4dd0b9-412c-4b67-a2df-c376070f680e_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2018-06-04T11:15:30+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>ANR to DB</TITLE>
|
14
|
<CODE>
|
15
|
<![CDATA[
|
16
|
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
17
|
xmlns:utils="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions">
|
18
|
|
19
|
<xsl:param name="varDataSourceId"/>
|
20
|
<xsl:variable name="namespacePrefix" select="string('anr_________')"/>
|
21
|
|
22
|
<!--<xsl:variable name="dateFormat" select="string('dd-MM-yyyy')"/>-->
|
23
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::ANR')"/>
|
24
|
|
25
|
<!--<xsl:variable name="fundingId">
|
26
|
<xsl:value-of
|
27
|
select="concat($funderID, '::', translate(.//column[@name = 'FUNDING STREAM'], ' ', ''))"
|
28
|
/>
|
29
|
</xsl:variable>
|
30
|
-->
|
31
|
<xsl:variable name="fundingId">
|
32
|
<xsl:value-of select="$funderID"/>
|
33
|
</xsl:variable>
|
34
|
<xsl:variable name="quot">"</xsl:variable>
|
35
|
<xsl:variable name="dollaro">$</xsl:variable>
|
36
|
<xsl:variable name="Id">
|
37
|
<xsl:value-of select="normalize-space(.//column[@isID = 'true'])"/>
|
38
|
</xsl:variable>
|
39
|
<xsl:template name="terminate">
|
40
|
<xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
|
41
|
</xsl:message>
|
42
|
</xsl:template>
|
43
|
|
44
|
<xsl:template name="orgPid">
|
45
|
<xsl:param name="organizationPidList"/>
|
46
|
<xsl:param name="position"/>
|
47
|
<xsl:param name="organizationId"/>
|
48
|
<xsl:if test="$organizationPidList[$position]">
|
49
|
<xsl:variable name="organizationPid"
|
50
|
select="concat('RNSR:', $organizationPidList[$position])"/>
|
51
|
<xsl:variable name="organizationPidType" select="'RNSR'"/>
|
52
|
<ROW table="dsm_identities">
|
53
|
<FIELD name="_dnet_resource_identifier_">
|
54
|
<xsl:value-of select="concat($organizationPid, '@@', $organizationPidType)"/>
|
55
|
</FIELD>
|
56
|
<FIELD name="pid">
|
57
|
<xsl:value-of select="$organizationPid"/>
|
58
|
</FIELD>
|
59
|
<FIELD name="issuertype">
|
60
|
<xsl:value-of select="$organizationPidType"/>
|
61
|
</FIELD>
|
62
|
</ROW>
|
63
|
<ROW table="dsm_organizationpids">
|
64
|
<FIELD name="organization">
|
65
|
<xsl:value-of select="$organizationId"/>
|
66
|
</FIELD>
|
67
|
<FIELD name="_dnet_resource_identifier_">
|
68
|
<xsl:value-of select="concat($organizationPid, '@@', $organizationId)"/>
|
69
|
</FIELD>
|
70
|
<FIELD name="pid">
|
71
|
<xsl:value-of select="$organizationPid"/>
|
72
|
</FIELD>
|
73
|
</ROW>
|
74
|
</xsl:if>
|
75
|
|
76
|
|
77
|
</xsl:template>
|
78
|
<xsl:template match="/">
|
79
|
<xsl:choose>
|
80
|
<xsl:when
|
81
|
test=".//column[@name = 'Titre.Francais'] | .//column[@name = 'Titre.Anglais'] | .//column[@name = 'Acronyme']">
|
82
|
<record>
|
83
|
|
84
|
<xsl:copy-of select=".//*[local-name() = 'header']"/>
|
85
|
|
86
|
<metadata>
|
87
|
<ROWS>
|
88
|
<xsl:variable name="projectId"
|
89
|
select="concat($namespacePrefix, '::', $Id)"/>
|
90
|
<!-- <xsl:variable name="startDate"
|
91
|
select="replace(.//column[@name = 'PROJECT STARTING DATE'], '/', '-')"/>
|
92
|
<xsl:variable name="endDate"
|
93
|
select="replace(.//column[@name = 'PROJECT COMPLETION DATE'], '/', '-')"/>
|
94
|
-->
|
95
|
|
96
|
<ROW table="projects">
|
97
|
<FIELD name="_dnet_resource_identifier_">
|
98
|
<xsl:value-of select="$projectId"/>
|
99
|
</FIELD>
|
100
|
<FIELD name="id">
|
101
|
<xsl:value-of select="$projectId"/>
|
102
|
</FIELD>
|
103
|
<FIELD name="code">
|
104
|
<xsl:value-of select="$Id"/>
|
105
|
</FIELD>
|
106
|
<xsl:choose>
|
107
|
<xsl:when test=".//column[@name = 'Titre.Anglais']">
|
108
|
<FIELD name="title">
|
109
|
<xsl:value-of
|
110
|
select=".//column[@name = 'Titre.Anglais']"/>
|
111
|
</FIELD>
|
112
|
</xsl:when>
|
113
|
<xsl:when test=".//column[@name = 'Titre.Francais']">
|
114
|
<FIELD name="title">
|
115
|
<xsl:value-of
|
116
|
select=".//column[@name = 'Titre.Francais']"/>
|
117
|
</FIELD>
|
118
|
</xsl:when>
|
119
|
<xsl:otherwise>
|
120
|
<FIELD name="title">
|
121
|
<xsl:value-of select=".//column[@name = 'Acronyme']"/>
|
122
|
</FIELD>
|
123
|
</xsl:otherwise>
|
124
|
</xsl:choose>
|
125
|
|
126
|
|
127
|
<FIELD name="acronym">
|
128
|
<xsl:value-of
|
129
|
select=".//column[@name = 'Acronyme (SIM)'] | .//column[@name = 'Acronyme']"
|
130
|
/>
|
131
|
</FIELD>
|
132
|
<!-- <FIELD name="startdate" type="date" format="{$dateFormat}">
|
133
|
<xsl:value-of select="$startDate"/>
|
134
|
</FIELD>
|
135
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
136
|
<xsl:value-of select="$endDate"/>
|
137
|
</FIELD>-->
|
138
|
<xsl:if test=".//column[@name = 'Responsable_scientifique']">
|
139
|
<FIELD name="contactfullname">
|
140
|
<xsl:value-of
|
141
|
select="normalize-space(.//column[@name = 'Responsable_scientifique'])"
|
142
|
/>
|
143
|
</FIELD>
|
144
|
</xsl:if>
|
145
|
|
146
|
<xsl:if test=".//column[@name = 'Aide_allouee']">
|
147
|
<FIELD name="fundedamount" type="float">
|
148
|
|
149
|
<xsl:value-of select=".//column[@name = 'Aide_allouee']"/>
|
150
|
</FIELD>
|
151
|
<FIELD name="currency">
|
152
|
<xsl:value-of select="string('EUR')"/>
|
153
|
</FIELD>
|
154
|
</xsl:if>
|
155
|
<xsl:if
|
156
|
test=".//column[@name = 'Resume.Francais'] or .//column[@name = 'Resume.Anglais']">
|
157
|
<xsl:choose>
|
158
|
<xsl:when test=".//column[@name = 'Resume.Anglais']">
|
159
|
<FIELD name="summary">
|
160
|
<xsl:value-of
|
161
|
select=".//column[@name = 'Resume.Anglais']"/>
|
162
|
</FIELD>
|
163
|
</xsl:when>
|
164
|
<xsl:otherwise>
|
165
|
<FIELD name="summary">
|
166
|
<xsl:value-of
|
167
|
select=".//column[@name = 'Resume.Francais']"/>
|
168
|
</FIELD>
|
169
|
</xsl:otherwise>
|
170
|
</xsl:choose>
|
171
|
</xsl:if>
|
172
|
<FIELD name="collectedfrom">
|
173
|
<xsl:value-of select="$varDataSourceId"/>
|
174
|
</FIELD>
|
175
|
<FIELD name="provenanceactionclass"
|
176
|
>sysimport:crosswalk:entityregistry</FIELD>
|
177
|
<FIELD name="provenanceactionscheme">dnet:provenanceActions</FIELD>
|
178
|
<FIELD name="oa_mandate_for_publications" type="boolean"
|
179
|
>false</FIELD>
|
180
|
<FIELD name="lastupdate" type="date">
|
181
|
<xsl:value-of select="current-dateTime()"/>
|
182
|
</FIELD>
|
183
|
</ROW>
|
184
|
<xsl:variable name="organizationCodeList"
|
185
|
select="tokenize(.//column[@name = 'Partenaire.Code_RNSR'], '@')"/>
|
186
|
<xsl:if test=".//column[@name = 'Partenaire.Coordinature']">
|
187
|
<xsl:variable name="Coord">
|
188
|
<xsl:value-of
|
189
|
select="utils:md5(.//column[@name = 'Partenaire.Coordinature'])"
|
190
|
/>
|
191
|
</xsl:variable>
|
192
|
<xsl:variable name="organizationId">
|
193
|
<xsl:value-of select="concat($namespacePrefix, '::', $Coord)"/>
|
194
|
</xsl:variable>
|
195
|
<ROW table="dsm_organizations">
|
196
|
<FIELD name="_dnet_resource_identifier_">
|
197
|
<xsl:value-of select="$organizationId"/>
|
198
|
</FIELD>
|
199
|
<FIELD name="id">
|
200
|
<xsl:value-of select="$organizationId"/>
|
201
|
</FIELD>
|
202
|
<FIELD name="lastupdate" type="date">
|
203
|
<xsl:value-of select="current-dateTime()"/>
|
204
|
</FIELD>
|
205
|
|
206
|
<FIELD name="legalname">
|
207
|
<xsl:value-of
|
208
|
select=".//column[@name = 'Partenaire.Coordinature']"/>
|
209
|
</FIELD>
|
210
|
|
211
|
<FIELD name="collectedfrom">
|
212
|
<xsl:value-of select="$varDataSourceId"/>
|
213
|
</FIELD>
|
214
|
<FIELD name="provenanceaction"
|
215
|
>sysimport:crosswalk:entityregistry</FIELD>
|
216
|
<FIELD name="trust" type="float">
|
217
|
<xsl:value-of select="0.81"/>
|
218
|
</FIELD>
|
219
|
</ROW>
|
220
|
|
221
|
<ROW table="project_organization">
|
222
|
<FIELD name="_dnet_resource_identifier_">
|
223
|
<xsl:value-of
|
224
|
select='concat($projectId, "@@", $organizationId)'/>
|
225
|
</FIELD>
|
226
|
|
227
|
<FIELD name="project">
|
228
|
<xsl:value-of select="$projectId"/>
|
229
|
</FIELD>
|
230
|
<FIELD name="resporganization">
|
231
|
<xsl:value-of select="$organizationId"/>
|
232
|
</FIELD>
|
233
|
|
234
|
|
235
|
<FIELD name="semanticclass">coordinator</FIELD>
|
236
|
|
237
|
|
238
|
|
239
|
</ROW>
|
240
|
<xsl:call-template name="orgPid">
|
241
|
<xsl:with-param name="position" select="1"/>
|
242
|
<xsl:with-param name="organizationPidList"
|
243
|
select="$organizationCodeList"/>
|
244
|
<xsl:with-param name="organizationId" select="$organizationId"/>
|
245
|
</xsl:call-template>
|
246
|
|
247
|
</xsl:if>
|
248
|
|
249
|
<xsl:if test=".//column[@name = 'Partenaire.Nom_organisme']">
|
250
|
<xsl:for-each
|
251
|
select="tokenize(.//column[@name = 'Partenaire.Nom_organisme'], '@')">
|
252
|
<xsl:if test="string-length(.) > 0">
|
253
|
<xsl:variable name="organizationId">
|
254
|
<xsl:value-of
|
255
|
select="concat($namespacePrefix, '::', utils:md5(.))"
|
256
|
/>
|
257
|
</xsl:variable>
|
258
|
<ROW table="dsm_organizations">
|
259
|
<FIELD name="_dnet_resource_identifier_">
|
260
|
<xsl:value-of select="$organizationId"/>
|
261
|
</FIELD>
|
262
|
<FIELD name="id">
|
263
|
<xsl:value-of select="$organizationId"/>
|
264
|
</FIELD>
|
265
|
<FIELD name="lastupdate" type="date">
|
266
|
<xsl:value-of select="current-dateTime()"/>
|
267
|
</FIELD>
|
268
|
|
269
|
<FIELD name="legalname">
|
270
|
<xsl:value-of select="."/>
|
271
|
</FIELD>
|
272
|
|
273
|
<FIELD name="collectedfrom">
|
274
|
<xsl:value-of select="$varDataSourceId"/>
|
275
|
</FIELD>
|
276
|
<FIELD name="provenanceaction"
|
277
|
>sysimport:crosswalk:entityregistry</FIELD>
|
278
|
<FIELD name="trust" type="float">
|
279
|
<xsl:value-of select="0.81"/>
|
280
|
</FIELD>
|
281
|
</ROW>
|
282
|
|
283
|
<ROW table="project_organization">
|
284
|
<FIELD name="_dnet_resource_identifier_">
|
285
|
<xsl:value-of
|
286
|
select='concat($projectId, "@@", $organizationId)'
|
287
|
/>
|
288
|
</FIELD>
|
289
|
|
290
|
<FIELD name="project">
|
291
|
<xsl:value-of select="$projectId"/>
|
292
|
</FIELD>
|
293
|
<FIELD name="resporganization">
|
294
|
<xsl:value-of select="$organizationId"/>
|
295
|
</FIELD>
|
296
|
|
297
|
|
298
|
|
299
|
|
300
|
<FIELD name="semanticclass">participant</FIELD>
|
301
|
|
302
|
</ROW>
|
303
|
<xsl:call-template name="orgPid">
|
304
|
<xsl:with-param name="organizationId"
|
305
|
select="$organizationId"/>
|
306
|
<xsl:with-param name="organizationPidList"
|
307
|
select="$organizationCodeList"/>
|
308
|
<xsl:with-param name="position" select="position()"/>
|
309
|
</xsl:call-template>
|
310
|
</xsl:if>
|
311
|
|
312
|
</xsl:for-each>
|
313
|
|
314
|
|
315
|
</xsl:if>
|
316
|
|
317
|
|
318
|
<ROW table="project_fundingpath">
|
319
|
<FIELD name="_dnet_resource_identifier_">
|
320
|
<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
|
321
|
</FIELD>
|
322
|
<FIELD name="funding">
|
323
|
<xsl:value-of select="$fundingId"/>
|
324
|
</FIELD>
|
325
|
<FIELD name="project">
|
326
|
<xsl:value-of select="$projectId"/>
|
327
|
</FIELD>
|
328
|
<!-- <FIELD name="startdate" type="date" format="{$dateFormat}">
|
329
|
<xsl:value-of select="$startDate"/>
|
330
|
</FIELD>
|
331
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
332
|
<xsl:value-of select="$endDate"/>
|
333
|
</FIELD> -->
|
334
|
</ROW>
|
335
|
|
336
|
</ROWS>
|
337
|
</metadata>
|
338
|
</record>
|
339
|
</xsl:when>
|
340
|
<xsl:otherwise>
|
341
|
<xsl:call-template name="terminate"/>
|
342
|
</xsl:otherwise>
|
343
|
</xsl:choose>
|
344
|
|
345
|
</xsl:template>
|
346
|
</xsl:stylesheet>
|
347
|
|
348
|
|
349
|
]]>
|
350
|
</CODE>
|
351
|
</SCRIPT>
|
352
|
</CONFIGURATION>
|
353
|
<STATUS/>
|
354
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
355
|
</BODY>
|
356
|
</RESOURCE_PROFILE>
|