Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="e29e2faf-9ae1-42c3-a722-3e7a116886b6_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>FCT to DB</TITLE>
14
				<CODE>
15
					<![CDATA[
16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
18

    
19
    <xsl:param name="varDataSourceId"/>
20
    <xsl:variable name="namespacePrefix" select="string('fct_________')"/>
21

    
22
    <xsl:variable name="invalid" select="' ,-'"/>
23
    <xsl:variable name="valid" select="'___'"/>
24

    
25
    <xsl:variable name="prefix" select="string('fct_________')"/>
26
    <xsl:variable name="funderID" select="concat($prefix, '::FCT')"/>
27

    
28

    
29
    <!--    TO BE USED COUPLED WITH THE OTHER
30

    
31
<xsl:template name="terminate">
32
                <xsl:message terminate="yes">
33

    
34
                    funder is not FCT; transformation interrupeted
35
                </xsl:message>
36
            </xsl:template>
37

    
38
 -->
39

    
40

    
41
    <xsl:template name="orgPid">
42
        <xsl:param name="organizationPidType"/>
43
        <xsl:param name="organizationPidValue"/>
44
        <xsl:param name="organizationId"/>
45
        <xsl:variable name="organizationPid"
46
            select="concat($organizationPidType, ':', $organizationPidValue)"/>
47
        <ROW table="dsm_identities">
48
            <FIELD name="_dnet_resource_identifier_">
49
                <xsl:value-of select="concat($organizationPid, '@@', $organizationPidType)"/>
50
            </FIELD>
51
            <FIELD name="pid">
52
                <xsl:value-of select="$organizationPid"/>
53
            </FIELD>
54
            <FIELD name="issuertype">
55
                <xsl:value-of select="$organizationPidType"/>
56
            </FIELD>
57
        </ROW>
58
        <ROW table="dsm_organizationpids">
59
            <FIELD name="organization">
60
                <xsl:value-of select="$organizationId"/>
61
            </FIELD>
62
            <FIELD name="_dnet_resource_identifier_">
63
                <xsl:value-of select="concat($organizationPid, '@@', $organizationId)"/>
64
            </FIELD>
65
            <FIELD name="pid">
66
                <xsl:value-of select="$organizationPid"/>
67
            </FIELD>
68
        </ROW>
69

    
70

    
71

    
72

    
73
    </xsl:template>
74
    <xsl:template name="orgTempalte">
75

    
76
        <xsl:param name="elem"/>
77
        <xsl:param name="role"/>
78
        <xsl:param name="projectId"/>
79
        <xsl:variable name="organizationId"
80
            select="concat($namespacePrefix, '::', $elem/*[local-name() = 'OrgUnit']/@id)"/>
81
        <ROW table="dsm_organizations">
82
            <FIELD name="_dnet_resource_identifier_">
83
                <xsl:value-of select="$organizationId"/>
84
            </FIELD>
85
            <FIELD name="id">
86
                <xsl:value-of select="$organizationId"/>
87
            </FIELD>
88
            <FIELD name="legalname">
89
                <xsl:value-of select="normalize-space($elem//*[local-name() = 'Name'])"/>
90
            </FIELD>
91
            <FIELD name="legalshortname">
92
                <xsl:value-of select="normalize-space($elem//*[local-name() = 'Acronym'])"/>
93
            </FIELD>
94
            <xsl:for-each
95
                select=".//*[local-name() = 'Type'][@scheme = 'https://w3id.org/cerif/vocab/OrganisationTypes' and @xml:lang = 'en']">
96
                <xsl:choose>
97
                    <xsl:when test=". = 'Higher Education'">
98
                        <FIELD name="ec_highereducation" type="boolean">
99
                            <xsl:value-of select="true()"/>
100
                        </FIELD>
101
                    </xsl:when>
102
                    <xsl:when test=". = 'Research Institute'">
103
                        <FIELD name="ec_researchorganization" type="boolean">
104
                            <xsl:value-of select="true()"/>
105
                        </FIELD>
106
                    </xsl:when>
107
                    <xsl:when test=". = 'Private non-profit'">
108
                        <FIELD name="ec_nonprofit" type="boolean">
109
                            <xsl:value-of select="true()"/>
110
                        </FIELD>
111
                    </xsl:when>
112
                </xsl:choose>
113

    
114
            </xsl:for-each>
115

    
116
            <FIELD name="websiteurl">
117
                <xsl:value-of
118
                    select="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#URL']"
119
                />
120
            </FIELD>
121
            <FIELD name="collectedfrom">
122
                <xsl:value-of select="$varDataSourceId"/>
123
            </FIELD>
124
            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
125
            <FIELD name="lastupdate" type="date">
126
                <xsl:value-of select="current-dateTime()"/>
127
            </FIELD>
128
        </ROW>
129
        <ROW table="project_organization">
130
            <FIELD name="_dnet_resource_identifier_">
131
                <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
132
            </FIELD>
133
            <FIELD name="project">
134
                <xsl:value-of select="$projectId"/>
135
            </FIELD>
136
            <FIELD name="resporganization">
137
                <xsl:value-of select="$organizationId"/>
138
            </FIELD>
139

    
140
            <FIELD name="semanticclass">
141
                <xsl:value-of select="$role"/>
142
            </FIELD>
143

    
144
        </ROW>
145
        <xsl:if
146
            test="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#ISNI']">
147
            <xsl:call-template name="orgPid">
148
                <xsl:with-param name="organizationPidType" select="'ISNI'"/>
149
                <xsl:with-param name="organizationPidValue"
150
                    select="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#ISNI']"/>
151
                <xsl:with-param name="organizationId" select="$organizationId"/>
152
            </xsl:call-template>
153
        </xsl:if>
154
        <xsl:if
155
            test="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#RingGold']">
156
            <xsl:call-template name="orgPid">
157
                <xsl:with-param name="organizationPidType" select="'RingGold'"/>
158
                <xsl:with-param name="organizationPidValue"
159
                    select="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#RingGold']"/>
160
                <xsl:with-param name="organizationId" select="$organizationId"/>
161
            </xsl:call-template>
162
        </xsl:if>
163
        <xsl:if
164
            test="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#NIF']">
165
            <xsl:call-template name="orgPid">
166
                <xsl:with-param name="organizationPidType" select="'NIF'"/>
167
                <xsl:with-param name="organizationPidValue"
168
                    select="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#NIF']"/>
169
                <xsl:with-param name="organizationId" select="$organizationId"/>
170
            </xsl:call-template>
171
        </xsl:if>
172
        <xsl:if
173
            test="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#DGEEC']">
174
            <xsl:call-template name="orgPid">
175
                <xsl:with-param name="organizationPidType" select="'DGEEC'"/>
176
                <xsl:with-param name="organizationPidValue"
177
                    select="$elem//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#DGEEC']"/>
178
                <xsl:with-param name="organizationId" select="$organizationId"/>
179
            </xsl:call-template>
180
        </xsl:if>
181
    </xsl:template>
182

    
183
    <!--    TO BE USED IF SOME OF THE PROJECTS ARE NOT FROM FCT
184

    
185
<xsl:template match="/">
186
<xsl:choose>
187
<xsl:when test="//*[local-name() = 'Funded']//*[local-name() = 'Acronym'] = 'FCT'">
188
        <record>
189
            <xsl:copy-of select=".//*[local-name() = 'header']"/>
190
            <metadata>
191
                <ROWS>
192
                    <xsl:for-each select="//*[local-name() = 'Project']">
193
                        <xsl:call-template name="projectTemplate"/>
194
                    </xsl:for-each>
195
                </ROWS>
196
            </metadata>
197

    
198
        </record>
199
</xsl:when>
200
<xsl:otherwise>
201
<FunderAcronym>
202
<xsl:value-of select="//*[local-name() = 'Funded']//*[local-name() = 'Acronym'] "/>
203
</FunderAcronym>
204
</xsl:otherwise>
205
</xsl:choose>
206
    </xsl:template>
207

    
208
-->
209

    
210
    <xsl:template match="/">
211

    
212
        <record>
213
            <xsl:copy-of select=".//*[local-name() = 'header']"/>
214
            <metadata>
215
                <ROWS>
216
                    <xsl:for-each select="//*[local-name() = 'Project']">
217
                        <xsl:call-template name="projectTemplate"/>
218
                    </xsl:for-each>
219
                </ROWS>
220
            </metadata>
221

    
222
        </record>
223

    
224
    </xsl:template>
225

    
226
    <xsl:template name="projectTemplate">
227
        <xsl:variable name="projectCode"
228
            select="./*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#ProjectReference']"/>
229
        <xsl:variable name="projectId" select="concat($namespacePrefix, '::', $projectCode)"/>
230
        <!--<xsl:variable name="projectAcronym" select="./*[local-name() = 'Acronym']"/>-->
231
        <xsl:variable name="projectTitle" select="./*[local-name() = 'Title'][@xml:lang = 'en']"/>
232
        <xsl:variable name="startDate" select="./*[local-name() = 'StartDate']"/>
233
        <xsl:variable name="endDate" select="./*[local-name() = 'EndDate']"/>
234
        <xsl:variable name="projectSummary" select="./*[local-name() = 'Abstract']"/>
235
        <xsl:variable name="tokens" select="tokenize($projectCode, '/')"/>
236
        <xsl:variable name="callID" select="concat($tokens[1], '/', $tokens[last()])"/>
237
        <xsl:variable name="projectKeywords"
238
            select="./*[local-name() = 'Keyword'][@xml:lang = 'en']"/>
239
        <xsl:variable name="contactPerson"
240
            select="./*[local-name() = 'Team']/*[local-name() = 'Contact']//*[local-name() = 'PersonName']"/>
241
        <xsl:variable name="fundedAmount"
242
            select=".//*[local-name() = 'Funding']/*[local-name() = 'Amount']"/>
243
        <xsl:variable name="fundedCurrency"
244
            select=".//*[local-name() = 'Funding']/*[local-name() = 'Amount']/@currency"/>
245
        <xsl:variable name="websiteUrl"
246
            select=".//*[local-name() = 'Funding']/*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#URL']"/>
247
        <xsl:variable name="coordinatorList" select=".//*[local-name() = 'Coordinator']"/>
248
        <xsl:variable name="participantList" select=".//*[local-name() = 'Partner']"/>
249

    
250
        <ROW table="projects">
251
            <FIELD name="_dnet_resource_identifier_">
252
                <xsl:value-of select="$projectId"/>
253
            </FIELD>
254
            <FIELD name="id">
255
                <xsl:value-of select="$projectId"/>
256
            </FIELD>
257
            <FIELD name="code">
258
                <xsl:value-of select="$projectCode"/>
259
            </FIELD>
260

    
261
            <!--   <FIELD name="websiteurl">
262
                <xsl:choose>
263
                    <xsl:when test="contains($websiteUrl,'?idProjecto')">
264
                        <xsl:value-of select="$websiteUrl"/>
265
                    </xsl:when>
266
                    <xsl:otherwise>
267
                        <xsl:variable name="prefix" select="substring-before($websiteUrl, 'idProjecto')"/>
268

    
269
                        <xsl:value-of select="concat($prefix, '?', substring-after($websiteUrl, $prefix))"/>
270
                    </xsl:otherwise>
271
                </xsl:choose>
272

    
273
            </FIELD> -->
274
            <!--   <FIELD name="call_identifier">
275
                <xsl:value-of select="$callID"/>
276
            </FIELD> -->
277
            <FIELD name="title">
278
                <xsl:value-of select="$projectTitle"/>
279
            </FIELD>
280
            <FIELD name="summary">
281
                <xsl:value-of select="$projectSummary"/>
282
            </FIELD>
283
            <FIELD name="startdate" type="date" format="yyyy/MM/dd">
284
                <xsl:value-of select="$startDate"/>
285
            </FIELD>
286
            <FIELD name="enddate" type="date" format="yyyy/MM/dd">
287
                <xsl:value-of select="$endDate"/>
288
            </FIELD>
289
            <FIELD name="keywords">
290
                <xsl:value-of select="$projectKeywords"/>
291
            </FIELD>
292
            <FIELD name="contactfullname">
293
                <xsl:value-of select="$contactPerson"/>
294
            </FIELD>
295

    
296
            <FIELD name="fundedamount" type="float">
297
                <xsl:value-of select="$fundedAmount"/>
298
            </FIELD>
299
            <FIELD name="currency">
300
                <xsl:value-of select="$fundedCurrency"/>
301
            </FIELD>
302

    
303
            <FIELD name="collectedfrom">
304
                <xsl:value-of select="$varDataSourceId"/>
305
            </FIELD>
306
            <FIELD name="contracttypescheme">fct:contractTypes</FIELD>
307
            <FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
308
            <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
309
            <xsl:if test="//*[local-name() = 'OAMandate']">
310
                <FIELD name="oa_mandate_for_publications" type="boolean">
311
                    <xsl:value-of select="lower-case(//*[local-name() = 'OAMandate']/@mandated)"/>
312
                </FIELD>
313
            </xsl:if>
314
            <FIELD name="lastupdate" type="date">
315
                <xsl:value-of select="current-dateTime()"/>
316
            </FIELD>
317
        </ROW>
318

    
319
        <xsl:variable name="p1"
320
            select="normalize-space(./*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#FundingProgram'])"/>
321

    
322

    
323
        <xsl:variable name="fundingId">
324
            <xsl:choose>
325
                <xsl:when test="string-length($p1) > 0">
326
                    <xsl:value-of select="concat($funderID, '::', $p1)"/>
327
                </xsl:when>
328
                <xsl:otherwise>
329
                    <xsl:value-of select="$funderID"/>
330
                </xsl:otherwise>
331
            </xsl:choose>
332
        </xsl:variable>
333

    
334

    
335

    
336

    
337
        <ROW table="project_fundingpath">
338
            <FIELD name="_dnet_resource_identifier_">
339
                <xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
340
            </FIELD>
341
            <FIELD name="funding">
342
                <xsl:value-of select="$fundingId"/>
343
            </FIELD>
344
            <FIELD name="project">
345
                <xsl:value-of select="$projectId"/>
346
            </FIELD>
347
            <FIELD name="startdate" type="date" format="yyyy/MM/dd">
348
                <xsl:value-of select="$startDate"/>
349
            </FIELD>
350
            <FIELD name="enddate" type="date" format="yyyy/MM/dd">
351
                <xsl:value-of select="$endDate"/>
352
            </FIELD>
353
        </ROW>
354

    
355

    
356
        <xsl:for-each select="$coordinatorList">
357
            <xsl:variable name="role">
358
                <xsl:choose>
359
                    <xsl:when test="position() = 1">
360
                        <xsl:value-of select="coordinator"/>
361
                    </xsl:when>
362
                    <xsl:otherwise>
363
                        <xsl:value-of select="participant"/>
364
                    </xsl:otherwise>
365
                </xsl:choose>
366
            </xsl:variable>
367
            <xsl:call-template name="orgTempalte">
368
                <xsl:with-param name="elem" select="."/>
369
                <xsl:with-param name="role" select="$role"/>
370

    
371
                <xsl:with-param name="projectId" select="$projectId"/>
372
            </xsl:call-template>
373

    
374
        </xsl:for-each>
375

    
376
        <xsl:for-each select="$participantList">
377
            <xsl:variable name="role">
378
                <xsl:value-of select="participant"/>
379
            </xsl:variable>
380
            <xsl:call-template name="orgTempalte">
381
                <xsl:with-param name="elem" select="."/>
382
                <xsl:with-param name="role" select="$role"/>
383
                <xsl:with-param name="projectId" select="$projectId"/>
384
            </xsl:call-template>
385
        </xsl:for-each>
386

    
387

    
388

    
389
    </xsl:template>
390
</xsl:stylesheet>
391

    
392
]]>
393
				</CODE>
394
			</SCRIPT>
395
		</CONFIGURATION>
396
		<STATUS/>
397
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
398
	</BODY>
399
</RESOURCE_PROFILE>
(12-12/32)