geo_combine 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8627401efabab03d06f210ee160e7e09c7223398
4
- data.tar.gz: dcdc93c201e689dc2c9b8245ac2076617af34e39
3
+ metadata.gz: f0afe886cbbf89998cabcdad7c4daa67842f454d
4
+ data.tar.gz: bf8ea5de5455e02536043c038bcd96c0eae804c1
5
5
  SHA512:
6
- metadata.gz: 9c957f3b783684f18c18c3265349c7efa4db3aa12094f573e9d4d9e5a2366f3464e390add7a12734213ca1801c5ef3d0d820a8139fdce47c07ba99e037f71e5f
7
- data.tar.gz: e6bedee395328db1deed473721231e7a5d678e0bfa2a9b038e3f7de596e99622cc7dff7b4dc2d6db14d2d5734339d01fa9d5a462bfbe4363872afe87c98ecb48
6
+ metadata.gz: 8e3155d7e08bd953c81f8ae501a691406e5ab606d66749a6cb7bd30262f7d21094a3db830af11c9ed65000d81cf88b0fcb5f8868b3f878f22f8d8ee701511dec
7
+ data.tar.gz: 90c54a422198f1c960550a19dcf993b8083e13cf8d477870485bb196535a90393f5bbd83ed8a94a810905b1b537838e671c4cd406e1aa014acf5a6603254226f
@@ -1,3 +1,7 @@
1
+ sudo: false
1
2
  language: ruby
3
+ cache: bundler
2
4
  rvm:
3
- - 2.1.5
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
data/README.md CHANGED
@@ -83,7 +83,15 @@ $ rake geocombine:index
83
83
  $ bundle exec geocombine index
