Project

General

Profile

« Previous | Next » 

Revision 50489

merged branch dsm into trunk

View differences:

re3data_2_db.xsl
7 7
	<xsl:param name="namespacePrefix"/>
8 8

  
9 9
	<xsl:variable name="dsId" select="concat($namespacePrefix, '::', normalize-space(.//*[local-name()='re3data.orgIdentifier']))"/>
10
	<xsl:variable name="subjects">
11
		<xsl:for-each select="//*[local-name()='subject']">
12
			<xsl:if test="position() &gt; 1">,</xsl:if>
13
			<xsl:value-of select="concat('&quot;', substring-after(., ' '), '&quot;')"/>
14
		</xsl:for-each>
15
	</xsl:variable>
10 16

  
11 17
	<xsl:template match="/">
12
		<record
13
		>
18
		<record>
14 19

  
15 20
			<xsl:copy-of select=".//*[local-name()='header']"/>
16 21
			<metadata>
17 22
				<ROWS>
18
					<ROW table="datasources">
23
					<ROW table="dsm_datasources">
19 24
						<FIELD name="_dnet_resource_identifier_">
20 25
							<xsl:value-of select="$dsId"/>
21 26
						</FIELD>
......
28 33
						<FIELD name="englishName">
29 34
							<xsl:value-of select=".//*[local-name()='additionalName'][@language='eng']"/>
30 35
						</FIELD>
31
						<FIELD name="typology">
32
							<xsl:value-of select=".//*[local-name()='software']/*[local-name()='softwareName']"/>
33
						</FIELD>
34
						<FIELD name="webSiteURL">
36
						<FIELD name="websiteurl">
35 37
							<xsl:value-of select=".//*[local-name()='repositoryURL']"/>
36 38
						</FIELD>
37
						<FIELD name="logoURL"></FIELD>
38
						<FIELD name="contactEmail"></FIELD>
39
						<FIELD name="latitude"></FIELD>
40
						<FIELD name="longitude"></FIELD>
41
						<FIELD name="timezone"></FIELD>
42
						<FIELD name="nameSpacePrefix">
39
						<FIELD name="namespaceprefix">
43 40
							<xsl:value-of select="dnet:generateNsPrefix('r3', dnet:md5(normalize-space(.//*[local-name()='re3data.orgIdentifier'])))"/>
44 41
						</FIELD>
42
						<FIELD name="collectedfrom">
43
							<xsl:value-of select="$parentDatasourceId"/>
44
						</FIELD>
45
						<FIELD name="typology">datarepository::unknown</FIELD>
46
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
47
						<FIELD name="platform">
48
							<xsl:value-of select=".//*[local-name()='software']/*[local-name()='softwareName']"/>
49
						</FIELD>
45 50
						<FIELD name="description">
46 51
							<xsl:value-of select="./*[local-name()='description']"/>
47 52
						</FIELD>
48
						<FIELD name="collectedfrom">
49
							<xsl:value-of select="$parentDatasourceId"/>
50
						</FIELD>
51
						<FIELD name="datasourceClass">datarepository::unknown</FIELD>
52
						<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
53
						<FIELD name="releaseStartDate" type="date">
53
						<FIELD name="releasestartdate" type="date">
54 54
							<xsl:value-of select=".//*[local-name()='startDate']"/>
55 55
						</FIELD>
56
						<FIELD name="releaseEndDate" type="date">
56
						<FIELD name="releaseenddate" type="date">
57 57
							<xsl:value-of select=".//*[local-name()='endDate']"/>
58 58
						</FIELD>
59
						<FIELD name="missionStatementURL">
59
						<FIELD name="missionstatementurl">
60 60
							<xsl:value-of select=".//*[local-name()='missionStatementURL']"/>
61 61
						</FIELD>
62

  
62 63
						<xsl:choose>
63 64
							<xsl:when test=".//*[local-name()='providerType'] = 'dataProvider'">
64
								<FIELD name="dataProvider" type="boolean">true</FIELD>
65
								<FIELD name="dataprovider" type="boolean">true</FIELD>
65 66
							</xsl:when>
66 67
							<xsl:otherwise>
67
								<FIELD name="dataProvider" type="boolean">false</FIELD>
68
								<FIELD name="dataprovider" type="boolean">false</FIELD>
68 69
							</xsl:otherwise>
69 70
						</xsl:choose>
70 71
						<xsl:choose>
71 72
							<xsl:when test=".//*[local-name()='providerType'] = 'serviceProvider'">
72
								<FIELD name="serviceProvider" type="boolean">true</FIELD>
73
								<FIELD name="serviceprovider" type="boolean">true</FIELD>
73 74
							</xsl:when>
74 75
							<xsl:otherwise>
75
								<FIELD name="serviceProvider" type="boolean">false</FIELD>
76
								<FIELD name="serviceprovider" type="boolean">false</FIELD>
