Project

General

Profile

« Previous | Next » 

Revision 60435

TR for new funder chist-era

View differences:

modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/funders/chistera2db.xml
1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="7de15e12-48b6-4f56-b841-5e744321a7d4_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2021-02-11T15:57:11+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>CHIST-ERA 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
                    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
19

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

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

  
26

  
27
                    <xsl:variable name="fundingId">
28
                    <xsl:value-of select="$funderID"/>
29
                    </xsl:variable>
30

  
31

  
32
                    <xsl:variable name="Id">
33
                    <xsl:value-of select="normalize-space(.//column[@isID = 'true'])"/>
34
                    </xsl:variable>
35
                    <xsl:template name="terminate">
36
                    <xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
37
                    </xsl:message>
38
                    </xsl:template>
39

  
40
                    <xsl:template name="orgTempalte">
41
                    <xsl:param name="orgName"/>
42
                    <xsl:param name="orgCountry"/>
43
                    <xsl:param name="role"/>
44
                    <xsl:param name="projectId"/>
45
                    <xsl:variable name="organizationId"
46
                    select="concat($namespacePrefix, '::', utils:md5($orgName))"/>
47
                    <ROW table="dsm_organizations">
48
                    <FIELD name="_dnet_resource_identifier_">
49
                    <xsl:value-of select="$organizationId"/>
50
                    </FIELD>
51
                    <FIELD name="id">
52
                    <xsl:value-of select="$organizationId"/>
53
                    </FIELD>
54
                    <FIELD name="legalname">
55
                    <xsl:value-of select="$orgName"/>
56
                    </FIELD>
57
                    <FIELD name="country">
58
                    <xsl:value-of select="$orgCountry"/>
59
                    </FIELD>
60
                    <FIELD name="collectedfrom">
61
                    <xsl:value-of select="$varDataSourceId"/>
62
                    </FIELD>
63
                    <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
64
                    <FIELD name="lastupdate" type="date">
65
                    <xsl:value-of select="current-dateTime()"/>
66
                    </FIELD>
67
                    </ROW>
68
                    <ROW table="project_organization">
69
                    <FIELD name="_dnet_resource_identifier_">
70
                    <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
71
                    </FIELD>
72
                    <FIELD name="project">
73
                    <xsl:value-of select="$projectId"/>
74
                    </FIELD>
75
                    <FIELD name="resporganization">
76
                    <xsl:value-of select="$organizationId"/>
77
                    </FIELD>
78

  
79
                    <FIELD name="semanticclass">
80
                    <xsl:value-of select="$role"/>
81
                    </FIELD>
82

  
83
                    </ROW>
84

  
85
                    </xsl:template>
86

  
87
                    <xsl:template match="/">
88
                    <record>
89
                    <xsl:copy-of select=".//*[local-name() = 'header']"/>
90
                    <metadata>
91
                    <ROWS>
92
                    <xsl:variable name="projectId"
93
                    select="concat($namespacePrefix, '::', utils:md5($Id))"/>
94
                    <ROW table="projects">
95
                    <FIELD name="_dnet_resource_identifier_">
96
                    <xsl:value-of select="$projectId"/>
97
                    </FIELD>
98
                    <FIELD name="id">
99
                    <xsl:value-of select="$projectId"/>
100
                    </FIELD>
101
                    <FIELD name="code">
102
                    <xsl:value-of select="$Id"/>
103
                    </FIELD>
104

  
105
                    <FIELD name="title">
106
                    <xsl:value-of
107
                    select=".//column[@name = 'Title']"
108
                    />
109
                    </FIELD>
110

  
111

  
112
                    <FIELD name="acronym">
113
                    <xsl:value-of
114
                    select=".//column[@name = 'Acronym']"
115
                    />
116
                    </FIELD>
117

  
118

  
119

  
120
                    <FIELD name="summary">
121
                    <xsl:value-of select=".//column[@name = 'Abstract']"/>
122
                    </FIELD>
123

  
124

  
125
                    <xsl:if test=".//column[@name = 'Coordinator']">
126
                    <FIELD name ="contactfullname">
127
                    <xsl:value-of select="normalize-space(.//column[@name='Coordinator'])"/>
128
                    </FIELD>
129
                    </xsl:if>
130

  
131

  
132
                    <FIELD name="collectedfrom">
133
                    <xsl:value-of select="$varDataSourceId"/>
134
                    </FIELD>
135
                    <FIELD name="provenanceactionclass"
136
                    >sysimport:crosswalk:entityregistry</FIELD>
