1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="2b85d042-815d-4058-9374-7c64d099d46c_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2019-03-18T17:59:33+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>RE3DATA FIX ORGS</TITLE>
|
14
|
<CODE>
|
15
|
|
16
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
17
|
xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="2.0">
|
18
|
|
19
|
<xsl:param name="varDataSourceId"/>
|
20
|
<xsl:variable name="namespacePrefix" select="string('re3data_____')"/>
|
21
|
|
22
|
<xsl:variable name="dsId"
|
23
|
select="concat($namespacePrefix, '::', normalize-space(.//*[local-name() = 're3data.orgIdentifier']))"/>
|
24
|
<xsl:variable name="subjects">
|
25
|
<xsl:for-each select="//*[local-name() = 'subject']">
|
26
|
<xsl:if test="position() > 1"> @@ </xsl:if>
|
27
|
<xsl:value-of select="substring-after(., ' ')"/>
|
28
|
</xsl:for-each>
|
29
|
</xsl:variable>
|
30
|
|
31
|
<xsl:template match="/">
|
32
|
<record>
|
33
|
|
34
|
<xsl:copy-of select=".//*[local-name() = 'header']"/>
|
35
|
<metadata>
|
36
|
<ROWS>
|
37
|
<xsl:for-each select="//*[local-name() = 'institution']">
|
38
|
<xsl:variable name="orgId"
|
39
|
select="concat($namespacePrefix, '::', dnet:md5(concat(normalize-space(./*[local-name() = 'institutionName']), '_', normalize-space(./*[local-name() = 'institutionCountry']))))"/>
|
40
|
<ROW table="dsm_organizations">
|
41
|
<FIELD name="_dnet_resource_identifier_">
|
42
|
<xsl:value-of select="$orgId"/>
|
43
|
</FIELD>
|
44
|
<FIELD name="id">
|
45
|
<xsl:value-of select="$orgId"/>
|
46
|
</FIELD>
|
47
|
<FIELD name="legalname">
|
48
|
<xsl:value-of select="./*[local-name() = 'institutionName']"/>
|
49
|
</FIELD>
|
50
|
<xsl:variable name="orgShortname">
|
51
|
<xsl:value-of
|
52
|
select="./*[local-name() = 'institutionAdditionalName'][1]"/>
|
53
|
</xsl:variable>
|
54
|
<xsl:if test="upper-case($orgShortname) = $orgShortname">
|
55
|
<FIELD name="legalshortname">
|
56
|
<xsl:value-of select="$orgShortname"/>
|
57
|
</FIELD>
|
58
|
</xsl:if>
|
59
|
<FIELD name="websiteurl">
|
60
|
<xsl:choose>
|
61
|
<xsl:when
|
62
|
test="starts-with(normalize-space(./*[local-name() = 'institutionURL']), 'http')">
|
63
|
<xsl:value-of select="./*[local-name() = 'institutionURL']"
|
64
|
/>
|
65
|
</xsl:when>
|
66
|
<xsl:when
|
67
|
test="string-length(normalize-space(./*[local-name() = 'institutionURL'])) > 0">
|
68
|
<xsl:value-of
|
69
|
select="concat('http://', normalize-space(./*[local-name() = 'institutionURL']))"
|
70
|
/>
|
71
|
</xsl:when>
|
72
|
</xsl:choose>
|
73
|
</FIELD>
|
74
|
<FIELD name="country">
|
75
|
<xsl:value-of select="./*[local-name() = 'institutionCountry']"/>
|
76
|
</FIELD>
|
77
|
<xsl:if test="./*[local-name() = 'institutionType'] = 'non-profit'">
|
78
|
<FIELD name="ec_nonprofit" type="boolean">true</FIELD>
|
79
|
</xsl:if>
|
80
|
<FIELD name="collectedfrom">
|
81
|
<xsl:value-of select="$varDataSourceId"/>
|
82
|
</FIELD>
|
83
|
<FIELD name="provenanceaction"
|
84
|
>sysimport:crosswalk:entityregistry</FIELD>
|
85
|
</ROW>
|
86
|
|
87
|
<ROW table="dsm_datasource_organization">
|
88
|
<FIELD name="_dnet_resource_identifier_">
|
89
|
<xsl:value-of select="concat($dsId, '@@', $orgId)"/>
|
90
|
</FIELD>
|
91
|
<FIELD name="datasource">
|
92
|
<xsl:value-of select="$dsId"/>
|
93
|
</FIELD>
|
94
|
<FIELD name="organization">
|
95
|
<xsl:value-of select="$orgId"/>
|
96
|
</FIELD>
|
97
|
</ROW>
|
98
|
<xsl:for-each select="//*[local-name() = 'institutionIdentifier']">
|
99
|
<xsl:if test="starts-with(./text(), 'ROR') or starts-with(./text(), 'RRID') or starts-with(./text(), 'VIAF')">
|
100
|
<ROW table="dsm_identities">
|
101
|
<FIELD name="_dnet_resource_identifier_">
|
102
|
<xsl:value-of select="concat(./text(), '@@', substring-before(./text(), ':'))"/>
|
103
|
</FIELD>
|
104
|
<FIELD name="pid">
|
105
|
<xsl:value-of select="./text()"/>
|
106
|
</FIELD>
|
107
|
<FIELD name="issuertype">
|
108
|
<xsl:value-of select="substring-before(./text(), ':')"/>
|
109
|
</FIELD>
|
110
|
</ROW>
|
111
|
<ROW table="dsm_organizationpids">
|
112
|
<FIELD name="_dnet_resource_identifier_">
|
113
|
<xsl:value-of select="concat(./text(), '@@', $orgId)"/>
|
114
|
</FIELD>
|
115
|
<FIELD name="pid">
|
116
|
<xsl:value-of select="./text()"/>
|
117
|
</FIELD>
|
118
|
<FIELD name="organization">
|
119
|
<xsl:value-of select="$orgId"/>
|
120
|
</FIELD>
|
121
|
</ROW>
|
122
|
</xsl:if>
|
123
|
</xsl:for-each>
|
124
|
</xsl:for-each>
|
125
|
|
126
|
</ROWS>
|
127
|
</metadata>
|
128
|
</record>
|
129
|
</xsl:template>
|
130
|
</xsl:stylesheet>
|
131
|
|
132
|
</CODE>
|
133
|
</SCRIPT>
|
134
|
</CONFIGURATION>
|
135
|
<STATUS/>
|
136
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
137
|
</BODY>
|
138
|
</RESOURCE_PROFILE>
|