Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="5b194596-4f55-4df2-989a-27b50232ddf6_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2018-07-02T11:15:30+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>OPENDOAR 2 DB</TITLE>
14
				<CODE>
15
					<![CDATA[
16
					<?xml version="1.0" encoding="UTF-8"?>
17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
                xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="1.0">
19

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

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

    
26
			<xsl:copy-of select=".//*[local-name()='header']"/>
27
			<metadata>
28
				<xsl:variable name="rid" select="normalize-space(//repository/@rID)"/>
29
				<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/>
30
				<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
31
				<xsl:variable name="oUrl" select="normalize-space(//oUrl)"/>
32
				<xsl:variable name="oName" select="normalize-space(//oName)"/>
33
				<xsl:variable name="organizationId" select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')"/>
34
				<xsl:variable name="repositoryType">
35
					<xsl:choose>
36
						<xsl:when test="normalize-space(//repositoryType) = 'Institutional'">
37
							<xsl:value-of select="string('pubsrepository::institutional')"/>
38
						</xsl:when>
39
						<xsl:when test="normalize-space(//repositoryType) = 'Disciplinary'">
40
							<xsl:value-of select="string('pubsrepository::thematic')"/>
41
						</xsl:when>
42
						<xsl:when test="normalize-space(//repositoryType) = 'Aggregating'">
43
							<xsl:value-of select="string('aggregator::pubsrepository::unknown')"/>
44
						</xsl:when>
45
						<xsl:otherwise>
46
							<xsl:value-of select="string('pubsrepository::unknown')"/>
47
						</xsl:otherwise>
48
					</xsl:choose>
49
				</xsl:variable>
50

    
51
				<xsl:variable name="contenttypes">
52
					<xsl:for-each select=".//contentType">
53
						<xsl:if test="position() &gt; 1"> - </xsl:if>
54
						<xsl:value-of select="."/>
55
					</xsl:for-each>
56
				</xsl:variable>
57
				<xsl:variable name="languages">
58
					<xsl:for-each select=".//lName">
59
						<xsl:if test="position() &gt; 1">, </xsl:if>
60
						<xsl:value-of select="."/>
61
					</xsl:for-each>
62
				</xsl:variable>
63

    
64
				<xsl:variable name="subjects">
65
					<xsl:for-each select=".//clTitle">
66
						<xsl:if test="position() &gt; 1"> @@ </xsl:if>
67
						<xsl:value-of select="."/>
68
					</xsl:for-each>
69
				</xsl:variable>
70

    
71
				<ROWS>
72
					<ROW table="dsm_datasources">
73
						<FIELD name="_dnet_resource_identifier_">
74
							<xsl:value-of select="$datasourceId"/>
75
						</FIELD>
76
						<FIELD name="id">
77
							<xsl:value-of select="$datasourceId"/>
78
						</FIELD>
79
						<FIELD name="officialname">
80
							<xsl:value-of select="normalize-space(//rName)"/>
81
						</FIELD>
82
						<FIELD name="englishname">
83
							<xsl:value-of select="normalize-space(//rAcronym)"/>
84
						</FIELD>
85
						<FIELD name="websiteurl">
86
							<xsl:value-of select="normalize-space(//rUrl)"/>
87
						</FIELD>
88
						<FIELD name="contactemail">
89
							<xsl:value-of select="normalize-space(//pEmail)"/>
90
						</FIELD>
91
						<FIELD name="latitude" type="float">
92
							<xsl:value-of select="normalize-space(//paLatitude)"/>
93
						</FIELD>
94
						<FIELD name="longitude" type="float">
95
							<xsl:value-of select="normalize-space(//paLongitude)"/>
96
						</FIELD>
97
						<FIELD name="namespaceprefix">
98
							<xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/>
99
						</FIELD>
100
						<FIELD name="languages">
101
							<xsl:value-of select="normalize-space($languages)"/>
102
						</FIELD>
103
						<FIELD name="od_contenttypes">
104
							<xsl:value-of select="normalize-space($contenttypes)"/>
105
						</FIELD>
106
						<FIELD name="collectedfrom">
107
							<xsl:value-of select="$varDataSourceId"/>
108
						</FIELD>
109
						<FIELD name="typology">
110
							<xsl:value-of select="$repositoryType"/>
111
						</FIELD>
112
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
113
						<FIELD name="platform">
114
							<xsl:value-of select="normalize-space(//rSoftWareName)"/>
115
						</FIELD>
116
						<FIELD name="description">
117
							<xsl:value-of select="normalize-space(//rDescription)"/>
118
						</FIELD>
119

    
120
						<FIELD name="subjects">
121
							<xsl:value-of select="normalize-space($subjects)"/>
122
						</FIELD>
123
					</ROW>
124

    
125
					<ROW table="dsm_api">
126
						<FIELD name="_dnet_resource_identifier_">
127
							<xsl:value-of select="$apiId"/>
128
						</FIELD>
129
						<FIELD name="id">
130
							<xsl:value-of select="$apiId"/>
131
						</FIELD>
132
						<FIELD name="protocol">oai</FIELD>
133
						<FIELD name="datasource">
134
							<xsl:value-of select="$datasourceId"/>
135
						</FIELD>
136
						<FIELD name="contentdescription">metadata</FIELD>
137
						<FIELD name="typology">
138
							<xsl:value-of select="$repositoryType"/>
139
						</FIELD>
140
						<FIELD name="baseurl">
141
							<xsl:value-of select="normalize-space(//rOaiBaseUrl)"/>
142
						</FIELD>
143
						<FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
144
					</ROW>
145

    
146
					<ROW table="dsm_apiparams">
147
						<FIELD name="_dnet_resource_identifier_">
148
							<xsl:value-of select="concat($apiId, '@@format')"/>
149
						</FIELD>
150
						<FIELD name="api">
151
							<xsl:value-of select="$apiId"/>
152
						</FIELD>
153
						<FIELD name="param">format</FIELD>
154
						<FIELD name="value">oai_dc</FIELD>
155
					</ROW>
156

    
157
					<ROW table="dsm_organizations">
158
						<FIELD name="_dnet_resource_identifier_">
159
							<xsl:value-of select="$organizationId"/>
160
						</FIELD>
161
						<FIELD name="id">
162
							<xsl:value-of select="$organizationId"/>
163
						</FIELD>
164
						<FIELD name="legalname">
165
							<xsl:value-of select="$oName"/>
166
						</FIELD>
167
						<FIELD name="legalshortname">
168
							<xsl:value-of select="normalize-space(//oAcronym)"/>
169
						</FIELD>
170
						<FIELD name="websiteurl">
171
							<xsl:choose>
172
								<xsl:when test="starts-with(normalize-space($oUrl), 'http')">
173
									<xsl:value-of select="normalize-space($oUrl)"/>
174
								</xsl:when>
175
								<xsl:when test="string-length(normalize-space($oUrl)) &gt; 0">
176
									<xsl:value-of select="concat('http://', normalize-space($oUrl))"/>
177
								</xsl:when>
178
							</xsl:choose>
179
						</FIELD>
180

    
181
						<FIELD name="country">
182
							<xsl:choose>
183
								<xsl:when test="normalize-space(//cIsoCode) = 'GB'">UK</xsl:when>
184
								<xsl:otherwise>
185
									<xsl:value-of select="normalize-space(//cIsoCode)"></xsl:value-of>
186
								</xsl:otherwise>
187
							</xsl:choose>
188
						</FIELD>
189

    
190
						<FIELD name="collectedfrom">
191
							<xsl:value-of select="$varDataSourceId"/>
192
						</FIELD>
193
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
194
					</ROW>
195

    
196
					<ROW table="dsm_datasource_organization">
197
						<FIELD name="_dnet_resource_identifier_">
198
							<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
199
						</FIELD>
200
						<FIELD name="datasource">
201
							<xsl:value-of select="$datasourceId"/>
202
						</FIELD>
203
						<FIELD name="organization">
204
							<xsl:value-of select="$organizationId"/>
205
						</FIELD>
206
					</ROW>
207

    
208
				</ROWS>
209
			</metadata>
210
		</record>
211
	</xsl:template>
212

    
213
</xsl:stylesheet>
214

    
215
					]]>
216
				</CODE>
217
			</SCRIPT>
218
		</CONFIGURATION>
219
		<STATUS/>
220
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
221
	</BODY>
222
</RESOURCE_PROFILE>
(5-5/6)