137
                    <FIELD name="provenanceactionscheme">dnet:provenanceActions</FIELD>
138
                    <FIELD name="oa_mandate_for_publications" type="boolean"
139
                    >false</FIELD>
140
                    <FIELD name="lastupdate" type="date">
141
                    <xsl:value-of select="current-dateTime()"/>
142
                    </FIELD>
143
                    </ROW>
144
                    <ROW table="project_fundingpath">
145
                    <FIELD name="_dnet_resource_identifier_">
146
                    <xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
147
                    </FIELD>
148
                    <FIELD name="funding">
149
                    <xsl:value-of select="$fundingId"/>
150
                    </FIELD>
151
                    <FIELD name="project">
152
                    <xsl:value-of select="$projectId"/>
153
                    </FIELD>
154

  
155
                    </ROW>
156

  
157
                    <xsl:call-template name="orgTempalte">
158
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country']"/>
159
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution']"/>
160
                    <xsl:with-param name="projectId" select="$projectId"/>
161
                    <xsl:with-param name="role" select="'coordinator'"></xsl:with-param>
162
                    </xsl:call-template>
163
                    <xsl:if test=".//column[@name='Partner 2']">
164
                    <xsl:call-template name="orgTempalte">
165
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country 2']"/>
166
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution 2']"/>
167
                    <xsl:with-param name="projectId" select="$projectId"/>
168
                    <xsl:with-param name="role" select="'participant'"></xsl:with-param>
169
                    </xsl:call-template>
170

  
171
                    </xsl:if>
172
                    <xsl:if test=".//column[@name='Partner 3']">
173
                    <xsl:call-template name="orgTempalte">
174
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country 3']"/>
175
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution 3']"/>
176
                    <xsl:with-param name="projectId" select="$projectId"/>
177
                    <xsl:with-param name="role" select="'participant'"></xsl:with-param>
178
                    </xsl:call-template>
179

  
180
                    </xsl:if>
181
                    <xsl:if test=".//column[@name='Partner 4']">
182
                    <xsl:call-template name="orgTempalte">
183
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country 4']"/>
184
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution 4']"/>
185
                    <xsl:with-param name="projectId" select="$projectId"/>
186
                    <xsl:with-param name="role" select="'participant'"></xsl:with-param>
187
                    </xsl:call-template>
188

  
189
                    </xsl:if>
190
                    <xsl:if test=".//column[@name='Partner 5']">
191
                    <xsl:call-template name="orgTempalte">
192
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country 5']"/>
193
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution 5']"/>
194
                    <xsl:with-param name="projectId" select="$projectId"/>
195
                    <xsl:with-param name="role" select="'participant'"></xsl:with-param>
196
                    </xsl:call-template>
197

  
198
                    </xsl:if>
199
                    <xsl:if test=".//column[@name='Partner 6']">
200
                    <xsl:call-template name="orgTempalte">
201
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country 6']"/>
202
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution 6']"/>
203
                    <xsl:with-param name="projectId" select="$projectId"/>
204
                    <xsl:with-param name="role" select="'participant'"></xsl:with-param>
205
                    </xsl:call-template>
206

  
207
                    </xsl:if>
208
                    <xsl:if test=".//column[@name='Partner 7']">
209
                    <xsl:call-template name="orgTempalte">
210
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country 7']"/>
211
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution 7']"/>
212
                    <xsl:with-param name="projectId" select="$projectId"/>
213
                    <xsl:with-param name="role" select="'participant'"></xsl:with-param>
214
                    </xsl:call-template>
215

  
216
                    </xsl:if>
217
                    <xsl:if test=".//column[@name='Partner 8']">
218
                    <xsl:call-template name="orgTempalte">
219
                    <xsl:with-param name="orgCountry" select=".//column[@name='Country 8']"/>
220
                    <xsl:with-param name="orgName" select=".//column[@name = 'Institution 8']"/>
221
                    <xsl:with-param name="projectId" select="$projectId"/>
222
                    <xsl:with-param name="role" select="'participant'"></xsl:with-param>
223
                    </xsl:call-template>
224

  
225
                    </xsl:if>
226

  
227

  
228
                    </ROWS>
229
                    </metadata>
230
                    </record>
231

  
232

  
233
                    </xsl:template>
234
                    </xsl:stylesheet>
235

  
236
                    ]]>
237
                </CODE>
238
            </SCRIPT>
239
        </CONFIGURATION>
240
        <STATUS/>
241
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
242
    </BODY>
243
</RESOURCE_PROFILE>

Also available in: Unified diff