Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="ace59c22-1c4d-4c9e-8bc6-52bcb6e0726c_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2019-09-26T15:17:56+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>RSF to DB</TITLE>
14
                <CODE><![CDATA[
15
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:utils="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions"
17
    exclude-result-prefixes="xs" version="2.0">
18

    
19
     <xsl:param name="varDataSourceId"/>
20

    
21
    <xsl:param name="quote">"</xsl:param>
22
 <xsl:variable name="namespacePrefix" select="string('rsf_________')"/>
23
    <xsl:variable name="funderID" select="concat($namespacePrefix, '::RSF')"/>
24

    
25

    
26
    <!--<xsl:variable name="stream" select="normalize-space(.//column[@name='FUNDING STREAM(S)'])"/>-->
27
    <xsl:variable name="fundingID">
28

    
29
                <xsl:value-of select="$funderID"/>
30
    </xsl:variable>
31

    
32
    <xsl:variable name="projectId" select="concat($namespacePrefix, '::',  normalize-space(.//column[@name='Project Number']))"/>
33

    
34
    <xsl:variable name="fundingPeriod" select="tokenize(.//column[@name='Implementation period'],'-')"/>
35
    <xsl:variable name="startDate" select="normalize-space(.//column[@name='Start Date'])"/>
36
    <xsl:variable name="endDate" select="normalize-space(.//column[@name='End Date'])"/>
37

    
38
    <xsl:variable name="dateFormat" select="string('YYYY')"/>
39
    <xsl:variable name="projectTitle" select="normalize-space(.//column[@name='Project title'])"/>
40

    
41
    <xsl:template match="/">
42

    
43

    
44

    
45
        <record>
46

    
47
            <xsl:copy-of select=".//*[local-name()='header']"/>
48
            <metadata>
49
                <xsl:if test="string-length($projectTitle) &gt; 0 and string-length($projectId) &gt; 0">
50
                <ROWS>
51

    
52
                        <ROW table="projects">
53
                            <FIELD name="_dnet_resource_identifier_">
54
                                <xsl:value-of select="$projectId"/>
55
                            </FIELD>
56
                            <FIELD name="id">
57
                                <xsl:value-of select="$projectId"/>
58
                            </FIELD>
59
                            <FIELD name="code">
60
                                <xsl:value-of select="normalize-space(.//column[@name='Project Number'])"/>
61
                            </FIELD>
62
                            <FIELD name="startdate" type="date" format="{$dateFormat}">
63
                                <xsl:value-of select="$startDate"/>
64
                            </FIELD>
65
                            <FIELD name="enddate" type="date" format="{$dateFormat}">
66
                                <xsl:value-of select="$endDate"/>
67
                            </FIELD>
68
                            <FIELD name="title">
69
                                <xsl:value-of select="$projectTitle"/>
70
                            </FIELD>
71
                            <!-- <FIELD name="call_identifier">
72
                                <xsl:value-of select=".//column[@name='Research area']"/>
73
                            </FIELD> -->
74
                            <FIELD name="contactfullname">
75
                                <xsl:value-of select=".//column[@name='Project Lead']"/>
76
                            </FIELD>
77

    
78
                            <FIELD name="summary">
79
                                <xsl:value-of select=".//column[@name='Annotation']"/>
80
                            </FIELD>
81
                            <FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
82
                            <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
83
                            <FIELD name="collectedfrom">
84
                                <xsl:value-of select="$varDataSourceId"/>
85
                            </FIELD>
86

    
87
                            <FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
88

    
89
                        </ROW>
90

    
91

    
92

    
93
                        <ROW table="project_fundingpath">
94
                            <FIELD name="_dnet_resource_identifier_">
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:variable name="organizationId" select="concat($namespacePrefix,'::',utils:md5(normalize-space(.//column[@name='Affiliation'])))"/>
111
                    <ROW table = "dsm_organizations">
112
                        <FIELD name="_dnet_resource_identifier_">
113
                            <xsl:value-of select="$organizationId"/>
114
                        </FIELD>
115
                        <FIELD name="id">
116
                            <xsl:value-of select="$organizationId"/>
117
                        </FIELD>
118
                        <FIELD name="legalname">
119
         <xsl:choose>
120
                                <xsl:when test="string-length(normalize-space(.//column[@name='Affiliation'])) > 255">
121
                                    <xsl:value-of select="substring(normalize-space(.//column[@name='Affiliation']),0,254)"/>
122
                                </xsl:when>
123
                                <xsl:otherwise>
124
                                    <xsl:value-of select="normalize-space(.//column[@name='Affiliation'])"/>
125
                                </xsl:otherwise>
126
                            </xsl:choose>
127
                        </FIELD>
128
                        <FIELD name="collectedfrom">
129
                            <xsl:value-of select="$varDataSourceId"/>
130
                        </FIELD>
131
                            <FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
132
                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
133
                    </ROW>
134
                    <ROW table="project_organization">
135
                        <FIELD name="_dnet_resource_identifier_">
136
                            <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
137
                        </FIELD>
138
                        <FIELD name="project">
139
                            <xsl:value-of select="$projectId"/>
140
                        </FIELD>
141
                        <FIELD name="resporganization">
142
                            <xsl:value-of select="$organizationId"/>
143
                        </FIELD>
144

    
145
                    <FIELD name="semanticclass">coordinator</FIELD>
146
                    </ROW>
147
                </ROWS>
148
                </xsl:if>
149
            </metadata>
150
        </record>
151

    
152
    </xsl:template>
153
</xsl:stylesheet>
154
                ]]>
155

    
156
                </CODE>
157
            </SCRIPT>
158
        </CONFIGURATION>
159
        <STATUS/>
160
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
161
    </BODY>
162
</RESOURCE_PROFILE>
(22-22/29)