geoblacklight-schema 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/LICENSE +14 -0
  4. data/README.md +44 -0
  5. data/bin/fgdc2mods.rb +5 -0
  6. data/bin/mods2geoblacklight.rb +5 -0
  7. data/bin/xsltproc-saxon +14 -0
  8. data/conf/protwords.txt +21 -0
  9. data/conf/schema.xml +158 -0
  10. data/conf/solrconfig.xml +160 -0
  11. data/conf/stopwords_en.txt +34 -0
  12. data/conf/synonyms.txt +29 -0
  13. data/examples/Gemfile +4 -0
  14. data/examples/generate-example-doc.rb +42 -0
  15. data/examples/selected.json +5787 -0
  16. data/examples/upload-to-solr.rb +50 -0
  17. data/geoblacklight-schema.gemspec +23 -0
  18. data/lib/geoblacklight/gazetteer.csv +1011 -0
  19. data/lib/geoblacklight/gazetteer.rb +104 -0
  20. data/lib/xslt/arcgis_to_iso19110.xsl +364 -0
  21. data/lib/xslt/fgdc2mods.xsl +1007 -0
  22. data/lib/xslt/iso2mods.xsl +939 -0
  23. data/lib/xslt/mods2geoblacklight.xsl +268 -0
  24. data/lib/xslt/mods2ogp.xsl +195 -0
  25. data/tools/fgdc2html/Gemfile +2 -0
  26. data/tools/fgdc2html/fgdc2html.css +71 -0
  27. data/tools/fgdc2html/fgdc2html.js +6 -0
  28. data/tools/fgdc2html/fgdc2html.xsl +1034 -0
  29. data/tools/fgdc2html/render.rb +30 -0
  30. data/tools/iso2html/Gemfile +2 -0
  31. data/tools/iso2html/iso-html.xsl +1745 -0
  32. data/tools/iso2html/render.rb +24 -0
  33. data/tools/iso2html/utils/convert-enumerations.xsl +97 -0
  34. data/tools/iso2html/utils/convert-latlong.xsl +73 -0
  35. data/tools/iso2html/utils/decode-uri/base.css +408 -0
  36. data/tools/iso2html/utils/decode-uri/index.html +29 -0
  37. data/tools/iso2html/utils/elements-fgdc.xml +824 -0
  38. data/tools/iso2html/utils/elements-iso.xml +636 -0
  39. data/tools/iso2html/utils/printFormatted.xsl +267 -0
  40. data/tools/iso2html/utils/printTextLines.xsl +192 -0
  41. data/tools/iso2html/utils/replace-newlines.xsl +97 -0
  42. data/tools/iso2html/utils/replace-string.xsl +80 -0
  43. data/tools/iso2html/utils/strip-digits.xsl +60 -0
  44. data/tools/iso2html/utils/url-decode.xsl +87 -0
  45. data/tools/iso2html/utils/wrap-text.xsl +174 -0
  46. data/tools/ogp/0_download.rb +96 -0
  47. data/tools/ogp/1_validate.rb +225 -0
  48. data/tools/ogp/2_transform.rb +438 -0
  49. data/tools/ogp/3_stanford.rb +35 -0
  50. data/tools/ogp/4_select.rb +189 -0
  51. data/tools/ogp/5_ingest.rb +55 -0
  52. data/tools/ogp/Gemfile +2 -0
  53. data/tools/solr/Gemfile +3 -0
  54. data/tools/solr/purge.rb +33 -0
  55. data/tools/solr/upload.rb +35 -0
  56. data/vendor/.keep +0 -0
  57. metadata +131 -0
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Usage: render.rb iso.xml [iso.xml...]
4
+ #
5
+ require 'nokogiri'
6
+
7
+ class RenderCLI
8
+ @@xslt = Nokogiri::XSLT(File.read(File.join(File.dirname(__FILE__), 'iso-html.xsl')))
9
+
10
+ def run(xmlfn)
11
+ doc = Nokogiri::XML(File.read(xmlfn))
12
+ htmlfn = xmlfn.gsub(/\.xml$/, '.html')
13
+ File.open(htmlfn, 'wb') do |f|
14
+ f << @@xslt.transform(doc)
15
+ end
16
+ end
17
+ end
18
+
19
+ # __MAIN__
20
+ cli = RenderCLI.new
21
+ ARGV.each do |fn|
22
+ puts "Processing #{fn}"
23
+ cli.run(fn)
24
+ end
@@ -0,0 +1,97 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet
3
+ version="1.0"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
6
+
7
+ <xs:annotation>
8
+ <xs:documentation>
9
+ Convert string-based enumerations within a schema to regular
10
+ expressions which allow any combination of capitalization. Original
11
+ version of this stylesheet obtained from:
12
+ http://www.ibm.com/developerworks/xml/library/x-case/
13
+ </xs:documentation>
14
+ </xs:annotation>
15
+
16
+ <xsl:template match="*|@*|text()">
17
+ <xsl:copy>
18
+ <xsl:apply-templates select="*|@*|text()"/>
19
+ </xsl:copy>
20
+ </xsl:template>
21
+
22
+ <xsl:template match="xs:restriction[@base='xs:string']
23
+ [count(xs:enumeration) &gt; 0]">
24
+ <xs:restriction base="xs:string">
25
+ <xs:pattern>
26
+ <xsl:attribute name="value">
27
+ <xsl:for-each select="xs:enumeration">
28
+
29
+ <!-- Step 1. Write a left parenthesis -->
30
+ <xsl:text>(</xsl:text>
31
+
32
+ <!-- Step 2. Write the upper- and lowercase letters -->
33
+ <xsl:call-template name="case-insensitive-pattern">
34
+ <xsl:with-param name="index" select="1"/>
35
+ <xsl:with-param name="string" select="@value"/>
36
+ </xsl:call-template>
37
+
38
+ <!-- Step 3. Write a right parenthesis -->
39
+ <xsl:text>)</xsl:text>
40
+
41
+ <!-- Step 4. If this isn't the last enumeration, write -->
42
+ <!-- a vertical bar -->
43
+ <xsl:if test="not(position()=last())">
44
+ <xsl:text>|</xsl:text>
45
+ </xsl:if>
46
+ </xsl:for-each>
47
+ </xsl:attribute>
48
+ </xs:pattern>
49
+ </xs:restriction>
50
+ </xsl:template>
51
+
52
+ <xsl:template name="case-insensitive-pattern">
53
+ <xsl:param name="string"/>
54
+ <xsl:param name="index"/>
55
+
56
+ <xsl:variable name="current-letter">
57
+ <!-- Write a left parenthesis -->
58
+ <xsl:text>(</xsl:text>
59
+
60
+ <!-- Convert the current letter to uppercase -->
61
+ <xsl:value-of select="translate(substring($string, $index, 1),
62
+ 'abcdefghijklmnopqrstuvwxyz',
63
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
64
+
65
+ <!-- Write a vertical bar -->
66
+ <xsl:text>|</xsl:text>
67
+
68
+ <!-- Convert the current letter to lowercase -->
69
+ <xsl:value-of select="translate(substring($string, $index, 1),
70
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
71
+ 'abcdefghijklmnopqrstuvwxyz')"/>
72
+
73
+ <!-- Write a right parenthesis -->
74
+ <xsl:text>)</xsl:text>
75
+ </xsl:variable>
76
+
77
+ <xsl:variable name="remaining-letters">
78
+
79
+ <!-- If $index is less than the length of the string, -->
80
+ <!-- call the template again. -->
81
+ <xsl:if test="$index &lt; string-length($string)">
82
+ <xsl:call-template name="case-insensitive-pattern">
83
+
84
+ <!-- The string parameter doesn't change -->
85
+ <xsl:with-param name="string" select="$string"/>
86
+
87
+ <!-- Increment the index of the current letter by 1 -->
88
+ <xsl:with-param name="index" select="$index+1"/>
89
+ </xsl:call-template>
90
+ </xsl:if>
91
+ </xsl:variable>
92
+
93
+ <!-- Finally, we output the concatenated values -->
94
+ <xsl:value-of select="concat($current-letter, $remaining-letters)"/>
95
+ </xsl:template>
96
+
97
+ </xsl:stylesheet>
@@ -0,0 +1,73 @@
1
+ <!--
2
+
3
+ convert-latlong.xsl
4
+
5
+ Author: John Maurer (jmaurer@hawaii.edu)
6
+ Date: June 2007 (when I was at National Snow and Ice Data Center)
7
+
8
+ This Extensible Stylesheet Language for Transformations (XSLT) document
9
+ converts a latitude or longitude decimal value from positive and negative
10
+ numbers (e.g. 180, 89.2, -180, -89.2) to strings that indicate the
11
+ hemisphere (e.g. 180 E, 89.2 N, 180 W, 89.2 S). A zero value is returned
12
+ unchanged (e.g. 0).
13
+
14
+ You can import this XSLT in other XSLT files to call the "convert-latlong"
15
+ template for accomplishing this. Here is an example import statement:
16
+
17
+ <xsl:import href="convert-latlong.xsl"/>
18
+
19
+ For more information on XSLT see:
20
+
21
+ http://en.wikipedia.org/wiki/XSLT
22
+ http://www.w3.org/TR/xslt
23
+
24
+ -->
25
+
26
+ <xsl:stylesheet
27
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28
+ version="1.0">
29
+
30
+ <xsl:output method="text"/>
31
+
32
+ <!-- This template converts latitude and longitude values from positive
33
+ and negative integers (e.g. 180, 90, -180, -90) to strings that
34
+ indicate the hemisphere (e.g. 180 E, 90 N, 180 W, 90 S). A zero
35
+ value is returned unchanged (e.g. 0): -->
36
+
37
+ <xsl:template name="convert-latlong">
38
+ <xsl:param name="latitude"/>
39
+ <xsl:param name="longitude"/>
40
+ <xsl:param name="value"/>
41
+ <xsl:choose>
42
+ <xsl:when test="$latitude">
43
+ <xsl:choose>
44
+ <xsl:when test="number( $value ) &gt; 1">
45
+ <xsl:value-of select="concat( $value, ' N' )"/>
46
+ </xsl:when>
47
+ <xsl:when test="number( $value ) &lt; 1">
48
+ <xsl:value-of select="concat( substring-after( $value, '-' ), ' S' )"/>
49
+ </xsl:when>
50
+ <!-- If zero, just return the value: -->
51
+ <xsl:otherwise>
52
+ <xsl:value-of select="$value"/>
53
+ </xsl:otherwise>
54
+ </xsl:choose>
55
+ </xsl:when>
56
+ <xsl:when test="$longitude">
57
+ <xsl:choose>
58
+ <xsl:when test="number( $value ) &gt; 1">
59
+ <xsl:value-of select="concat( $value, ' E' )"/>
60
+ </xsl:when>
61
+ <xsl:when test="number( $value ) &lt; 1">
62
+ <xsl:value-of select="concat( substring-after( $value, '-' ), ' W' )"/>
63
+ </xsl:when>
64
+ <!-- If zero, just return the value: -->
65
+ <xsl:otherwise>
66
+ <xsl:value-of select="$value"/>
67
+ </xsl:otherwise>
68
+ </xsl:choose>
69
+ </xsl:when>
70
+ </xsl:choose>
71
+ </xsl:template>
72
+
73
+ </xsl:stylesheet>
@@ -0,0 +1,408 @@
1
+ /* box model */
2
+
3
+ BODY {
4
+ margin: 1em;
5
+ }
6
+
7
+ H1 {
8
+ padding: 0.3em 0.5em 0.3em 0.5em;
9
+ margin: 0em;
10
+ }
11
+
12
+ H2 {
13
+ padding: 0.2em 1em 0.2em 0.8em;
14
+ margin: 1em 0em 0em 0em;
15
+ }
16
+
17
+ H3 {
18
+ padding: 0.1em 1em 0.2em 0.8em;
19
+ margin: 0em;
20
+ }
21
+
22
+ H4 {
23
+ padding: 0em;
24
+ margin: 0.5em 1em;
25
+ }
26
+
27
+ H5 {
28
+ padding: 0em;
29
+ margin: 0em 1em;
30
+ }
31
+
32
+ P, TABLE {
33
+ margin: 0.5em 1em;
34
+ }
35
+
36
+ UL, OL {
37
+ margin: 0.5em 2em;
38
+ }
39
+
40
+ UL UL, UL OL, OL UL, OL OL {
41
+ margin: 0.5em 0em;
42
+ }
43
+
44
+ TD.implementations UL {
45
+ margin: 0.5em 0em;
46
+ }
47
+
48
+ TD.implementations LI {
49
+ margin: 0em 2em;
50
+ }
51
+
52
+ LI {
53
+ margin: 0.5em 2em;
54
+ list-style-type: disc;
55
+ }
56
+
57
+ LI P {
58
+ margin: 0em;
59
+ }
60
+
61
+ DL {
62
+ margin: 0.5em 2em 1em 2em;
63
+ }
64
+
65
+ DT {
66
+ margin: 1em;
67
+ clear: both;
68
+ }
69
+
70
+ DD {
71
+ margin: -0.5em 0em -0.5em 2em;
72
+ }
73
+
74
+ DD UL, DD OL {
75
+ margin-left: 0em;
76
+ }
77
+
78
+ BLOCKQUOTE {
79
+ margin-left: 3em;
80
+ }
81
+
82
+ IMG {
83
+ position: relative;
84
+ }
85
+
86
+ TABLE {
87
+ width: 100%;
88
+ margin: 0em;
89
+ }
90
+
91
+ PRE {
92
+ padding: 0.5em 3em 0.5em 3em;
93
+ margin: 0em;
94
+ }
95
+
96
+ #content TD PRE {
97
+ padding: 0em;
98
+ }
99
+
100
+ PRE.copyright {
101
+ padding: 0em;
102
+ margin: 0em;
103
+ }
104
+
105
+ .issue {
106
+ padding: 0em 3em;
107
+ margin: 0em;
108
+ }
109
+
110
+ #menu {
111
+ width: 20%;
112
+ padding: 0em;
113
+ }
114
+
115
+ P.level1, P.level2, P.level3, P.level4 {
116
+ padding: 0em 1em;
117
+ margin: 0em;
118
+ }
119
+
120
+ P.level1 {
121
+ margin: 0em 0em 3px 0em;
122
+ }
123
+
124
+ P.level2 {
125
+ margin: 0em 0em 1px 0em;
126
+ }
127
+
128
+ P.level3 {
129
+ margin-left: 1em;
130
+ }
131
+
132
+ P.level4 {
133
+ margin-left: 2em;
134
+ }
135
+
136
+ #content TH, #content TD {
137
+ margin: 0em;
138
+ padding: 0em 0.5em;
139
+ }
140
+
141
+ #navigation, #content, #colophon P {
142
+ margin-top: 2px;
143
+ }
144
+
145
+ TD.implementations {
146
+ width: 25%;
147
+ }
148
+
149
+ /* fonts */
150
+ BODY, TR {
151
+ font-family: 'Trebuchet MS', Arial, sans-serif;
152
+ }
153
+
154
+ H1, H2, H3, H4, H5, H6 {
155
+ font-family: 'Trebuchet MS', Arial, sans-serif;
156
+ }
157
+
158
+ H1 {
159
+ font-size: 173%;
160
+ font-weight: bold;
161
+ }
162
+
163
+ H2 {
164
+ font-size: 120%;
165
+ font-weight: bold;
166
+ }
167
+
168
+ H3 {
169
+ font-size: 120%;
170
+ font-weight: bold;
171
+ }
172
+
173
+ H4 {
174
+ font-size: 100%;
175
+ font-weight: bold;
176
+ }
177
+
178
+ H5 {
179
+ font-size: 100%
180
+ font-weight: normal;
181
+ font-style: italic;
182
+ }
183
+
184
+ #navigation TD {
185
+ font-weight: bold;
186
+ }
187
+
188
+ DT {
189
+ font-weight: bold;
190
+ }
191
+
192
+ PRE, CODE {
193
+ font-size: 100%;
194
+ }
195
+
196
+ A:link, A:visited, A:active, A:hover {
197
+ font-weight: bold;
198
+ }
199
+
200
+ A.offsite:link, A.offsite:visited, A.offsite:active, A.offsite:hover {
201
+ font-weight: normal;
202
+ }
203
+
204
+ #menu P.level1, P.level1 A:link, P.level1 A:visited, P.level1 A:hover {
205
+ font-weight: bold;
206
+ }
207
+
208
+ #menu P.level2, P.level2 A:link, P.level2 A:visited {
209
+ font-weight: normal;
210
+ }
211
+
212
+ #menu P.level3, P.level3 A:link, P.level3 A:visited {
213
+ font-weight: normal;
214
+ }
215
+
216
+ #menu P.level3, #menu P.level4 {
217
+ font-size: 83%;
218
+ }
219
+
220
+ #menu P.level4, P.level4 A:link, P.level4 A:visited {
221
+ font-weight: normal;
222
+ font-style: italic;
223
+ }
224
+
225
+ .note {
226
+ font-family: 'Trebuchet MS', Arial, sans-serif;
227
+ font-size: 100%;
228
+ font-style: italic;
229
+ }
230
+
231
+ #colophon {
232
+ font-size: 69%;
233
+ }
234
+
235
+ /* colours */
236
+ BODY {
237
+ background: white;
238
+ color: black;
239
+ border: 0px none white;
240
+ }
241
+
242
+ /* this is to make Navigator fill the entire line */
243
+ H1, #content {
244
+ border: 1px solid white;
245
+ width: 100%;
246
+ }
247
+
248
+ H1, H1 A:link, H1 A:visited, H1 A:active, H1 A:hover {
249
+ background: #401;
250
+ color: white;
251
+ }
252
+
253
+ H2 {
254
+ border-top: 5px solid white;
255
+ width: 100%;
256
+ }
257
+
258
+ H2, H2 A:link, H2 A:visited, H2 A:active, H2 A:hover {
259
+ background: #041;
260
+ color: white;
261
+ }
262
+
263
+
264
+ H3 {
265
+ border-top: 3px solid white;
266
+ width: 100%;
267
+ }
268
+
269
+ H3, H3 A:link, H3 A:visited, H3 A:active, H3 A:hover {
270
+ color: #041;
271
+ background: #EFE;
272
+ }
273
+
274
+ #content TABLE {
275
+ border-collapse: collapse;
276
+ }
277
+
278
+ #content TH {
279
+ background: #041;
280
+ color: white;
281
+ }
282
+
283
+ #content TD {
284
+ background: #EFE;
285
+ color: black;
286
+ border: 1px solid #041;
287
+ }
288
+
289
+ #content, #navigation {
290
+ background: #EFE;
291
+ color: black;
292
+ }
293
+
294
+ HR {
295
+ color: #041;
296
+ background: #041;
297
+ }
298
+
299
+ IMG, A:link IMG, A:visited IMG, A:hover IMG, A:active IMG {
300
+ border: 0px none white;
301
+ background: transparent;
302
+ }
303
+
304
+ A:link, A:visited, A:active, A:hover {
305
+ color: #052;
306
+ background: transparent;
307
+ border: 0px none white;
308
+ }
309
+
310
+ .note {
311
+ color: #333;
312
+ }
313
+
314
+ .note A:link, .note A:visited, .note A:hover {
315
+ background: transparent;
316
+ color: #041;
317
+ }
318
+
319
+ .error {
320
+ color: #C00;
321
+ }
322
+
323
+ #colophon {
324
+ color: #333;
325
+ background: #FEE;
326
+ }
327
+
328
+ #colophon A:link, #colophon A:visited, #colophon A:hover {
329
+ color: #401;
330
+ background: transparent;
331
+ }
332
+
333
+ TD.implementations {
334
+ border-left: 1px solid #041;
335
+ }
336
+
337
+ #menu {
338
+ background: #EEF;
339
+ color: #014;
340
+ }
341
+
342
+ #menu P.level1, P.level1 A:link, P.level1 A:visited, P.level1 A:active P.level1 A:hover {
343
+ background: #014;
344
+ color: white;
345
+ }
346
+
347
+ #menu P.level2, P.level2 A:link, P.level2 A:visited, P.level2 A:active P.level2 A:hover,
348
+ #menu P.level3, P.level3 A:link, P.level3 A:visited, P.level3 A:active P.level3 A:hover,
349
+ #menu P.level4, P.level4 A:link, P.level4 A:visited, P.level4 A:active P.level4 A:hover {
350
+ background: #EEF;
351
+ color: #014;
352
+ }
353
+
354
+
355
+ P.level2 A:hover, P.level3 A:hover, P.level4 A:hover {
356
+ text-decoration: underline;
357
+ }
358
+
359
+
360
+ /* text */
361
+ OL OL LI {
362
+ list-style: lower-alpha;
363
+ }
364
+
365
+ TH {
366
+ text-align: left;
367
+ }
368
+
369
+ TD {
370
+ vertical-align: top;
371
+ }
372
+
373
+ #content TH, #content TD {
374
+ text-align: center;
375
+ }
376
+
377
+ #content TH.rowhead, #content TD.rowhead {
378
+ text-align: left;
379
+ }
380
+
381
+ H1 {
382
+ text-transform: uppercase;
383
+ }
384
+
385
+ H2 {
386
+ text-transform: uppercase;
387
+ }
388
+
389
+ H4 {
390
+ text-transform: lowercase;
391
+ }
392
+
393
+ #menu {
394
+ text-transform: lowercase;
395
+ }
396
+
397
+ #navigation TD {
398
+ text-transform: uppercase;
399
+ text-align: center;
400
+ }
401
+
402
+ A.offsite {
403
+ text-decoration: underline;
404
+ }
405
+
406
+ A, A.function, A.element {
407
+ text-decoration: none;
408
+ }