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

    
267
                            </xsl:if>
268

    
269

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

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

    
281
                        <ROW table="project_organization">
282
                            <FIELD name="_dnet_resource_identifier_">
283
                                <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
284
                            </FIELD>
285
                            <xsl:choose>
286
                                <xsl:when
287
                                    test="string-length(translate(./ParticipantOrder, $whitelist, '')) &gt; 0">
288
                                    <FIELD name="participantnumber" type="int">9999</FIELD>
289
                                </xsl:when>
290
                                <xsl:otherwise>
291
                                    <FIELD name="participantnumber" type="int">
292
                                        <xsl:value-of select="./ParticipantOrder"/>
293
                                    </FIELD>
294
                                </xsl:otherwise>
295
                            </xsl:choose>
296
                            <FIELD name="project">
297
                                <xsl:value-of select="$projectId"/>
298
                            </FIELD>
299
                            <FIELD name="resporganization">
300
                                <xsl:value-of select="$organizationId"/>
301
                            </FIELD>
302
                            <xsl:if test="string(./PartecipantOrder) castable as xs:integer">
303
                                <xsl:choose>
304
                                    <xsl:when test="./ParticipantOrder = 1">
305
                                        <FIELD name="semanticclass">coordinator</FIELD>
306
                                    </xsl:when>
307
                                    <xsl:otherwise>
308
                                        <FIELD name="semanticclass">participant</FIELD>
309
                                    </xsl:otherwise>
310
                                </xsl:choose>
311
                            </xsl:if>
312
                        </ROW>
313
                    </xsl:for-each>
314
                </ROWS>
315
            </metadata>
316
        </record>
317
    </xsl:template>
318
</xsl:stylesheet>
319

    
320
]]>
321
                </CODE>
322
            </SCRIPT>
323
        </CONFIGURATION>
324
        <STATUS/>
325
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
326
    </BODY>
327
</RESOURCE_PROFILE>
(5-5/28)