Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER
4
                value="6daafb85-53b2-4adb-8054-f91b10029b20_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
7
        <RESOURCE_URI value=""/>
8
        <DATE_OF_CREATION value="2019-03-18T17:59:33+00:00"/>
9
    </HEADER>
10
    <BODY>
11
        <CONFIGURATION>
12
            <IMPORTED/>
13
            <SCRIPT>
14
                <TITLE>RE3DATA 2 DB</TITLE>
15
                <CODE>
16

    
17
                    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
                                    xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions"
19
                                    version="2.0">
20

    
21
                        <xsl:param name="varDataSourceId"/>
22
                        <xsl:variable name="namespacePrefix" select="string('re3data_____')"/>
23

    
24
                        <xsl:variable name="dsId"
25
                                      select="concat($namespacePrefix, '::', normalize-space(.//*[local-name()='re3data.orgIdentifier']))"/>
26
                        <xsl:variable name="subjects">
27
                            <xsl:for-each select="//*[local-name()='subject']">
28
                                <xsl:if test="position() > 1">@@</xsl:if>
29
                                <xsl:value-of select="substring-after(., ' ')"/>
30
                            </xsl:for-each>
31
                        </xsl:variable>
32

    
33
                        <xsl:template match="/">
34
                            <record>
35

    
36
                                <xsl:copy-of select=".//*[local-name()='header']"/>
37
                                <metadata>
38
                                    <ROWS>
39
                                        <ROW table="dsm_datasources">
40
                                            <FIELD name="_dnet_resource_identifier_">
41
                                                <xsl:value-of select="$dsId"/>
42
                                            </FIELD>
43
                                            <FIELD name="id">
44
                                                <xsl:value-of select="$dsId"/>
45
                                            </FIELD>
46
                                            <FIELD name="officialName">
47
                                                <xsl:value-of select=".//*[local-name()='repositoryName']"/>
48
                                            </FIELD>
49
                                            <FIELD name="englishName">
50
                                                <xsl:value-of
51
                                                        select=".//*[local-name()='additionalName'][@language='eng']"/>
52
                                            </FIELD>
53
                                            <FIELD name="websiteurl">
54
                                                <xsl:value-of select=".//*[local-name()='repositoryURL']"/>
55
                                            </FIELD>
56
                                            <FIELD name="namespaceprefix">
57
                                                <xsl:value-of
58
                                                        select="dnet:generateNsPrefix('r3', dnet:md5(normalize-space(.//*[local-name()='re3data.orgIdentifier'])))"/>
59
                                            </FIELD>
60
                                            <FIELD name="collectedfrom">
61
                                                <xsl:value-of select="$varDataSourceId"/>
62
                                            </FIELD>
63
                                            <FIELD name="typology">datarepository::unknown</FIELD>
64
                                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
65
                                            <FIELD name="platform">
66
                                                <xsl:value-of
67
                                                        select=".//*[local-name()='software']/*[local-name()='softwareName']"/>
68
                                            </FIELD>
69
                                            <FIELD name="description">
70
                                                <xsl:value-of select="./*[local-name()='description']"/>
71
                                            </FIELD>
72
                                            <FIELD name="releasestartdate" type="date">
73
                                                <xsl:value-of select=".//*[local-name()='startDate']"/>
74
                                            </FIELD>
75
                                            <FIELD name="releaseenddate" type="date">
76
                                                <xsl:value-of select=".//*[local-name()='endDate']"/>
77
                                            </FIELD>
78
                                            <FIELD name="missionstatementurl">
79
                                                <xsl:value-of select=".//*[local-name()='missionStatementURL']"/>
80
                                            </FIELD>
81

    
82
                                            <xsl:choose>
83
                                                <xsl:when test=".//*[local-name()='providerType'] = 'dataProvider'">
84
                                                    <FIELD name="dataprovider" type="boolean">true</FIELD>
85
                                                </xsl:when>
86
                                                <xsl:otherwise>
87
                                                    <FIELD name="dataprovider" type="boolean">false</FIELD>
88
                                                </xsl:otherwise>
89
                                            </xsl:choose>
90
                                            <xsl:choose>
91
                                                <xsl:when test=".//*[local-name()='providerType'] = 'serviceProvider'">
92
                                                    <FIELD name="serviceprovider" type="boolean">true</FIELD>
