Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="b2f93c95-f4e7-447e-9048-1a651630670e_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>CORDA to DB</TITLE>
14
				<CODE>
15
					<![CDATA[
16
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
18
    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 select="concat(substring($datevalue, 1, 2),'-',substring($datevalue,3,3),'-',substring($datevalue,6,4))"/>
27
        </FIELD>
28
    </xsl:template>
29

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

    
33
    <xsl:template match="/">
34
        <record>
35
            <xsl:copy-of select=".//*[local-name()='header']"/>
36
            <metadata>
37
                <ROWS>
38
                    <xsl:for-each select="//Project">
39

    
40
                        <xsl:variable name="specificName">
41
                            <xsl:choose>
42
                                <xsl:when test="normalize-space(./ProjectSpecificProgram)">
43
                                    <xsl:value-of select="normalize-space(./ProjectSpecificProgram)"/>
44
                                </xsl:when>
45
                                <xsl:otherwise>
46
                                    <xsl:value-of select="string('UNKNOWN')"/>
47
                                </xsl:otherwise>
48
                            </xsl:choose>
49
                        </xsl:variable>
50

    
51
                        <xsl:variable name="specificDesc" select="./ProjectSpecificProgramDescr"/>
52
                        <xsl:variable name="specificId" select="normalize-space(concat($funderID, '::FP7::', $specificName))"/>
53

    
54
                        <xsl:variable name="projectProgramName">
55
                            <xsl:choose>
56
                                <xsl:when test="normalize-space(./ProjectProgram)">
57
                                    <xsl:value-of select="normalize-space(./ProjectProgram)"/>
58
                                </xsl:when>
59
                                <xsl:otherwise>
60
                                    <xsl:value-of select="string('UNKNOWN')"/>
61
                                </xsl:otherwise>
62
                            </xsl:choose>
63
                        </xsl:variable>
64

    
65
                        <xsl:variable name="projectProgramDesc" select="./ProjectProgramDescr"/>
66
                        <xsl:variable name="projectProgramId" select="concat($funderID, '::FP7::', $specificName, '::', $projectProgramName)"/>
67
                        <xsl:variable name="projectId" select="concat('corda_______::', normalize-space(./ProjectId))"/>
68

    
69

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

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

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

    
253
                            </xsl:if>
254

    
255

    
256
                            <FIELD name="collectedfrom">
257
                                <xsl:value-of select="$varDataSourceId"/>
258
                            </FIELD>
259
                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
260

    
261
                            <FIELD name="trust" type="float">
262
                                <xsl:value-of select="0.8"/>
263
                            </FIELD>
264
                        </ROW>
265

    
266
                        <ROW table="project_organization">
267
                            <FIELD name="_dnet_resource_identifier_">
268
                                <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
269
                            </FIELD>
270
                            <xsl:choose>
271
                                <xsl:when test="string-length(translate(./ParticipantOrder, $whitelist, '')) &gt; 0">
272
                                    <FIELD name="participantnumber" type="int">9999</FIELD>
273
                                </xsl:when>
274
                                <xsl:otherwise>
275
                                    <FIELD name="participantnumber" type="int">
276
                                        <xsl:value-of select="./ParticipantOrder"/>
277
                                    </FIELD>
278
                                </xsl:otherwise>
279
                            </xsl:choose>
280
                            <FIELD name="project">
281
                                <xsl:value-of select="$projectId"/>
282
                            </FIELD>
283
                            <FIELD name="resporganization">
284
                                <xsl:value-of select="$organizationId"/>
285
                            </FIELD>
286
                            <xsl:if test="string(./PartecipantOrder) castable as xs:integer">
287
                                <xsl:choose>
288
                                <xsl:when test="./ParticipantOrder = 1">
289
                                    <FIELD name="semanticclass">coordinator</FIELD>
290
                                </xsl:when>
291
                                <xsl:otherwise>
292
                                    <FIELD name="semanticclass">participant</FIELD>
293
                                </xsl:otherwise>
294
                            </xsl:choose>
295
                            </xsl:if>
296
                        </ROW>
297
                    </xsl:for-each>
298
                </ROWS>
299
            </metadata>
300
        </record>
301
    </xsl:template>
302
</xsl:stylesheet>
303
]]>
304
				</CODE>
305
			</SCRIPT>
306
		</CONFIGURATION>
307
		<STATUS/>
308
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
309
	</BODY>
310
</RESOURCE_PROFILE>
(5-5/27)