Project

General

Profile

« Previous | Next » 

Revision 60438

TR for ukri and gsri (formerly rcuk and gsrt)

View differences:

modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/funders/gsri2db.xml
1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="6cc23fa1-0c10-4395-8019-2a3ba7ba777e_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2021-02-05T15:37:59+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>GSRI 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('gsri________')"/>
21

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

  
26

  
27

  
28

  
29
                    <xsl:template match="/">
30
                    <xsl:variable name="sector" select=".//column[@name='Sector ΕΤΑΚ']"/>
31
                    <xsl:variable name="description" select=".//column[@name='Περιγραφή Φυσικού Αντικειμένου Έργου']"/>
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(utils:md5(.//column[@name='Project ID (MIS)'])))"/>
40

  
41
                    <!--<xsl:variable name="contact" select="tokenize(.//column[@name='Project Leader'],' ')"/>-->
42

  
43

  
44
                    <ROW table="projects">
45
                    <FIELD name="_dnet_resource_identifier_">
46
                    <xsl:value-of select="$projectId"/>
47
                    </FIELD>
48
                    <FIELD name="id">
49
                    <xsl:value-of select="$projectId"/>
50
                    </FIELD>
51
                    <FIELD name="code">
52
                    <xsl:value-of
53
                    select="normalize-space(.//column[@name = 'Project ID (MIS)'])"
54
                    />
55
                    </FIELD>
56
                    <FIELD name="title">
57
                    <xsl:value-of
58
                    select=".//column[@name = 'Project Title']"/>
59
                    </FIELD>
60

  
61
                    <!--      <FIELD name="contactfullname">
62
                    <xsl:value-of select="concat($contact[2],', ', $contact[1])"/>
63
                    </FIELD>-->
64
                    <xsl:choose>
65
                    <xsl:when test="$sector != '' ">
66

  
67

  
68
                    <FIELD name="optional2">
69
                    <xsl:value-of
70
                    select="concat('{',$quote,'sector',$quote,':',$quote,$sector,$quote,'}')"
71
                    />
72
                    </FIELD>
73
                    </xsl:when>
74

  
75
                    </xsl:choose>
76
                    <FIELD name="collectedfrom">
77
                    <xsl:value-of select="$varDataSourceId"/>
78
                    </FIELD>
79
                    <!-- <FIELD name="optional1">
80
                    <xsl:value-of select="concat(.//column[@name='Budget (€)'],' €')"/>
81
                    </FIELD>-->
82
                    <FIELD name="provenanceactionclass"
83
                    >sysimport:crosswalk:entityregistry</FIELD>
84
                    <FIELD name="provenanceactionscheme"
85
                    >dnet:provenanceActions</FIELD>
86
                    <FIELD name="oa_mandate_for_publications" type="boolean"
87
                    >false</FIELD>
88
                    <FIELD name="lastupdate" type="date">
89
                    <xsl:value-of select="current-dateTime()"/>
90
                    </FIELD>
91
                    </ROW>
92
                    <ROW table="project_fundingpath">
93
                    <FIELD name="_dnet_resource_identifier_">
94
                    <xsl:value-of
95
                    select="concat($funderID, '@@', $projectId)"/>
96
                    </FIELD>
97
                    <FIELD name="funding">
98
                    <xsl:value-of select="$funderID"/>
99
                    </FIELD>
100
                    <FIELD name="project">
101
                    <xsl:value-of select="$projectId"/>
102
                    </FIELD>
103

  
104
                    </ROW>
105
                    <xsl:if test=".//column[@name='Beneficiary Name'] != ''">
106

  
107
                    <xsl:variable name="organizationId"
108
                    select="concat($namespacePrefix,'::',utils:md5(normalize-space(.//column[@name='Beneficiary Name'])))"/>
109
                    <ROW table="dsm_organizations">
110

  
111
                    <FIELD name="_dnet_resource_identifier_">
112
                    <xsl:value-of select="$organizationId"/>
113
                    </FIELD>
114
                    <FIELD name="id">
115
                    <xsl:value-of select="$organizationId"/>
116
                    </FIELD>
117
                    <xsl:choose>
118
                    <xsl:when test="string-length(.//column[@name='Beneficiary Name']) > 255">
119
                    <FIELD name="legalname">
120
                    <xsl:value-of
121
                    select="normalize-space(substring(.//column[@name='Beneficiary Name'],1,255))"
122
                    />
123
                    </FIELD>
124
                    </xsl:when>
125
                    <xsl:otherwise>
126
                    <FIELD name="legalname">
127
                    <xsl:value-of
128
                    select="normalize-space(.//column[@name='Beneficiary Name'])"
129
                    />
130
                    </FIELD>
131
                    </xsl:otherwise>
132
                    </xsl:choose>
133

  
134
                    <FIELD name="country">
135
                    <xsl:value-of select="string('GR')" />
136
                    </FIELD>
137
                    <FIELD name="collectedfrom">
138
                    <xsl:value-of select="$varDataSourceId"/>
139
                    </FIELD>
140
                    <FIELD name="provenanceaction"
141
                    >sysimport:crosswalk:entityregistry</FIELD>
142
                    <FIELD name="lastupdate" type="date">
143
                    <xsl:value-of select="current-dateTime()"/>
144
                    </FIELD>
145
                    </ROW>
146
                    <ROW table="project_organization">
147
                    <FIELD name="_dnet_resource_identifier_">
148
                    <xsl:value-of
149
                    select='concat($projectId, "@@", $organizationId)'
150
                    />
151
                    </FIELD>
152
                    <FIELD name="project">
153
                    <xsl:value-of select="$projectId"/>
154
                    </FIELD>
155
                    <FIELD name="resporganization">
156
                    <xsl:value-of select="$organizationId"/>
157
                    </FIELD>
158
                    <FIELD name="semanticclass">coordinator</FIELD>
159
                    </ROW>
160
                    </xsl:if>
161
                    </ROWS>
162
                    </metadata>
163
                    </record>
164
                    </xsl:template>
165
                    </xsl:stylesheet>
166
                    ]]>
