|
1 |
<RESOURCE_PROFILE>
|
|
2 |
<HEADER>
|
|
3 |
<RESOURCE_IDENTIFIER value="0fdc906c-0cf8-4b2e-86cf-fb10f6fc7c9a_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>GSRT to DB</TITLE>
|
|
14 |
<CODE><![CDATA[
|
|
15 |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
16 |
xmlns:utils="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions">
|
|
17 |
|
|
18 |
<xsl:param name="varDataSourceId"/>
|
|
19 |
<xsl:variable name="namespacePrefix" select="string('gsrt________')"/>
|
|
20 |
|
|
21 |
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
|
|
22 |
<xsl:variable name="funderID" select="concat($namespacePrefix, '::GSRT')"/>
|
|
23 |
<xsl:param name="quote">"</xsl:param>
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
<xsl:template match="/">
|
|
29 |
<xsl:variable name="sector" select=".//column[@name='Sector ΕΤΑΚ']"/>
|
|
30 |
<xsl:variable name="description" select=".//column[@name='Περιγραφή Φυσικού Αντικειμένου Έργου']"/>
|
|
31 |
<record>
|
|
32 |
|
|
33 |
<xsl:copy-of select=".//*[local-name() = 'header']"/>
|
|
34 |
|
|
35 |
<metadata>
|
|
36 |
<ROWS>
|
|
37 |
<xsl:variable name="projectId"
|
|
38 |
select="concat($namespacePrefix, '::', normalize-space(utils:md5(.//column[@name='Project ID (MIS)'])))"/>
|
|
39 |
|
|
40 |
<!--<xsl:variable name="contact" select="tokenize(.//column[@name='Project Leader'],' ')"/>-->
|
|
41 |
|
|
42 |
|
|
43 |
<ROW table="projects">
|
|
44 |
<FIELD name="_dnet_resource_identifier_">
|
|
45 |
<xsl:value-of select="$projectId"/>
|
|
46 |
</FIELD>
|
|
47 |
<FIELD name="id">
|
|
48 |
<xsl:value-of select="$projectId"/>
|
|
49 |
</FIELD>
|
|
50 |
<FIELD name="code">
|
|
51 |
<xsl:value-of
|
|
52 |
select="normalize-space(.//column[@name = 'Project ID (MIS)'])"
|
|
53 |
/>
|
|
54 |
</FIELD>
|
|
55 |
<FIELD name="title">
|
|
56 |
<xsl:value-of
|
|
57 |
select=".//column[@name = 'Project Title']"/>
|
|
58 |
</FIELD>
|
|
59 |
|
|
60 |
<!-- <FIELD name="contactfullname">
|
|
61 |
<xsl:value-of select="concat($contact[2],', ', $contact[1])"/>
|
|
62 |
</FIELD>-->
|
|
63 |
<xsl:choose>
|
|
64 |
<xsl:when test="$sector != '' ">
|
|
65 |
|
|
66 |
<xsl:choose>
|
|
67 |
<xsl:when test="$description != ''">
|
|
68 |
<FIELD name="optional2">
|
|
69 |
<xsl:value-of
|
|
70 |
select="concat('{',$quote,'sector',$quote,':',$quote,$sector,$quote,',',$quote,'description',$quote,':',$quote,$description,$quote,'}')"
|
|
71 |
/>
|
|
72 |
</FIELD>
|
|
73 |
</xsl:when>
|
|
74 |
<xsl:otherwise>
|
|
75 |
<FIELD name="optional2">
|
|
76 |
<xsl:value-of
|
|
77 |
select="concat('{',$quote,'sector',$quote,':',$quote,$sector,$quote,'}')"
|
|
78 |
/>
|
|
79 |
</FIELD>
|
|
80 |
</xsl:otherwise>
|
|
81 |
</xsl:choose>
|
|
82 |
</xsl:when>
|
|
83 |
<xsl:otherwise>
|
|
84 |
<xsl:if test="$description != ''">
|
|
85 |
<FIELD name="optional2">
|
|
86 |
<xsl:value-of
|
|
87 |
select="concat('{',$quote,'description',$quote,':',$quote,$description,$quote,'}')"
|
|
88 |
/>
|
|
89 |
</FIELD>
|
|
90 |
</xsl:if>
|
|
91 |
|
|
92 |
</xsl:otherwise>
|
|
93 |
</xsl:choose>
|
|
94 |
<FIELD name="collectedfrom">
|
|
95 |
<xsl:value-of select="$varDataSourceId"/>
|
|
96 |
</FIELD>
|
|
97 |
<!-- <FIELD name="optional1">
|
|
98 |
<xsl:value-of select="concat(.//column[@name='Budget (€)'],' €')"/>
|
|
99 |
</FIELD>-->
|
|
100 |
<FIELD name="provenanceactionclass"
|
|
101 |
>sysimport:crosswalk:entityregistry</FIELD>
|
|
102 |
<FIELD name="provenanceactionscheme"
|
|
103 |
>dnet:provenanceActions</FIELD>
|
|
104 |
<FIELD name="oa_mandate_for_publications" type="boolean"
|
|
105 |
>false</FIELD>
|
|
106 |
<FIELD name="lastupdate" type="date">
|
|
107 |
<xsl:value-of select="current-dateTime()"/>
|
|
108 |
</FIELD>
|
|
109 |
</ROW>
|
|
110 |
<ROW table="project_fundingpath">
|
|
111 |
<FIELD name="_dnet_resource_identifier_">
|
|
112 |
<xsl:value-of
|
|
113 |
select="concat($funderID, '@@', $projectId)"/>
|
|
114 |
</FIELD>
|
|
115 |
<FIELD name="funding">
|
|
116 |
<xsl:value-of select="$funderID"/>
|
|
117 |
</FIELD>
|
|
118 |
<FIELD name="project">
|
|
119 |
<xsl:value-of select="$projectId"/>
|
|
120 |
</FIELD>
|
|
121 |
|
|
122 |
</ROW>
|
|
123 |
<xsl:if test=".//column[@name='Beneficiary Name'] != ''">
|
|
124 |
|
|
125 |
<xsl:variable name="organizationId"
|
|
126 |
select="concat($namespacePrefix,'::',utils:md5(normalize-space(.//column[@name='Beneficiary Name'])))"/>
|
|
127 |
<ROW table="dsm_organizations">
|
|
128 |
|
|
129 |
<FIELD name="_dnet_resource_identifier_">
|
|
130 |
<xsl:value-of select="$organizationId"/>
|
|
131 |
</FIELD>
|
|
132 |
<FIELD name="id">
|
|
133 |
<xsl:value-of select="$organizationId"/>
|
|
134 |
</FIELD>
|
|
135 |
<xsl:choose>
|
|
136 |
<xsl:when test="string-length(.//column[@name='Beneficiary Name']) > 255">
|
|
137 |
<FIELD name="legalname">
|
|
138 |
<xsl:value-of
|
|
139 |
select="normalize-space(substring(.//column[@name='Beneficiary Name'],1,255))"
|
|
140 |
/>
|
|
141 |
</FIELD>
|
|
142 |
</xsl:when>
|
|
143 |
<xsl:otherwise>
|
|
144 |
<FIELD name="legalname">
|
|
145 |
<xsl:value-of
|
|
146 |
select="normalize-space(.//column[@name='Beneficiary Name'])"
|
|
147 |
/>
|
|
148 |
</FIELD>
|
|
149 |
</xsl:otherwise>
|
|
150 |
</xsl:choose>
|
|
151 |
|
|
152 |
<FIELD name="country">
|
|
153 |
<xsl:value-of select="string('GR')" />
|
|
154 |
</FIELD>
|
|
155 |
<FIELD name="collectedfrom">
|
|
156 |
<xsl:value-of select="$varDataSourceId"/>
|
|
157 |
</FIELD>
|
|
158 |
<FIELD name="provenanceaction"
|
|
159 |
>sysimport:crosswalk:entityregistry</FIELD>
|
|
160 |
<FIELD name="lastupdate" type="date">
|
|
161 |
<xsl:value-of select="current-dateTime()"/>
|
|
162 |
</FIELD>
|
|
163 |
</ROW>
|
|
164 |
<ROW table="project_organization">
|
|
165 |
<FIELD name="_dnet_resource_identifier_">
|
|
166 |
<xsl:value-of
|
|
167 |
select='concat($projectId, "@@", $organizationId)'
|
|
168 |
/>
|
|
169 |
</FIELD>
|
|
170 |
<FIELD name="project">
|
|
171 |
<xsl:value-of select="$projectId"/>
|
|
172 |
</FIELD>
|
|
173 |
<FIELD name="resporganization">
|
|
174 |
<xsl:value-of select="$organizationId"/>
|
|
175 |
</FIELD>
|
|
176 |
<FIELD name="semanticclass">coordinator</FIELD>
|
|
177 |
</ROW>
|
|
178 |
</xsl:if>
|
|
179 |
</ROWS>
|
|
180 |
</metadata>
|
|
181 |
</record>
|
|
182 |
</xsl:template>
|
|
183 |
</xsl:stylesheet>
|
|
184 |
|
|
185 |
]]>
|
|
186 |
</CODE>
|
|
187 |
</SCRIPT>
|
|
188 |
</CONFIGURATION>
|
|
189 |
<STATUS/>
|
|
190 |
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
|
191 |
</BODY>
|
|
192 |
</RESOURCE_PROFILE>
|
moved info in jsonextrainfo to optional2