Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER
4
                value="b2f93c95-f4e7-447e-9048-1a651630670e_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
7
        <RESOURCE_URI value=""/>
8
        <DATE_OF_CREATION value="2018-06-04T11:15:30+00:00"/>
9
    </HEADER>
10
    <BODY>
11
        <CONFIGURATION>
12
            <IMPORTED/>
13
            <SCRIPT>
14
                <TITLE>CORDA to DB</TITLE>
15
                <CODE>
16
                    <![CDATA[
17
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
19

    
20
    <xsl:param name="varDataSourceId"/>
21

    
22
    <xsl:template name="dateCorda">
23
        <xsl:param name="datename"/>
24
        <xsl:param name="datevalue"/>
25
        <FIELD name="{$datename}" type="date" format="dd-MMM-yyyy">
26
            <xsl:value-of
27
                select="concat(substring($datevalue, 1, 2), '-', substring($datevalue, 3, 3), '-', substring($datevalue, 6, 4))"
28
            />
29
        </FIELD>
30
    </xsl:template>
31

    
32
    <xsl:variable name="namespacePrefix" select="string('ec__________')"/>
33
    <xsl:variable name="funderID" select="concat($namespacePrefix, '::EC')"/>
34

    
35
    <xsl:template match="/">
36
        <record>
37
            <xsl:copy-of select=".//*[local-name() = 'header']"/>
38
            <metadata>
39
                <ROWS>
40
                    <xsl:for-each select="//Project">
41
                        <xsl:variable name="projectId"
42
                            select="concat('corda_______::', normalize-space(./ProjectId))"/>
43
                        <xsl:variable name="fundingpath">
44
                            <xsl:choose>
45
                                <xsl:when test="normalize-space(./ProjectSpecificProgram)">
46
                                    <xsl:choose>
47
                                        <xsl:when test="normalize-space(./ProjectProgram)">
48
                                            <xsl:value-of
49
                                                select="concat($funderID, '::FP7::', normalize-space(./ProjectSpecificProgram), '::', normalize-space(./ProjectProgram))"
50
                                            />
51
                                        </xsl:when>
52
                                        <xsl:otherwise>
53
                                            <xsl:value-of
54
                                                select="concat($funderID, '::FP7::', normalize-space(./ProjectSpecificProgram))"
55
                                            />
56
                                        </xsl:otherwise>
57
                                    </xsl:choose>
58
                                </xsl:when>
59
                                <xsl:otherwise>
60
                                    <xsl:value-of select="concat($funderID, '::FP7')"/>
61
                                </xsl:otherwise>
62
                            </xsl:choose>
63
                        </xsl:variable>
64

    
65
                        <ROW table="projects">
66
                            <FIELD name="_dnet_resource_identifier_">
67
                                <xsl:value-of select="$projectId"/>
68
                            </FIELD>
69
                            <FIELD name="id">
70
                                <xsl:value-of select="$projectId"/>
71
                            </FIELD>
72
                            <FIELD name="lastupdate" type="date">
73
                                <xsl:value-of select="current-dateTime()"/>
74
                            </FIELD>
75
                            <FIELD name="code">
76
                                <xsl:value-of select="./ProjectId"/>
77
                            </FIELD>
78
                            <FIELD name="acronym">
79
                                <xsl:value-of select="./ProjectAcronym"/>
80
                            </FIELD>
81
                            <FIELD name="title">
82
                                <xsl:value-of select="./ProjectTitle"/>
83
                            </FIELD>
84
                            <xsl:call-template name="dateCorda">
85
                                <xsl:with-param name="datename">startdate</xsl:with-param>
86
                                <xsl:with-param name="datevalue" select="./ProjectStartDate"/>
87
                            </xsl:call-template>
88
                            <xsl:call-template name="dateCorda">
89
                                <xsl:with-param name="datename">enddate</xsl:with-param>
90
                                <xsl:with-param name="datevalue" select="./ProjectEndDate"/>
91
                            </xsl:call-template>
92
                            <FIELD name="call_identifier">
93
                                <xsl:value-of select="./ProjectCallIdentifier"/>
94
                            </FIELD>
95
                            <FIELD name="ec_sc39" type="boolean">
96
                                <xsl:value-of select="./SpecialClause39"/>
97
                            </FIELD>
98
                            <FIELD name="oa_mandate_for_publications" type="boolean">
99
                                <xsl:value-of select="./SpecialClause39"/>
100
                            </FIELD>
101
                            <FIELD name="collectedfrom">
102
                                <xsl:value-of select="$varDataSourceId"/>
103
                            </FIELD>
104
                            <FIELD name="contracttype">
105
                                <xsl:value-of select="./ProjectFundingScheme"/>
106
                            </FIELD>
107
                            <FIELD name="contracttypescheme">ec:FP7contractTypes</FIELD>
108
                            <FIELD name="contracttypename">
109
                                <xsl:value-of select="./ProjectFundingSchemeDescr"/>
110
                            </FIELD>
111
                            <FIELD name="provenanceActionClass"
112
                                >sysimport:crosswalk:entityregistry</FIELD>
113
                            <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
114
                            <FIELD name="websiteurl">
115
                                <xsl:value-of select="./ProjectInternetAddress"/>
116
                            </FIELD>
117
                            <FIELD name="optional1">
118
                                <xsl:value-of select="./ProjectSubFundingScheme"/>
119
                            </FIELD>
120
                            <FIELD name="optional2">
121
                                <xsl:value-of select="./ProjectCallWebpageUrl"/>
122
                            </FIELD>
123
                            <xsl:variable name="personSurname"
124
                                select="normalize-space(./CoordinatorContactPerson/PersonLastName)"/>
125
                            <xsl:variable name="personFirstName"
126
                                select="normalize-space(./CoordinatorContactPerson/PersonFirstName)"/>
127
                            <xsl:variable name="contactfullname">
128
                                <xsl:choose>
129
                                    <xsl:when
130
                                        test="string-length($personFirstName) &gt; 0 and string-length($personSurname) &gt; 0">
131
                                        <xsl:value-of
132
                                            select="normalize-space(concat($personSurname, ', ', $personFirstName))"
133
                                        />
134
                                    </xsl:when>
135
                                    <xsl:when test="string-length($personFirstName) &gt; 0">
136
                                        <xsl:value-of select="$personFirstName"/>
137
                                    </xsl:when>
138
                                    <xsl:when test="string-length($personSurname) &gt; 0">
139
                                        <xsl:value-of select="$personSurname"/>
140
                                    </xsl:when>
141
                                    <xsl:otherwise>
142
                                        <xsl:value-of select="''"/>
143
                                    </xsl:otherwise>
144
                                </xsl:choose>
145
                            </xsl:variable>
146
                            <xsl:if test="string-length($contactfullname) &gt; 0">
147
                                <FIELD name="contactfullname">
148
                                    <xsl:value-of select="$contactfullname"/>
149
                                </FIELD>
150
                            </xsl:if>
151
                            <xsl:variable name="contactfax"
152
                                select="normalize-space(./CoordinatorContactPerson/ContactFax)"/>
153
                            <xsl:if test="string-length($contactfax) &gt; 0">
154
                                <FIELD name="contactfax">
155
                                    <xsl:value-of select="$contactfax"/>
156
                                </FIELD>
157
                            </xsl:if>
158
                            <xsl:variable name="contactphone"
159
                                select="normalize-space(./CoordinatorContactPerson/ContactPhone)"/>
160
                            <xsl:if test="string-length($contactphone) &gt; 0">
161
                                <FIELD name="contactphone">
162
                                    <xsl:value-of select="$contactphone"/>
163
                                </FIELD>
164
                            </xsl:if>
165
                            <xsl:variable name="contactemail"
166
                                select="normalize-space(./CoordinatorContactPerson/ContactEmail)"/>
167
                            <xsl:if test="string-length($contactemail) &gt; 0">
168
                                <FIELD name="contactemail">
169
                                    <xsl:value-of select="$contactemail"/>
170
                                </FIELD>
171
                            </xsl:if>
172
                        </ROW>
173

    
174
                        <ROW table="project_fundingpath">
175
                            <FIELD name="_dnet_resource_identifier_">
176
                                <xsl:value-of select="concat($fundingpath, '@@', $projectId)"/>
177
                            </FIELD>
178
                            <FIELD name="funding">
179
                                <xsl:value-of select="$fundingpath"/>
180
                            </FIELD>
181
                            <FIELD name="project">
182
                                <xsl:value-of select="$projectId"/>
183
                            </FIELD>
184
                            <xsl:call-template name="dateCorda">
185
                                <xsl:with-param name="datename">startdate</xsl:with-param>
186
                                <xsl:with-param name="datevalue" select="./ProjectStartDate"/>
187
                            </xsl:call-template>
188
                            <xsl:call-template name="dateCorda">
189
                                <xsl:with-param name="datename">enddate</xsl:with-param>
190
                                <xsl:with-param name="datevalue" select="./ProjectEndDate"/>
191
                            </xsl:call-template>
192
                            <FIELD name="semanticclass">
193
                                <xsl:value-of select="./ProjectFundingScheme"/>
194
                            </FIELD>
195
                            <FIELD name="semanticscheme">ec:FP7contractTypes</FIELD>
196
                        </ROW>
197
                    </xsl:for-each>
198

    
199
                    <xsl:for-each select="//OrganisationParticipant[normalize-space(./OrganisationPIC) != '']">
200
                        <xsl:variable name="organizationPIC" select="./OrganisationPIC"/>
201
                        <xsl:variable name="organizationId"
202
                            select="concat('corda_______::', $organizationPIC)"/>
203
                        <xsl:variable name="projectId"
204
                            select="concat('corda_______::', normalize-space(../ProjectId))"/>
205
                        <xsl:variable name="whitelist" select="'0123456789'"/>
206
                        <ROW table="dsm_organizations">
207
                            <FIELD name="_dnet_resource_identifier_">
208
                                <xsl:value-of select="$organizationId"/>
209
                            </FIELD>
210
                            <FIELD name="id">
211
                                <xsl:value-of select="$organizationId"/>
212
                            </FIELD>
213
                            <FIELD name="lastupdate" type="date">
214
                                <xsl:value-of select="current-dateTime()"/>
215
                            </FIELD>
216
                            <FIELD name="legalshortname">
217
                                <xsl:value-of select="./OrganisationShortName"/>
218
                            </FIELD>
219
                            <FIELD name="legalname">
220
                                <xsl:value-of select="./OrganisationLegalName"/>
221
                            </FIELD>
222
                            <FIELD name="websiteurl">
223
                                <xsl:choose>
224
                                    <xsl:when
225
                                        test="starts-with(normalize-space(./OrganisationWebPage), 'http')">
226
                                        <xsl:value-of select="./OrganisationWebPage"/>
227
                                    </xsl:when>
228
                                    <xsl:when
229
                                        test="string-length(normalize-space(./OrganisationWebPage)) &gt; 0">
230
                                        <xsl:value-of
231
                                            select="concat('http://', normalize-space(./OrganisationWebPage))"
232
                                        />
233
                                    </xsl:when>
234
                                </xsl:choose>
235
                            </FIELD>
236
                            <FIELD name="ec_legalbody" type="boolean">
237
                                <xsl:value-of select="./PublicBody"/>
238
                            </FIELD>
239
                            <FIELD name="ec_legalperson" type="boolean">
240
                                <xsl:value-of select="./LegalPerson"/>
241
                            </FIELD>
242
                            <FIELD name="ec_nonprofit" type="boolean">
243
                                <xsl:value-of select="./NonProfit"/>
244
                            </FIELD>
245
                            <FIELD name="ec_researchorganization" type="boolean">
246
                                <xsl:value-of select="./ResearchOrganisation"/>
247
                            </FIELD>
248
                            <FIELD name="ec_highereducation" type="boolean">
249
                                <xsl:value-of select="./HigherEducation"/>
250
                            </FIELD>
251
                            <FIELD name="ec_internationalorganizationeurinterests" type="boolean">
252
                                <xsl:value-of select="./InternationalOrgEurInterest"/>
253
                            </FIELD>
254
                            <FIELD name="ec_internationalorganization" type="boolean">
255
                                <xsl:value-of select="./InternationalOrgEurInterest"/>
256
                            </FIELD>
257
                            <FIELD name="ec_enterprise" type="boolean">
258
                                <xsl:value-of select="./Enterprise"/>
259
                            </FIELD>
260
                            <FIELD name="ec_smevalidated" type="boolean">
261
                                <xsl:value-of select="./SMEValidated"/>
262
                            </FIELD>
263
                            <xsl:if test="./OrganisationCountry">
264
                                <FIELD name="country">
265
                                    <xsl:value-of select="./OrganisationCountry"/>
266
                                </FIELD>
267

    
268
                            </xsl:if>
269

    
270

    
271
                            <FIELD name="collectedfrom">
272
                                <xsl:value-of select="$varDataSourceId"/>
273
                            </FIELD>
274
                            <FIELD name="provenanceaction"
275
                                >sysimport:crosswalk:entityregistry</FIELD>
276

    
277
                            <FIELD name="trust" type="float">
278
                                <xsl:value-of select="0.8"/>
279
                            </FIELD>
280
                        </ROW>
281

    
282
                         <ROW table="dsm_identities">
283
                            <FIELD name="_dnet_resource_identifier_">
284
                                <xsl:value-of
285
                                        select="concat($organizationPIC, '@@PIC')"/>
286
                            </FIELD>
287
                            <FIELD name="pid">
288
                                <xsl:value-of select="$organizationPIC"/>
289
                            </FIELD>
290
                            <FIELD name="issuertype">PIC</FIELD>
291
                        </ROW>
292
                        <ROW table="dsm_organizationpids">
293
                            <FIELD name="_dnet_resource_identifier_">
294
                                <xsl:value-of select="concat('PIC:',$organizationPIC, '@@', $organizationId)"/>
295
                            </FIELD>
296
                            <FIELD name="pid">
297
                                <xsl:value-of select="$organizationPIC"/>
298
                            </FIELD>
299
                            <FIELD name="organization">
300
                                <xsl:value-of select="$organizationId"/>
301
                            </FIELD>
302
                        </ROW>
303

    
304
                        <ROW table="project_organization">
305
                            <FIELD name="_dnet_resource_identifier_">
306
                                <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
307
                            </FIELD>
308
                            <xsl:choose>
309
                                <xsl:when
310
                                    test="string-length(translate(./ParticipantOrder, $whitelist, '')) &gt; 0">
311
                                    <FIELD name="participantnumber" type="int">9999</FIELD>
312
                                </xsl:when>
313
                                <xsl:otherwise>
314
                                    <FIELD name="participantnumber" type="int">
315
                                        <xsl:value-of select="./ParticipantOrder"/>
316
                                    </FIELD>
317
                                </xsl:otherwise>
318
                            </xsl:choose>
319
                            <FIELD name="project">
320
                                <xsl:value-of select="$projectId"/>
321
                            </FIELD>
322
                            <FIELD name="resporganization">
323
                                <xsl:value-of select="$organizationId"/>
324
                            </FIELD>
325
                            <xsl:if test="string(./PartecipantOrder) castable as xs:integer">
326
                                <xsl:choose>
327
                                    <xsl:when test="./ParticipantOrder = 1">
328
                                        <FIELD name="semanticclass">coordinator</FIELD>
329
                                    </xsl:when>
330
                                    <xsl:otherwise>
331
                                        <FIELD name="semanticclass">participant</FIELD>
332
                                    </xsl:otherwise>
333
                                </xsl:choose>
334
                            </xsl:if>
335
                        </ROW>
336
                    </xsl:for-each>
337
                </ROWS>
338
            </metadata>
339
        </record>
340
    </xsl:template>
341
</xsl:stylesheet>
342

    
343
]]>
344
                </CODE>
345
            </SCRIPT>
346
        </CONFIGURATION>
347
        <STATUS/>
348
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
349
    </BODY>
350
</RESOURCE_PROFILE>
(6-6/32)