adiwg-mdtranslator 2.6.0 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -1
  3. data/Rakefile +1 -0
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +10 -0
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +6 -6
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +100 -86
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_timePeriod.rb +3 -0
  8. data/lib/adiwg/mdtranslator/readers/fgdc/readme.md +4 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +157 -157
  10. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_body.rb +4 -7
  11. data/lib/adiwg/mdtranslator/version.rb +7 -1
  12. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb +87 -0
  13. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +172 -0
  14. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +164 -0
  15. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +73 -0
  16. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +54 -0
  17. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb +49 -0
  18. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +60 -0
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +78 -0
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicRange.rb +54 -0
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +152 -0
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +99 -0
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb +73 -0
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb +67 -0
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb +47 -0
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +200 -0
  27. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb +63 -0
  28. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +102 -0
  29. data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb +49 -0
  30. data/lib/adiwg/mdtranslator/writers/fgdc/readme.md +22 -0
  31. data/lib/adiwg/mdtranslator/writers/fgdc/version.rb +15 -0
  32. data/lib/adiwg/mdtranslator/writers/html/version.rb +3 -2
  33. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +1 -1
  34. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +3 -1
  35. data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +15 -0
  36. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +1 -1
  37. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +29 -27
  38. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +15 -0
  39. data/lib/adiwg/mdtranslator/writers/mdJson/mdJson_writer.rb +4 -2
  40. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +1 -0
  41. data/lib/adiwg/mdtranslator/writers/mdJson/version.rb +3 -5
  42. data/lib/adiwg/mdtranslator/writers/sbJson/sbJson_writer.rb +1 -1
  43. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +21 -9
  44. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +21 -3
  45. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +27 -7
  46. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_webLink.rb +17 -4
  47. data/lib/adiwg/mdtranslator/writers/sbJson/version.rb +1 -4
  48. data/lib/adiwg/mdtranslator.rb +5 -4
  49. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 237525902d612d3bf3f8c5a81c373a789d27b9c8
4
- data.tar.gz: caa5edd6722337501c2698e0ea7ee4a61b0eccea
3
+ metadata.gz: 95997a263659c300096fdde23a9b106fc0087077
4
+ data.tar.gz: 2c5744f3015d572bbf3cd42b61edd658351c6120
5
5
  SHA512:
