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="contracttypeclass">
108
                                <xsl:value-of select="./ProjectFundingScheme"/>
109
                            </FIELD>
110
                            <FIELD name="contracttypescheme">ec:FP7contractTypes</FIELD>
111
                            <FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
112
                            <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
113
                            <FIELD name="websiteurl">
114
                                <xsl:value-of select="./ProjectInternetAddress"/>
115
                            </FIELD>
116
                            <FIELD name="optional1">
117
                                <xsl:value-of select="./ProjectSubFundingScheme"/>
118
                            </FIELD>
119
                            <FIELD name="optional2">
120
                                <xsl:value-of select="./ProjectCallWebpageUrl"/>
121
                            </FIELD>
122
                            <xsl:variable name="personSurname" select="normalize-space(./CoordinatorContactPerson/PersonLastName)"/>
123
                            <xsl:variable name="personFirstName" select="normalize-space(./CoordinatorContactPerson/PersonFirstName)"/>
124
                            <xsl:variable name="contactfullname">
125
                                <xsl:choose>
126
                                    <xsl:when test="string-length($personFirstName) &gt; 0 and string-length($personSurname) &gt; 0">
127
                                        <xsl:value-of select="normalize-space(concat($personSurname, ', ', $personFirstName))"/>
128
                                    </xsl:when>
129
                                    <xsl:when test="string-length($personFirstName) &gt; 0">
130
                                        <xsl:value-of select="$personFirstName"/>
131
                                    </xsl:when>
132
                                    <xsl:when test="string-length($personSurname) &gt; 0">
133
                                        <xsl:value-of select="$personSurname"/>
134
                                    </xsl:when>
135
                                    <xsl:otherwise>
136
                                        <xsl:value-of select="''"/>
137
                                    </xsl:otherwise>
138
                                </xsl:choose>
139
                            </xsl:variable>
140
                            <xsl:if test="string-length($contactfullname) &gt; 0">
141
                                <FIELD name="contactfullname">
142
                                    <xsl:value-of select="$contactfullname"/>
143
                                </FIELD>
144
                            </xsl:if>
145
                            <xsl:variable name="contactfax" select="normalize-space(./CoordinatorContactPerson/ContactFax)"/>
146
                            <xsl:if test="string-length($contactfax) &gt; 0">
147
                                <FIELD name="contactfax">
148
                                    <xsl:value-of select="$contactfax"/>
149
                                </FIELD>
150
                            </xsl:if>
151
                            <xsl:variable name="contactphone" select="normalize-space(./CoordinatorContactPerson/ContactPhone)"/>
152
                            <xsl:if test="string-length($contactphone) &gt; 0">
153
                                <FIELD name="contactphone">
154
                                    <xsl:value-of select="$contactphone"/>
155
                                </FIELD>
156
                            </xsl:if>
157
                            <xsl:variable name="contactemail" select="normalize-space(./CoordinatorContactPerson/ContactEmail)"/>
158
                            <xsl:if test="string-length($contactemail) &gt; 0">
159
                                <FIELD name="contactemail">
160
                                    <xsl:value-of select="$contactemail"/>
161
                                </FIELD>
162
                            </xsl:if>
163
                        </ROW>
164

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

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

    
250
                            </xsl:if>
251

    
252

    
253
                            <FIELD name="collectedfrom">
254
                                <xsl:value-of select="$varDataSourceId"/>
255
                            </FIELD>
256
                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
257

    
258
                            <FIELD name="trust" type="float">
259
                                <xsl:value-of select="0.8"/>
260
                            </FIELD>
261
                        </ROW>
262

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