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,267 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+
5
+ <!--
6
+ Print the text of an XML element as preformatted text or wrapped paragraphs,
7
+ as appropriate. Makes the text readable on screen, and preserves the author's
8
+ intended formatting.
9
+
10
+ Created 6/20/06 Richard.Fozzard@noaa.gov
11
+
12
+ @version $Id$
13
+
14
+ The stylesheet that imports this file needs to define two callback templates:
15
+ printFormattedLine Output a line, preserving all formatting (whitespace)
16
+ printParagraphLine Output a line as a continuous paragraph (word-wrapped)
17
+ both with the param "line", the one line string to print.
18
+
19
+ Each callback template then outputs the "line" string as desired (e.g. HTML,
20
+ text, XML). These templates can have some optional params which printFormatted
21
+ will pass through as needed:
22
+ "restOfString" Useful for doing something different at the end, e.g. no <P>
23
+ "optional-param-1" Useful for passing indent values
24
+ "optional-param-2" or word wrap widths...
25
+ "optional-param-3" or whatever...
26
+
27
+ Then, whenever a string of one or more lines needs to be output, call the
28
+ printFormatted template with the params:
29
+ "elementContent" a one or more line string to print
30
+ "formattedSectionElement" Name of element to wrap a sequence of formatted lines
31
+ defaults to 'PRE', can be none, i.e. ''
32
+ plus any of the desired optional params for the callbacks
33
+ -->
34
+
35
+
36
+ <!--
37
+ g-fold-width
38
+ This parameter specifies the maximum length of a line when the
39
+ formattedSectionElement (<pre> by default) is used. The browser
40
+ may wrap PRE text at this width.
41
+ [only works in Firefox 1+]
42
+ -->
43
+ <!-- xsl:param name="g-fold-width" select="'80'"/ -->
44
+
45
+
46
+ <!-- Whitespace characters -->
47
+ <xsl:variable name="newline">
48
+ <xsl:text>&#10;</xsl:text>
49
+ </xsl:variable>
50
+
51
+ <xsl:variable name="tab">
52
+ <xsl:text>&#9;</xsl:text>
53
+ </xsl:variable>
54
+
55
+
56
+ <xsl:template name="printFormatted">
57
+ <!-- string to print out -->
58
+ <xsl:param name="elementContent"/>
59
+ <!-- Name of element to wrap a sequence of formatted lines.
60
+ Set to empty string for no element, i.e. plain text output. -->
61
+ <xsl:param name="formattedSectionElement" select="'PRE'"/>
62
+ <!-- used internally to skip 1 or more formatted lines -->
63
+ <xsl:param name="skipFormattedLines" select="false()"/>
64
+ <!-- if needed by callback template: -->
65
+ <xsl:param name="optional-param-1"/>
66
+ <xsl:param name="optional-param-2"/>
67
+ <xsl:param name="optional-param-3"/>
68
+
69
+ <xsl:if test="$elementContent"><!-- if not at end of string -->
70
+ <xsl:variable name="containsNewline" select="contains($elementContent,$newline)"/>
71
+ <xsl:variable name="firstLine">
72
+ <xsl:call-template name="strip-trailing-whitespace">
73
+ <xsl:with-param name="content">
74
+ <xsl:choose>
75
+ <xsl:when test="$containsNewline">
76
+ <xsl:value-of select="substring-before($elementContent,$newline)"/>
77
+ </xsl:when>
78
+ <xsl:otherwise>
79
+ <xsl:value-of select="$elementContent"/>
80
+ </xsl:otherwise>
81
+ </xsl:choose>
82
+ </xsl:with-param>
83
+ </xsl:call-template>
84
+ </xsl:variable>
85
+
86
+ <xsl:variable name="restOfString" select="substring-after($elementContent,$newline)"/>
87
+
88
+ <!-- This line is formatted if it has 3 spaces or a tab or empty line -->
89
+ <xsl:variable name="thisLineFormatted"
90
+ select="$firstLine = '' or contains($firstLine,' ') or contains($firstLine,$tab)"/>
91
+
92
+
93
+ <xsl:choose>
94
+ <!-- if a formatted line -->
95
+ <xsl:when test="$thisLineFormatted = true()">
96
+
97
+ <!-- if at start of a formatted section, and it's a non-empty line before the end of the element, print it -->
98
+ <xsl:if test="not($skipFormattedLines) and (normalize-space($firstLine) or normalize-space($restOfString))">
99
+ <xsl:choose>
100
+ <!-- if specified, wrap a formatted section (1 or more lines) in an element -->
101
+ <xsl:when test="$formattedSectionElement">
102
+ <xsl:element name="{$formattedSectionElement}">
103
+ <xsl:attribute name="wrap"/><!-- works on Firefox 1.5+, not on IE 6/7, Safari 2 -->
104
+ <!-- xsl:attribute name="width"><xsl:value-of select="$g-fold-width"/></xsl:attribute -->
105
+ <xsl:call-template name="printFormattedSection">
106
+ <xsl:with-param name="elementContent" select="$elementContent"/>
107
+ <xsl:with-param name="optional-param-1" select="$optional-param-1"/>
108
+ <xsl:with-param name="optional-param-2" select="$optional-param-2"/>
109
+ <xsl:with-param name="optional-param-3" select="$optional-param-3"/>
110
+ </xsl:call-template>
111
+ </xsl:element>
112
+ </xsl:when>
113
+
114
+ <!-- else if no element specified,
115
+ output a formatted section (1 or more lines) directly -->
116
+ <xsl:otherwise>
117
+ <xsl:call-template name="printFormattedSection">
118
+ <xsl:with-param name="elementContent" select="$elementContent"/>
119
+ <xsl:with-param name="optional-param-1" select="$optional-param-1"/>
120
+ <xsl:with-param name="optional-param-2" select="$optional-param-2"/>
121
+ <xsl:with-param name="optional-param-3" select="$optional-param-3"/>
122
+ </xsl:call-template>
123
+ </xsl:otherwise>
124
+ </xsl:choose>
125
+ </xsl:if>
126
+
127
+ <!-- go to next line, recursively until next non-formatted line or end of string -->
128
+ <xsl:call-template name="printFormatted">
129
+ <xsl:with-param name="elementContent" select="$restOfString"/>
130
+ <xsl:with-param name="formattedSectionElement" select="$formattedSectionElement"/>
131
+ <xsl:with-param name="skipFormattedLines" select="true()"/>
132
+ <xsl:with-param name="optional-param-1" select="$optional-param-1"/>
133
+ <xsl:with-param name="optional-param-2" select="$optional-param-2"/>
134
+ <xsl:with-param name="optional-param-3" select="$optional-param-3"/>
135
+ </xsl:call-template>
136
+
137
+ </xsl:when>
138
+
139
+ <!-- else not a formatted line; treat as paragraph -->
140
+ <xsl:otherwise>
141
+
142
+ <!-- make callback to importing stylesheet to print the paragraph -->
143
+ <xsl:call-template name="printParagraphLine">
144
+ <xsl:with-param name="line" select="$firstLine"/>
145
+ <xsl:with-param name="restOfString" select="$restOfString"/>
146
+ <xsl:with-param name="optional-param-1" select="$optional-param-1"/>
147
+ <xsl:with-param name="optional-param-2" select="$optional-param-2"/>
148
+ <xsl:with-param name="optional-param-3" select="$optional-param-3"/>
149
+ </xsl:call-template>
150
+
151
+ <!-- go to next line, recursively until non-formatted line or end of string -->
152
+ <xsl:call-template name="printFormatted">
153
+ <xsl:with-param name="elementContent" select="$restOfString"/>
154
+ <xsl:with-param name="formattedSectionElement" select="$formattedSectionElement"/>
155
+ <xsl:with-param name="skipFormattedLines" select="false()"/>
156
+ <xsl:with-param name="optional-param-1" select="$optional-param-1"/>
157
+ <xsl:with-param name="optional-param-2" select="$optional-param-2"/>
158
+ <xsl:with-param name="optional-param-3" select="$optional-param-3"/>
159
+ </xsl:call-template>
160
+
161
+ </xsl:otherwise>
162
+ </xsl:choose>
163
+
164
+ </xsl:if>
165
+ </xsl:template>
166
+
167
+
168
+
169
+ <xsl:template name="printFormattedSection">
170
+ <xsl:param name="elementContent"/><!-- string to print out -->
171
+ <!-- if needed by callback template: -->
172
+ <xsl:param name="optional-param-1"/>
173
+ <xsl:param name="optional-param-2"/>
174
+ <xsl:param name="optional-param-3"/>
175
+
176
+ <xsl:if test="$elementContent"><!-- if not at end of string -->
177
+ <xsl:variable name="firstLine">
178
+ <xsl:call-template name="strip-trailing-whitespace">
179
+ <xsl:with-param name="content" select="substring-before($elementContent,$newline)"/>
180
+ </xsl:call-template>
181
+ </xsl:variable>
182
+
183
+ <xsl:variable name="restOfString" select="substring-after($elementContent,$newline)"/>
184
+
185
+ <!-- This line is formatted if it has 3 spaces or a tab or empty line -->
186
+ <xsl:variable name="thisLineFormatted"
187
+ select="$firstLine = '' or contains($firstLine,' ') or contains($firstLine,$tab)"/>
188
+
189
+
190
+ <xsl:if test="$thisLineFormatted = true()"><!-- if a formatted line -->
191
+ <!-- make callback to importing stylesheet to print the formatted line -->
192
+ <xsl:call-template name="printFormattedLine">
193
+ <xsl:with-param name="line" select="$firstLine"/>
194
+ <xsl:with-param name="restOfString" select="$restOfString"/>
195
+ <xsl:with-param name="optional-param-1" select="$optional-param-1"/>
196
+ <xsl:with-param name="optional-param-2" select="$optional-param-2"/>
197
+ <xsl:with-param name="optional-param-3" select="$optional-param-3"/>
198
+ </xsl:call-template>
199
+
200
+ <!-- recursively call self until all formatted lines written -->
201
+ <xsl:call-template name="printFormattedSection">
202
+ <xsl:with-param name="elementContent" select="$restOfString"/>
203
+ <xsl:with-param name="optional-param-1" select="$optional-param-1"/>
204
+ <xsl:with-param name="optional-param-2" select="$optional-param-2"/>
205
+ <xsl:with-param name="optional-param-3" select="$optional-param-3"/>
206
+ </xsl:call-template>
207
+ </xsl:if>
208
+ <!-- do nothing and end recursion if we find a non-formatted, plain line -->
209
+ </xsl:if>
210
+
211
+ </xsl:template>
212
+
213
+
214
+
215
+
216
+
217
+ <!--
218
+ Strip the leading white space (including newlines or other characters
219
+ that get translated to white space by normalize-space) from a block
220
+ of text.
221
+
222
+ [Stolen from somewhere on the web using Google.]
223
+ -->
224
+
225
+ <xsl:template name="strip-leading-whitespace">
226
+ <xsl:param name="content"/>
227
+ <xsl:variable name="normalized-text" select="normalize-space($content)"/>
228
+ <xsl:variable name="first-char" select="substring($normalized-text,1,1)"/>
229
+ <xsl:variable name="leading-spaces" select="substring-before($content,$first-char)"/>
230
+ <xsl:choose>
231
+ <xsl:when test="string-length($leading-spaces) &gt; 0">
232
+ <xsl:value-of select="substring-after($content,$leading-spaces)"/>
233
+ </xsl:when>
234
+ <xsl:otherwise>
235
+ <xsl:value-of select="$content"/>
236
+ </xsl:otherwise>
237
+ </xsl:choose>
238
+ </xsl:template>
239
+
240
+
241
+ <!--
242
+ Strip the trailing white space (including newlines or other characters
243
+ that get translated to white space by normalize-space) from a block
244
+ of text.
245
+
246
+ [Stolen from somewhere on the web using Google.]
247
+ -->
248
+
249
+ <xsl:template name="strip-trailing-whitespace">
250
+ <xsl:param name="content"/>
251
+ <xsl:param name="i" select="string-length($content)"/>
252
+ <xsl:choose>
253
+ <xsl:when test="translate(substring($content, $i, 1), ' &#9;&#10;&#13;', '')">
254
+ <xsl:value-of select="substring($content,1,$i)"/>
255
+ </xsl:when>
256
+ <xsl:when test="$i &lt; 2"/><!-- done! -->
257
+ <xsl:otherwise>
258
+ <xsl:call-template name="strip-trailing-whitespace">
259
+ <xsl:with-param name="content" select="$content"/>
260
+ <xsl:with-param name="i" select="$i - 1"/>
261
+ </xsl:call-template>
262
+ </xsl:otherwise>
263
+ </xsl:choose>
264
+
265
+ </xsl:template>
266
+
267
+ </xsl:stylesheet>
@@ -0,0 +1,192 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+
5
+ <!--
6
+ Print an XML element as plain formatted text or wrapped paragraphs,
7
+ as appropriate. Makes the text readable on screen, and preserves the author's
8
+ intended formatting.
9
+
10
+ [The 'fold' and 'chop' templates come from original xml-to-text.xsl by Joe
11
+ Shirley.]
12
+
13
+ Created 6/20/06 Richard.Fozzard@noaa.gov
14
+
15
+ @version $Id$
16
+
17
+ This file defines two callback templates used by printFormatted.xsl:
18
+ printFormattedLine Output a line, preserving all formatting (whitespace)
19
+ printParagraphLine Output a line as a continuous paragraph (word-wrapped)
20
+
21
+ -->
22
+
23
+ <!--
24
+ g-fold-width
25
+ This parameter specifies the maximum length of a line when the
26
+ 'fold' text formatting option is chosen. This parameter is ignored
27
+ for other text formatting options.
28
+ -->
29
+ <xsl:param name="g-fold-width" select="'80'"/>
30
+
31
+ <!--
32
+ g-fold-character
33
+ This parameter specifies where a line may be broken when the
34
+ 'fold' text formatting option is chosen. This parameter is ignored
35
+ for other text formatting options.
36
+ -->
37
+ <xsl:param name="g-fold-character" select="' '"/>
38
+
39
+ <xsl:variable name="newline">
40
+ <xsl:text>&#10;</xsl:text>
41
+ </xsl:variable>
42
+
43
+ <xsl:variable name="tab">
44
+ <xsl:text>&#9;</xsl:text>
45
+ </xsl:variable>
46
+
47
+ <!-- Output a single line formatted with all white space preserved. Indent each line
48
+ to the current indent level.
49
+ -->
50
+ <xsl:template name="printFormattedLine">
51
+ <xsl:param name="line"/>
52
+ <xsl:param name="restOfString"/>
53
+ <xsl:param name="optional-param-1"/>
54
+
55
+ <xsl:variable name="indent" select="$optional-param-1"/>
56
+
57
+ <!-- Print next line, unless it's a blank line after final text line. -->
58
+ <xsl:if test="(string-length($line) &gt; 0) or (string-length(normalize-space($restOfString)) &gt; 0)">
59
+ <xsl:value-of select="$indent"/>
60
+ <xsl:value-of select="$line"/>
61
+ <xsl:value-of select="$newline"/>
62
+ </xsl:if>
63
+
64
+ </xsl:template>
65
+
66
+
67
+ <!-- Output a single line formatted as a word-wrapped paragraph. Indent each line
68
+ to the current indent level. Use 'fold' template to do the word-wrapping.
69
+ -->
70
+ <xsl:template name="printParagraphLine">
71
+ <xsl:param name="line"/>
72
+ <xsl:param name="restOfString"/>
73
+ <xsl:param name="optional-param-1"/>
74
+ <xsl:param name="optional-param-2"/>
75
+
76
+ <xsl:variable name="indent" select="$optional-param-1"/>
77
+ <xsl:variable name="length" select="$optional-param-2"/>
78
+
79
+ <!-- Print line with 'fold', unless it's a blank line after final text line. -->
80
+ <xsl:if test="(string-length($line) &gt; 0) or (string-length(normalize-space($restOfString)) &gt; 0)">
81
+ <xsl:value-of select="$indent"/><!-- fold doesn't indent first line -->
82
+ <xsl:call-template name="fold">
83
+ <xsl:with-param name="original-string" select="normalize-space($line)"/>
84
+ <xsl:with-param name="length" select="$length"/>
85
+ <xsl:with-param name="indent" select="$indent"/>
86
+ </xsl:call-template>
87
+ </xsl:if>
88
+
89
+ </xsl:template>
90
+
91
+ <!--
92
+ Text formatting template. Create line breaks. Indent each line to
93
+ the current indent level. Return the next line each time the
94
+ template is called.
95
+ -->
96
+
97
+ <xsl:template name="fold">
98
+ <xsl:param name="original-string"/>
99
+ <xsl:param name="length"/>
100
+ <xsl:param name="indent"/>
101
+ <xsl:param name="fold-width" select="$g-fold-width"/>
102
+ <xsl:variable name="printstring">
103
+ <xsl:choose>
104
+ <xsl:when test="string-length($original-string) &gt; number($length)">
105
+ <!-- Text is longer than max, chop it down and print next line. -->
106
+ <xsl:call-template name="chop">
107
+ <xsl:with-param name="newstring" select="''"/>
108
+ <xsl:with-param name="original-string" select="$original-string"/>
109
+ <xsl:with-param name="length" select="$length"/>
110
+ </xsl:call-template>
111
+ </xsl:when>
112
+ <xsl:otherwise>
113
+ <xsl:value-of select="$original-string"/>
114
+ </xsl:otherwise>
115
+ </xsl:choose>
116
+ </xsl:variable>
117
+ <xsl:value-of select="$printstring"/>
118
+ <xsl:value-of select="$newline"/>
119
+ <xsl:variable name="str" select="substring-after($original-string, $printstring)"/>
120
+ <xsl:if test="string-length($str)">
121
+ <!-- More text, call fold recursively. -->
122
+ <xsl:value-of select="$indent"/>
123
+ <xsl:call-template name="fold">
124
+ <xsl:with-param name="original-string" select="$str"/>
125
+ <xsl:with-param name="length" select="number($fold-width) - string-length($indent)"/>
126
+ <xsl:with-param name="indent" select="$indent"/>
127
+ </xsl:call-template>
128
+ </xsl:if>
129
+ </xsl:template>
130
+
131
+
132
+ <!--
133
+ Create line breaks. Break only at specified line break
134
+ character. If possible keep lines less than a specified maximum
135
+ length, otherwise break at first acceptable character after
136
+ maximum length. Return one line each time the template is called.
137
+ -->
138
+
139
+ <xsl:template name="chop">
140
+ <xsl:param name="newstring"/>
141
+ <xsl:param name="original-string"/>
142
+ <xsl:param name="char" select="$g-fold-character"/>
143
+ <xsl:param name="length"/>
144
+ <xsl:variable name="str1">
145
+ <!-- str1 is the part before the break. -->
146
+ <xsl:choose>
147
+ <xsl:when test="contains($original-string, $char)">
148
+ <!-- The text contains a break character, chop it off. -->
149
+ <xsl:value-of select="concat($newstring, substring-before($original-string, $char), $char)"/>
150
+ </xsl:when>
151
+ <xsl:otherwise>
152
+ <!-- The text contains no break character, use it all. -->
153
+ <xsl:value-of select="concat($newstring, $original-string)"/>
154
+ </xsl:otherwise>
155
+ </xsl:choose>
156
+ </xsl:variable>
157
+ <xsl:variable name="str2">
158
+ <!-- str2 is the part after the break. -->
159
+ <xsl:choose>
160
+ <xsl:when test="contains($original-string, $char)">
161
+ <!-- The text contains a break character, take what is after that. -->
162
+ <xsl:value-of select="substring-after($original-string, $char)"/>
163
+ </xsl:when>
164
+ <xsl:otherwise>
165
+ <!-- The text contains no break character, use an empty string. -->
166
+ <xsl:value-of select="''"/>
167
+ </xsl:otherwise>
168
+ </xsl:choose>
169
+ </xsl:variable>
170
+ <xsl:choose>
171
+ <xsl:when test="(string-length($str1) &lt; number($length)) and $str2">
172
+ <xsl:variable name="return-value">
173
+ <xsl:call-template name="chop">
174
+ <xsl:with-param name="newstring" select="$str1"/>
175
+ <xsl:with-param name="original-string" select="$str2"/>
176
+ <xsl:with-param name="char" select="$char"/>
177
+ <xsl:with-param name="length" select="$length"/>
178
+ </xsl:call-template>
179
+ </xsl:variable>
180
+ <xsl:value-of select="$return-value"/>
181
+ </xsl:when>
182
+ <xsl:when test="$newstring">
183
+ <xsl:value-of select="$newstring"/>
184
+ </xsl:when>
185
+ <xsl:otherwise>
186
+ <xsl:value-of select="$str1"/>
187
+ </xsl:otherwise>
188
+ </xsl:choose>
189
+ </xsl:template>
190
+
191
+
192
+ </xsl:stylesheet>