Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="a2611b61-3748-4917-9397-3426b5174d8d_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2018-11-02T12:28:21+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>OPENDOAR 2 DB REST</TITLE>
14
                <CODE><![CDATA[
15

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

    
19
	<xsl:param name="varDataSourceId"/>
20
	<xsl:variable name="namespacePrefix" select="string('opendoar____')"/>
21

    
22
	<xsl:template match="/">
23
		<record>
24

    
25
			<xsl:copy-of select=".//*[local-name()='header']"/>
26
			<metadata>
27
				<xsl:variable name="rid" select="normalize-space(//items/system_metadata/id)"/>
28
				<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/>
29
				<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
30
				<xsl:variable name="oUrl" select="normalize-space(//organisation/url)"/>
31
				<xsl:variable name="oName" select="normalize-space(//organisation/name/name)"/>
32
				<xsl:variable name="organizationId" select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')"/>
33
				<xsl:variable name="repositoryType">
34
					<xsl:choose>
35
						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'institutional'">
36
							<xsl:value-of select="string('pubsrepository::institutional')"/>
37
						</xsl:when>
38
						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'governmental'">
39
							<xsl:value-of select="string('pubsrepository::institutional')"/>
40
						</xsl:when>
41
						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'disciplinary'">
42
							<xsl:value-of select="string('pubsrepository::thematic')"/>
43
						</xsl:when>
44
						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'aggregating'">
45
							<xsl:choose>
46
								<xsl:when test="lower-case(normalize-space(//repository_metadata/content_types)) = 'journal_articles'">
47
									<xsl:value-of select="string('aggregator::pubsrepository::journals')"/>
48
								</xsl:when>
49
								<xsl:otherwise>
50
									<xsl:value-of select="string('aggregator::pubsrepository::unknown')"/>
51
								</xsl:otherwise>
52
							</xsl:choose>
53
						</xsl:when>
54
						<xsl:otherwise>
55
							<xsl:value-of select="string('pubsrepository::unknown')"/>
56
						</xsl:otherwise>
57
					</xsl:choose>
58
				</xsl:variable>
59

    
60
				<xsl:variable name="contenttypes">
61
					<xsl:for-each select=".//content_types">
62
						<xsl:if test="position() &gt; 1"> - </xsl:if>
63
						<xsl:value-of select="."/>
64
					</xsl:for-each>
65
				</xsl:variable>
66
				<xsl:variable name="languages">
67
					<xsl:for-each select=".//content_languages">
68
						<xsl:if test="position() &gt; 1">, </xsl:if>
69
						<xsl:value-of select="."/>
70
					</xsl:for-each>
71
				</xsl:variable>
72

    
73
				<xsl:variable name="subjects">
74
					<xsl:for-each select=".//content_subjects/label">
75
						<xsl:if test="position() &gt; 1"> @@ </xsl:if>
76
						<xsl:value-of select="."/>
77
					</xsl:for-each>
78
				</xsl:variable>
79

    
80
				<ROWS>
81
					<ROW table="dsm_datasources">
82
						<FIELD name="_dnet_resource_identifier_">
83
							<xsl:value-of select="$datasourceId"/>
84
						</FIELD>
85
						<FIELD name="id">
86
							<xsl:value-of select="$datasourceId"/>
87
						</FIELD>
88
						<FIELD name="officialname">
89
						<xsl:choose>
90
                                <xsl:when test="//repository_metadata/name/name">
91
                                    <xsl:value-of
92
                                        select="normalize-space(//repository_metadata/name/name)"/>
93
                                </xsl:when>
94
                                <xsl:otherwise>
95
                                    <xsl:value-of
96
                                        select="normalize-space(//repository_metadata/name/acronym)"/>
97
                                </xsl:otherwise>
98
                            </xsl:choose>
99
						</FIELD>
100
						<FIELD name="englishname">
101
							<xsl:choose>
102
                                <xsl:when test="//repository_metadata/name/acronym">
103
                                    <xsl:value-of
104
                                        select="normalize-space(//repository_metadata/name/acronym)"/>
105
                                </xsl:when>
106
                                <xsl:otherwise>
107
                                    <xsl:value-of
108
                                        select="normalize-space(//repository_metadata/name/name)"/>
109
                                </xsl:otherwise>
110
                            </xsl:choose>
111
						</FIELD>
112
						<FIELD name="websiteurl">
113
							<xsl:value-of select="normalize-space(//repository_metadata/url)"/>
114
						</FIELD>
115
						<FIELD name="contactemail">
116
							<xsl:value-of select="normalize-space(//pEmail)"/>
117
						</FIELD>
118
                        <xsl:if test="not(normalize-space(//organisation/location/latitude) = 'null')">
119
                            <FIELD name="latitude" type="float">
120
                              <xsl:value-of select="normalize-space(//organisation/location/latitude)"/>
121
                            </FIELD>
122
                        </xsl:if>
123
                        <xsl:if test="normalize-space(//organisation/location/latitude) = 'null'">
124
							<FIELD name="latitude" type="float"/>
125
                        </xsl:if>
126
                        <xsl:if test="not(normalize-space(//organisation/location/longitude) = 'null')">
127
                              <FIELD name="longitude" type="float">
128
                                <xsl:value-of select="normalize-space(//organisation/location/longitude)"/>
129
                              </FIELD>
130
                        </xsl:if>
131
                        <xsl:if test="normalize-space(//organisation/location/longitude) = 'null'">
132
							<FIELD name="longitude" type="float"/>
133
                        </xsl:if>
134
						<FIELD name="namespaceprefix">
135
							<xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/>
136
						</FIELD>
137
						<FIELD name="languages">
138
							<xsl:value-of select="normalize-space($languages)"/>
139
						</FIELD>
140
						<FIELD name="od_contenttypes">
141
							<xsl:value-of select="normalize-space($contenttypes)"/>
142
						</FIELD>
143
						<FIELD name="collectedfrom">
144
							<xsl:value-of select="$varDataSourceId"/>
145
						</FIELD>
146
						<FIELD name="typology">
147
							<xsl:value-of select="$repositoryType"/>
148
						</FIELD>
149
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
150
						<FIELD name="platform">
151
							<xsl:value-of select="normalize-space(//repository_metadata/software/name)"/>
152
						</FIELD>
153
						<FIELD name="description">
154
							<xsl:value-of select="normalize-space(//repository_metadata/description)"/>
155
						</FIELD>
156

    
157
						<FIELD name="subjects">
158
							<xsl:value-of select="normalize-space($subjects)"/>
159
						</FIELD>
160
						<xsl:if test="//policies/preservation_policy/version_control/policy[./text() = 'updated_versions_allowed']">
161
						    <FIELD name="versioning" type="boolean">true</FIELD>
162
						</xsl:if>
163
					</ROW>
164

    
165
					<ROW table="dsm_api">
166
						<FIELD name="_dnet_resource_identifier_">
167
							<xsl:value-of select="$apiId"/>
168
						</FIELD>
169
						<FIELD name="id">
170
							<xsl:value-of select="$apiId"/>
171
						</FIELD>
172
						<FIELD name="protocol">oai</FIELD>
173
						<FIELD name="datasource">
174
							<xsl:value-of select="$datasourceId"/>
175
						</FIELD>
176
						<FIELD name="contentdescription">metadata</FIELD>
177
						<FIELD name="typology">
178
							<xsl:value-of select="$repositoryType"/>
179
						</FIELD>
180
						<FIELD name="baseurl">
181
							<xsl:value-of select="normalize-space(//repository_metadata/oai_url)"/>
182
						</FIELD>
183
						<FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
184
					</ROW>
185

    
186
					<ROW table="dsm_apiparams">
187
						<FIELD name="_dnet_resource_identifier_">
188
							<xsl:value-of select="concat($apiId, '@@format')"/>
189
						</FIELD>
190
						<FIELD name="api">
191
							<xsl:value-of select="$apiId"/>
192
						</FIELD>
193
						<FIELD name="param">format</FIELD>
194
						<FIELD name="value">oai_dc</FIELD>
195
					</ROW>
196

    
197
					<ROW table="dsm_organizations">
198
						<FIELD name="_dnet_resource_identifier_">
199
							<xsl:value-of select="$organizationId"/>
200
						</FIELD>
201
						<FIELD name="id">
202
							<xsl:value-of select="$organizationId"/>
203
						</FIELD>
204
						<FIELD name="legalname">
205
							<xsl:value-of select="$oName"/>
206
						</FIELD>
207
						<FIELD name="legalshortname">
208
							<xsl:value-of select="normalize-space(//organisation/name/acronym)"/>
209
						</FIELD>
210
						<FIELD name="websiteurl">
211
							<xsl:choose>
212
								<xsl:when test="starts-with(normalize-space($oUrl), 'http')">
213
									<xsl:value-of select="normalize-space($oUrl)"/>
214
								</xsl:when>
215
								<xsl:when test="string-length(normalize-space($oUrl)) &gt; 0">
216
									<xsl:value-of select="concat('http://', normalize-space($oUrl))"/>
217
								</xsl:when>
218
							</xsl:choose>
219
						</FIELD>
220

    
221
						<FIELD name="country">
222
							<xsl:choose>
223
								<xsl:when test="normalize-space(//organisation/country) = 'UK'">GB</xsl:when>
224
								<xsl:otherwise>
225
	                                <xsl:value-of select="normalize-space(//organisation/country)"/>
226
								</xsl:otherwise>
227
							</xsl:choose>
228
						</FIELD>
229

    
230
						<FIELD name="collectedfrom">
231
							<xsl:value-of select="$varDataSourceId"/>
232
						</FIELD>
233
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
234
					</ROW>
235

    
236
					<ROW table="dsm_datasource_organization">
237
						<FIELD name="_dnet_resource_identifier_">
238
							<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
239
						</FIELD>
240
						<FIELD name="datasource">
241
							<xsl:value-of select="$datasourceId"/>
242
						</FIELD>
243
						<FIELD name="organization">
244
							<xsl:value-of select="$organizationId"/>
245
						</FIELD>
246
					</ROW>
247

    
248
				</ROWS>
249
			</metadata>
250
		</record>
251
	</xsl:template>
252

    
253
</xsl:stylesheet>
254

    
255

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