167

  
168
                </CODE>
169
            </SCRIPT>
170
        </CONFIGURATION>
171
        <STATUS/>
172
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
173
    </BODY>
174
</RESOURCE_PROFILE>
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/funders/ukri2db.xml
1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="b4ac3d3d-419d-4312-b243-c14d768bd766_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2021-02-02T16:42:14+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>UKRI 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:per="http://gtr.ukri.org/gtr/api/person" exclude-result-prefixes="xs" version="2.0">
18

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

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

  
25
                    <xsl:template match="/">
26
                    <record>
27
                    <xsl:copy-of select=".//*[local-name() = 'header']"/>
28
                    <metadata>
29
                    <ROWS>
30
                    <xsl:variable name="projectCode"
31
                    select="//*[local-name() = 'identifier' and ./@*[local-name() = 'type' and . = 'RCUK']]"/>
32
                    <xsl:variable name="projectId"
33
                    select="concat($namespacePrefix, '::', $projectCode)"/>
34

  
35
                    <xsl:variable name="sDate"
36
                    select=".//*[local-name() = 'fund']/*[local-name() = 'start']"/>
37
                    <xsl:variable name="eDate"
38
                    select=".//*[local-name() = 'fund']/*[local-name() = 'end']"/>
39
                    <xsl:variable name="startDate">
40
                    <xsl:choose>
41
                    <xsl:when test="contains($sDate, '+')">
42
                    <xsl:value-of select="substring-before($sDate, '+')"/>
43
                    </xsl:when>
44
                    <xsl:when test="contains($sDate, 'Z')">
45
                    <xsl:value-of select="substring-before($sDate, 'Z')"/>
46
                    </xsl:when>
47
                    <xsl:otherwise>
48
                    <xsl:value-of select="$sDate"/>
49
                    </xsl:otherwise>
50
                    </xsl:choose>
51
                    </xsl:variable>
52
                    <xsl:variable name="endDate">
53
                    <xsl:choose>
54
                    <xsl:when test="contains($eDate, '+')">
55
                    <xsl:value-of select="substring-before($eDate, '+')"/>
56
                    </xsl:when>
57
                    <xsl:when test="contains($eDate, 'Z')">
58
                    <xsl:value-of select="substring-before($eDate, 'Z')"/>
59
                    </xsl:when>
60
                    <xsl:otherwise>
61
                    <xsl:value-of select="$eDate"/>
62
                    </xsl:otherwise>
63
                    </xsl:choose>
64
                    </xsl:variable>
65
                    <xsl:variable name="funding" select=".//*[local-name() = 'funder']/name"/>
66
                    <xsl:variable name="fundingId">
67
                    <xsl:choose>
68
                    <xsl:when test="string-length($funding) > 0">