93
                                                </xsl:when>
94
                                                <xsl:otherwise>
95
                                                    <FIELD name="serviceprovider" type="boolean">false</FIELD>
96
                                                </xsl:otherwise>
97
                                            </xsl:choose>
98
                                            <FIELD name="databaseaccesstype">
99
                                                <xsl:value-of select=".//*[local-name()='databaseAccessType']"/>
100
                                            </FIELD>
101
                                            <FIELD name="datauploadtype">
102
                                                <xsl:value-of select=".//*[local-name()='dataUploadType']"/>
103
                                            </FIELD>
104
                                            <FIELD name="databaseaccessrestriction">
105
                                                <xsl:value-of select=".//*[local-name()='databaseAccessRestriction']"/>
106
                                            </FIELD>
107
                                            <FIELD name="datauploadrestriction">
108
                                                <xsl:value-of select=".//*[local-name()='dataUploadRestriction']"/>
109
                                            </FIELD>
110
                                            <xsl:choose>
111
                                                <xsl:when test=".//*[local-name()='versioning'] = 'yes'">
112
                                                    <FIELD name="versioning" type="boolean">true</FIELD>
113
                                                </xsl:when>
114
                                                <xsl:otherwise>
115
                                                    <FIELD name="versioning" type="boolean">false</FIELD>
116
                                                </xsl:otherwise>
117
                                            </xsl:choose>
118
                                            <FIELD name="citationguidelineurl">
119
                                                <xsl:value-of select=".//*[local-name()='citationGuidelineURL']"/>
120
                                            </FIELD>
121
                                            <FIELD name="qualitymanagementkind">
122
                                                <xsl:value-of select=".//*[local-name()='qualityManagement']"/>
123
                                            </FIELD>
124
                                            <FIELD name="pidsystems">
125
                                                <xsl:value-of select=".//*[local-name()='pidSystem']"/>
126
                                            </FIELD>
127
                                            <FIELD name="certificates">
128
                                                <xsl:value-of select=".//*[local-name()='certificate']"/>
129
                                            </FIELD>
130
                                            <FIELD name="subjects">
131
                                                <xsl:value-of select="normalize-space($subjects)"/>
132
                                            </FIELD>
133
                                        </ROW>
134

    
135
                                        <xsl:for-each select="//*[local-name()='api']">
136
                                            <xsl:variable name="apiId"
137
                                                          select="concat('api_________::', $dsId, '::', position())"/>
138
                                            <xsl:variable name="baseURL" select="normalize-space(.)"/>
139
                                            <ROW table="dsm_api">
140
                                                <FIELD name="_dnet_resource_identifier_">
141
                                                    <xsl:value-of select="$apiId"/>
142
                                                </FIELD>
143
                                                <FIELD name="id">
144
                                                    <xsl:value-of select="$apiId"/>
145
                                                </FIELD>
146
                                                <FIELD name="protocol">
147
                                                    <xsl:value-of select="normalize-space(@apiType)"/>
148
                                                </FIELD>
149
                                                <FIELD name="datasource">
150
                                                    <xsl:value-of select="$dsId"/>
151
                                                </FIELD>
152
                                                <FIELD name="contentdescription">metadata</FIELD>
153
                                                <FIELD name="typology">datarepository::unknown</FIELD>
154

    
155
                                                <FIELD name="baseurl">
156
                                                    <xsl:value-of select="$baseURL"/>
157
                                                </FIELD>
158
                                            </ROW>
159
                                        </xsl:for-each>
160

    
161
                                        <xsl:for-each select="//*[local-name() = 'institution']">
162
                                            <xsl:variable name="orgId"
163
                                                          select="concat($namespacePrefix, '::', dnet:md5(concat(normalize-space(./*[local-name() = 'institutionName']), '_', normalize-space(./*[local-name() = 'institutionCountry']))))"/>
164
                                            <ROW table="dsm_organizations">
165
                                                <FIELD name="_dnet_resource_identifier_">
166
                                                    <xsl:value-of select="$orgId"/>
167
                                                </FIELD>
168
                                                <FIELD name="id">
169
                                                    <xsl:value-of select="$orgId"/>
170
                                                </FIELD>
171
                                                <FIELD name="legalname">
172
                                                    <xsl:value-of select="./*[local-name() = 'institutionName']"/>