76 77
							</xsl:otherwise>
77 78
						</xsl:choose>
78
						<FIELD name="databaseAccessType">
79
						<FIELD name="databaseaccesstype">
79 80
							<xsl:value-of select=".//*[local-name()='databaseAccessType']"/>
80 81
						</FIELD>
81
						<FIELD name="dataUploadType">
82
						<FIELD name="datauploadtype">
82 83
							<xsl:value-of select=".//*[local-name()='dataUploadType']"/>
83 84
						</FIELD>
84
						<FIELD name="databaseAccessRestriction">
85
						<FIELD name="databaseaccessrestriction">
85 86
							<xsl:value-of select=".//*[local-name()='databaseAccessRestriction']"/>
86 87
						</FIELD>
87
						<FIELD name="dataUploadRestriction">
88
						<FIELD name="datauploadrestriction">
88 89
							<xsl:value-of select=".//*[local-name()='dataUploadRestriction']"/>
89 90
						</FIELD>
90 91
						<xsl:choose>
91 92
							<xsl:when test=".//*[local-name()='versioning'] = 'yes'">
92
								<FIELD name="serviceProvider" type="boolean">true</FIELD>
93
								<FIELD name="versioning" type="boolean">true</FIELD>
93 94
							</xsl:when>
94 95
							<xsl:otherwise>
95
								<FIELD name="serviceProvider" type="boolean">false</FIELD>
96
								<FIELD name="versioning" type="boolean">false</FIELD>
96 97
							</xsl:otherwise>
97 98
						</xsl:choose>
98
						<FIELD name="citationGuidelineURL">
99
						<FIELD name="citationguidelineurl">
99 100
							<xsl:value-of select=".//*[local-name()='citationGuidelineURL']"/>
100 101
						</FIELD>
101
						<FIELD name="qualityManagementKind">
102
						<FIELD name="qualitymanagementkind">
102 103
							<xsl:value-of select=".//*[local-name()='qualityManagement']"/>
103 104
						</FIELD>
104
						<FIELD name="PIDsystems">
105
						<FIELD name="pidsystems">
105 106
							<xsl:value-of select=".//*[local-name()='pidSystem']"/>
106 107
						</FIELD>
107 108
						<FIELD name="certificates">
108 109
							<xsl:value-of select=".//*[local-name()='certificate']"/>
109 110
						</FIELD>
111
						<FIELD name="subjects">
112
							<xsl:value-of select="concat('{', normalize-space($subjects), '}')"/>
113
						</FIELD>
110 114
					</ROW>
111 115

  
112 116
					<xsl:for-each select="//*[local-name()='api']">
113 117
						<xsl:variable name="apiId" select="concat('api_________::', $dsId, '::', position())"/>
114
						<ROW table="api">
118
						<xsl:variable name="baseURL" select="normalize-space(.)"/>
119
						<ROW table="dsm_api">
115 120
							<FIELD name="_dnet_resource_identifier_">
116 121
								<xsl:value-of select="$apiId"/>
117 122
							</FIELD>
118 123
							<FIELD name="id">
119 124
								<xsl:value-of select="$apiId"/>
120 125
							</FIELD>
121
							<FIELD name="protocolclass">
126
							<FIELD name="protocol">
122 127
								<xsl:value-of select="normalize-space(@apiType)"/>
123 128
							</FIELD>
124 129
							<FIELD name="datasource">
125 130
								<xsl:value-of select="$dsId"/>
126 131
							</FIELD>
127
							<FIELD name="typologyclass">datarepository::unknown</FIELD>
132
							<FIELD name="contentdescription">metadata</FIELD>
133
							<FIELD name="typology">datarepository::unknown</FIELD>
134

  
135
							<FIELD name="baseurl">
136
								<xsl:value-of select="$baseURL"/>
137
							</FIELD>
128 138
						</ROW>
129 139

  
130
						<ROW table="apicollections">
131
							<FIELD name="_dnet_resource_identifier_">
132
								<xsl:value-of select="concat($apiId, '@@baseUrl')"/>
133
							</FIELD>
134
							<FIELD name="param">baseUrl</FIELD>
135
							<xsl:variable name="baseURL" select="normalize-space(.)"/>
136
							<FIELD name="original">
137
								<xsl:choose>
138
									<xsl:when test="$baseURL != ''">
139
										<xsl:value-of select="$baseURL"/>
140
									</xsl:when>
141
									<xsl:otherwise>
142
										<xsl:value-of select="string('http://unavailable.base.url')"/>
143
									</xsl:otherwise>
144
								</xsl:choose>
145
							</FIELD>
140
						<!-- CANNOT ASSUME THE FORMAT IS oai_dc
141
						<ROW table="dsm_apiparams">
146 142
							<FIELD name="api">
147 143
								<xsl:value-of select="$apiId"/>
