Project

General

Profile

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
                    <!--COMMENTED because optional2 has max length 255 chars and it is not able to contain description of projects. To be de-commented as soon as a proper description field will be added to the database --><!--
64
                        <xsl:choose>
65
                            <xsl:when test="$sector != '' ">
66

    
67
                                <xsl:choose>
68
                                    <xsl:when test="$description != ''">
69
                                        <FIELD name="optional2">
70
                                            <xsl:value-of
71
                                                select="concat('{',$quote,'sector',$quote,':',$quote,$sector,$quote,',',$quote,'description',$quote,':',$quote,$description,$quote,'}')"
72
                                            />
73
                                        </FIELD>
74
                                    </xsl:when>
75
                                    <xsl:otherwise>
76
                                        <FIELD name="optional2">
77
                                            <xsl:value-of
78
                                                select="concat('{',$quote,'sector',$quote,':',$quote,$sector,$quote,'}')"
79
                                            />
80
                                        </FIELD>
81
                                    </xsl:otherwise>
82
                                </xsl:choose>
83
                            </xsl:when>
84
                            <xsl:otherwise>
85
                                <xsl:if test="$description != ''">
86
                                    <FIELD name="optional2">
87
                                        <xsl:value-of
88
                                            select="concat('{',$quote,'description',$quote,':',$quote,$description,$quote,'}')"
89
                                        />
90
                                    </FIELD>
91
                                </xsl:if>
92

    
93
                            </xsl:otherwise>
94
                        </xsl:choose>
95
-->
96

    
97
                        <FIELD name="collectedfrom">
98
                            <xsl:value-of select="$varDataSourceId"/>
99
                        </FIELD>
100
                        <!-- <FIELD name="optional1">
101
                    <xsl:value-of select="concat(.//column[@name='Budget (€)'],' €')"/>
102
                    </FIELD>-->
103
                        <FIELD name="provenanceactionclass"
104
                            >sysimport:crosswalk:entityregistry</FIELD>
105
                        <FIELD name="provenanceactionscheme"
106
                            >dnet:provenanceActions</FIELD>
107
                        <FIELD name="oa_mandate_for_publications" type="boolean"
108
                            >false</FIELD>
109
                        <FIELD name="lastupdate" type="date">
110
                            <xsl:value-of select="current-dateTime()"/>
111
                        </FIELD>
112
                    </ROW>
113
                    <ROW table="project_fundingpath">
114
                        <FIELD name="_dnet_resource_identifier_">
115
                            <xsl:value-of
116
                                select="concat($funderID, '@@', $projectId)"/>
117
                        </FIELD>
118
                        <FIELD name="funding">
119
                            <xsl:value-of select="$funderID"/>
120
                        </FIELD>
121
                        <FIELD name="project">
122
                            <xsl:value-of select="$projectId"/>
123
                        </FIELD>
124

    
125
                    </ROW>
126
                    <xsl:if test=".//column[@name='Beneficiary Name'] != ''">
127

    
128
                        <xsl:variable name="organizationId"
129
                            select="concat($namespacePrefix,'::',utils:md5(normalize-space(.//column[@name='Beneficiary Name'])))"/>
130
                        <ROW table="dsm_organizations">
131

    
132
                            <FIELD name="_dnet_resource_identifier_">
133
                                <xsl:value-of select="$organizationId"/>
134
                            </FIELD>
135
                            <FIELD name="id">
136
                                <xsl:value-of select="$organizationId"/>
137
                            </FIELD>
138
                            <xsl:choose>
139
                                <xsl:when test="string-length(.//column[@name='Beneficiary Name']) > 255">
140
                                    <FIELD name="legalname">
141
                                        <xsl:value-of
142
                                            select="normalize-space(substring(.//column[@name='Beneficiary Name'],1,255))"
143
                                        />
144
                                    </FIELD>
145
                                </xsl:when>
146
                                <xsl:otherwise>
147
                                    <FIELD name="legalname">
148
                                        <xsl:value-of
149
                                            select="normalize-space(.//column[@name='Beneficiary Name'])"
150
                                        />
151
                                    </FIELD>
152
                                </xsl:otherwise>
153
                            </xsl:choose>
154

    
155
                            <FIELD name="country">
156
                                <xsl:value-of select="string('GR')" />
157
                            </FIELD>
158
                            <FIELD name="collectedfrom">
159
                                <xsl:value-of select="$varDataSourceId"/>
160
                            </FIELD>
161
                            <FIELD name="provenanceaction"
162
                                >sysimport:crosswalk:entityregistry</FIELD>
163
                            <FIELD name="lastupdate" type="date">
164
                                <xsl:value-of select="current-dateTime()"/>
165
                            </FIELD>
166
                        </ROW>
167
                        <ROW table="project_organization">
168
                            <FIELD name="_dnet_resource_identifier_">
169
                                <xsl:value-of
170
                                    select='concat($projectId, "@@", $organizationId)'
171
                                />
172
                            </FIELD>
173
                            <FIELD name="project">
174
                                <xsl:value-of select="$projectId"/>
175
                            </FIELD>
176
                            <FIELD name="resporganization">
177
                                <xsl:value-of select="$organizationId"/>
178
                            </FIELD>
179
                            <FIELD name="semanticclass">coordinator</FIELD>
180
                        </ROW>
181
                    </xsl:if>
182
                </ROWS>
183
            </metadata>
184
        </record>
185
    </xsl:template>
186
</xsl:stylesheet>
187

    
188
]]>
189
                </CODE>
190
            </SCRIPT>
191
        </CONFIGURATION>
192
        <STATUS/>
193
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
194
    </BODY>
195
</RESOURCE_PROFILE>
(13-13/29)