Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER
4
                value="2b85d042-815d-4058-9374-7c64d099d46c_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 FIX ORGS</TITLE>
15
                <CODE>
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">sysimport:crosswalk:entityregistry
84
                                                </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
103
                                                                    select="concat(./text(), '@@', substring-before(./text(), ':'))"/>
104
                                                        </FIELD>
105
                                                        <FIELD name="pid">
106
                                                            <xsl:value-of select="./text()"/>
107
                                                        </FIELD>
108
                                                        <FIELD name="issuertype">
109
                                                            <xsl:value-of select="substring-before(./text(), ':')"/>
110
                                                        </FIELD>
111
                                                    </ROW>
112
                                                    <ROW table="dsm_organizationpids">
113
                                                        <FIELD name="_dnet_resource_identifier_">
114
                                                            <xsl:value-of select="concat(./text(), '@@', $orgId)"/>
115
                                                        </FIELD>
116
                                                        <FIELD name="pid">
117
                                                            <xsl:value-of select="./text()"/>
118
                                                        </FIELD>
119
                                                        <FIELD name="organization">
120
                                                            <xsl:value-of select="$orgId"/>
121
                                                        </FIELD>
122
                                                    </ROW>
123
                                                </xsl:if>
124
                                            </xsl:for-each>
125
                                        </xsl:for-each>
126

    
127
                                    </ROWS>
128
                                </metadata>
129
                            </record>
130
                        </xsl:template>
131
                    </xsl:stylesheet>
132
                </CODE>
133
            </SCRIPT>
134
        </CONFIGURATION>
135
        <STATUS/>
136
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
137
    </BODY>
138
</RESOURCE_PROFILE>
(8-8/8)