Project

General

Profile

« Previous | Next » 

Revision 57243

transformation rule fro Russian Science Foundation

View differences:

modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/funders/rsf2db.xml
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="$projectId"/>
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
                           <!-- <FIELD name="amount"> it was optional1 before
78
                                <xsl:value-of select="concat(.//column[@name='Funding'], ' €')"/>
79
                            </FIELD> -->
80
                            <FIELD name="summary">
81
                                <xsl:value-of select=".//column[@name='Annotation']"/>
82
                            </FIELD>
83
                            <FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
84
                            <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
85
                            <FIELD name="collectedfrom">
86
                                <xsl:value-of select="$varDataSourceId"/>
87
                            </FIELD>
88

  
89
                            <FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
90

  
91
                        </ROW>
92

  
93

  
94

  
95
                        <ROW table="project_fundingpath">
96
                            <FIELD name="_dnet_resource_identifier_">
97
                                <xsl:value-of select="concat($fundingID,'@@', $projectId)"/>
98
                            </FIELD>
99
                            <FIELD name="funding">
100
                                <xsl:value-of select="$fundingID"/>
101
                            </FIELD>
102
                            <FIELD name="project">
103
                                <xsl:value-of select="$projectId"/>
104
                            </FIELD>
105
                            <FIELD name="startdate" type="date" format="{$dateFormat}">
106
                                <xsl:value-of select="$startDate"/>
107
                            </FIELD>
108
                            <FIELD name="enddate" type="date" format="{$dateFormat}">
109
                                <xsl:value-of select="$endDate"/>
110
                            </FIELD>
111
                        </ROW>
112
                    <xsl:variable name="organizationId" select="concat($namespacePrefix,'::',utils:md5(normalize-space(.//column[@name='Affiliation'])))"/>
113
                    <ROW table = "dsm_organizations">
114
                        <FIELD name="_dnet_resource_identifier_">
115
                            <xsl:value-of select="$organizationId"/>
116
                        </FIELD>
117
                        <FIELD name="id">
118
                            <xsl:value-of select="$organizationId"/>
119
                        </FIELD>
120
                        <FIELD name="legalname">
121
         <xsl:choose>
122
                                <xsl:when test="string-length(normalize-space(.//column[@name='Affiliation'])) > 255">
123
                                    <xsl:value-of select="substring(normalize-space(.//column[@name='Affiliation']),0,254)"/>
124
                                </xsl:when>
125
                                <xsl:otherwise>
126
                                    <xsl:value-of select="normalize-space(.//column[@name='Affiliation'])"/>
127
                                </xsl:otherwise>
128
                            </xsl:choose>
129
                        </FIELD>
130
                        <FIELD name="collectedfrom">
131
                            <xsl:value-of select="$varDataSourceId"/>
132
                        </FIELD>
133
                            <FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
134
                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
135
                    </ROW>
136
                    <ROW table="project_organization">
137
                        <FIELD name="_dnet_resource_identifier_">
138
                            <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
139
                        </FIELD>
140
                        <FIELD name="project">
141
                            <xsl:value-of select="$projectId"/>
142
                        </FIELD>
143
                        <FIELD name="resporganization">
144
                            <xsl:value-of select="$organizationId"/>
145
                        </FIELD>
146

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

  
154
    </xsl:template>
155
</xsl:stylesheet>
156
                ]]>
157

  
158
                </CODE>
159
            </SCRIPT>
160
        </CONFIGURATION>
161
        <STATUS/>
162
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
163
    </BODY>
164
</RESOURCE_PROFILE>

Also available in: Unified diff