1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="e931caab-7bec-4b07-9e72-de15739b4f0d_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>FWF to DB</TITLE>
|
14
|
<CODE>
|
15
|
<![CDATA[
|
16
|
<xsl:stylesheet xmlns:fwf="eu.dnetlib.data.transform.xml.FWFXsltFunctions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
17
|
|
18
|
<xsl:param name="varDataSourceId"/>
|
19
|
<xsl:variable name="namespacePrefix" select="string('fwf_________')"/>
|
20
|
|
21
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::FWF')"/>
|
22
|
|
23
|
<xsl:variable name="projectFundingAndNumber" select="normalize-space(//column[@name='project number'])"/>
|
24
|
<xsl:variable name="fundingCode" select="normalize-space(substring-before($projectFundingAndNumber, '–'))"/>
|
25
|
<xsl:variable name="projectNumber" select="normalize-space(substring-after($projectFundingAndNumber, '–'))"/>
|
26
|
<xsl:variable name="projectID" select="concat($namespacePrefix, '::', concat($fundingCode, '_', $projectNumber))"/>
|
27
|
<xsl:variable name="projectTitle" select="//column[@name='project title']"/>
|
28
|
|
29
|
<xsl:template match="/">
|
30
|
<record>
|
31
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
32
|
<metadata>
|
33
|
<xsl:if test="string-length($projectTitle) > 0 and
|
34
|
string-length($projectID) > 0 and
|
35
|
//column[@name='status'] != 'canceled'">
|
36
|
|
37
|
<xsl:variable name="projectCode" select="concat($fundingCode,' ', $projectNumber)"/>
|
38
|
<xsl:variable name="startDate" select=".//column[@name='from']"/>
|
39
|
<xsl:variable name="endDate" select=".//column[@name='till']"/>
|
40
|
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
|
41
|
<xsl:variable name="organizationId" select="fwf:getMd5(normalize-space(.//column[@name='research place and institute']))"/>
|
42
|
<xsl:variable name="fundingID">
|
43
|
<xsl:choose>
|
44
|
<xsl:when test="string-length($fundingCode) > 0">
|
45
|
<xsl:value-of select="concat($funderID, '::', $fundingCode)"/>
|
46
|
</xsl:when>
|
47
|
<xsl:otherwise>
|
48
|
<xsl:value-of select="$funderID"/>
|
49
|
</xsl:otherwise>
|
50
|
</xsl:choose>
|
51
|
</xsl:variable>
|
52
|
|
53
|
<ROWS>
|
54
|
<ROW table="projects">
|
55
|
<FIELD name="_dnet_resource_identifier_">
|
56
|
<xsl:value-of select="$projectID"/>
|
57
|
</FIELD>
|
58
|
<FIELD name="id">
|
59
|
<xsl:value-of select="$projectID"/>
|
60
|
</FIELD>
|
61
|
<FIELD name="code">
|
62
|
<xsl:value-of select="$projectCode"/>
|
63
|
</FIELD>
|
64
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
65
|
<xsl:value-of select="$startDate"/>
|
66
|
</FIELD>
|
67
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
68
|
<xsl:value-of select="$endDate"/>
|
69
|
</FIELD>
|
70
|
<FIELD name="title">
|
71
|
<xsl:value-of select="$projectTitle"/>
|
72
|
</FIELD>
|
73
|
<FIELD name ="contactfullname">
|
74
|
<xsl:value-of select="normalize-space(.//column[@name='project lead'])"/>
|
75
|
</FIELD>
|
76
|
<FIELD name="keywords">
|
77
|
<xsl:value-of select=".//column[@name='keywords']"/>
|
78
|
</FIELD>
|
79
|
<FIELD name="optional1">
|
80
|
<xsl:variable name="grantAmount" select=".//column[@name='grants awarded']"/>
|
81
|
<xsl:variable name="tmp" select="substring(normalize-space($grantAmount),1,1)"/>
|
82
|
<xsl:value-of select="concat($tmp,' ',substring-after($grantAmount,$tmp))"/>
|
83
|
</FIELD>
|
84
|
|
85
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
86
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
87
|
<FIELD name="collectedfrom">
|
88
|
<xsl:value-of select="$varDataSourceId"/>
|
89
|
</FIELD>
|
90
|
<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
|
91
|
</ROW>
|
92
|
<ROW table="project_fundingpath">
|
93
|
<FIELD name="_dnet_resource_identifier_">
|
94
|
|
95
|
<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
|
96
|
</FIELD>
|
97
|
<FIELD name="funding">
|
98
|
<xsl:value-of select="$fundingID"/>
|
99
|
</FIELD>
|
100
|
<FIELD name="project">
|
101
|
<xsl:value-of select="$projectID"/>
|
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>
|
109
|
</ROW>
|
110
|
<xsl:if test="string-length($organizationId) > 0">
|
111
|
<ROW table="dsm_organizations">
|
112
|
|
113
|
<FIELD name="_dnet_resource_identifier_">
|
114
|
<xsl:value-of select="concat($namespacePrefix, '::',$organizationId)"/>
|
115
|
</FIELD>
|
116
|
<FIELD name="id">
|
117
|
<xsl:value-of select="concat($namespacePrefix, '::',$organizationId)"/>
|
118
|
</FIELD>
|
119
|
<FIELD name="legalname">
|
120
|
<xsl:variable name="orgName" select="normalize-space(.//column[@name='research place and institute'])"/>
|
121
|
<xsl:choose>
|
122
|
<xsl:when test="string-length( $orgName) > 255">
|
123
|
<xsl:value-of select="substring($orgName,0,254)"/>
|
124
|
</xsl:when>
|
125
|
<xsl:otherwise>
|
126
|
<xsl:value-of select="normalize-space($orgName)"/>
|
127
|
</xsl:otherwise>
|
128
|
</xsl:choose>
|
129
|
</FIELD>
|
130
|
<FIELD name="collectedfrom">
|
131
|
<xsl:value-of select="$varDataSourceId"/>
|
132
|
</FIELD>
|
133
|
<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
|
134
|
|
135
|
<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
|
136
|
</ROW>
|
137
|
</xsl:if>
|
138
|
<xsl:if test="string-length($organizationId) > 0">
|
139
|
<ROW table="project_organization">
|
140
|
<FIELD name="_dnet_resource_identifier_">
|
141
|
<xsl:value-of select="concat($projectID, '@@', concat($namespacePrefix, '::',$organizationId))"/>
|
142
|
</FIELD>
|
143
|
<FIELD name="project">
|
144
|
<xsl:value-of select="$projectID"/>
|
145
|
</FIELD>
|
146
|
<FIELD name="resporganization">
|
147
|
<xsl:value-of select="concat($namespacePrefix, '::',$organizationId)"/>
|
148
|
</FIELD>
|
149
|
<FIELD name="semanticclass">participant</FIELD>
|
150
|
|
151
|
</ROW>
|
152
|
</xsl:if>
|
153
|
</ROWS>
|
154
|
</xsl:if>
|
155
|
</metadata>
|
156
|
</record>
|
157
|
</xsl:template>
|
158
|
</xsl:stylesheet>
|
159
|
]]>
|
160
|
</CODE>
|
161
|
</SCRIPT>
|
162
|
</CONFIGURATION>
|
163
|
<STATUS/>
|
164
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
165
|
</BODY>
|
166
|
</RESOURCE_PROFILE>
|