148 144
							</FIELD>
145
							<FIELD name="param">format</FIELD>
146
							<FIELD name="value">oai_dc</FIELD>
149 147
						</ROW>
148
						-->
150 149
					</xsl:for-each>
151 150

  
152
					<xsl:for-each select="//*[local-name()='policy']">
153
						<xsl:variable name="policyURL" select="./*[local-name='policyURL']"/>
154
						<xsl:variable name="policyId" select="concat($namespacePrefix, '::', dnet:md5($policyURL))"/>
155
						<ROW table="policies">
156
							<FIELD name="_dnet_resource_identifier_">
157
								<xsl:value-of select="$policyId"/>
158
							</FIELD>
159
							<FIELD name="id">
160
								<xsl:value-of select="$policyId"/>
161
							</FIELD>
162
							<FIELD name="name">
163
								<xsl:value-of select="./*[local-name='policyName']"/>
164
							</FIELD>
165
							<FIELD name="url">
166
								<xsl:value-of select="$policyURL"/>
167
							</FIELD>
168
						</ROW>
169

  
170
						<ROW table="datasource_policy">
171
							<FIELD name="_dnet_resource_identifier_">
172
								<xsl:value-of select="concat($dsId, '@@', $policyId)"/>
173
							</FIELD>
174
							<FIELD name="datasource">
175
								<xsl:value-of select="$dsId"/>
176
							</FIELD>
177
							<FIELD name="policy">
178
								<xsl:value-of select="$policyId"/>
179
							</FIELD>
180
						</ROW>
181
					</xsl:for-each>
182

  
183
					<xsl:for-each select="//*[local-name()='subject']">
184
						<xsl:variable name="subjectId" select="concat($namespacePrefix, '::DFG_',  substring-before(. , ' '))"></xsl:variable>
185
						<xsl:variable name="subjectName" select="substring-after(., ' ')"></xsl:variable>
186
						<ROW table="subjects">
187
							<FIELD name="_dnet_resource_identifier_">
188
								<xsl:value-of select="$subjectId"/>
189
							</FIELD>
190
							<FIELD name="id">
191
								<xsl:value-of select="$subjectId"/>
192
							</FIELD>
193
							<FIELD name="name">
194
								<xsl:value-of select="$subjectName"/>
195
							</FIELD>
196
							<FIELD name="semanticclass">DFG</FIELD>
197
							<FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
198
						</ROW>
199

  
200
						<ROW table="datasource_subject">
201
							<FIELD name="_dnet_resource_identifier_">
202
								<xsl:value-of select="concat($dsId, '@@', $subjectId)"/>
203
							</FIELD>
204
							<FIELD name="datasource">
205
								<xsl:value-of select="$dsId"/>
206
							</FIELD>
207
							<FIELD name="subject">
208
								<xsl:value-of select="$subjectId"/>
209
							</FIELD>
210
						</ROW>
211
					</xsl:for-each>
212

  
213 151
					<xsl:for-each select="//*[local-name()='institution']">
214 152
						<xsl:variable name="orgId" select="concat($namespacePrefix, '::', dnet:md5(normalize-space(./*[local-name()='institutionName'])))"/>
215
						<ROW table="organizations">
153
						<ROW table="dsm_organizations">
216 154
							<FIELD name="_dnet_resource_identifier_">
217 155
								<xsl:value-of select="$orgId"/>
218 156
							</FIELD>
......
235 173
									</xsl:when>
236 174
								</xsl:choose>
237 175
							</FIELD>
238
							<FIELD name="countryClass">
176
							<FIELD name="country">
239 177
								<xsl:value-of select="./*[local-name()='institutionCountry']"/>
240 178
							</FIELD>
241 179
							<FIELD name="collectedfrom">
242 180
								<xsl:value-of select="$parentDatasourceId"/>
243 181
							</FIELD>
244
							<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
182
							<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
245 183
							<FIELD name="trust" type="float">0.9</FIELD>
246 184
						</ROW>
247 185

  
248
						<ROW table="datasource_organization">
186
						<ROW table="dsm_datasource_organization">
249 187
							<FIELD name="_dnet_resource_identifier_">
250 188
								<xsl:value-of select="concat($dsId, '@@', $orgId)"/>
251 189
							</FIELD>
......
255 193
							<FIELD name="organization">
256 194
								<xsl:value-of select="$orgId"/>
257 195
							</FIELD>
258
							<FIELD name="startdate" type="date">
259
								<xsl:value-of select="./*[local-name()='responsibilityStartDate']"/>
260
							</FIELD>
261
							<FIELD name="enddate" type="date">
262
								<xsl:value-of select="./*[local-name()='responsibilityEndDate']"/>
263
							</FIELD>
264 196
						</ROW>
265 197
					</xsl:for-each>
266 198

  

Also available in: Unified diff