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
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
17
    exclude-result-prefixes="xs">
18

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

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

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

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

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

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

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

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

    
68

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

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

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

    
249
                            </xsl:if>
250

    
251

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

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

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