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>
|
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:value-of select="normalize-space(//repository_metadata/name/name)"/>
|
90
|
</FIELD>
|
91
|
<FIELD name="englishname">
|
92
|
<xsl:value-of select="normalize-space(//repository_metadata/acronym)"/>
|
93
|
</FIELD>
|
94
|
<FIELD name="websiteurl">
|
95
|
<xsl:value-of select="normalize-space(//repository_metadata/url)"/>
|
96
|
</FIELD>
|
97
|
<FIELD name="contactemail">
|
98
|
<xsl:value-of select="normalize-space(//pEmail)"/>
|
99
|
</FIELD>
|
100
|
<xsl:if test="not(normalize-space(//organisation/location/latitude) = 'null')">
|
101
|
<FIELD name="latitude" type="float">
|
102
|
<xsl:value-of select="normalize-space(//organisation/location/latitude)"/>
|
103
|
</FIELD>
|
104
|
</xsl:if>
|
105
|
<xsl:if test="normalize-space(//organisation/location/latitude) = 'null'">
|
106
|
<FIELD name="latitude" type="float"/>
|
107
|
</xsl:if>
|
108
|
<xsl:if test="not(normalize-space(//organisation/location/longitude) = 'null')">
|
109
|
<FIELD name="longitude" type="float">
|
110
|
<xsl:value-of select="normalize-space(//organisation/location/longitude)"/>
|
111
|
</FIELD>
|
112
|
</xsl:if>
|
113
|
<xsl:if test="normalize-space(//organisation/location/longitude) = 'null'">
|
114
|
<FIELD name="longitude" type="float"/>
|
115
|
</xsl:if>
|
116
|
<FIELD name="namespaceprefix">
|
117
|
<xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/>
|
118
|
</FIELD>
|
119
|
<FIELD name="languages">
|
120
|
<xsl:value-of select="normalize-space($languages)"/>
|
121
|
</FIELD>
|
122
|
<FIELD name="od_contenttypes">
|
123
|
<xsl:value-of select="normalize-space($contenttypes)"/>
|
124
|
</FIELD>
|
125
|
<FIELD name="collectedfrom">
|
126
|
<xsl:value-of select="$varDataSourceId"/>
|
127
|
</FIELD>
|
128
|
<FIELD name="typology">
|
129
|
<xsl:value-of select="$repositoryType"/>
|
130
|
</FIELD>
|
131
|
<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
|
132
|
<FIELD name="platform">
|
133
|
<xsl:value-of select="normalize-space(//repository_metadata/software/name)"/>
|
134
|
</FIELD>
|
135
|
<FIELD name="description">
|
136
|
<xsl:value-of select="normalize-space(//repository_metadata/description)"/>
|
137
|
</FIELD>
|
138
|
|
139
|
<FIELD name="subjects">
|
140
|
<xsl:value-of select="normalize-space($subjects)"/>
|
141
|
</FIELD>
|
142
|
</ROW>
|
143
|
|
144
|
<ROW table="dsm_api">
|
145
|
<FIELD name="_dnet_resource_identifier_">
|
146
|
<xsl:value-of select="$apiId"/>
|
147
|
</FIELD>
|
148
|
<FIELD name="id">
|
149
|
<xsl:value-of select="$apiId"/>
|
150
|
</FIELD>
|
151
|
<FIELD name="protocol">oai</FIELD>
|
152
|
<FIELD name="datasource">
|
153
|
<xsl:value-of select="$datasourceId"/>
|
154
|
</FIELD>
|
155
|
<FIELD name="contentdescription">metadata</FIELD>
|
156
|
<FIELD name="typology">
|
157
|
<xsl:value-of select="$repositoryType"/>
|
158
|
</FIELD>
|
159
|
<FIELD name="baseurl">
|
160
|
<xsl:value-of select="normalize-space(//repository_metadata/oai_url)"/>
|
161
|
</FIELD>
|
162
|
<FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
|
163
|
</ROW>
|
164
|
|
165
|
<ROW table="dsm_apiparams">
|
166
|
<FIELD name="_dnet_resource_identifier_">
|
167
|
<xsl:value-of select="concat($apiId, '@@format')"/>
|
168
|
</FIELD>
|
169
|
<FIELD name="api">
|
170
|
<xsl:value-of select="$apiId"/>
|
171
|
</FIELD>
|
172
|
<FIELD name="param">format</FIELD>
|
173
|
<FIELD name="value">oai_dc</FIELD>
|
174
|
</ROW>
|
175
|
|
176
|
<ROW table="dsm_organizations">
|
177
|
<FIELD name="_dnet_resource_identifier_">
|
178
|
<xsl:value-of select="$organizationId"/>
|
179
|
</FIELD>
|
180
|
<FIELD name="id">
|
181
|
<xsl:value-of select="$organizationId"/>
|
182
|
</FIELD>
|
183
|
<FIELD name="legalname">
|
184
|
<xsl:value-of select="$oName"/>
|
185
|
</FIELD>
|
186
|
<FIELD name="legalshortname">
|
187
|
<xsl:value-of select="normalize-space(//organisation/name/acronym)"/>
|
188
|
</FIELD>
|
189
|
<FIELD name="websiteurl">
|
190
|
<xsl:choose>
|
191
|
<xsl:when test="starts-with(normalize-space($oUrl), 'http')">
|
192
|
<xsl:value-of select="normalize-space($oUrl)"/>
|
193
|
</xsl:when>
|
194
|
<xsl:when test="string-length(normalize-space($oUrl)) &gt; 0">
|
195
|
<xsl:value-of select="concat('http://', normalize-space($oUrl))"/>
|
196
|
</xsl:when>
|
197
|
</xsl:choose>
|
198
|
</FIELD>
|
199
|
|
200
|
<FIELD name="country">
|
201
|
<xsl:choose>
|
202
|
<xsl:when test="normalize-space(//organisation/country) = 'UK'">GB</xsl:when>
|
203
|
<xsl:otherwise>
|
204
|
<xsl:value-of select="normalize-space(//organisation/country)"/>
|
205
|
</xsl:otherwise>
|
206
|
</xsl:choose>
|
207
|
</FIELD>
|
208
|
|
209
|
<FIELD name="collectedfrom">
|
210
|
<xsl:value-of select="$varDataSourceId"/>
|
211
|
</FIELD>
|
212
|
<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
|
213
|
</ROW>
|
214
|
|
215
|
<ROW table="dsm_datasource_organization">
|
216
|
<FIELD name="_dnet_resource_identifier_">
|
217
|
<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
|
218
|
</FIELD>
|
219
|
<FIELD name="datasource">
|
220
|
<xsl:value-of select="$datasourceId"/>
|
221
|
</FIELD>
|
222
|
<FIELD name="organization">
|
223
|
<xsl:value-of select="$organizationId"/>
|
224
|
</FIELD>
|
225
|
</ROW>
|
226
|
|
227
|
</ROWS>
|
228
|
</metadata>
|
229
|
</record>
|
230
|
</xsl:template>
|
231
|
|
232
|
</xsl:stylesheet>
|
233
|
|
234
|
|
235
|
</CODE>
|
236
|
</SCRIPT>
|
237
|
</CONFIGURATION>
|
238
|
<STATUS/>
|
239
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
240
|
</BODY>
|
241
|
</RESOURCE_PROFILE>
|