6
- metadata.gz: 79a9d0abadec138c139b287b3e306033eee12b9d0467b1ee0ce3e010a121f1aff03b88e4e715f05147ea48e58c277eea536631e88142f430eace7f6e6a37779a
7
- data.tar.gz: c459062d8d426ac181db0cc1f279811d5567e773c9f1bec809c3487e96920fcb11dad897343a60411ee8f7de31ea2986924953f09a295cf485c7e48bbc65e7e8
6
+ metadata.gz: b367d5f133db2bc2927e0a729028bcf04680bbdc6fbf101c5705a7643ae7b6452b474f1d4bc8d994bef4c82e6e9f63f8f0d1c8245cadd3af5f1764590d98a18d
7
+ data.tar.gz: d0746f77b488309360f28bfb1b3131eefc3b77b3b2a2a162889511facd5e073113a2cf3bc4541708ae41f2655b8ff53b1255b5920eab4a4286417ee39207a7a5
data/CHANGELOG.md CHANGED
@@ -1,7 +1,29 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.6.0](https://github.com/adiwg/mdTranslator/tree/v2.6.0) (2017-11-10)
3
+ ## [v2.6.1](https://github.com/adiwg/mdTranslator/tree/v2.6.1)
4
4
 
5
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.6.0...v2.6.1)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Include citation.onlineResource and metadataOnlineResource in webLinks [\#165](https://github.com/adiwg/mdTranslator/issues/165)
10
+
11
+ **Fixed bugs:**
12
+
13
+ - sbJSON identifier objects are not unique [\#162](https://github.com/adiwg/mdTranslator/issues/162)
14
+ - Metadata identifier is not written to sbJSON [\#160](https://github.com/adiwg/mdTranslator/issues/160)
15
+
16
+ **Closed issues:**
17
+
18
+ - add 'Agreement Number' to sbJson budget facet [\#166](https://github.com/adiwg/mdTranslator/issues/166)
19
+ - handle 80 character keyword length in sbJson writer [\#164](https://github.com/adiwg/mdTranslator/issues/164)
20
+ - sbJson reader should not import short abstract [\#163](https://github.com/adiwg/mdTranslator/issues/163)
21
+
22
+ **Merged pull requests:**
23
+
24
+ - Patches and enhancements to sbJson reader and writer [\#167](https://github.com/adiwg/mdTranslator/pull/167) ([stansmith907](https://github.com/stansmith907))
25
+
26
+ ## [v2.6.0](https://github.com/adiwg/mdTranslator/tree/v2.6.0) (2017-11-11)
5
27
  [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.5.0...v2.6.0)
6
28
 
7
29
  **Fixed bugs:**
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ Rake::TestTask.new do |t|
12
12
  'test/writers/mdJson/tc*.rb',
13
13
  'test/writers/sbJson/tc*.rb',
14
14
  'test/writers/html/tc*.rb',
15
+ 'test/writers/fgdc/tc*.rb',
15
16
  'test/translator/tc*.rb'
16
17
  ]
17
18
  t.verbose = true
@@ -2,6 +2,7 @@
2
2
  # unpack fgdc contact
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-11-27 add support for 'memberOfOrgs'
5
6
  # Stan Smith 2017-08-25 original script
6
7
 
7
8
  require 'nokogiri'
@@ -24,6 +25,8 @@ module ADIWG
24
25
  contactType = nil
25
26
  personName = ''
26
27
  orgName = ''
28
+ personId = nil
29
+ orgId = nil
27
30
  xContactInfo = xContact.xpath('./cntinfo')
28
31
  unless xContactInfo.empty?
29
32
 
@@ -60,6 +63,13 @@ module ADIWG
60
63
  hContact = Fgdc.get_contact_by_id(personId) if contactType == 'person'
61
64
  hContact = Fgdc.get_contact_by_id(orgId) if contactType == 'organization'
62
65
 
66
+ # contact - member of organization
67
+ if contactType == 'person'
68
+ unless orgId.nil?
69
+ hContact[:memberOfOrgs] << orgId
70
+ end
71
+ end
72
+
63
73
  # contact 10.3 (cntpos) - contact position
64
74
  position = xContactInfo.xpath('./cntpos').text
65
75
  if contactType == 'person'
@@ -21,7 +21,7 @@ module ADIWG
21
21
  # instance classes needed in script
22
22
  intMetadataClass = InternalMetadata.new
23
23
 
24
- # kewords 1.6.1 (theme) - thematic keywords {keyword}
24
+ # keywords 1.6.1 (theme) - thematic keywords {keyword}
25
25
  axTheme = xKeywords.xpath('./theme')
26
26
  unless axTheme.empty?
27
27
  axTheme.each do |xTheme|
@@ -50,7 +50,7 @@ module ADIWG
50
50
  end
51
51
 
52
52
  # if keyword thesaurus is 'ISO 19115 Topic Category'
53
- # convert to ISO topic categories
53
+ # also convert to ISO topic categories
54
54
  if hKeyword[:thesaurus][:title] == 'ISO 19115 Topic Category'
55
55
  hKeyword[:keywords].each do |hKeyObj|
56
56
  hResourceInfo[:topicCategories] << hKeyObj[:keyword]
@@ -65,7 +65,7 @@ module ADIWG
65
65
  end
66
66
  end
67
67
 
68
- # kewords 1.6.2 (place) - place keywords {keyword}
68
+ # keywords 1.6.2 (place) - place keywords {keyword}
69
69
  axPlace = xKeywords.xpath('./place')
70
70
  unless axPlace.empty?
71
71
  axPlace.each do |xPlace|
@@ -100,7 +100,7 @@ module ADIWG
100
100
  end
101
101
  end
102
102
 
103
- # kewords 1.6.3 (stratum) - stratum keywords {keyword}
103
+ # keywords 1.6.3 (stratum) - stratum keywords {keyword}
104
104
  axStratum = xKeywords.xpath('./stratum')
105
105
  unless axStratum.empty?
106
106
  axStratum.each do |xStratum|
@@ -135,7 +135,7 @@ module ADIWG
135
135
  end
136
136
  end
137
137
 
138
- # kewords 1.6.4 (temporal) - temporal keywords {keyword}
138
+ # keywords 1.6.4 (temporal) - temporal keywords {keyword}
139
139
  axTemporal = xKeywords.xpath('./temporal')
140
140
  unless axTemporal.empty?
141
141
  axTemporal.each do |xTemporal|
@@ -170,7 +170,7 @@ module ADIWG
170
170
  end
171
171
  end
172
172
 
173
- # kewords bio (keywtax) - taxonomy keywords {keyword}
173
+ # keywords bio (keywtax) - taxonomy keywords {keyword}
174
174
  nodeName = xKeywords.xpath('./*').first.name
175
175
  if nodeName == 'keywtax'
176
176
  hKeyword = intMetadataClass.newKeyword
@@ -2,6 +2,7 @@
2
2
  # unpack fgdc spatial domain
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-11-25 fix: allows multiple bounding polygons
5
6
  # Stan Smith 2017-08-22 original script
6
7
 
7
8
  require 'nokogiri'
@@ -59,14 +60,15 @@ module ADIWG
59
60
 
60
61
  # instance classes needed in script
61
62
  intMetadataClass = InternalMetadata.new
62
- hExtent = intMetadataClass.newExtent
63
- hGeoExtent = intMetadataClass.newGeographicExtent
64
- hExtent[:geographicExtents] << hGeoExtent
63
+ hIntExtent = intMetadataClass.newExtent
64
+ hIntGeoExtent = intMetadataClass.newGeographicExtent
65
+ hIntExtent[:geographicExtents] << hIntGeoExtent
66
+ hIntExtent[:description] = 'FGDC spatial domain'
65
67
 
66
68
  # spatial domain bio (descgeog) - geographic description
67
69
  description = xDomain.xpath('./descgeog').text
68
70
  unless description.empty?
69
- hGeoExtent[:description] = description
71
+ hIntGeoExtent[:description] = description
70
72
  end
71
73
 
72
74
  # spatial domain 1.5.1 (bounding) - bounding box
@@ -101,103 +103,115 @@ module ADIWG
101
103
 
102
104
  end
103
105
 
104
- hGeoExtent[:boundingBox] = hBbox
106
+ hIntGeoExtent[:boundingBox] = hBbox
105
107
  end
106
108
 
107
- # spatial domain 1.5.2 (dsgpoly) - data set geographic polygon
108
- xPoly = xDomain.xpath('./dsgpoly')
109
- unless xPoly.empty?
110
-
111
- polygon = []
112
-
113
- # polygon 1.5.2.1 (dsgpolyo) - polygon outer ring
114
- xOring = xPoly.xpath('./dsgpolyo')
115
- unless xOring.empty?
116
-
117
- # outer ring 1.5.2.1.1 (grngpoin) - g ring point
118
- # outer ring 1.5.2.1.2 (gring) - g ring
119
- # outer ring must be counterclockwise
120
- aOutCoords = process_polygon(xOring)
121
- unless aOutCoords.empty?
122
- if AdiwgCoordinates.is_polygon_clockwise(aOutCoords)
123
- aOutCoords.reverse!
109
+ # spatial domain 1.5.2 (dsgpoly) - data set geographic polygon []
110
+ axPoly = xDomain.xpath('//dsgpoly')
111
+ unless axPoly.empty?
112
+
113
+ # start new feature collection
114
+ hIntCollect = intMetadataClass.newFeatureCollection
115
+ hIntCollect[:type] = 'FeatureCollection'
116
+ hCollection = {
117
+ 'type' => 'FeatureCollection',
118
+ 'features' => []
119
+ }
120
+
121
+ axPoly.each do |xPoly|
122
+
123
+ # place the polygon in a feature
124
+ polygon = []
125
+
126
+ # polygon 1.5.2.1 (dsgpolyo) - polygon outer ring
127
+ xOring = xPoly.xpath('./dsgpolyo')
128
+ unless xOring.empty?
129
+
130
+ # outer ring 1.5.2.1.1 (grngpoin) - g ring point
131
+ # outer ring 1.5.2.1.2 (gring) - g ring
132
+ # outer ring must be counterclockwise
133
+ aOutCoords = process_polygon(xOring)
134
+ unless aOutCoords.empty?
135
+ if AdiwgCoordinates.is_polygon_clockwise(aOutCoords)
136
+ aOutCoords.reverse!
137
+ end
138
+ polygon << aOutCoords
124
139
  end
125
- polygon << aOutCoords
126
- end
127
140
 
128
- # first ring must be outer
129
- # only process if already have outer ring
130
- # polygon 1.5.2.2 (dsgpolyx) - polygon exclusion ring []
131
- axXring = xPoly.xpath('./dsgpolyx')
132
- axXring.each do |xRing|
133
-
134
- # exclusion ring 1.5.2.2.1 (grngpoin) - g ring point
135
- # exclusion ring 1.5.2.2.2 (gring) - g ring
136
- # exclusion ring must be clockwise
137
- aInCoords = process_polygon(xRing)
138
- unless aInCoords.empty?
139
- unless AdiwgCoordinates.is_polygon_clockwise(aInCoords)
140
- aInCoords.reverse!
141
+ # first ring must be outer
142
+ # only process if already have outer ring
143
+ # polygon 1.5.2.2 (dsgpolyx) - polygon exclusion ring []
144
+ axXring = xPoly.xpath('./dsgpolyx')
145
+ unless axXring.empty?
146
+ axXring.each do |xRing|
147
+
148
+ # exclusion ring 1.5.2.2.1 (grngpoin) - g ring point
149
+ # exclusion ring 1.5.2.2.2 (gring) - g ring
150
+ # exclusion ring must be clockwise
151
+ aInCoords = process_polygon(xRing)
152
+ unless aInCoords.empty?
153
+ unless AdiwgCoordinates.is_polygon_clockwise(aInCoords)
154
+ aInCoords.reverse!
155
+ end
156
+ polygon << aInCoords
157
+ end
158
+
141
159
  end
142
- polygon << aInCoords
143
160
  end
144
161
 
145
162
  end
146
- end
147
163
 
148
- unless polygon.empty?
149
-
150
- # make geoJson FeatureCollection from polygon
151
- hGeometry = {
152
- 'type' => 'Polygon',
153
- 'coordinates' => polygon
154
- }
155
- hFeature = {
156
- 'type' => 'Feature',
157
- 'geometry' => hGeometry,
158
- 'properties' => {
159
- 'description' => 'FGDC bounding polygon'
164
+ unless polygon.empty?
165
+
166
+ # make geoJson FeatureCollection from polygon
167
+ hGeometry = {
168
+ 'type' => 'Polygon',
169
+ 'coordinates' => polygon
170
+ }
171
+ hFeature = {
172
+ 'type' => 'Feature',
173
+ 'geometry' => hGeometry,
174
+ 'properties' => {
175
+ 'description' => 'FGDC bounding polygon'
176
+ }
160
177
  }
161
- }
162
- hCollection = {
163
- 'type' => 'FeatureCollection',
164
- 'features' => [hFeature]
165
- }
166
- geoJson = hCollection
167
-
168
- # make internal geometries from polygon
169
- hIntGeo = intMetadataClass.newGeometryObject
170
- hIntGeo[:type] = 'Polygon'
171
- hIntGeo[:coordinates] = polygon
172
- hIntGeo[:nativeGeoJson] = hGeometry
173
-
174
- hIntProps = intMetadataClass.newGeometryProperties
175
- hIntProps[:description] = 'FGDC bounding polygon'
176
-
177
- hIntFeature = intMetadataClass.newGeometryFeature
178
- hIntFeature[:type] = 'Feature'
179
- hIntFeature[:geometryObject] = hIntGeo
180
- hIntFeature[:nativeGeoJson] = hFeature
181
- hIntFeature[:properties] = hIntProps
182
-
183
- hIntCollect = intMetadataClass.newFeatureCollection
184
- hIntCollect[:type] = 'FeatureCollection'
185
- hIntCollect[:features] << hIntFeature
186
- hIntCollect[:nativeGeoJson] = hCollection
187
-
188
- hGeoExtent[:geographicElements] << hIntCollect
189
- hGeoExtent[:nativeGeoJson] << geoJson
190
-
191
- hExtent[:description] = 'FGDC spatial domain'
178
+ hCollection['features'] << hFeature
179
+
180
+ # make internal geometry object from polygon
181
+ hIntGeo = intMetadataClass.newGeometryObject
182
+ hIntGeo[:type] = 'Polygon'
183
+ hIntGeo[:coordinates] = polygon
184
+ hIntGeo[:nativeGeoJson] = hGeometry
185
+
186
+ # make internal geometry feature from geometry object
187
+ hIntFeature = intMetadataClass.newGeometryFeature
188
+ hIntFeature[:type] = 'Feature'
189
+ hIntFeature[:geometryObject] = hIntGeo
190
+ hIntFeature[:nativeGeoJson] = hFeature
191
+
192
+ # add properties to geometry feature
193
+ hIntProps = intMetadataClass.newGeometryProperties
194
+ hIntProps[:description] = 'FGDC bounding polygon'
195
+ hIntFeature[:properties] = hIntProps
196
+
197
+ # place feature into collection
198
+ # the collection nativeGeoJson is rewritten each pass
199
+ hIntCollect[:features] << hIntFeature
200
+ hIntCollect[:nativeGeoJson] = hCollection
192
201
 
202
+ end
193
203
  end
194
- end
195
204
 
196
- return hExtent
205
+ # place collection into geographic extent
206
+ hIntGeoExtent[:geographicElements] << hIntCollect
207
+ hIntGeoExtent[:nativeGeoJson] << hIntCollect[:nativeGeoJson]
197
208
 
198
- end
209
+ end
210
+
211
+ return hIntExtent
199
212
 
200
- end
213
+ end # unpack
214
+ end # SpatialDomain
201
215
 
202
216
  end
203
217
  end
@@ -65,6 +65,9 @@ module ADIWG
65
65
  end
66
66
 
67
67
  # time period 9.2 (mdattim) - multiple date times
68
+ # -> place into timePeriod since mdJson does not handle multi-date
69
+ # -> did not put multi-date in temporalExtent since it would be
70
+ # -> difficult to return it to the same context
68
71
  xMulti = xTimeInfo.xpath('./mdattim')
69
72
  unless xMulti.empty?
70
73
 
@@ -16,3 +16,7 @@ Standards that are now encouraged for use.
16
16
 
17
17
  The FGDC CSDGM format standard is fully documented on the
18
18
  [Content Standard for Digital Geospatial Metadata page](https://www.fgdc.gov/metadata/csdgm-standard).
19
+
20
+ This FGDC reader extends the FGDC standard by added the Biological Data Profile
21
+ FGDC-STD-001.1-1999 as defined by the U.S. Geological Survey National Biological
22
+ Information Infrastructure (NBII).