Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="_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>SFI 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"
18
                exclude-result-prefixes="xs" version="2.0">
19

    
20
	<xsl:param name="parentDatasourceId"/>
21
	<xsl:param name="namespacePrefix"/>
22

    
23
	<xsl:template match="/">
24

    
25
		<xsl:variable name="prefix" select="string('sfi_________')"/>
26

    
27
		<record>
28

    
29
			<xsl:copy-of select=".//*[local-name()='header']"/>
30

    
31
			<metadata>
32
				<ROWS>
33
					<xsl:if test="normalize-space(.//column[@name='Proposal ID']) and normalize-space(.//column[@name='Project Title'])">
34
						<xsl:variable name="projectId" select="concat($namespacePrefix, '::',  normalize-space(.//column[@name='Proposal ID']))"/>
35
						<xsl:variable name="startDate" select=".//column[@name='Start Date']"/>
36
						<xsl:variable name="endDate" select=".//column[@name='End Date']"/>
37
						<ROW table="projects">
38
							<FIELD name="_dnet_resource_identifier_">
39
								<xsl:value-of select="$projectId"/>
40
							</FIELD>
41
							<FIELD name="id">
42
								<xsl:value-of select="$projectId"/>
43
							</FIELD>
44
							<FIELD name="code">
45
								<xsl:value-of select=".//column[@name='Proposal ID']"/>
46
							</FIELD>
47
							<FIELD name="title">
48
								<xsl:value-of select=".//column[@name='Project Title']"/>
49
							</FIELD>
50
							<FIELD name="startdate" type="date" format="dd/MM/yyyy">
51
								<xsl:value-of select="$startDate"/>
52
							</FIELD>
53
							<FIELD name="enddate" type="date" format="dd/MM/yyyy">
54
								<xsl:value-of select="$endDate"/>
55
							</FIELD>
56
							<FIELD name="collectedfrom">
57
								<xsl:value-of select="$parentDatasourceId"/>
58
							</FIELD>
59
							<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
60
							<!-- 30/06/2016 must be converted into 2016-06-30-->
61
							<xsl:variable name="date" select="xs:date(concat(
62
							            substring($startDate,7,4),'-',
63
							            substring($startDate,4,2),'-',
64
							            substring($startDate,1,2)))"/>
65
							<FIELD name="oa_mandate_for_publications" type="boolean"><xsl:value-of select="$date &gt;= xs:date('2009-01-01')"/> </FIELD>
66
							<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
67
						</ROW>
68

    
69
						<xsl:if test="normalize-space(.//column[@name='Programme Name'])">
70
							<xsl:variable name="funderId" select="concat($prefix, '::SFI')"/>
71
							<xsl:variable name="fundingId" select="concat($funderId, '::', normalize-space(.//column[@name='Programme Name']))"/>
72
							<ROW table="project_fundingpath">
73
								<FIELD name="_dnet_resource_identifier_">
74
									<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
75
								</FIELD>
76
								<FIELD name="funding">
77
									<xsl:value-of select="$fundingId"/>
78
								</FIELD>
79
								<FIELD name="project">
80
									<xsl:value-of select="$projectId"/>
81
								</FIELD>
82
								<FIELD name="startdate" type="date" format="dd/MM/yyyy">
83
									<xsl:value-of select="$startDate"/>
84
								</FIELD>
85
								<FIELD name="enddate" type="date" format="dd/MM/yyyy">
86
									<xsl:value-of select="$endDate"/>
87
								</FIELD>
88
							</ROW>
89
						</xsl:if>
90

    
91
						<xsl:if test="normalize-space(.//column[@name='Research Body'])">
92
							<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(.//column[@name='Research Body']))"/>
93
							<ROW table="dsm_organizations">
94
								<FIELD name="_dnet_resource_identifier_">
95
									<xsl:value-of select="$organizationId"/>
96
								</FIELD>
97
								<FIELD name="id">
98
									<xsl:value-of select="$organizationId"/>
99
								</FIELD>
100
								<FIELD name="legalname">
101
									<xsl:value-of select=".//column[@name='Research Body']"/>
102
								</FIELD>
103
								<FIELD name="countryclass">IE</FIELD>
104
								<FIELD name="countryscheme">dnet:countries</FIELD>
105
								<FIELD name="collectedfrom">
106
									<xsl:value-of select="$parentDatasourceId"/>
107
								</FIELD>
108
								<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
109
								<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
110
							</ROW>
111
							<ROW table="project_organization">
112
								<FIELD name="_dnet_resource_identifier_">
113
									<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
114
								</FIELD>
115
								<FIELD name="project">
116
									<xsl:value-of select="$projectId"/>
117
								</FIELD>
118
								<FIELD name="organization">
119
									<xsl:value-of select="$organizationId"/>
120
								</FIELD>
121
								<FIELD name="participantnumber" type="int">1</FIELD>
122
								<FIELD name="role">coordinator</FIELD>
123
							</ROW>
124
						</xsl:if>
125
					</xsl:if>
126
				</ROWS>
127
			</metadata>
128
		</record>
129
	</xsl:template>
130

    
131
</xsl:stylesheet>
132
					]]>
133
				</CODE>
134
			</SCRIPT>
135
		</CONFIGURATION>
136
		<STATUS/>
137
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
138
	</BODY>
139
</RESOURCE_PROFILE>
(15-15/20)