Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="5a4dd0b9-412c-4b67-a2df-c376070f680e_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>ANR to DB</TITLE>
14
                <CODE>
15
                    <![CDATA[
16
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
    xmlns:utils="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions">
18

    
19
    <xsl:param name="varDataSourceId"/>
20
    <xsl:variable name="namespacePrefix" select="string('anr_________')"/>
21

    
22
    <!--<xsl:variable name="dateFormat" select="string('dd-MM-yyyy')"/>-->
23
    <xsl:variable name="funderID" select="concat($namespacePrefix, '::ANR')"/>
24

    
25
    <!--<xsl:variable name="fundingId">
26
<xsl:value-of
27
select="concat($funderID, '::', translate(.//column[@name = 'FUNDING STREAM'], ' ', ''))"
28
/>
29
</xsl:variable>
30
-->
31
    <xsl:variable name="fundingId">
32
        <xsl:value-of select="$funderID"/>
33
    </xsl:variable>
34
    <xsl:variable name="quot">"</xsl:variable>
35
    <xsl:variable name="dollaro">$</xsl:variable>
36
    <xsl:variable name="Id">
37
        <xsl:value-of select="normalize-space(.//column[@isID = 'true'])"/>
38
    </xsl:variable>
39
    <xsl:template name="terminate">
40
        <xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
41
        </xsl:message>
42
    </xsl:template>
43
    <xsl:template match="/">
44
        <xsl:choose>
45
            <xsl:when
46
                test=".//column[@name = 'Titre.Francais'] | .//column[@name = 'Titre.Anglais'] | .//column[@name = 'Acronyme']">
47
                <record>
48

    
49
                    <xsl:copy-of select=".//*[local-name() = 'header']"/>
50

    
51
                    <metadata>
52
                        <ROWS>
53
                            <xsl:variable name="projectId"
54
                                select="concat($namespacePrefix, '::', $Id)"/>
55
                            <!-- <xsl:variable name="startDate"
56
select="replace(.//column[@name = 'PROJECT STARTING DATE'], '/', '-')"/>
57
<xsl:variable name="endDate"
58
select="replace(.//column[@name = 'PROJECT COMPLETION DATE'], '/', '-')"/>
59
-->
60

    
61
                            <ROW table="projects">
62
                                <FIELD name="_dnet_resource_identifier_">
63
                                    <xsl:value-of select="$projectId"/>
64
                                </FIELD>
65
                                <FIELD name="id">
66
                                    <xsl:value-of select="$projectId"/>
67
                                </FIELD>
68
                                <FIELD name="code">
69
                                    <xsl:value-of select="$Id"/>
70
                                </FIELD>
71
                                <xsl:choose>
72
                                    <xsl:when
73
                                        test=".//column[@name = 'Titre.Anglais']">
74
                                        <FIELD name="title">
75
                                            <xsl:value-of
76
                                                select=".//column[@name = 'Titre.Anglais']"
77
                                            />
78
                                        </FIELD>
79
                                    </xsl:when>
80
                                    <xsl:when
81
                                        test=".//column[@name = 'Titre.Francais']">
82
                                        <FIELD name="title">
83
                                            <xsl:value-of
84
                                                select=".//column[@name = 'Titre.Francais']"
85
                                            />
86
                                        </FIELD>
87
                                    </xsl:when>
88
                                    <xsl:otherwise>
89
                                        <FIELD name="title">
90
                                            <xsl:value-of
91
                                                select=".//column[@name = 'Acronyme']"
92
                                            />
93
                                        </FIELD>
94
                                    </xsl:otherwise>
95
                                </xsl:choose>
96

    
97

    
98
                                <FIELD name="acronym">
99
                                    <xsl:value-of
100
                                        select=".//column[@name = 'Acronyme (SIM)'] | .//column[@name = 'Acronyme']"
101
                                    />
102
                                </FIELD>
103
                                <!--   <FIELD name="startdate" type="date" format="{$dateFormat}">
104
<xsl:value-of select="$startDate"/>
105
</FIELD>
106
<FIELD name="enddate" type="date" format="{$dateFormat}">
107
<xsl:value-of select="$endDate"/>
108
</FIELD>-->                     <xsl:if test=".//column[@name = 'Responsable_scientifique']">
109
                                    <FIELD name ="contactfullname">
110
                                        <xsl:value-of select="normalize-space(.//column[@name='Responsable_scientifique'])"/>
111
                                   </FIELD>
112
                                </xsl:if>
113

    
114
                                <xsl:if test=".//column[@name = 'Aide_allouee']">
115
                                    <FIELD name="fundedamount" type="float">
116

    
117
                                        <xsl:value-of select=".//column[@name = 'Aide_allouee']"/>
118
                                </FIELD>
119
                                <FIELD name="currency">
120
                                <xsl:value-of select="string('EUR')"/>
121
                                </FIELD>
122
                                </xsl:if>
123
                                <xsl:if test=".//column[@name = 'Resume.Francais'] or .//column[@name = 'Resume.Anglais']">
124
                                    <xsl:choose>
125
                                        <xsl:when test=".//column[@name = 'Resume.Anglais']">
126
                                            <FIELD name="summary">
127
                                                <xsl:value-of select=".//column[@name = 'Resume.Anglais']"/>
128
                                            </FIELD>
129
                                        </xsl:when>
130
                                        <xsl:otherwise>
131
                                            <FIELD name="summary">
132
                                                <xsl:value-of select=".//column[@name = 'Resume.Francais']"/>
133
                                            </FIELD>
134
                                        </xsl:otherwise>
135
                                    </xsl:choose>
136
                                </xsl:if>
137
                                <FIELD name="collectedfrom">
138
                                    <xsl:value-of select="$varDataSourceId"/>
139
                                </FIELD>
140
                                <FIELD name="provenanceactionclass"
141
                                    >sysimport:crosswalk:entityregistry</FIELD>
142
                                <FIELD name="provenanceactionscheme">dnet:provenanceActions</FIELD>
143
                                <FIELD name="oa_mandate_for_publications" type="boolean"
144
                                    >false</FIELD>
145
                                <FIELD name="lastupdate" type="date">
146
                                    <xsl:value-of select="current-dateTime()"/>
147
                                </FIELD>
148
                            </ROW>
149
                            <xsl:if test=".//column[@name = 'Partenaire.Coordinature']">
150
                                <xsl:variable name="Coord">
151
                                    <xsl:value-of select="utils:md5(.//column[@name = 'Partenaire.Coordinature'])"/>
152
                                </xsl:variable>
153
                                <xsl:variable name="organizationId" >
154
                                    <xsl:value-of select="concat($namespacePrefix, '::', $Coord)"/>
155
                                </xsl:variable>
156
                                <ROW table="dsm_organizations">
157
                                    <FIELD name="_dnet_resource_identifier_">
158
                                        <xsl:value-of select="$organizationId"/>
159
                                    </FIELD>
160
                                    <FIELD name="id">
161
                                        <xsl:value-of select="$organizationId"/>
162
                                    </FIELD>
163
                                    <FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
164

    
165
                                    <FIELD name="legalname">
166
                                        <xsl:value-of select=".//column[@name = 'Partenaire.Coordinature']"/>
167
                                    </FIELD>
168

    
169
                                    <FIELD name="collectedfrom">
170
                                        <xsl:value-of select="$varDataSourceId"/>
171
                                    </FIELD>
172
                                    <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
173
                                    <FIELD name="trust" type="float">
174
                                        <xsl:value-of select="0.81"/>
175
                                    </FIELD>
176
                                </ROW>
177

    
178
                                <ROW table="project_organization">
179
                                    <FIELD name="_dnet_resource_identifier_">
180
                                        <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
181
                                    </FIELD>
182

    
183
                                    <FIELD name="project">
184
                                        <xsl:value-of select="$projectId"/>
185
                                    </FIELD>
186
                                    <FIELD name="resporganization">
187
                                        <xsl:value-of select="$organizationId"/>
188
                                    </FIELD>
189

    
190

    
191
                                    <FIELD name="semanticclass">coordinator</FIELD>
192

    
193

    
194

    
195
                                </ROW>
196
                            </xsl:if>
197

    
198
                            <xsl:if test=".//column[@name = 'Partenaire.Nom_organisme']">
199
                                <xsl:for-each select="tokenize(.//column[@name = 'Partenaire.Nom_organisme'],'@')">
200
                                    <xsl:if test="string-length(.) > 0">
201
                                        <xsl:variable name="organizationId" >
202
                                            <xsl:value-of select="concat($namespacePrefix, '::', utils:md5(.))"/>
203
                                        </xsl:variable>
204
                                        <ROW table="dsm_organizations">
205
                                            <FIELD name="_dnet_resource_identifier_">
206
                                                <xsl:value-of select="$organizationId"/>
207
                                            </FIELD>
208
                                            <FIELD name="id">
209
                                                <xsl:value-of select="$organizationId"/>
210
                                            </FIELD>
211
                                            <FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
212

    
213
                                            <FIELD name="legalname">
214
                                                <xsl:value-of select="."/>
215
                                            </FIELD>
216

    
217
                                            <FIELD name="collectedfrom">
218
                                                <xsl:value-of select="$varDataSourceId"/>
219
                                            </FIELD>
220
                                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
221
                                            <FIELD name="trust" type="float">
222
                                                <xsl:value-of select="0.81"/>
223
                                            </FIELD>
224
                                        </ROW>
225

    
226
                                        <ROW table="project_organization">
227
                                            <FIELD name="_dnet_resource_identifier_">
228
                                                <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
229
                                            </FIELD>
230

    
231
                                            <FIELD name="project">
232
                                                <xsl:value-of select="$projectId"/>
233
                                            </FIELD>
234
                                            <FIELD name="resporganization">
235
                                                <xsl:value-of select="$organizationId"/>
236
                                            </FIELD>
237

    
238

    
239

    
240

    
241
                                            <FIELD name="semanticclass">participant</FIELD>
242

    
243
                                        </ROW>
244
                                    </xsl:if>
245
                                </xsl:for-each>
246

    
247

    
248
                            </xsl:if>
249

    
250

    
251
                            <ROW table="project_fundingpath">
252
                                <FIELD name="_dnet_resource_identifier_">
253
                                    <xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
254
                                </FIELD>
255
                                <FIELD name="funding">
256
                                    <xsl:value-of select="$fundingId"/>
257
                                </FIELD>
258
                                <FIELD name="project">
259
                                    <xsl:value-of select="$projectId"/>
260
                                </FIELD>
261
                                <!-- <FIELD name="startdate" type="date" format="{$dateFormat}">
262
                            <xsl:value-of select="$startDate"/>
263
                        </FIELD>
264
                        <FIELD name="enddate" type="date" format="{$dateFormat}">
265
                            <xsl:value-of select="$endDate"/>
266
                        </FIELD> -->
267
                            </ROW>
268

    
269
                        </ROWS>
270
                    </metadata>
271
                </record>
272
            </xsl:when>
273
            <xsl:otherwise>
274
                <xsl:call-template name="terminate"/>
275
            </xsl:otherwise>
276
        </xsl:choose>
277

    
278
    </xsl:template>
279
</xsl:stylesheet>
280

    
281
]]>
282
                </CODE>
283
            </SCRIPT>
284
        </CONFIGURATION>
285
        <STATUS/>
286
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
287
    </BODY>
288
</RESOURCE_PROFILE>
(2-2/28)