Project

General

Profile

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) &gt; 0 and
34
                      string-length($projectID) &gt; 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) &gt; 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="fundedamount" type="float">
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="translate(substring-after($grantAmount,$tmp),',','')"/>
83
                            </FIELD>
84
                            <FIELD name="currency">
85
                                <xsl:value-of select="string('EUR')"/>
86
                            </FIELD>
87

    
88

    
89
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
90
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
91
							<FIELD name="collectedfrom">
92
								<xsl:value-of select="$varDataSourceId"/>
93
							</FIELD>
94
							<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
95
						</ROW>
96
						<ROW table="project_fundingpath">
97
							<FIELD name="_dnet_resource_identifier_">
98

    
99
								<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
100
							</FIELD>
101
							<FIELD name="funding">
102
								<xsl:value-of select="$fundingID"/>
103
							</FIELD>
104
							<FIELD name="project">
105
								<xsl:value-of select="$projectID"/>
106
							</FIELD>
107
							<FIELD name="startdate" type="date" format="{$dateFormat}">
108
								<xsl:value-of select="$startDate"/>
109
							</FIELD>
110
							<FIELD name="enddate" type="date" format="{$dateFormat}">
111
								<xsl:value-of select="$endDate"/>
112
							</FIELD>
113
						</ROW>
114
						<xsl:if test="string-length($organizationId) &gt; 0">
115
							<ROW table="dsm_organizations">
116

    
117
								<FIELD name="_dnet_resource_identifier_">
118
									<xsl:value-of select="concat($namespacePrefix, '::',$organizationId)"/>
119
								</FIELD>
120
								<FIELD name="id">
121
									<xsl:value-of select="concat($namespacePrefix, '::',$organizationId)"/>
122
								</FIELD>
123
								<FIELD name="legalname">
124
									<xsl:variable name="orgName" select="normalize-space(.//column[@name='research place and institute'])"/>
125
									<xsl:choose>
126
										<xsl:when test="string-length( $orgName) &gt; 255">
127
											<xsl:value-of select="substring($orgName,0,254)"/>
128
										</xsl:when>
129
										<xsl:otherwise>
130
											<xsl:value-of select="normalize-space($orgName)"/>
131
										</xsl:otherwise>
132
									</xsl:choose>
133
								</FIELD>
134
								<FIELD name="country">
135
									<xsl:value-of select="string('AT')"/>
136
								</FIELD>
137
								<FIELD name="collectedfrom">
138
									<xsl:value-of select="$varDataSourceId"/>
139
								</FIELD>
140
								<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
141

    
142
								 <FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
143
							</ROW>
144
						<!--</xsl:if>
145
						<xsl:if test="string-length($organizationId) &gt; 0">-->
146
							<ROW table="project_organization">
147
								<FIELD name="_dnet_resource_identifier_">
148
									<xsl:value-of select="concat($projectID, '@@', concat($namespacePrefix, '::',$organizationId))"/>
149
								</FIELD>
150
								<FIELD name="project">
151
									<xsl:value-of select="$projectID"/>
152
								</FIELD>
153
								<FIELD name="resporganization">
154
									<xsl:value-of select="concat($namespacePrefix, '::',$organizationId)"/>
155
								</FIELD>
156
								<FIELD name="semanticclass">participant</FIELD>
157

    
158
							</ROW>
159
						</xsl:if>
160
					</ROWS>
161
				</xsl:if>
162
			</metadata>
163
		</record>
164
	</xsl:template>
165
</xsl:stylesheet>
166
]]>
167
				</CODE>
168
			</SCRIPT>
169
		</CONFIGURATION>
170
		<STATUS/>
171
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
172
	</BODY>
173
</RESOURCE_PROFILE>
(11-11/27)