1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="a8774a06-5ed7-4d9b-8a88-7ebf065109a5_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2020-10-21T17:09:50+02:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>SFRS to DB</TITLE>
|
14
|
<CODE>
|
15
|
<![CDATA[
|
16
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
17
|
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:utils="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" exclude-result-prefixes="xs" version="2.0">
|
18
|
|
19
|
<xsl:param name="varDataSourceId"/>
|
20
|
<xsl:param name="namespacePrefix" select="string('sfrs________')"/>
|
21
|
<xsl:param name="quote">"</xsl:param>
|
22
|
|
23
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::sfrs')"/>
|
24
|
|
25
|
|
26
|
<xsl:variable name="stream" select="normalize-space(.//column[@name = 'FUNDING STREAM(S)'])"/>
|
27
|
<xsl:variable name="fundingID">
|
28
|
<xsl:choose>
|
29
|
<xsl:when test="string-length($stream) > 0">
|
30
|
<xsl:value-of select="concat($funderID, '::', $stream)"/>
|
31
|
</xsl:when>
|
32
|
<xsl:otherwise>
|
33
|
<xsl:value-of select="$funderID"/>
|
34
|
</xsl:otherwise>
|
35
|
</xsl:choose>
|
36
|
</xsl:variable>
|
37
|
|
38
|
<xsl:variable name="projectId"
|
39
|
select="concat($namespacePrefix, '::', normalize-space(.//column[@name = 'PROJECT IDENTIFIER']))"/>
|
40
|
|
41
|
|
42
|
<xsl:variable name="startDate" select="translate(.//column[@name = 'START DATE'], '/\', '--')"/>
|
43
|
<xsl:variable name="endDate" select="translate(.//column[@name = 'END DATE'], '/\', '--')"/>
|
44
|
|
45
|
<xsl:variable name="dateFormat" select="string('dd-MM-yyyy')"/>
|
46
|
<xsl:variable name="projectTitle"
|
47
|
select="normalize-space(.//column[@name = 'PROJECT TITLE or ACRONYM'])"/>
|
48
|
<xsl:variable name="principalInvestigator"
|
49
|
select="normalize-space(.//column[@name = 'Project_Leader'])"/>
|
50
|
<xsl:variable name="leadingInstitution"
|
51
|
select="normalize-space(.//column[@name = 'Institution'])"/>
|
52
|
<xsl:variable name="otherInstitutions"
|
53
|
select="normalize-space(.//column[@name = 'Other_institution'])"/>
|
54
|
<xsl:variable name="fundedamount" select="normalize-space(.//column[@name = 'Budget'])"/>
|
55
|
|
56
|
<xsl:template match="/">
|
57
|
<record>
|
58
|
|
59
|
<xsl:copy-of select=".//*[local-name() = 'header']"/>
|
60
|
<metadata>
|
61
|
<ROWS>
|
62
|
<xsl:if
|
63
|
test="string-length($projectTitle) > 0 and string-length($projectId) > 0">
|
64
|
<ROW table="projects">
|
65
|
<FIELD name="_dnet_resource_identifier_">
|
66
|
<xsl:value-of select="$projectId"/>
|
67
|
</FIELD>
|
68
|
<FIELD name="id">
|
69
|
<xsl:value-of select="$projectId"/>
|
70
|
</FIELD>
|
71
|
<FIELD name="code">
|
72
|
<xsl:value-of
|
73
|
select="normalize-space(.//column[@name = 'PROJECT IDENTIFIER'])"
|
74
|
/>
|
75
|
</FIELD>
|
76
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
77
|
<xsl:value-of select="$startDate"/>
|
78
|
</FIELD>
|
79
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
80
|
<xsl:value-of select="$endDate"/>
|
81
|
</FIELD>
|
82
|
<FIELD name="title">
|
83
|
<xsl:value-of select="$projectTitle"/>
|
84
|
</FIELD>
|
85
|
<FIELD name="contactfullname">
|
86
|
<xsl:value-of select="$principalInvestigator"/>
|
87
|
</FIELD>
|
88
|
<xsl:if test="$fundedamount">
|
89
|
<FIELD name="fundedamount" type="float">
|
90
|
<xsl:value-of
|
91
|
select="translate($fundedamount, ',', '')"
|
92
|
/>
|
93
|
</FIELD>
|
94
|
<FIELD name="currency">
|
95
|
<xsl:value-of select="string('EUR')"/>
|
96
|
</FIELD>
|
97
|
</xsl:if>
|
98
|
<FIELD name="provenanceActionClass"
|
99
|
>sysimport:crosswalk:entityregistry</FIELD>
|
100
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
101
|
<FIELD name="collectedfrom">
|
102
|
<xsl:value-of select="$varDataSourceId"/>
|
103
|
</FIELD>
|
104
|
<FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
|
105
|
</ROW>
|
106
|
</xsl:if>
|
107
|
<ROW table="project_fundingpath">
|
108
|
<FIELD name="_dnet_resource_identifier_">
|
109
|
<xsl:value-of select="concat($fundingID, '@@', $projectId)"/>
|
110
|
</FIELD>
|
111
|
<FIELD name="funding">
|
112
|
<xsl:value-of select="$fundingID"/>
|
113
|
</FIELD>
|
114
|
<FIELD name="project">
|
115
|
<xsl:value-of select="$projectId"/>
|
116
|
</FIELD>
|
117
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
118
|
<xsl:value-of select="$startDate"/>
|
119
|
</FIELD>
|
120
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
121
|
<xsl:value-of select="$endDate"/>
|
122
|
</FIELD>
|
123
|
</ROW>
|
124
|
<xsl:variable name="organizationId"
|
125
|
select="concat($namespacePrefix, '::', utils:md5(normalize-space($leadingInstitution)))"/>
|
126
|
<ROW table="dsm_organizations">
|
127
|
<FIELD name="_dnet_resource_identifier_">
|
128
|
<xsl:value-of select="$organizationId"/>
|
129
|
</FIELD>
|
130
|
<FIELD name="id">
|
131
|
<xsl:value-of select="$organizationId"/>
|
132
|
</FIELD>
|
133
|
<FIELD name="legalname">
|
134
|
<xsl:value-of select="normalize-space($leadingInstitution)"/>
|
135
|
</FIELD>
|
136
|
<FIELD name="collectedfrom">
|
137
|
<xsl:value-of select="$varDataSourceId"/>
|
138
|
</FIELD>
|
139
|
<FIELD name="provenanceaction"
|
140
|
>sysimport:crosswalk:entityregistry</FIELD>
|
141
|
<FIELD name="lastupdate" type="date">
|
142
|
<xsl:value-of select="current-dateTime()"/>
|
143
|
</FIELD>
|
144
|
</ROW>
|
145
|
|
146
|
<ROW table="project_organization">
|
147
|
<FIELD name="_dnet_resource_identifier_">
|
148
|
<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
|
149
|
</FIELD>
|
150
|
<FIELD name="project">
|
151
|
<xsl:value-of select="$projectId"/>
|
152
|
</FIELD>
|
153
|
<FIELD name="resporganization">
|
154
|
<xsl:value-of select="$organizationId"/>
|
155
|
</FIELD>
|
156
|
|
157
|
|
158
|
<FIELD name="semanticclass">coordinator</FIELD>
|
159
|
|
160
|
</ROW>
|
161
|
|
162
|
<xsl:for-each select="tokenize($otherInstitutions, '\$')">
|
163
|
<xsl:variable name="organizationId"
|
164
|
select="concat($namespacePrefix, '::', utils:md5(normalize-space(.)))"/>
|
165
|
|
166
|
<ROW table="dsm_organizations">
|
167
|
<FIELD name="_dnet_resource_identifier_">
|
168
|
<xsl:value-of select="$organizationId"/>
|
169
|
</FIELD>
|
170
|
<FIELD name="id">
|
171
|
<xsl:value-of select="$organizationId"/>
|
172
|
</FIELD>
|
173
|
<FIELD name="legalname">
|
174
|
<xsl:value-of select="normalize-space(.)"/>
|
175
|
</FIELD>
|
176
|
|
177
|
|
178
|
|
179
|
<FIELD name="collectedfrom">
|
180
|
<xsl:value-of select="$varDataSourceId"/>
|
181
|
</FIELD>
|
182
|
<FIELD name="provenanceaction"
|
183
|
>sysimport:crosswalk:entityregistry</FIELD>
|
184
|
<FIELD name="lastupdate" type="date">
|
185
|
<xsl:value-of select="current-dateTime()"/>
|
186
|
</FIELD>
|
187
|
</ROW>
|
188
|
<ROW table="project_organization">
|
189
|
<FIELD name="_dnet_resource_identifier_">
|
190
|
<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
|
191
|
</FIELD>
|
192
|
<FIELD name="project">
|
193
|
<xsl:value-of select="$projectId"/>
|
194
|
</FIELD>
|
195
|
<FIELD name="resporganization">
|
196
|
<xsl:value-of select="$organizationId"/>
|
197
|
</FIELD>
|
198
|
|
199
|
<FIELD name="semanticclass">participant</FIELD>
|
200
|
|
201
|
</ROW>
|
202
|
|
203
|
</xsl:for-each>
|
204
|
|
205
|
</ROWS>
|
206
|
|
207
|
</metadata>
|
208
|
</record>
|
209
|
</xsl:template>
|
210
|
</xsl:stylesheet>
|
211
|
]]>
|
212
|
|
213
|
</CODE>
|
214
|
</SCRIPT>
|
215
|
</CONFIGURATION>
|
216
|
<STATUS/>
|
217
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
218
|
</BODY>
|
219
|
</RESOURCE_PROFILE>
|