geoblacklight-schema 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/LICENSE +14 -0
- data/README.md +44 -0
- data/bin/fgdc2mods.rb +5 -0
- data/bin/mods2geoblacklight.rb +5 -0
- data/bin/xsltproc-saxon +14 -0
- data/conf/protwords.txt +21 -0
- data/conf/schema.xml +158 -0
- data/conf/solrconfig.xml +160 -0
- data/conf/stopwords_en.txt +34 -0
- data/conf/synonyms.txt +29 -0
- data/examples/Gemfile +4 -0
- data/examples/generate-example-doc.rb +42 -0
- data/examples/selected.json +5787 -0
- data/examples/upload-to-solr.rb +50 -0
- data/geoblacklight-schema.gemspec +23 -0
- data/lib/geoblacklight/gazetteer.csv +1011 -0
- data/lib/geoblacklight/gazetteer.rb +104 -0
- data/lib/xslt/arcgis_to_iso19110.xsl +364 -0
- data/lib/xslt/fgdc2mods.xsl +1007 -0
- data/lib/xslt/iso2mods.xsl +939 -0
- data/lib/xslt/mods2geoblacklight.xsl +268 -0
- data/lib/xslt/mods2ogp.xsl +195 -0
- data/tools/fgdc2html/Gemfile +2 -0
- data/tools/fgdc2html/fgdc2html.css +71 -0
- data/tools/fgdc2html/fgdc2html.js +6 -0
- data/tools/fgdc2html/fgdc2html.xsl +1034 -0
- data/tools/fgdc2html/render.rb +30 -0
- data/tools/iso2html/Gemfile +2 -0
- data/tools/iso2html/iso-html.xsl +1745 -0
- data/tools/iso2html/render.rb +24 -0
- data/tools/iso2html/utils/convert-enumerations.xsl +97 -0
- data/tools/iso2html/utils/convert-latlong.xsl +73 -0
- data/tools/iso2html/utils/decode-uri/base.css +408 -0
- data/tools/iso2html/utils/decode-uri/index.html +29 -0
- data/tools/iso2html/utils/elements-fgdc.xml +824 -0
- data/tools/iso2html/utils/elements-iso.xml +636 -0
- data/tools/iso2html/utils/printFormatted.xsl +267 -0
- data/tools/iso2html/utils/printTextLines.xsl +192 -0
- data/tools/iso2html/utils/replace-newlines.xsl +97 -0
- data/tools/iso2html/utils/replace-string.xsl +80 -0
- data/tools/iso2html/utils/strip-digits.xsl +60 -0
- data/tools/iso2html/utils/url-decode.xsl +87 -0
- data/tools/iso2html/utils/wrap-text.xsl +174 -0
- data/tools/ogp/0_download.rb +96 -0
- data/tools/ogp/1_validate.rb +225 -0
- data/tools/ogp/2_transform.rb +438 -0
- data/tools/ogp/3_stanford.rb +35 -0
- data/tools/ogp/4_select.rb +189 -0
- data/tools/ogp/5_ingest.rb +55 -0
- data/tools/ogp/Gemfile +2 -0
- data/tools/solr/Gemfile +3 -0
- data/tools/solr/purge.rb +33 -0
- data/tools/solr/upload.rb +35 -0
- data/vendor/.keep +0 -0
- metadata +131 -0
@@ -0,0 +1,268 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!--
|
3
|
+
mods2geoblacklight.xsl - Transforms MODS with GML extensions into a GeoBlacklight document
|
4
|
+
|
5
|
+
Copyright 2014, Stanford University Libraries.
|
6
|
+
|
7
|
+
Created by Darren Hardy.
|
8
|
+
|
9
|
+
Example usage:
|
10
|
+
|
11
|
+
xsltproc -stringparam geoserver_root 'http://example.com/geoserver'
|
12
|
+
-stringparam wxs_geoserver_root 'http://example.com/geoserver'
|
13
|
+
-stringparam now '2014-04-30T21:17:41Z'
|
14
|
+
-stringparam rights 'Public'
|
15
|
+
-stringparam stacks_root 'http://stacks.example.com'
|
16
|
+
-output '/var/geomdtk/current/workspace/fw/920/bc/5473/fw920bc5473/temp/geoblacklightSolr.xml'
|
17
|
+
'/home/geostaff/geomdtk/current/lib/geomdtk/mods2geoblacklight.xsl'
|
18
|
+
'/var/geomdtk/current/workspace/fw/920/bc/5473/fw920bc5473/metadata/descMetadata.xml'
|
19
|
+
|
20
|
+
Requires parameters:
|
21
|
+
|
22
|
+
- geoserver_root - URL prefix to the geoserver for WMS
|
23
|
+
- wxs_geoserver_root - URL prefix to the geoserver for WFS/WCS
|
24
|
+
- stacks_root - URL prefix to the download server
|
25
|
+
- now - the current date/time
|
26
|
+
- rights - the rights for the object
|
27
|
+
|
28
|
+
-->
|
29
|
+
<xsl:stylesheet xmlns="http://lucene.apache.org/solr/4/document" xmlns:gml="http://www.opengis.net/gml/3.2/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="gml mods rdf xsl dc">
|
30
|
+
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
|
31
|
+
<xsl:strip-space elements="*"/>
|
32
|
+
<xsl:template match="/mods:mods">
|
33
|
+
<!-- XXX: Handle other institution naming schemes -->
|
34
|
+
<xsl:variable name="purl" select="mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/@rdf:about"/>
|
35
|
+
<xsl:variable name="druid" select="substring($purl, string-length($purl)-10)"/>
|
36
|
+
<add>
|
37
|
+
<doc>
|
38
|
+
<field name="uuid">
|
39
|
+
<xsl:value-of select="$purl"/>
|
40
|
+
</field>
|
41
|
+
<field name="dc_identifier_s">
|
42
|
+
<xsl:value-of select="$purl"/>
|
43
|
+
</field>
|
44
|
+
<field name="dc_title_s">
|
45
|
+
<xsl:value-of select="mods:titleInfo/mods:title[not(@type)]/text()"/>
|
46
|
+
</field>
|
47
|
+
<field name="dc_description_s">
|
48
|
+
<xsl:for-each select="mods:abstract[@displayLabel='Abstract' or @displayLabel='Purpose']">
|
49
|
+
<xsl:value-of select="text()"/>
|
50
|
+
</xsl:for-each>
|
51
|
+
</field>
|
52
|
+
<field name="dc_rights_s">
|
53
|
+
<xsl:value-of select="$rights"/>
|
54
|
+
</field>
|
55
|
+
<field name="dct_provenance_s">
|
56
|
+
<xsl:value-of select="mods:recordInfo/mods:recordContentSource/text()"/>
|
57
|
+
</field>
|
58
|
+
<field name="dct_references_s">
|
59
|
+
<xsl:text>{</xsl:text>
|
60
|
+
<xsl:text>"http://schema.org/url":"</xsl:text>
|
61
|
+
<xsl:value-of select="$purl"/>
|
62
|
+
<xsl:text>",</xsl:text>
|
63
|
+
<xsl:text>"http://schema.org/downloadUrl":"</xsl:text>
|
64
|
+
<xsl:value-of select="$stacks_root"/>
|
65
|
+
<xsl:text>/file/druid:</xsl:text>
|
66
|
+
<xsl:value-of select="$druid"/>
|
67
|
+
<xsl:text>/data.zip",</xsl:text>
|
68
|
+
<xsl:text>"http://www.loc.gov/mods/v3":"</xsl:text>
|
69
|
+
<xsl:value-of select="$purl"/>
|
70
|
+
<xsl:text>.mods",</xsl:text>
|
71
|
+
<xsl:text>"http://www.isotc211.org/schemas/2005/gmd/":"</xsl:text>
|
72
|
+
<xsl:text>http://opengeometadata.stanford.edu/metadata/edu.stanford.purl/druid:</xsl:text>
|
73
|
+
<xsl:value-of select="$druid"/>
|
74
|
+
<xsl:text>/iso19139.xml",</xsl:text>
|
75
|
+
<xsl:text>"http://www.w3.org/1999/xhtml":"</xsl:text>
|
76
|
+
<xsl:text>http://opengeometadata.stanford.edu/metadata/edu.stanford.purl/druid:</xsl:text>
|
77
|
+
<xsl:value-of select="$druid"/>
|
78
|
+
<xsl:text>/default.html",</xsl:text>
|
79
|
+
<xsl:if test="substring-after(mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:format/text(), 'format=')='Shapefile'">
|
80
|
+
<xsl:text>"http://www.opengis.net/def/serviceType/ogc/wfs":"</xsl:text>
|
81
|
+
<xsl:value-of select="$wxs_geoserver_root"/>
|
82
|
+
<xsl:text>/wfs",</xsl:text>
|
83
|
+
</xsl:if>
|
84
|
+
<xsl:if test="substring-after(mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:format/text(), 'format=')='GeoTIFF'">
|
85
|
+
<xsl:text>"http://www.opengis.net/def/serviceType/ogc/wcs":"</xsl:text>
|
86
|
+
<xsl:value-of select="$wxs_geoserver_root"/>
|
87
|
+
<xsl:text>/wcs",</xsl:text>
|
88
|
+
<!-- <xsl:text>"http://iiif.io/api/image":"</xsl:text>
|
89
|
+
<xsl:value-of select="$purl"/>
|
90
|
+
<xsl:text>/iiif",</xsl:text> -->
|
91
|
+
</xsl:if>
|
92
|
+
<xsl:if test="substring-after(mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:format/text(), 'format=')='ArcGRID'">
|
93
|
+
<xsl:text>"http://www.opengis.net/def/serviceType/ogc/wcs":"</xsl:text>
|
94
|
+
<xsl:value-of select="$wxs_geoserver_root"/>
|
95
|
+
<xsl:text>/wcs",</xsl:text>
|
96
|
+
<!-- <xsl:text>"http://iiif.io/api/image":"</xsl:text>
|
97
|
+
<xsl:value-of select="$purl"/>
|
98
|
+
<xsl:text>/iiif",</xsl:text> -->
|
99
|
+
</xsl:if>
|
100
|
+
<xsl:text>"http://www.opengis.net/def/serviceType/ogc/wms":"</xsl:text>
|
101
|
+
<xsl:value-of select="$geoserver_root"/>
|
102
|
+
<xsl:text>/wms"</xsl:text>
|
103
|
+
<xsl:text>}</xsl:text>
|
104
|
+
</field>
|
105
|
+
<!-- XXX: Handle other institution naming schemes -->
|
106
|
+
<field name="layer_id_s">
|
107
|
+
<xsl:text>druid:</xsl:text><xsl:value-of select="$druid"/>
|
108
|
+
</field>
|
109
|
+
<!-- XXX: Handle other institutions -->
|
110
|
+
<field name="layer_slug_s">
|
111
|
+
<xsl:text>stanford-</xsl:text><xsl:value-of select="$druid"/>
|
112
|
+
</field>
|
113
|
+
<xsl:for-each select="mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:type">
|
114
|
+
<field name="layer_geom_type_s">
|
115
|
+
<xsl:choose>
|
116
|
+
<xsl:when test="substring-after(., '#')='LineString'">
|
117
|
+
<xsl:text>Line</xsl:text>
|
118
|
+
</xsl:when>
|
119
|
+
<xsl:otherwise>
|
120
|
+
<xsl:value-of select="substring-after(., '#')"/>
|
121
|
+
</xsl:otherwise>
|
122
|
+
</xsl:choose>
|
123
|
+
</field>
|
124
|
+
</xsl:for-each>
|
125
|
+
<field name="layer_modified_dt">
|
126
|
+
<xsl:value-of select='$now'/>
|
127
|
+
</field>
|
128
|
+
<field name="dc_format_s">
|
129
|
+
<xsl:value-of select="substring-after(mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:format/text(), 'format=')"/>
|
130
|
+
</field>
|
131
|
+
<!-- XXX: Handle other languages - get from MODS -->
|
132
|
+
<field name="dc_language_s">
|
133
|
+
<xsl:text>English</xsl:text>
|
134
|
+
</field>
|
135
|
+
<field name="dc_type_s">
|
136
|
+
<xsl:value-of select="substring-before(mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:type/text(),'#')"/>
|
137
|
+
</field>
|
138
|
+
<field name="dc_publisher_s">
|
139
|
+
<xsl:value-of select="mods:originInfo/mods:publisher"/>
|
140
|
+
</field>
|
141
|
+
<xsl:for-each select="mods:name">
|
142
|
+
<field name="dc_creator_sm">
|
143
|
+
<xsl:value-of select="mods:namePart"/>
|
144
|
+
</field>
|
145
|
+
</xsl:for-each>
|
146
|
+
<xsl:for-each select="mods:subject/mods:topic">
|
147
|
+
<xsl:choose>
|
148
|
+
<xsl:when test="@authority='ISO19115topicCategory'">
|
149
|
+
<field name="dc_subject_sm">
|
150
|
+
<xsl:value-of select="@valueURI"/>
|
151
|
+
</field>
|
152
|
+
</xsl:when>
|
153
|
+
<xsl:when test="text()!=''">
|
154
|
+
<field name="dc_subject_sm">
|
155
|
+
<xsl:value-of select="text()"/>
|
156
|
+
</field>
|
157
|
+
</xsl:when>
|
158
|
+
</xsl:choose>
|
159
|
+
</xsl:for-each>
|
160
|
+
<xsl:choose>
|
161
|
+
<xsl:when test="mods:originInfo/mods:dateIssued">
|
162
|
+
<field name="dct_issued_s">
|
163
|
+
<xsl:value-of select="mods:originInfo/mods:dateIssued"/>
|
164
|
+
</field>
|
165
|
+
</xsl:when>
|
166
|
+
</xsl:choose>
|
167
|
+
<xsl:for-each select="mods:subject/mods:temporal">
|
168
|
+
<field name="dct_temporal_sm">
|
169
|
+
<xsl:value-of select="text()"/>
|
170
|
+
</field>
|
171
|
+
</xsl:for-each>
|
172
|
+
<xsl:if test="mods:relatedItem[@type='host']">
|
173
|
+
<field name="dct_isPartOf_sm">
|
174
|
+
<xsl:value-of select="mods:relatedItem/mods:titleInfo/mods:title"/>
|
175
|
+
</field>
|
176
|
+
</xsl:if>
|
177
|
+
<xsl:for-each select="mods:subject/mods:geographic">
|
178
|
+
<field name="dct_spatial_sm">
|
179
|
+
<xsl:value-of select="text()"/>
|
180
|
+
</field>
|
181
|
+
</xsl:for-each>
|
182
|
+
<xsl:for-each select="mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:coverage">
|
183
|
+
<!-- XXX: leads to duplicates <field name="dct_spatial_sm">
|
184
|
+
<xsl:value-of select="@dc:title"/>
|
185
|
+
</field> -->
|
186
|
+
<xsl:if test="@rdf:resource!=''">
|
187
|
+
<field name="dc_relation_sm">
|
188
|
+
<xsl:value-of select="@rdf:resource"/>
|
189
|
+
</field>
|
190
|
+
</xsl:if>
|
191
|
+
</xsl:for-each>
|
192
|
+
<xsl:for-each select="mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/gml:boundedBy/gml:Envelope">
|
193
|
+
<xsl:variable name="x2" select="number(substring-before(gml:upperCorner/text(), ' '))"/><!-- E -->
|
194
|
+
<xsl:variable name="x1" select="number(substring-before(gml:lowerCorner/text(), ' '))"/><!-- W -->
|
195
|
+
<xsl:variable name="y2" select="number(substring-after(gml:upperCorner/text(), ' '))"/><!-- N -->
|
196
|
+
<xsl:variable name="y1" select="number(substring-after(gml:lowerCorner/text(), ' '))"/><!-- S -->
|
197
|
+
<field name="georss_box_s">
|
198
|
+
<xsl:value-of select="$y1"/>
|
199
|
+
<xsl:text> </xsl:text>
|
200
|
+
<xsl:value-of select="$x1"/>
|
201
|
+
<xsl:text> </xsl:text>
|
202
|
+
<xsl:value-of select="$y2"/>
|
203
|
+
<xsl:text> </xsl:text>
|
204
|
+
<xsl:value-of select="$x2"/>
|
205
|
+
</field>
|
206
|
+
<field name="georss_polygon_s">
|
207
|
+
<xsl:text></xsl:text>
|
208
|
+
<xsl:value-of select="$y1"/>
|
209
|
+
<xsl:text> </xsl:text>
|
210
|
+
<xsl:value-of select="$x1"/>
|
211
|
+
<xsl:text> </xsl:text>
|
212
|
+
<xsl:value-of select="$y2"/>
|
213
|
+
<xsl:text> </xsl:text>
|
214
|
+
<xsl:value-of select="$x1"/>
|
215
|
+
<xsl:text> </xsl:text>
|
216
|
+
<xsl:value-of select="$y2"/>
|
217
|
+
<xsl:text> </xsl:text>
|
218
|
+
<xsl:value-of select="$x2"/>
|
219
|
+
<xsl:text> </xsl:text>
|
220
|
+
<xsl:value-of select="$y1"/>
|
221
|
+
<xsl:text> </xsl:text>
|
222
|
+
<xsl:value-of select="$x2"/>
|
223
|
+
<xsl:text> </xsl:text>
|
224
|
+
<xsl:value-of select="$y1"/>
|
225
|
+
<xsl:text> </xsl:text>
|
226
|
+
<xsl:value-of select="$x1"/>
|
227
|
+
</field>
|
228
|
+
<field name="solr_geom">
|
229
|
+
<xsl:text>ENVELOPE(</xsl:text>
|
230
|
+
<xsl:value-of select="$x1"/>
|
231
|
+
<xsl:text>, </xsl:text>
|
232
|
+
<xsl:value-of select="$x2"/>
|
233
|
+
<xsl:text>, </xsl:text>
|
234
|
+
<xsl:value-of select="$y2"/>
|
235
|
+
<xsl:text>, </xsl:text>
|
236
|
+
<xsl:value-of select="$y1"/>
|
237
|
+
<xsl:text>)</xsl:text>
|
238
|
+
</field>
|
239
|
+
<field name="solr_bbox">
|
240
|
+
<xsl:value-of select="$x1"/>
|
241
|
+
<xsl:text> </xsl:text>
|
242
|
+
<xsl:value-of select="$y1"/>
|
243
|
+
<xsl:text> </xsl:text>
|
244
|
+
<xsl:value-of select="$x2"/>
|
245
|
+
<xsl:text> </xsl:text>
|
246
|
+
<xsl:value-of select="$y2"/>
|
247
|
+
</field>
|
248
|
+
<!-- <field name="solr_sw_pt">
|
249
|
+
<xsl:value-of select="$y1"/>
|
250
|
+
<xsl:text>,</xsl:text>
|
251
|
+
<xsl:value-of select="$x1"/>
|
252
|
+
</field>
|
253
|
+
<field name="solr_ne_pt">
|
254
|
+
<xsl:value-of select="$y2"/>
|
255
|
+
<xsl:text>,</xsl:text>
|
256
|
+
<xsl:value-of select="$x2"/>
|
257
|
+
</field> -->
|
258
|
+
</xsl:for-each>
|
259
|
+
<xsl:if test="mods:subject/mods:temporal[1]">
|
260
|
+
<field name="solr_year_i">
|
261
|
+
<xsl:value-of select="substring(mods:subject/mods:temporal[1]/text(), 1, 4)"/>
|
262
|
+
</field>
|
263
|
+
</xsl:if>
|
264
|
+
</doc>
|
265
|
+
</add>
|
266
|
+
</xsl:template>
|
267
|
+
<xsl:template match="*"/>
|
268
|
+
</xsl:stylesheet>
|
@@ -0,0 +1,195 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!--
|
3
|
+
mods2ogp.xsl - Transforms MODS with GML extensions into an OGP Solr document
|
4
|
+
|
5
|
+
Copyright 2013, Stanford University Libraries.
|
6
|
+
|
7
|
+
Created by Darren Hardy.
|
8
|
+
|
9
|
+
For OGP Solr schema, see:
|
10
|
+
|
11
|
+
https://github.com/OpenGeoportal/ogpSolrConfig/blob/master/ogpSolrConfig/SolrConfig/schema.xml
|
12
|
+
|
13
|
+
Example usage:
|
14
|
+
|
15
|
+
xsltproc -stringparam geoserver_root 'http://kurma-podd1.stanford.edu/geoserver'
|
16
|
+
-stringparam purl 'http://purl-dev.stanford.edu/fw920bc5473'
|
17
|
+
-output '/var/geomdtk/current/workspace/fw/920/bc/5473/fw920bc5473/temp/ogpSolr.xml'
|
18
|
+
'/home/geostaff/geomdtk/current/lib/geomdtk/mods2ogp.xsl'
|
19
|
+
'/var/geomdtk/current/workspace/fw/920/bc/5473/fw920bc5473/metadata/descMetadata.xml'
|
20
|
+
|
21
|
+
Requires parameters:
|
22
|
+
|
23
|
+
- geoserver_root - URL prefix to the geoserver
|
24
|
+
- purl - complete URL with aa111bb1111 (len = 11)
|
25
|
+
|
26
|
+
-->
|
27
|
+
<xsl:stylesheet xmlns="http://lucene.apache.org/solr/4/document" xmlns:gml="http://www.opengis.net/gml/3.2/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="gml mods rdf xsl">
|
28
|
+
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
|
29
|
+
<xsl:strip-space elements="*"/>
|
30
|
+
<xsl:template match="/mods:mods">
|
31
|
+
<xsl:variable name="druid" select="substring($purl, string-length($purl)-10)"/>
|
32
|
+
<add>
|
33
|
+
<doc>
|
34
|
+
<field name="LayerId">
|
35
|
+
<!-- REQUIRED -->
|
36
|
+
<xsl:value-of select="$druid"/>
|
37
|
+
</field>
|
38
|
+
<field name="Name">
|
39
|
+
<!-- REQUIRED -->
|
40
|
+
<xsl:value-of select="$druid"/>
|
41
|
+
</field>
|
42
|
+
<field name="ExternalLayerId">
|
43
|
+
<xsl:value-of select="$purl"/>
|
44
|
+
</field>
|
45
|
+
<field name="CollectionId">
|
46
|
+
<xsl:value-of select="mods:relatedItem/mods:titleInfo/mods:title"/>
|
47
|
+
</field>
|
48
|
+
<field name="Access">
|
49
|
+
<!-- REQUIRED: Uses Public due to GIS-7 -->
|
50
|
+
<xsl:text>Public</xsl:text>
|
51
|
+
</field>
|
52
|
+
<field name="Institution">
|
53
|
+
<!-- REQUIRED -->
|
54
|
+
<xsl:text>Stanford</xsl:text>
|
55
|
+
</field>
|
56
|
+
<field name="WorkspaceName">
|
57
|
+
<xsl:text>druid</xsl:text>
|
58
|
+
</field>
|
59
|
+
<field name="GeoReferenced">
|
60
|
+
<xsl:text>true</xsl:text>
|
61
|
+
</field>
|
62
|
+
<field name="Availability">
|
63
|
+
<xsl:text>Online</xsl:text>
|
64
|
+
</field>
|
65
|
+
<xsl:comment>XXX - MODS data are year only but OGP's solr schema requires full date</xsl:comment>
|
66
|
+
<field name="ContentDate">
|
67
|
+
<xsl:choose>
|
68
|
+
<xsl:when test="mods:subject/mods:temporal">
|
69
|
+
<xsl:value-of select="substring(mods:subject/mods:temporal, 1, 4)"/>
|
70
|
+
<xsl:text>-01-01T00:00:00Z</xsl:text>
|
71
|
+
</xsl:when>
|
72
|
+
<xsl:when test="mods:originInfo/mods:dateIssued">
|
73
|
+
<xsl:value-of select="substring(mods:originInfo/mods:dateIssued, 1, 4)"/>
|
74
|
+
<xsl:text>-01-01T00:00:00Z</xsl:text>
|
75
|
+
</xsl:when>
|
76
|
+
</xsl:choose>
|
77
|
+
</field>
|
78
|
+
<field name="LayerDisplayName">
|
79
|
+
<!-- REQUIRED -->
|
80
|
+
<xsl:value-of select="mods:titleInfo/mods:title[not(@type)]"/>
|
81
|
+
</field>
|
82
|
+
<!-- <xsl:value-of select="'XXX'"/> -->
|
83
|
+
<xsl:for-each select="mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/dc:type">
|
84
|
+
<field name="DataType">
|
85
|
+
<xsl:choose>
|
86
|
+
<xsl:when test="substring(., 9)='LineString'">
|
87
|
+
<xsl:text>Line</xsl:text>
|
88
|
+
</xsl:when>
|
89
|
+
<xsl:otherwise>
|
90
|
+
<xsl:value-of select='substring(., 9)'/><!-- strip Dataset# prefix -->
|
91
|
+
</xsl:otherwise>
|
92
|
+
</xsl:choose>
|
93
|
+
</field>
|
94
|
+
</xsl:for-each>
|
95
|
+
<field name="Publisher">
|
96
|
+
<xsl:value-of select="mods:originInfo/mods:publisher"/>
|
97
|
+
</field>
|
98
|
+
<field name="Originator">
|
99
|
+
<xsl:for-each select="mods:name">
|
100
|
+
<xsl:value-of select="mods:namePart"/>
|
101
|
+
<xsl:if test="position()!=last()">
|
102
|
+
<xsl:text>; </xsl:text>
|
103
|
+
</xsl:if>
|
104
|
+
</xsl:for-each>
|
105
|
+
</field>
|
106
|
+
<field name="Abstract">
|
107
|
+
<xsl:for-each select="mods:abstract[@displayLabel='Abstract' or @displayLabel='Purpose']/text()">
|
108
|
+
<xsl:value-of select="."/>
|
109
|
+
<xsl:text>; </xsl:text>
|
110
|
+
</xsl:for-each>
|
111
|
+
</field>
|
112
|
+
<field name="ThemeKeywords">
|
113
|
+
<xsl:for-each select="mods:subject/mods:topic">
|
114
|
+
<xsl:choose>
|
115
|
+
<xsl:when test="@authority='ISO19115topicCategory'">
|
116
|
+
<xsl:value-of select="@valueURI"/>
|
117
|
+
</xsl:when>
|
118
|
+
|
119
|
+
<xsl:otherwise>
|
120
|
+
<xsl:value-of select="text()"/>
|
121
|
+
</xsl:otherwise>
|
122
|
+
</xsl:choose>
|
123
|
+
|
124
|
+
<xsl:text>; </xsl:text>
|
125
|
+
</xsl:for-each>
|
126
|
+
|
127
|
+
</field>
|
128
|
+
<field name="PlaceKeywords">
|
129
|
+
<xsl:for-each select="mods:subject/mods:geographic">
|
130
|
+
<xsl:value-of select="text()"/>
|
131
|
+
<xsl:text>; </xsl:text>
|
132
|
+
</xsl:for-each>
|
133
|
+
</field>
|
134
|
+
<xsl:for-each select="mods:extension[@displayLabel='geo']/rdf:RDF/rdf:Description/gml:boundedBy/gml:Envelope">
|
135
|
+
<xsl:variable name="x2" select="number(substring-before(gml:upperCorner/text(), ' '))"/>
|
136
|
+
<xsl:variable name="x1" select="number(substring-before(gml:lowerCorner/text(), ' '))"/>
|
137
|
+
<xsl:variable name="y2" select="number(substring-after(gml:upperCorner/text(), ' '))"/>
|
138
|
+
<xsl:variable name="y1" select="number(substring-after(gml:lowerCorner/text(), ' '))"/>
|
139
|
+
<field name="MinX">
|
140
|
+
<xsl:value-of select="$x1"/>
|
141
|
+
</field>
|
142
|
+
<field name="MinY">
|
143
|
+
<xsl:value-of select="$y1"/>
|
144
|
+
</field>
|
145
|
+
<field name="MaxX">
|
146
|
+
<xsl:value-of select="$x2"/>
|
147
|
+
</field>
|
148
|
+
<field name="MaxY">
|
149
|
+
<xsl:value-of select="$y2"/>
|
150
|
+
</field>
|
151
|
+
<xsl:comment> XXX: doesn't work across meridian </xsl:comment>
|
152
|
+
<field name="CenterX">
|
153
|
+
<xsl:value-of select="($x2 - $x1) div 2 + $x1"/>
|
154
|
+
</field>
|
155
|
+
<xsl:comment> XXX: doesn't work across meridian </xsl:comment>
|
156
|
+
<field name="CenterY">
|
157
|
+
<xsl:value-of select="($y2 - $y1) div 2 + $y1"/>
|
158
|
+
</field>
|
159
|
+
<xsl:comment> XXX: in degrees ??? </xsl:comment>
|
160
|
+
<field name="HalfWidth">
|
161
|
+
<xsl:value-of select="($x2 - $x1) div 2"/>
|
162
|
+
</field>
|
163
|
+
<xsl:comment> XXX: in degrees ??? </xsl:comment>
|
164
|
+
<field name="HalfHeight">
|
165
|
+
<xsl:value-of select="($y2 - $y1) div 2"/>
|
166
|
+
</field>
|
167
|
+
<xsl:comment> XXX: in degrees**2 ??? </xsl:comment>
|
168
|
+
<field name="Area">
|
169
|
+
<xsl:value-of select="round(($y2 - $y1) * ($x2 - $x1))"/>
|
170
|
+
</field>
|
171
|
+
<field name="SrsProjectionCode">
|
172
|
+
<xsl:value-of select="@srsName"/>
|
173
|
+
</field>
|
174
|
+
</xsl:for-each>
|
175
|
+
<field name="Location">
|
176
|
+
<!-- output is JSON so we wrap in CDATA -->
|
177
|
+
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
|
178
|
+
<xsl:text>{
|
179
|
+
"wms": ["</xsl:text>
|
180
|
+
<xsl:value-of select="$geoserver_root"/>
|
181
|
+
<xsl:text>/wms"],
|
182
|
+
"wfs": ["</xsl:text>
|
183
|
+
<xsl:value-of select="$geoserver_root"/>
|
184
|
+
<xsl:text>/wfs"],
|
185
|
+
"purl": ["</xsl:text>
|
186
|
+
<xsl:value-of select="$purl"/>
|
187
|
+
<xsl:text>"] }</xsl:text>
|
188
|
+
<xsl:text disable-output-escaping="yes">]]></xsl:text>
|
189
|
+
</field>
|
190
|
+
<field name="FgdcText"/>
|
191
|
+
</doc>
|
192
|
+
</add>
|
193
|
+
</xsl:template>
|
194
|
+
<xsl:template match="*"/>
|
195
|
+
</xsl:stylesheet>
|