69
                    <xsl:value-of select="concat($funderID, '::', .//*[local-name() = 'funder']/name)"/>
70
                    </xsl:when>
71
                    <xsl:otherwise>
72
                    <xsl:value-of select="$funderID"/>
73
                    </xsl:otherwise>
74
                    </xsl:choose>
75
                    </xsl:variable>
76

  
77
                    <ROW table="projects">
78
                    <FIELD name="_dnet_resource_identifier_">
79
                    <xsl:value-of select="$projectId"/>
80
                    </FIELD>
81
                    <FIELD name="id">
82
                    <xsl:value-of select="$projectId"/>
83
                    </FIELD>
84
                    <FIELD name="code">
85
                    <xsl:value-of select="$projectCode"/>
86
                    </FIELD>
87
                    <FIELD name="title">
88
                    <xsl:value-of select=".//*[local-name() = 'title']"/>
89
                    </FIELD>
90
                    <FIELD name="startdate" type="date" format="{$dateFormat}">
91
                    <xsl:value-of select="$startDate"/>
92
                    </FIELD>
93
                    <FIELD name="enddate" type="date" format="{$dateFormat}">
94
                    <xsl:value-of select="$endDate"/>
95
                    </FIELD>
96
                    <FIELD name="collectedfrom">
97
                    <xsl:value-of select="$varDataSourceId"/>
98
                    </FIELD>
99
                    <FIELD name="provenanceactionclass"
100
                    >sysimport:crosswalk:entityregistry</FIELD>
101
                    <FIELD name="fundedamount" type="float">
102
                    <xsl:value-of
103
                    select=".//*[local-name() = 'valuePounds']/@*[local-name() = 'amount']"
104
                    />
105
                    </FIELD>
106
                    <FIELD name="currency">
107
                    <xsl:value-of
108
                    select=".//*[local-name() = 'valuePounds']/@*[local-name() = 'currencyCode']"
109
                    />
110
                    </FIELD>
111

  
112
                    <FIELD name="summary">
113
                    <xsl:value-of
114
                    select=".//*[local-name() = 'abstractText']"
115
                    />
116
                    </FIELD>
117

  
118
                    <xsl:variable name="principalInvestigators">
119
                    <xsl:apply-templates select=".//*[local-name() = 'person']"/>
120
                    </xsl:variable>
121

  
122
                    <xsl:if test="string-length($principalInvestigators) &amp;gt; 0">
123
                    <FIELD name="contactfullname">
124
                    <xsl:value-of select="$principalInvestigators"/>
125
                    </FIELD>
126
                    </xsl:if>
127
                    <FIELD name="lastupdate" type="date">
128
                    <xsl:value-of select="current-dateTime()"/>
129
                    </FIELD>
130
                    </ROW>
131

  
132
                    <ROW table="project_fundingpath">
133
                    <FIELD name="_dnet_resource_identifier_">
134
                    <xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
135
                    </FIELD>
136
                    <FIELD name="funding">
137
                    <xsl:value-of select="$fundingId"/>
138
                    </FIELD>
139
                    <FIELD name="project">
140
                    <xsl:value-of select="$projectId"/>
141
                    </FIELD>
142
                    <FIELD name="startdate" type="date" format="{$dateFormat}">
143
                    <xsl:value-of select="$startDate"/>
144
                    </FIELD>
145
                    <FIELD name="enddate" type="date" format="{$dateFormat}">
146
                    <xsl:value-of select="$endDate"/>
147
                    </FIELD>
148
                    </ROW>
149

  
150
                    <xsl:for-each select=".//pp-org">
151
                    <xsl:variable name="organizationId"
152
                    select="concat($namespacePrefix, '::', normalize-space(./id))"/>
153
                    <xsl:variable name="country" select="./country"/>
154
                    <ROW table="dsm_organizations">
155
                    <FIELD name="_dnet_resource_identifier_">
156
                    <xsl:value-of select="$organizationId"/>
157
                    </FIELD>
158
                    <FIELD name="id">
159
                    <xsl:value-of select="$organizationId"/>
160
                    </FIELD>
161
                    <FIELD name="legalname">
162
                    <xsl:value-of select="./name"/>
163
                    </FIELD>
164

  
165
                    <xsl:if test="string-length($country) &amp;gt; 0">
166
                    <FIELD name="country">
167
                    <xsl:value-of select="$country"/>
168
                    </FIELD>
169
                    </xsl:if>
170

  
171
                    <FIELD name="collectedfrom">