173
                                                </FIELD>
174
                                                <xsl:variable name="orgShortname">
175
                                                    <xsl:value-of
176
                                                            select="./*[local-name() = 'institutionAdditionalName'][1]"/>
177
                                                </xsl:variable>
178
                                                <xsl:if test="upper-case($orgShortname) = $orgShortname">
179
                                                    <FIELD name="legalshortname">
180
                                                        <xsl:value-of select="$orgShortname"/>
181
                                                    </FIELD>
182
                                                </xsl:if>
183
                                                <FIELD name="websiteurl">
184
                                                    <xsl:choose>
185
                                                        <xsl:when
186
                                                                test="starts-with(normalize-space(./*[local-name() = 'institutionURL']), 'http')">
187
                                                            <xsl:value-of select="./*[local-name() = 'institutionURL']"
188
                                                            />
189
                                                        </xsl:when>
190
                                                        <xsl:when
191
                                                                test="string-length(normalize-space(./*[local-name() = 'institutionURL'])) > 0">
192
                                                            <xsl:value-of
193
                                                                    select="concat('http://', normalize-space(./*[local-name() = 'institutionURL']))"
194
                                                            />
195
                                                        </xsl:when>
196
                                                    </xsl:choose>
197
                                                </FIELD>
198
                                                <FIELD name="country">
199
                                                    <xsl:value-of select="./*[local-name() = 'institutionCountry']"/>
200
                                                </FIELD>
201
                                                <xsl:if test="./*[local-name() = 'institutionType'] = 'non-profit'">
202
                                                    <FIELD name="ec_nonprofit" type="boolean">true</FIELD>
203
                                                </xsl:if>
204
                                                <FIELD name="collectedfrom">
205
                                                    <xsl:value-of select="$varDataSourceId"/>
206
                                                </FIELD>
207
                                                <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
208
                                            </ROW>
209

    
210
                                            <ROW table="dsm_datasource_organization">
211
                                                <FIELD name="_dnet_resource_identifier_">
212
                                                    <xsl:value-of select="concat($dsId, '@@', $orgId)"/>
213
                                                </FIELD>
214
                                                <FIELD name="datasource">
215
                                                    <xsl:value-of select="$dsId"/>
216
                                                </FIELD>
217
                                                <FIELD name="organization">
218
                                                    <xsl:value-of select="$orgId"/>
219
                                                </FIELD>
220
                                            </ROW>
221
                                            <xsl:for-each select="//*[local-name() = 'institutionIdentifier']">
222
                                                <xsl:if test="starts-with(./text(), 'ROR') or starts-with(./text(), 'RRID') or starts-with(./text(), 'VIAF')">
223
                                                    <ROW table="dsm_identities">
224
                                                        <FIELD name="_dnet_resource_identifier_">
225
                                                            <xsl:value-of
226
                                                                    select="concat(./text(), '@@', substring-before(./text(), ':'))"/>
227
                                                        </FIELD>
228
                                                        <FIELD name="pid">
229
                                                            <xsl:value-of select="./text()"/>
230
                                                        </FIELD>
231
                                                        <FIELD name="issuertype">
232
                                                            <xsl:value-of select="substring-before(./text(), ':')"/>
233
                                                        </FIELD>
234
                                                    </ROW>
235
                                                    <ROW table="dsm_organizationpids">
236
                                                        <FIELD name="_dnet_resource_identifier_">
237
                                                            <xsl:value-of select="concat(./text(), '@@', $orgId)"/>
238
                                                        </FIELD>
239
                                                        <FIELD name="pid">
240
                                                            <xsl:value-of select="./text()"/>
241
                                                        </FIELD>
242
                                                        <FIELD name="organization">
243
                                                            <xsl:value-of select="$orgId"/>
244
                                                        </FIELD>
245
                                                    </ROW>
246
                                                </xsl:if>
247
                                            </xsl:for-each>
248
                                        </xsl:for-each>
249

    
250
                                    </ROWS>
251
                                </metadata>
252
                            </record>
253
                        </xsl:template>
254
                    </xsl:stylesheet>
255

    
256
                </CODE>
257
            </SCRIPT>
258
        </CONFIGURATION>
259
        <STATUS/>
260
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
261
    </BODY>
262
</RESOURCE_PROFILE>
(7-7/8)