1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="788858b8-f135-481d-9e24-88459384b32d_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>CONICYT 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('conicytf____')"/>
|
21
|
|
22
|
<xsl:variable name="dateFormat" select="string('mm-DD-yyyy')"/>
|
23
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::CONICYT')"/>
|
24
|
<xsl:variable name="fundingId">
|
25
|
<xsl:value-of
|
26
|
select="concat($funderID, '::', .//column[@name = 'FUNDER STREAM LEVEL I'], '::', .//column[@name = 'FUNDER STREAM LEVEL II'])"
|
27
|
/>
|
28
|
</xsl:variable>
|
29
|
|
30
|
|
31
|
<xsl:template match="/">
|
32
|
<record>
|
33
|
|
34
|
<xsl:copy-of select=".//*[local-name() = 'header']"/>
|
35
|
|
36
|
<metadata>
|
37
|
<ROWS>
|
38
|
<xsl:variable name="projectId"
|
39
|
select="concat($namespacePrefix, '::', normalize-space(.//column[@name = 'PROJECT IDENTIFIER']))"/>
|
40
|
<xsl:variable name="startDate"
|
41
|
select="replace(.//column[@name = 'START DATE'], '/', '-')"/>
|
42
|
|
43
|
<xsl:variable name="endDate"
|
44
|
select="replace(.//column[@name = 'END DATE'], '/', '-')"/>
|
45
|
|
46
|
<ROW table="projects">
|
47
|
|
48
|
<FIELD name="_dnet_resource_identifier_">
|
49
|
<xsl:value-of select="$projectId"/>
|
50
|
</FIELD>
|
51
|
<FIELD name="id">
|
52
|
<xsl:value-of select="$projectId"/>
|
53
|
</FIELD>
|
54
|
<FIELD name="lastupdate" type="date">
|
55
|
<xsl:value-of select="current-dateTime()"/>
|
56
|
</FIELD>
|
57
|
<FIELD name="code">
|
58
|
<xsl:value-of select=".//column[@name = 'PROJECT IDENTIFIER']"/>
|
59
|
</FIELD>
|
60
|
<FIELD name="title">
|
61
|
<xsl:value-of select=".//column[@name = 'PROJECT TITLE']"/>
|
62
|
</FIELD>
|
63
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
64
|
<xsl:value-of select="$startDate"/>
|
65
|
</FIELD>
|
66
|
|
67
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
68
|
<xsl:value-of select="$endDate"/>
|
69
|
</FIELD>
|
70
|
<FIELD name="websiteurl">
|
71
|
<xsl:value-of select=".//column[@name = 'URL DE INFORME FINAL']"/>
|
72
|
</FIELD>
|
73
|
|
74
|
<FIELD name="contactfullname">
|
75
|
<xsl:choose>
|
76
|
<xsl:when test=".//column[@name = 'DIRECTOR Nombre'] = ''">
|
77
|
|
78
|
<xsl:value-of
|
79
|
select="concat(.//column[@name = 'DIRECTOR Apellido1'], ' ', .//column[@name = 'DIRECTOR Apellido2'])"
|
80
|
/>
|
81
|
</xsl:when>
|
82
|
<xsl:otherwise>
|
83
|
<xsl:choose>
|
84
|
<xsl:when
|
85
|
test=".//column[@name = 'DIRECTOR Apellido1'] = ''">
|
86
|
<xsl:value-of
|
87
|
select=".//column[@name = 'DIRECTOR Nombre']"/>
|
88
|
</xsl:when>
|
89
|
<xsl:otherwise>
|
90
|
<xsl:value-of
|
91
|
select="concat(normalize-space(concat(.//column[@name = 'DIRECTOR Apellido1'], ' ', .//column[@name = 'DIRECTOR Apellido2'])), ', ', .//column[@name = 'DIRECTOR Nombre'])"
|
92
|
/>
|
93
|
</xsl:otherwise>
|
94
|
</xsl:choose>
|
95
|
|
96
|
</xsl:otherwise>
|
97
|
</xsl:choose>
|
98
|
|
99
|
</FIELD>
|
100
|
<FIELD name="lastupdate" type="date">
|
101
|
<xsl:value-of select="current-dateTime()"/>
|
102
|
</FIELD>
|
103
|
<FIELD name="collectedfrom">
|
104
|
<xsl:value-of select="$varDataSourceId"/>
|
105
|
</FIELD>
|
106
|
<FIELD name="provenanceActionClass"
|
107
|
>sysimport:crosswalk:entityregistry</FIELD>
|
108
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
109
|
<FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
|
110
|
</ROW>
|
111
|
|
112
|
<xsl:for-each
|
113
|
select="tokenize(.//column[@name = 'PARTICIPANT INSTITUTIONS2'], ';')">
|
114
|
<xsl:variable name="organizationId"
|
115
|
select="concat($namespacePrefix, '::', utils:md5(normalize-space(.)))"/>
|
116
|
<ROW table="dsm_organizations">
|
117
|
<FIELD name="_dnet_resource_identifier_">
|
118
|
<xsl:value-of select="$organizationId"/>
|
119
|
</FIELD>
|
120
|
<FIELD name="id">
|
121
|
<xsl:value-of select="$organizationId"/>
|
122
|
</FIELD>
|
123
|
<FIELD name="lastupdate" type="date">
|
124
|
<xsl:value-of select="current-dateTime()"/>
|
125
|
</FIELD>
|
126
|
<FIELD name="legalshortname">
|
127
|
<xsl:value-of select="normalize-space(.)"/>
|
128
|
</FIELD>
|
129
|
<FIELD name="country">
|
130
|
<xsl:value-of select="string('CL')"/>
|
131
|
</FIELD>
|
132
|
<FIELD name="collectedfrom">
|
133
|
<xsl:value-of select="$varDataSourceId"/>
|
134
|
</FIELD>
|
135
|
<FIELD name="provenanceaction"
|
136
|
>sysimport:crosswalk:entityregistry</FIELD>
|
137
|
|
138
|
</ROW>
|
139
|
<ROW table="project_organization">
|
140
|
<FIELD name="_dnet_resource_identifier_">
|
141
|
<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
|
142
|
</FIELD>
|
143
|
<FIELD name="project">
|
144
|
<xsl:value-of select="$projectId"/>
|
145
|
</FIELD>
|
146
|
<FIELD name="resporganization">
|
147
|
<xsl:value-of select="$organizationId"/>
|
148
|
</FIELD>
|
149
|
<FIELD name="semanticclass">participant</FIELD>
|
150
|
</ROW>
|
151
|
</xsl:for-each>
|
152
|
|
153
|
<ROW table="project_fundingpath">
|
154
|
<FIELD name="_dnet_resource_identifier_">
|
155
|
<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
|
156
|
</FIELD>
|
157
|
<FIELD name="funding">
|
158
|
<xsl:value-of select="$fundingId"/>
|
159
|
</FIELD>
|
160
|
<FIELD name="project">
|
161
|
<xsl:value-of select="$projectId"/>
|
162
|
</FIELD>
|
163
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
164
|
<xsl:value-of select="$startDate"/>
|
165
|
</FIELD>
|
166
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
167
|
<xsl:value-of select="$endDate"/>
|
168
|
</FIELD>
|
169
|
</ROW>
|
170
|
</ROWS>
|
171
|
</metadata>
|
172
|
</record>
|
173
|
</xsl:template>
|
174
|
</xsl:stylesheet>
|
175
|
]]>
|
176
|
</CODE>
|
177
|
</SCRIPT>
|
178
|
</CONFIGURATION>
|
179
|
<STATUS/>
|
180
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
181
|
</BODY>
|
182
|
</RESOURCE_PROFILE>
|