dnet45/modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/datasources/opendoar2dbrest.xml @ 59662
1 |
<RESOURCE_PROFILE>
|
---|---|
2 |
<HEADER>
|
3 |
<RESOURCE_IDENTIFIER
|
4 |
value="a2611b61-3748-4917-9397-3426b5174d8d_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
5 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
6 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
7 |
<RESOURCE_URI value=""/> |
8 |
<DATE_OF_CREATION value="2019-11-11T10:35:54+00:00"/> |
9 |
</HEADER>
|
10 |
<BODY>
|
11 |
<CONFIGURATION>
|
12 |
<IMPORTED/>
|
13 |
<SCRIPT>
|
14 |
<TITLE>OPENDOAR 2 DB REST</TITLE> |
15 |
<CODE>
|
16 |
|
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(//items/system_metadata/id)"/> |
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(//organisation/url)"/> |
32 |
<xsl:variable name="oName" select="normalize-space(//organisation/name/name)"/> |
33 |
<xsl:variable name="organizationId" |
34 |
select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')"/> |
35 |
<xsl:variable name="repositoryType"> |
36 |
<xsl:choose>
|
37 |
<xsl:when
|
38 |
test="lower-case(normalize-space(//repository_metadata/type)) = 'institutional'"> |
39 |
<xsl:value-of select="string('pubsrepository::institutional')"/> |
40 |
</xsl:when>
|
41 |
<xsl:when
|
42 |
test="lower-case(normalize-space(//repository_metadata/type)) = 'governmental'"> |
43 |
<xsl:value-of select="string('pubsrepository::institutional')"/> |
44 |
</xsl:when>
|
45 |
<xsl:when
|
46 |
test="lower-case(normalize-space(//repository_metadata/type)) = 'disciplinary'"> |
47 |
<xsl:value-of select="string('pubsrepository::thematic')"/> |
48 |
</xsl:when>
|
49 |
<xsl:when
|
50 |
test="lower-case(normalize-space(//repository_metadata/type)) = 'aggregating'"> |
51 |
<xsl:choose>
|
52 |
<xsl:when
|
53 |
test="lower-case(normalize-space(//repository_metadata/content_types)) = 'journal_articles'"> |
54 |
<xsl:value-of
|
55 |
select="string('aggregator::pubsrepository::journals')"/> |
56 |
</xsl:when>
|
57 |
<xsl:otherwise>
|
58 |
<xsl:value-of
|
59 |
select="string('aggregator::pubsrepository::unknown')"/> |
60 |
</xsl:otherwise>
|
61 |
</xsl:choose>
|
62 |
</xsl:when>
|
63 |
<xsl:otherwise>
|
64 |
<xsl:value-of select="string('pubsrepository::unknown')"/> |
65 |
</xsl:otherwise>
|
66 |
</xsl:choose>
|
67 |
</xsl:variable>
|
68 |
|
69 |
<xsl:variable name="contenttypes"> |
70 |
<xsl:for-each select=".//content_types"> |
71 |
<xsl:if test="position() &gt; 1">-</xsl:if> |
72 |
<xsl:value-of select="."/> |
73 |
</xsl:for-each>
|
74 |
</xsl:variable>
|
75 |
<xsl:variable name="languages"> |
76 |
<xsl:for-each select=".//content_languages"> |
77 |
<xsl:if test="position() &gt; 1">,</xsl:if> |
78 |
<xsl:value-of select="."/> |
79 |
</xsl:for-each>
|
80 |
</xsl:variable>
|
81 |
|
82 |
<xsl:variable name="subjects"> |
83 |
<xsl:for-each select=".//content_subjects/label"> |
84 |
<xsl:if test="position() &gt; 1">@@</xsl:if> |
85 |
<xsl:value-of select="."/> |
86 |
</xsl:for-each>
|
87 |
</xsl:variable>
|
88 |
|
89 |
<ROWS>
|
90 |
<ROW table="dsm_datasources"> |
91 |
<FIELD name="_dnet_resource_identifier_"> |
92 |
<xsl:value-of select="$datasourceId"/> |
93 |
</FIELD>
|
94 |
<FIELD name="id"> |
95 |
<xsl:value-of select="$datasourceId"/> |
96 |
</FIELD>
|
97 |
<FIELD name="officialname"> |
98 |
<xsl:choose>
|
99 |
<xsl:when test="//repository_metadata/name/name"> |
100 |
<xsl:value-of
|
101 |
select="normalize-space(//repository_metadata/name/name)"/> |
102 |
</xsl:when>
|
103 |
<xsl:otherwise>
|
104 |
<xsl:value-of
|
105 |
select="normalize-space(//repository_metadata/name/acronym)"/> |
106 |
</xsl:otherwise>
|
107 |
</xsl:choose>
|
108 |
</FIELD>
|
109 |
<FIELD name="englishname"> |
110 |
<xsl:choose>
|
111 |
<xsl:when test="//repository_metadata/name/acronym"> |
112 |
<xsl:value-of
|
113 |
select="normalize-space(//repository_metadata/name/acronym)"/> |
114 |
</xsl:when>
|
115 |
<xsl:otherwise>
|
116 |
<xsl:value-of
|
117 |
select="normalize-space(//repository_metadata/name/name)"/> |
118 |
</xsl:otherwise>
|
119 |
</xsl:choose>
|
120 |
</FIELD>
|
121 |
<FIELD name="websiteurl"> |
122 |
<xsl:value-of select="normalize-space(//repository_metadata/url)"/> |
123 |
</FIELD>
|
124 |
<FIELD name="contactemail"> |
125 |
<xsl:value-of select="normalize-space(//pEmail)"/> |
126 |
</FIELD>
|
127 |
<xsl:if test="not(normalize-space(//organisation/location/latitude) = 'null')"> |
128 |
<FIELD name="latitude" type="float"> |
129 |
<xsl:value-of
|
130 |
select="normalize-space(//organisation/location/latitude)"/> |
131 |
</FIELD>
|
132 |
</xsl:if>
|
133 |
<xsl:if test="normalize-space(//organisation/location/latitude) = 'null'"> |
134 |
<FIELD name="latitude" type="float"/> |
135 |
</xsl:if>
|
136 |
<xsl:if test="not(normalize-space(//organisation/location/longitude) = 'null')"> |
137 |
<FIELD name="longitude" type="float"> |
138 |
<xsl:value-of
|
139 |
select="normalize-space(//organisation/location/longitude)"/> |
140 |
</FIELD>
|
141 |
</xsl:if>
|
142 |
<xsl:if test="normalize-space(//organisation/location/longitude) = 'null'"> |
143 |
<FIELD name="longitude" type="float"/> |
144 |
</xsl:if>
|
145 |
<FIELD name="namespaceprefix"> |
146 |
<xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/> |
147 |
</FIELD>
|
148 |
<FIELD name="languages"> |
149 |
<xsl:value-of select="normalize-space($languages)"/> |
150 |
</FIELD>
|
151 |
<FIELD name="od_contenttypes"> |
152 |
<xsl:value-of select="normalize-space($contenttypes)"/> |
153 |
</FIELD>
|
154 |
<FIELD name="collectedfrom"> |
155 |
<xsl:value-of select="$varDataSourceId"/> |
156 |
</FIELD>
|
157 |
<FIELD name="typology"> |
158 |
<xsl:value-of select="$repositoryType"/> |
159 |
</FIELD>
|
160 |
<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD> |
161 |
<FIELD name="platform"> |
162 |
<xsl:value-of
|
163 |
select="normalize-space(//repository_metadata/software/name)"/> |
164 |
</FIELD>
|
165 |
<FIELD name="description"> |
166 |
<xsl:value-of
|
167 |
select="normalize-space(//repository_metadata/description)"/> |
168 |
</FIELD>
|
169 |
|
170 |
<FIELD name="subjects"> |
171 |
<xsl:value-of select="normalize-space($subjects)"/> |
172 |
</FIELD>
|
173 |
<xsl:if test="//policies/preservation_policy/version_control/policy[./text() = 'updated_versions_allowed']"> |
174 |
<FIELD name="versioning" type="boolean">true</FIELD> |
175 |
</xsl:if>
|
176 |
</ROW>
|
177 |
|
178 |
<ROW table="dsm_api"> |
179 |
<FIELD name="_dnet_resource_identifier_"> |
180 |
<xsl:value-of select="$apiId"/> |
181 |
</FIELD>
|
182 |
<FIELD name="id"> |
183 |
<xsl:value-of select="$apiId"/> |
184 |
</FIELD>
|
185 |
<FIELD name="protocol">oai</FIELD> |
186 |
<FIELD name="datasource"> |
187 |
<xsl:value-of select="$datasourceId"/> |
188 |
</FIELD>
|
189 |
<FIELD name="contentdescription">metadata</FIELD> |
190 |
<FIELD name="typology"> |
191 |
<xsl:value-of select="$repositoryType"/> |
192 |
</FIELD>
|
193 |
<FIELD name="baseurl"> |
194 |
<xsl:value-of select="normalize-space(//repository_metadata/oai_url)"/> |
195 |
</FIELD>
|
196 |
<FIELD name="metadata_identifier_path"> |
197 |
//*[local-name()='header']/*[local-name()='identifier'] |
198 |
</FIELD>
|
199 |
</ROW>
|
200 |
|
201 |
<ROW table="dsm_apiparams"> |
202 |
<FIELD name="_dnet_resource_identifier_"> |
203 |
<xsl:value-of select="concat($apiId, '@@format')"/> |
204 |
</FIELD>
|
205 |
<FIELD name="api"> |
206 |
<xsl:value-of select="$apiId"/> |
207 |
</FIELD>
|
208 |
<FIELD name="param">format</FIELD> |
209 |
<FIELD name="value">oai_dc</FIELD> |
210 |
</ROW>
|
211 |
|
212 |
<ROW table="dsm_organizations"> |
213 |
<FIELD name="_dnet_resource_identifier_"> |
214 |
<xsl:value-of select="$organizationId"/> |
215 |
</FIELD>
|
216 |
<FIELD name="id"> |
217 |
<xsl:value-of select="$organizationId"/> |
218 |
</FIELD>
|
219 |
<FIELD name="legalname"> |
220 |
<xsl:value-of select="$oName"/> |
221 |
</FIELD>
|
222 |
<FIELD name="legalshortname"> |
223 |
<xsl:value-of select="normalize-space(//organisation/name/acronym)"/> |
224 |
</FIELD>
|
225 |
<FIELD name="websiteurl"> |
226 |
<xsl:choose>
|
227 |
<xsl:when test="starts-with(normalize-space($oUrl), 'http')"> |
228 |
<xsl:value-of select="normalize-space($oUrl)"/> |
229 |
</xsl:when>
|
230 |
<xsl:when test="string-length(normalize-space($oUrl)) &gt; 0"> |
231 |
<xsl:value-of
|
232 |
select="concat('http://', normalize-space($oUrl))"/> |
233 |
</xsl:when>
|
234 |
</xsl:choose>
|
235 |
</FIELD>
|
236 |
|
237 |
<FIELD name="country"> |
238 |
<xsl:choose>
|
239 |
<xsl:when test="normalize-space(//organisation/country) = 'UK'">GB |
240 |
</xsl:when>
|
241 |
<xsl:otherwise>
|
242 |
<xsl:value-of select="normalize-space(//organisation/country)"/> |
243 |
</xsl:otherwise>
|
244 |
</xsl:choose>
|
245 |
</FIELD>
|
246 |
|
247 |
<FIELD name="collectedfrom"> |
248 |
<xsl:value-of select="$varDataSourceId"/> |
249 |
</FIELD>
|
250 |
<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD> |
251 |
</ROW>
|
252 |
|
253 |
<ROW table="dsm_datasource_organization"> |
254 |
<FIELD name="_dnet_resource_identifier_"> |
255 |
<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/> |
256 |
</FIELD>
|
257 |
<FIELD name="datasource"> |
258 |
<xsl:value-of select="$datasourceId"/> |
259 |
</FIELD>
|
260 |
<FIELD name="organization"> |
261 |
<xsl:value-of select="$organizationId"/> |
262 |
</FIELD>
|
263 |
</ROW>
|
264 |
|
265 |
</ROWS>
|
266 |
</metadata>
|
267 |
</record>
|
268 |
</xsl:template>
|
269 |
|
270 |
</xsl:stylesheet>
|
271 |
|
272 |
|
273 |
</CODE>
|
274 |
</SCRIPT>
|
275 |
</CONFIGURATION>
|
276 |
<STATUS/>
|
277 |
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS> |
278 |
</BODY>
|
279 |
</RESOURCE_PROFILE>
|