84
84
  ```
85
85
 
86
- Indexs all of the `geoblacklight.json` files in cloned repositories to a Solr index running at http://127.0.0.1:8983/solr
86
+ Indexes all of the `geoblacklight.json` files in cloned repositories to a Solr index running at http://127.0.0.1:8983/solr
87
+
88
+ #### Custom Solr location
89
+
90
+ Solr location can also be specified by an environment variable `SOLR_URL`.
91
+
92
+ ```sh
93
+ $ SOLR_URL=http://www.example.com:1234/solr/collection rake geocombine:index
94
+ ```
87
95
 
88
96
  ## Contributing
89
97
 
@@ -48,6 +48,9 @@ module GeoCombine
48
48
  end
49
49
  end
50
50
 
51
+ # Require custom exceptions
52
+ require 'geo_combine/exceptions'
53
+
51
54
  # Require translation mixins
52
55
  require 'geo_combine/formats'
53
56
  require 'geo_combine/subjects'
@@ -26,14 +26,12 @@ module GeoCombine
26
26
  # @return [Hash]
27
27
  def geoblacklight_terms
28
28
  {
29
- uuid: @metadata['id'],
30
29
  dc_identifier_s: @metadata['id'],
31
30
  dc_title_s: @metadata['name'],
32
31
  dc_description_s: sanitize_and_remove_lines(@metadata['description']),
33
32
  dc_rights_s: 'Public',
34
33
  dct_provenance_s: @metadata['owner'],
35
34
  dct_references_s: references,
36
- georss_box_s: georss_box,
37
35
  # layer_id_s is used for describing a layer id for a web serivce (WMS, WFS) but is still a required field
38
36
  layer_id_s: '',
39
37
  layer_geom_type_s: @metadata['geometry_type'],
@@ -62,13 +60,6 @@ module GeoCombine
62
60
  }
63
61
  end
64
62
 
65
- ##
66
- # Builds a GeoRSS box
67
- # @return [String]
68
- def georss_box
69
- "#{south} #{west} #{north} #{east}"
70
- end
71
-
72
63
  ##
73
64
  # Builds a Solr Envelope using CQL syntax
74
65
  # @return [String]
@@ -0,0 +1,6 @@
1
+ module GeoCombine
2
+ module Exceptions
3
+ class InvalidDCTReferences < StandardError
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,5 @@
1
+ require 'open-uri'
2
+
1
3
  module GeoCombine
2
4
  class Geoblacklight
3
5
  include GeoCombine::Formats
@@ -6,6 +8,8 @@ module GeoCombine
6
8
 
7
9
  attr_reader :metadata
8
10
 
11
+ GEOBLACKLIGHT_VERSION = 'v1.1.0'
12
+
9
13
  ##
10
14
  # Initializes a GeoBlacklight object
11
15
  # @param [String] metadata be a valid JSON string document in
@@ -13,6 +17,7 @@ module GeoCombine
13
17
  # @param [Hash] fields enhancements to metadata that are merged with @metadata
14
18
  def initialize(metadata, fields = {})
15
19
  @metadata = JSON.parse(metadata).merge(fields)
20
+ @schema = nil
16
21
  end
17
22
 
18
23
  ##
@@ -39,8 +44,22 @@ module GeoCombine
39
44
  # Validates a GeoBlacklight-Schema json document
40
45
  # @return [Boolean]
41
46
  def valid?
42
- schema = JSON.parse(File.read(File.join(File.dirname(__FILE__), '../schema/geoblacklight-schema.json')))
43
- JSON::Validator.validate!(schema, to_json, validate_schema: true)
47
+ @schema ||= JSON.parse(open("https://raw.githubusercontent.com/geoblacklight/geoblacklight/#{GEOBLACKLIGHT_VERSION}/schema/geoblacklight-schema.json").read)
48
+ JSON::Validator.validate!(@schema, to_json, fragment: '#/properties/layer') && dct_references_validate!
49
+ end
50
+
51
+ ##
52
+ # Validate dct_references_s
53
+ # @return [Boolean]
54
+ def dct_references_validate!
55
+ return true unless metadata.key?('dct_references_s')
56
+ begin
57
+ ref = JSON.parse(metadata['dct_references_s'])
58
+ raise GeoCombine::Exceptions::InvalidDCTReferences, 'dct_references must be parsed to a Hash' unless ref.is_a?(Hash)
59
+ true
60
+ rescue JSON::ParserError => e
61
+ raise e, "Invalid JSON in dct_references_s: #{e.message}"
62
+ end
44
63
  end
45
64
 
46
65
  private
@@ -1,3 +1,3 @@
1
1
  module GeoCombine
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -12,7 +12,7 @@ namespace :geocombine do
12
12
  ogm_repos = JSON.parse(Net::HTTP.get(ogm_api_uri)).map{ |repo| repo['git_url']}
13
13
  ogm_repos.each do |repo|
14
14
  if repo =~ /^git:\/\/github.com\/OpenGeoMetadata\/(edu|org|uk)\..*/
15
- system "mkdir -p #{ogm_path} && cd #{ogm_path} && git clone #{repo}"
15
+ system "mkdir -p #{ogm_path} && cd #{ogm_path} && git clone --depth 1 #{repo}"
16
16
  end
17
17
  end
18
18
  end
@@ -1,24 +1,24 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
2
+ <!--
3
3
  fgdc2geoBL.xsl - Transformation from FGDC into GeoBlacklight Solr
4
-
4
+
5
5
  -->
6
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7
7
  version="1.0">
8
8
  <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>
9
9
  <xsl:strip-space elements="*"/>
10
10
 
11
11
  <xsl:param name="zipName" select="'data.zip'"/>
12
-
12
+
13
13
  <xsl:variable name="institution">
14
14
  <xsl:for-each select="metadata">
15
15
  <xsl:choose>
16
16
  <xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'Harvard')">
17
17
  <xsl:text>Harvard</xsl:text>
18
- </xsl:when>
18
+ </xsl:when>
19
19
  <xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'Tufts')">
20
20
  <xsl:text>Tufts</xsl:text>
21
- </xsl:when>
21
+ </xsl:when>
22
22
  <xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'MIT')">
23
23
  <xsl:text>MIT</xsl:text>
24
24
  </xsl:when>
@@ -40,18 +40,18 @@
40
40
  <xsl:when test="contains(metainfo/metc/cntinfo/cntorgp/cntorg, 'Harvard')">
41
41
  <xsl:text>Harvard</xsl:text>
42
42
  </xsl:when>
43
-
43
+
44
44
  </xsl:choose>
45
45
  </xsl:for-each>
46
46
  </xsl:variable>
47
-
47
+
48
48
  <!-- Output bounding box -->
49
49
  <xsl:variable name="upperCorner">
50
50
  <xsl:value-of select="number(metadata/idinfo/spdom/bounding/eastbc)"/>
51
51
  <xsl:text> </xsl:text>
52
52
  <xsl:value-of select="number(metadata/idinfo/spdom/bounding/northbc)"/>
53
53
  </xsl:variable>
54
-
54
+
55
55
  <xsl:variable name="lowerCorner">
56
56
 
57
57
  <xsl:value-of select="number(metadata/idinfo/spdom/bounding/westbc)"/>
@@ -64,28 +64,28 @@
64
64
  <xsl:variable name="y2" select="number(metadata/idinfo/spdom/bounding/northbc)"/><!-- N -->
65
65
  <xsl:variable name="y1" select="number(metadata/idinfo/spdom/bounding/southbc)"/><!-- S -->
66
66
 
67
-
67
+
68
68
  <xsl:variable name="format">
69
69
  <xsl:choose>
70
70
  <xsl:when test="contains(metadata/idinfo/citation/citeinfo/geoform, 'raster digital data')">
71
- <xsl:text>image/tiff</xsl:text>
71
+ <xsl:text>GeoTIFF</xsl:text>
72
72
  </xsl:when>
73
73
  <xsl:when test="contains(metadata/idinfo/citation/citeinfo/geoform, 'vector digital data')">
74
- <xsl:text>application/x-esri-shapefile</xsl:text>
74
+ <xsl:text>Shapefile</xsl:text>
75
75
  </xsl:when>
76
76
  <xsl:when test="contains(metadata/distinfo/stdorder/digform/digtinfo/formname, 'TIFF')">
77
- <xsl:text>image/tiff</xsl:text>
77
+ <xsl:text>GeoTIFF</xsl:text>
78
78
  </xsl:when>
79
79
  <xsl:when test="contains(metadata/distinfo/stdorder/digform/digtinfo/formname, 'JPEG2000')">
80
- <xsl:text>image/tiff</xsl:text>
80
+ <xsl:text>image/jpeg</xsl:text>
81
81
  </xsl:when>
82
82
  <xsl:when test="contains(metadata/distinfo/stdorder/digform/digtinfo/formname, 'Shape')">
83
- <xsl:text>application/x-esri-shapefile</xsl:text>
83
+ <xsl:text>Shapefile</xsl:text>
84
84
  </xsl:when>
85
85
  </xsl:choose>
86
86
  </xsl:variable>
87
-
88
-
87
+
88
+
89
89
  <xsl:variable name="uuid">
90
90
  <xsl:choose>
91
91
  <xsl:when test="$institution = 'Harvard'">
@@ -99,27 +99,25 @@
99
99
  </xsl:when>
100
100
  </xsl:choose>
101
101
  </xsl:variable>
102
-
103
-
102
+
103
+
104
104
  <xsl:template match="metadata">
105
105
  <xsl:text>{</xsl:text>
106
-
107
- <xsl:text>"uuid": "</xsl:text>
108
- <xsl:value-of select="$uuid"/>
109
- <xsl:text>",</xsl:text>
110
-
106
+
107
+ <xsl:text>"geoblacklight_version": "1.0",</xsl:text>
108
+
111
109
  <xsl:text>"dc_identifier_s": "</xsl:text>
112
110
  <xsl:value-of select="idinfo/citation/citeinfo/onlink"/>
113
111
  <xsl:text>",</xsl:text>
114
-
112
+
115
113
  <xsl:text>"dc_title_s": "</xsl:text>
116
114
  <xsl:value-of select="idinfo/citation/citeinfo/title"/>
117
115
  <xsl:text>",</xsl:text>
118
-
116
+
119
117
  <xsl:text>"dc_description_s": "</xsl:text>
120
118
  <xsl:value-of select="idinfo/descript/abstract"/>
121
119
  <xsl:text>",</xsl:text>
122
-
120
+
123
121
  <xsl:text>"dc_rights_s": "</xsl:text>
124
122
  <xsl:choose>
125
123
  <xsl:when test="contains(idinfo/accconst, 'Restricted')">
@@ -151,31 +149,31 @@
151
149
  </xsl:otherwise>
152
150
  </xsl:choose>
153
151
  <xsl:text>",</xsl:text>
154
-
152
+
155
153
  <xsl:text>"dct_provenance_s": "</xsl:text>
156
154
  <xsl:value-of select="$institution"/>
157
155
  <xsl:text>",</xsl:text>
158
-
156
+
159
157
  <!-- <field name="dct_references_s">
160
158
  <xsl:text>{</xsl:text>
161
- <xsl:text>"http://schema.org/url":"</xsl:text>
159
+ <xsl:text>"http://schema.org/url":"</xsl:text>
162
160
  <xsl:value-of select="$purl"/>
163
161
  <xsl:text>",</xsl:text>
164
- <xsl:text>"http://schema.org/thumbnailUrl":"</xsl:text>
162
+ <xsl:text>"http://schema.org/thumbnailUrl":"</xsl:text>
165
163
  <xsl:value-of select="$stacks_root"/>
166
164
  <xsl:text>/file/druid:</xsl:text>
167
165
  <xsl:value-of select="$druid"/>
168
166
  <xsl:text>/preview.jpg",</xsl:text>
169
- <xsl:text>"http://schema.org/DownloadAction":"</xsl:text>
167
+ <xsl:text>"http://schema.org/DownloadAction":"</xsl:text>
170
168
  <xsl:value-of select="$stacks_root"/>
171
169
  <xsl:text>/file/druid:</xsl:text>
172
170
  <xsl:value-of select="$druid"/>
173
171
  <xsl:text>/data.zip",</xsl:text>
174
- <xsl:text>"http://www.loc.gov/mods/v3":"</xsl:text>
172
+ <xsl:text>"http://www.loc.gov/mods/v3":"</xsl:text>
175
173
  <xsl:text>http://earthworks.stanford.edu/opengeometadata/layers/edu.stanford.purl/</xsl:text>
176
174
  <xsl:value-of select="$druid"/>
177
175
  <xsl:text>/mods",</xsl:text>
178
- <xsl:text>"http://www.isotc211.org/schemas/2005/gmd/":"</xsl:text>
176
+ <xsl:text>"http://www.isotc211.org/schemas/2005/gmd/":"</xsl:text>
179
177
  <xsl:text>http://earthworks.stanford.edu/opengeometadata/layers/edu.stanford.purl/</xsl:text>
180
178
  <xsl:value-of select="$druid"/>
181
179
  <xsl:text>/iso19139",</xsl:text>
@@ -190,18 +188,18 @@
190
188
  <xsl:text>/wcs"</xsl:text>
191
189
  <xsl:text>}</xsl:text>
192
190
  </field> -->
193
-
191
+
194
192
  <xsl:text>"layer_id_s": "</xsl:text>
195
193
  <xsl:text>urn:</xsl:text>
196
194
  <xsl:value-of select="$uuid"/>
197
195
  <xsl:text>",</xsl:text>
198
-
196
+
199
197
  <xsl:text>"layer_slug_s": "</xsl:text>
200
198
  <xsl:value-of select="$institution"/>
201
199
  <xsl:text>-</xsl:text>
202
200
  <xsl:value-of select="$uuid"/>
203
201
  <xsl:text>",</xsl:text>
204
-
202
+
205
203
  <xsl:choose>
206
204
  <xsl:when test="contains(metadata/spdoinfo/ptvctinf/sdtsterm/sdtstype, 'G-polygon')">
207
205
  <xsl:text>"layer_geom_type_s": "</xsl:text>
@@ -213,7 +211,7 @@
213
211
  <xsl:text>Point</xsl:text>
214
212
  <xsl:text>",</xsl:text>
215
213
  </xsl:when>
216
-
214
+
217
215
  <xsl:when test="contains(metadata/spdoinfo/ptvctinf/sdtsterm/sdtstype, 'String')">
218
216
  <xsl:text>"layer_geom_type_s": "</xsl:text>
219
217
  <xsl:text>Line</xsl:text>
@@ -225,36 +223,36 @@
225
223
  <xsl:text>",</xsl:text>
226
224
  </xsl:when>
227
225
  </xsl:choose>
228
-
229
-
226
+
227
+
230
228
 
231
229
  <xsl:choose>
232
230
  <xsl:when test="string-length(metainfo/metd)=4">
233
231
  <xsl:text>"layer_modified_dt": "</xsl:text>
234
- <xsl:value-of select="metainfo/metd"/>
232
+ <xsl:value-of select="metainfo/metd"/>
235
233
  <xsl:text>",</xsl:text>
236
234
  </xsl:when>
237
-
235
+
238
236
  <xsl:when test="string-length(metainfo/metd)=6">
239
237
  <xsl:text>"layer_modified_dt": "</xsl:text>
240
- <xsl:value-of select="substring(metainfo/metd,1,4)"/>
238
+ <xsl:value-of select="substring(metainfo/metd,1,4)"/>
241
239
  <xsl:text>-</xsl:text>
242
240
  <xsl:value-of select="substring(metainfo/metd,5,2)"/>
243
241
  <xsl:text>",</xsl:text>
244
242
  </xsl:when>
245
-
243
+
246
244
  <xsl:when test="string-length(metainfo/metd)=8">
247
245
  <xsl:text>"layer_modified_dt": "</xsl:text>
248
- <xsl:value-of select="substring(metainfo/metd,1,4)"/>
246
+ <xsl:value-of select="substring(metainfo/metd,1,4)"/>
249
247
  <xsl:text>-</xsl:text>
250
- <xsl:value-of select="substring(metainfo/metd,5,2)"/>
248
+ <xsl:value-of select="substring(metainfo/metd,5,2)"/>
251
249
  <xsl:text>-</xsl:text>
252
250
  <xsl:value-of select="substring(metainfo/metd,7,2)"/>
253
251
  <xsl:text>",</xsl:text>
254
252
  </xsl:when>
255
253
  </xsl:choose>
256
-
257
-
254
+
255
+
258
256
  <xsl:if test="idinfo/citation/citeinfo/origin">
259
257
  <xsl:text>"dc_creator_sm": [</xsl:text>
260
258
  <xsl:for-each select="idinfo/citation/citeinfo/origin">
@@ -267,9 +265,9 @@
267
265
  </xsl:for-each>
268
266
  <xsl:text>],</xsl:text>
269
267
  </xsl:if>
270
-
271
-
272
-
268
+
269
+
270
+
273
271
  <xsl:if test="idinfo/citation/citeinfo/pubinfo/publish">
274
272
  <xsl:text>"dc_publisher_sm": [</xsl:text>
275
273
  <xsl:for-each select="idinfo/citation/citeinfo/pubinfo/publish">
@@ -280,26 +278,26 @@
280
278
  <xsl:text>,</xsl:text>
281
279
  </xsl:if>
282
280
  </xsl:for-each>
283
- <xsl:text>],</xsl:text>
284
- </xsl:if>
285
-
286
-
281
+ <xsl:text>],</xsl:text>
282
+ </xsl:if>
283
+
284
+
287
285
  <xsl:text>"dc_format_s": "</xsl:text>
288
286
  <xsl:value-of select="$format"/>
289
287
  <xsl:text>",</xsl:text>
290
-
288
+
291
289
  <xsl:if test="contains(idinfo/descript/langdata, 'en')">
292
290
  <xsl:text>"dc_language_s": "</xsl:text>
293
291
  <xsl:text>English</xsl:text>
294
292
  <xsl:text>",</xsl:text>
295
293
  </xsl:if>
296
-
294
+
297
295
  <!-- DCMI Type vocabulary: defaults to dataset -->
298
296
  <xsl:text>"dc_type_s": "</xsl:text>
299
297
  <xsl:text>Dataset</xsl:text>
300
298
  <xsl:text>",</xsl:text>
301
-
302
-
299
+
300
+
303
301
  <xsl:if test="idinfo/keywords/theme/themekey">
304
302
  <xsl:text>"dc_subject_sm": [</xsl:text>
305
303
  <xsl:for-each select="idinfo/keywords/theme/themekey">
@@ -314,7 +312,7 @@
314
312
  </xsl:for-each>
315
313
  <xsl:text>],</xsl:text>
316
314
  </xsl:if>
317
-
315
+
318
316
  <xsl:if test="idinfo/keywords/place/placekey">
319
317
  <xsl:text>"dc_spatial_sm": [</xsl:text>
320
318
  <xsl:for-each select="idinfo/keywords/place/placekey">
@@ -330,47 +328,47 @@
330
328
  <xsl:choose>
331
329
  <xsl:when test="string-length(idinfo/citation/citeinfo/pubdate)=4">
332
330
  <xsl:text>"dct_issued_s": "</xsl:text>
333
- <xsl:value-of select="idinfo/citation/citeinfo/pubdate"/>
331
+ <xsl:value-of select="idinfo/citation/citeinfo/pubdate"/>
334
332
  <xsl:text>",</xsl:text>
335
333
  </xsl:when>
336
-
334
+
337
335
  <xsl:when test="string-length(idinfo/citation/citeinfo/pubdate)=6">
338
336
  <xsl:text>"dct_issued_s": "</xsl:text>
339
- <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
337
+ <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
340
338
  <xsl:text>-</xsl:text>
341
- <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,5,2)"/>
339
+ <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,5,2)"/>
342
340
  <xsl:text>",</xsl:text>
343
341
  </xsl:when>
344
-
342
+
345
343
  <xsl:when test="string-length(idinfo/citation/citeinfo/pubdate)=8">
346
344
  <xsl:text>"dct_issued_s": "</xsl:text>
347
- <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
345
+ <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
348
346
  <xsl:text>-</xsl:text>
349
- <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,5,2)"/>
347
+ <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,5,2)"/>
350
348
  <xsl:text>-</xsl:text>
351
- <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,7,2)"/>
349
+ <xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,7,2)"/>
352
350
  <xsl:text>",</xsl:text>
353
351
  </xsl:when>
354
352
  </xsl:choose>
355
-
353
+
356
354
  <!-- singular content date: YYYY -->
357
-
355
+
358
356
  <xsl:for-each select="idinfo/timeperd/timeinfo/sngdate/caldate">
359
357
  <xsl:if test="text() !='' ">
360
- <xsl:text>"dct_temporal_sm": "</xsl:text>
358
+ <xsl:text>"dct_temporal_sm": ["</xsl:text>
361
359
  <xsl:value-of select="substring(.,1,4)"/>
362
- <xsl:text>",</xsl:text>
360
+ <xsl:text>"],</xsl:text>
363
361
  </xsl:if>
364
362
  </xsl:for-each>
365
-
366
-
367
- <xsl:for-each select="idinfo/timeperd/timeinfo/mdattim/sngdate">
368
- <xsl:text>"dct_temporal_sm": "</xsl:text>
363
+
364
+
365
+ <xsl:for-each select="idinfo/timeperd/timeinfo/mdattim/sngdate">
366
+ <xsl:text>"dct_temporal_sm": ["</xsl:text>
369
367
  <xsl:value-of select="substring(caldate,1,4)"/>
370
- <xsl:text>",</xsl:text>
371
- </xsl:for-each>
372
-
373
-
368
+ <xsl:text>"],</xsl:text>
369
+ </xsl:for-each>
370
+
371
+
374
372
  <!-- months, days YYYY-MM, YYYY-MM-DD
375
373
  <xsl:when test="string-length(idinfo/timeperd/timeinfo/sngdate/caldate)=4">
376
374
  <xsl:value-of select="idinfo/timeperd/timeinfo/sngdate/caldate"/>
@@ -387,29 +385,29 @@
387
385
  <xsl:text>-</xsl:text>
388
386
  <xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,7,2)"/>
389
387
  </xsl:when> -->
390
-
388
+
391
389
  <!-- content date range: YYYY-YYYY if dates in range differ -->
392
-
390
+
393
391
  <xsl:for-each select="idinfo/timeperd/timeinfo/rngdates">
394
- <xsl:text>"dct_temporal_sm": "</xsl:text>
392
+ <xsl:text>"dct_temporal_sm": ["</xsl:text>
395
393
  <xsl:value-of select="substring(begdate, 1,4)"/>
396
- <xsl:if test="substring(begdate,1,4) != substring(enddate,1,4)">
394
+ <xsl:if test="substring(begdate,1,4) != substring(enddate,1,4)">
397
395
  <xsl:text>-</xsl:text>
398
396
  <xsl:value-of select="substring(enddate,1,4)"/>
399
397
  </xsl:if>
400
- <xsl:text>",</xsl:text>
398
+ <xsl:text>"],</xsl:text>
401
399
  </xsl:for-each>
402
-
400
+
403
401
  <xsl:for-each select="idinfo/keywords/temporal/tempkey">
404
402
  <xsl:if test="text() != substring(idinfo/timeperd/timeinfo/sngdate/caldate,1,4)">
405
- <xsl:text>"dct_temporal_sm": "</xsl:text>
403
+ <xsl:text>"dct_temporal_sm": ["</xsl:text>
406
404
  <xsl:value-of select="."/>
407
- <xsl:text>",</xsl:text>
405
+ <xsl:text>"],</xsl:text>
408
406
  </xsl:if>
409
407
  </xsl:for-each>
410
-
408
+
411
409
  <!-- collection -->
412
-
410
+
413
411
  <xsl:if test="idinfo/citation/citeinfo/lworkcit/citeinfo | idinfo/citation/citeinfo/serinfo/sername">
414
412
  <xsl:text>"dct_isPartOf_sm": [</xsl:text>
415
413
  <xsl:for-each select="idinfo/citation/citeinfo/lworkcit/citeinfo | idinfo/citation/citeinfo/serinfo">
@@ -422,45 +420,7 @@
422
420
  </xsl:for-each>
423
421
  <xsl:text>],</xsl:text>
424
422
  </xsl:if>
425
-
426
-
427
- <!-- cross-references -->
428
- <xsl:if test="idinfo/crossref/citeinfo">
429
- <xsl:text>"dct_relation_sm": [</xsl:text>
430
- <xsl:for-each select="idinfo/crossref/citeinfo">
431
- <xsl:text>"</xsl:text>
432
- <xsl:value-of select="title"/>
433
- <xsl:text>"</xsl:text>
434
- <xsl:if test="position() != last()">
435
- <xsl:text>,</xsl:text>
436
- </xsl:if>
437
- <xsl:text>],</xsl:text>
438
- </xsl:for-each>
439
- </xsl:if>
440
-
441
- <xsl:text>"georss_polygon_s": "</xsl:text>
442
- <xsl:text></xsl:text>
443
- <xsl:value-of select="$y1"/>
444
- <xsl:text> </xsl:text>
445
- <xsl:value-of select="$x1"/>
446
- <xsl:text> </xsl:text>
447
- <xsl:value-of select="$y2"/>
448
- <xsl:text> </xsl:text>
449
- <xsl:value-of select="$x1"/>
450
- <xsl:text> </xsl:text>
451
- <xsl:value-of select="$y2"/>
452
- <xsl:text> </xsl:text>
453
- <xsl:value-of select="$x2"/>
454
- <xsl:text> </xsl:text>
455
- <xsl:value-of select="$y1"/>
456
- <xsl:text> </xsl:text>
457
- <xsl:value-of select="$x2"/>
458
- <xsl:text> </xsl:text>
459
- <xsl:value-of select="$y1"/>
460
- <xsl:text> </xsl:text>
461
- <xsl:value-of select="$x1"/>
462
- <xsl:text>",</xsl:text>
463
-
423
+
464
424
  <xsl:text>"solr_geom": "ENVELOPE(</xsl:text>
465
425
  <xsl:value-of select="$x1"/>
466
426
  <xsl:text>, </xsl:text>
@@ -470,55 +430,36 @@
470
430
  <xsl:text>, </xsl:text>
471
431
  <xsl:value-of select="$y1"/>
472
432
  <xsl:text>)",</xsl:text>
473
-
474
- <xsl:text>"georss_box_s": "</xsl:text>
475
- <xsl:value-of select="$y1"/>
476
- <xsl:text> </xsl:text>
477
- <xsl:value-of select="$x1"/>
478
- <xsl:text> </xsl:text>
479
- <xsl:value-of select="$y2"/>
480
- <xsl:text> </xsl:text>
481
- <xsl:value-of select="$x2"/>
482
- <xsl:text>",</xsl:text>
483
-
484
-
433
+
485
434
  <!-- content date for solr year: choose singular, or beginning date of range: YYYY -->
486
435
  <xsl:if test="idinfo/timeperd/timeinfo">
487
436
  <xsl:choose>
488
437
  <xsl:when test="idinfo/timeperd/timeinfo/sngdate/caldate/text() != ''">
489
438
 
490
439
  <xsl:text>"solr_year_i": </xsl:text>
491
- <xsl:text>"</xsl:text>
492
440
  <xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,1,4)"/>
493
- <xsl:text>"</xsl:text>
494
-
441
+
495
442
  </xsl:when>
496
-
443
+
497
444
  <xsl:when test="idinfo/timeperd/timeinfo/mdattim/sngdate/caldate">
498
445
  <xsl:if test="position() = 1">
499
446
  <xsl:text>"solr_year_i": </xsl:text>
500
- <xsl:text>"</xsl:text>
501
447
  <xsl:value-of select="substring(caldate,1,4)"/>
502
- <xsl:text>"</xsl:text>
503
448
  </xsl:if>
504
449
  </xsl:when>
505
-
450
+
506
451
  <xsl:when test="idinfo/timeperd/timeinfo/rngdates/begdate/text() != ''[1]">
507
452
  <xsl:if test="position() = 1">
508
453
  <xsl:text>"solr_year_i": </xsl:text>
509
- <xsl:text>"</xsl:text>
510
454
  <xsl:value-of select="substring(rngdates/begdate/text(), 1,4)"/>
511
- <xsl:text>"</xsl:text>
512
455
  </xsl:if>
513
456
  </xsl:when>
514
-
457
+
515
458
  <xsl:when test="//metadata/idinfo/keywords/temporal/tempkey">
516
459
  <xsl:for-each select="//metadata/idinfo/keywords/temporal/tempkey[1]">
517
460
  <xsl:if test="text() != ''">
518
461
  <xsl:text>"solr_year_i": </xsl:text>
519
- <xsl:text>"</xsl:text>
520
462
  <xsl:value-of select="."/>
521
- <xsl:text>"</xsl:text>
522
463
  </xsl:if>
523
464
  </xsl:for-each>
524
465
  </xsl:when>
@@ -526,6 +467,6 @@
526
467
  </xsl:if>
527
468
 
528
469
 
529
- <xsl:text>}</xsl:text>
470
+ <xsl:text>}</xsl:text>
530
471
  </xsl:template>
531
472
  </xsl:stylesheet>