geo_combine 0.1.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +6 -1
- data/Gemfile +2 -1
- data/README.md +108 -23
- data/geo_combine.gemspec +4 -2
- data/lib/geo_combine.rb +11 -1
- data/lib/geo_combine/bounding_box.rb +71 -0
- data/lib/geo_combine/ckan_metadata.rb +112 -0
- data/lib/geo_combine/esri_open_data.rb +0 -9
- data/lib/geo_combine/exceptions.rb +8 -0
- data/lib/geo_combine/formatting.rb +6 -1
- data/lib/geo_combine/geo_blacklight_harvester.rb +203 -0
- data/lib/geo_combine/geoblacklight.rb +80 -12
- data/lib/geo_combine/ogp.rb +229 -0
- data/lib/geo_combine/railtie.rb +7 -0
- data/lib/geo_combine/version.rb +1 -1
- data/lib/tasks/geo_combine.rake +54 -20
- data/lib/xslt/fgdc2geoBL.xsl +95 -154
- data/lib/xslt/fgdc2html.xsl +105 -157
- data/lib/xslt/iso2geoBL.xsl +62 -84
- data/lib/xslt/iso2html.xsl +1107 -1070
- data/spec/features/iso2html_spec.rb +7 -1
- data/spec/fixtures/docs/basic_geoblacklight.json +5 -7
- data/spec/fixtures/docs/ckan.json +456 -0
- data/spec/fixtures/docs/full_geoblacklight.json +2 -8
- data/spec/fixtures/docs/geoblacklight_pre_v1.json +37 -0
- data/spec/fixtures/docs/ogp_harvard_line.json +28 -0
- data/spec/fixtures/docs/ogp_harvard_raster.json +28 -0
- data/spec/fixtures/docs/ogp_tufts_vector.json +31 -0
- data/spec/fixtures/json_docs.rb +20 -0
- data/spec/lib/geo_combine/bounding_box_spec.rb +59 -0
- data/spec/lib/geo_combine/ckan_metadata_spec.rb +114 -0
- data/spec/lib/geo_combine/esri_open_data_spec.rb +1 -14
- data/spec/lib/geo_combine/fgdc_spec.rb +11 -14
- data/spec/lib/geo_combine/formatting_spec.rb +6 -0
- data/spec/lib/geo_combine/geo_blacklight_harvester_spec.rb +190 -0
- data/spec/lib/geo_combine/geoblacklight_spec.rb +137 -11
- data/spec/lib/geo_combine/iso19139_spec.rb +5 -2
- data/spec/lib/geo_combine/ogp_spec.rb +163 -0
- data/spec/spec_helper.rb +1 -0
- metadata +63 -14
- data/lib/schema/geoblacklight-schema.json +0 -169
data/lib/geo_combine/version.rb
CHANGED
data/lib/tasks/geo_combine.rake
CHANGED
@@ -1,39 +1,73 @@
|
|
1
|
-
require 'find'
|
2
1
|
require 'net/http'
|
3
2
|
require 'json'
|
4
3
|
require 'rsolr'
|
4
|
+
require 'find'
|
5
|
+
require 'geo_combine/geo_blacklight_harvester'
|
5
6
|
|
6
7
|
namespace :geocombine do
|
8
|
+
commit_within = (ENV['SOLR_COMMIT_WITHIN'] || 5000).to_i
|
7
9
|
ogm_path = ENV['OGM_PATH'] || 'tmp/opengeometadata'
|
8
10
|
solr_url = ENV['SOLR_URL'] || 'http://127.0.0.1:8983/solr/blacklight-core'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
whitelist = %w[
|
12
|
+
https://github.com/OpenGeoMetadata/big-ten.git
|
13
|
+
]
|
14
|
+
|
15
|
+
desc 'Clone OpenGeoMetadata repositories'
|
16
|
+
task :clone, [:repo] do |_t, args|
|
17
|
+
if args.repo
|
18
|
+
ogm_repos = ["https://github.com/OpenGeoMetadata/#{args.repo}.git"]
|
19
|
+
else
|
20
|
+
ogm_api_uri = URI('https://api.github.com/orgs/opengeometadata/repos')
|
21
|
+
ogm_repos = JSON.parse(Net::HTTP.get(ogm_api_uri)).map do |repo|
|
22
|
+
repo['clone_url'] if repo['size'] > 0
|
23
|
+
end.compact
|
24
|
+
ogm_repos.select! { |repo| whitelist.include?(repo) || repo =~ /(edu|org|uk)\..*\.git$/ }
|
25
|
+
end
|
13
26
|
ogm_repos.each do |repo|
|
14
|
-
|
15
|
-
system "mkdir -p #{ogm_path} && cd #{ogm_path} && git clone #{repo}"
|
16
|
-
end
|
27
|
+
system "echo #{repo} && mkdir -p #{ogm_path} && cd #{ogm_path} && git clone --depth 1 #{repo}"
|
17
28
|
end
|
18
29
|
end
|
30
|
+
|
19
31
|
desc '"git pull" OpenGeoMetadata repositories'
|
20
|
-
task :pull do
|
21
|
-
|
32
|
+
task :pull, [:repo] do |_t, args|
|
33
|
+
paths = if args.repo
|
34
|
+
[File.join(ogm_path, args.repo)]
|
35
|
+
else
|
36
|
+
Dir.glob("#{ogm_path}/*")
|
37
|
+
end
|
38
|
+
paths.each do |path|
|
39
|
+
next unless File.directory?(path)
|
40
|
+
system "echo #{path} && cd #{path} && git pull origin"
|
41
|
+
end
|
22
42
|
end
|
23
|
-
|
43
|
+
|
44
|
+
desc 'Index all of the GeoBlacklight JSON documents'
|
24
45
|
task :index do
|
25
|
-
|
46
|
+
puts "Indexing #{ogm_path} into #{solr_url}"
|
47
|
+
solr = RSolr.connect url: solr_url, adapter: :net_http_persistent
|
26
48
|
Find.find(ogm_path) do |path|
|
27
|
-
next unless path
|
49
|
+
next unless File.basename(path) == 'geoblacklight.json'
|
28
50
|
doc = JSON.parse(File.read(path))
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
51
|
+
[doc].flatten.each do |record|
|
52
|
+
begin
|
53
|
+
puts "Indexing #{record['layer_slug_s']}: #{path}" if $DEBUG
|
54
|
+
solr.update params: { commitWithin: commit_within, overwrite: true },
|
55
|
+
data: [record].to_json,
|
56
|
+
headers: { 'Content-Type' => 'application/json' }
|
57
|
+
rescue RSolr::Error::Http => error
|
58
|
+
puts error
|
59
|
+
end
|
36
60
|
end
|
37
61
|
end
|
62
|
+
solr.commit
|
63
|
+
end
|
64
|
+
|
65
|
+
namespace :geoblacklight_harvester do
|
66
|
+
desc 'Harvest documents from a configured GeoBlacklight instance'
|
67
|
+
task :index, [:site] do |_t, args|
|
68
|
+
raise ArgumentError, 'A site argument is required' unless args.site
|
69
|
+
|
70
|
+
GeoCombine::GeoBlacklightHarvester.new(args.site).index
|
71
|
+
end
|
38
72
|
end
|
39
73
|
end
|
data/lib/xslt/fgdc2geoBL.xsl
CHANGED
@@ -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>
|
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>
|
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>
|
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/
|
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>
|
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>"
|
108
|
-
|
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
|
-
|
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>
|