172
                    <xsl:value-of select="$varDataSourceId"/>
173
                    </FIELD>
174
                    <FIELD name="provenanceaction"
175
                    >sysimport:crosswalk:entityregistry</FIELD>
176
                    <FIELD name="lastupdate" type="date">
177
                    <xsl:value-of select="current-dateTime()"/>
178
                    </FIELD>
179
                    </ROW>
180
                    <ROW table="project_organization">
181
                    <FIELD name="_dnet_resource_identifier_">
182
                    <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
183
                    </FIELD>
184
                    <FIELD name="project">
185
                    <xsl:value-of select="$projectId"/>
186
                    </FIELD>
187
                    <FIELD name="resporganization">
188
                    <xsl:value-of select="$organizationId"/>
189
                    </FIELD>
190

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

  
193
                    </ROW>
194

  
195
                    </xsl:for-each>
196

  
197
                    <xsl:variable name="leadOrgId"
198
                    select="concat($namespacePrefix, '::', normalize-space(.//ld-org/id))"/>
199
                    <ROW table="dsm_organizations">
200
                    <FIELD name="_dnet_resource_identifier_">
201
                    <xsl:value-of select="$leadOrgId"/>
202
                    </FIELD>
203
                    <FIELD name="id">
204
                    <xsl:value-of select="$leadOrgId"/>
205
                    </FIELD>
206
                    <FIELD name="legalname">
207
                    <xsl:value-of select=".//ld-org/name"/>
208
                    </FIELD>
209
                    <xsl:variable name="country" select=".//ld-org/country"/>
210
                    <xsl:if test="string-length($country) &amp;gt; 0">
211
                    <FIELD name="country">
212
                    <xsl:value-of select="$country"/>
213
                    </FIELD>
214
                    </xsl:if>
215

  
216
                    <FIELD name="collectedfrom">
217
                    <xsl:value-of select="$varDataSourceId"/>
218
                    </FIELD>
219
                    <FIELD name="provenanceAction">sysimport:crosswalk:entityregistry</FIELD>
220
                    </ROW>
221

  
222
                    <ROW table="project_organization">
223
                    <FIELD name="_dnet_resource_identifier_">
224
                    <xsl:value-of select='concat($projectId, "@@", $leadOrgId)'/>
225
                    </FIELD>
226
                    <FIELD name="project">
227
                    <xsl:value-of select="$projectId"/>
228
                    </FIELD>
229
                    <FIELD name="resporganization">
230
                    <xsl:value-of select="$leadOrgId"/>
231
                    </FIELD>
232
                    <FIELD name="participantnumber" type="int">1</FIELD>
233
                    <FIELD name="semanticclass">coordinator</FIELD>
234
                    </ROW>
235

  
236
                    </ROWS>
237
                    </metadata>
238
                    </record>
239
                    </xsl:template>
240

  
241
                    <xsl:template match="per:person">
242
                    <xsl:variable name="personSurname"
243
                    select="normalize-space(.//*[local-name() = 'surname'])"/>
244
                    <xsl:variable name="personFirstName"
245
                    select="normalize-space(.//*[local-name() = 'firstName'])"/>
246
                    <xsl:variable name="contactfullname">
247
                    <xsl:choose>
248
                    <xsl:when
249
                    test="string-length($personFirstName) &amp;gt; 0 and string-length($personSurname) &amp;gt; 0">
250
                    <xsl:value-of
251
                    select="normalize-space(concat($personSurname, ', ', $personFirstName))"
252
                    />
253
                    </xsl:when>
254
                    <xsl:when test="string-length($personFirstName) &amp;gt; 0">
255
                    <xsl:value-of select="$personFirstName"/>
256
                    </xsl:when>
257
                    <xsl:when test="string-length($personSurname) &amp;gt; 0">
258
                    <xsl:value-of select="$personSurname"/>
259
                    </xsl:when>
260
                    <xsl:otherwise>
261
                    <xsl:value-of select="''"/>
262
                    </xsl:otherwise>
263
                    </xsl:choose>
264
                    </xsl:variable>
265
                    <xsl:value-of select="concat($contactfullname,';')"/>
266
                    </xsl:template>
267
                    </xsl:stylesheet>
268
                    ]]>
269

  
270
                </CODE>
271
            </SCRIPT>
272
        </CONFIGURATION>
273
        <STATUS/>
274
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
275
    </BODY>
276
</RESOURCE_PROFILE>

Also available in: Unified diff