adiwg-mdtranslator 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05a5a0a4dc73f22a0ce7486fe6be73754cc93743
4
- data.tar.gz: 7c4c4d97eb981e0d6612ce4dc439b356eb0fe0cc
3
+ metadata.gz: c76bab7a13d123b87ccc5b186b838330dd5dcd08
4
+ data.tar.gz: 83e0218e6a5ea373d2b9283ca61d72a32a840dd5
5
5
  SHA512:
6
- metadata.gz: 5d224f7a98809a3738ca574b64662f466ba023f33a81fced281d72c06c2df0f3059a08daddbf7dfe9352e9ec4c56f89874644419c860a9eaa42fd4c6c6fd2f85
7
- data.tar.gz: 533e4af92c507a80d47d89669a68d9d7a9ca829c790047b65c66bfbf968e57506889b980932975b277f813d244e3f4e2caf2f6318e8bd43331c75fbb2ae43d26
6
+ metadata.gz: 666c6243ff33753bd0d73f29097d707464d5cf0ffe04f2ac4c7b64a9dde97e5c523d22755a5a79aa04d17f960c034104bff16e2761e965540144edcc763072e4
7
+ data.tar.gz: 5b88078e37e97f0f6ed0327e6c71be0f90fbf0a56c3c777e99b0b337ee0a5d83a4e1c988bead13d0f599b257aef32be0f2035450b3d5253f97819255a828d2d0
@@ -22,7 +22,11 @@ module ADIWG
22
22
  intMetadataClass = InternalMetadata.new
23
23
 
24
24
  # entity attribute 5.1.1 (enttype) - definition and description set
25
+ # also search for (enttyp); Metavist and USGS fgdc validator use 'enttyp'
25
26
  xEntity = xDetail.xpath('./enttype')
27
+ if xEntity.empty?
28
+ xEntity = xDetail.xpath('./enttyp')
29
+ end
26
30
  unless xEntity.empty?
27
31
 
28
32
  hEntity = intMetadataClass.newEntity
@@ -61,6 +61,7 @@ module ADIWG
61
61
  intMetadataClass = InternalMetadata.new
62
62
  hExtent = intMetadataClass.newExtent
63
63
  hGeoExtent = intMetadataClass.newGeographicExtent
64
+ hExtent[:geographicExtents] << hGeoExtent
64
65
 
65
66
  # spatial domain 1.5.1 (bounding) - bounding box
66
67
  xBbox = xDomain.xpath('./bounding')
@@ -127,27 +128,27 @@ module ADIWG
127
128
 
128
129
  # make geoJson FeatureCollection from polygon
129
130
  hGeometry = {
130
- type: 'Polygon',
131
- coordinates: polygon
131
+ 'type' => 'Polygon',
132
+ 'coordinates' => polygon
132
133
  }
133
134
  hFeature = {
134
- type: 'Feature',
135
- geometry: hGeometry,
136
- properties: {
137
- description: 'FGDC bounding polygon'
135
+ 'type' => 'Feature',
136
+ 'geometry' => hGeometry,
137
+ 'properties' => {
138
+ 'description' => 'FGDC bounding polygon'
138
139
  }
139
140
  }
140
141
  hCollection = {
141
- type: 'FeatureCollection',
142
- features: [hFeature]
142
+ 'type' => 'FeatureCollection',
143
+ 'features' => [hFeature]
143
144
  }
144
- geoJson = hCollection.to_json
145
+ geoJson = hCollection
145
146
 
146
147
  # make internal geometries from polygon
147
148
  hIntGeo = intMetadataClass.newGeometryObject
148
149
  hIntGeo[:type] = 'Polygon'
149
150
  hIntGeo[:coordinates] = polygon
150
- hIntGeo[:nativeGeoJson] = hGeometry.to_json
151
+ hIntGeo[:nativeGeoJson] = hGeometry
151
152
 
152
153
  hIntProps = intMetadataClass.newGeometryProperties
153
154
  hIntProps[:description] = 'FGDC bounding polygon'
@@ -155,18 +156,17 @@ module ADIWG
155
156
  hIntFeature = intMetadataClass.newGeometryFeature
156
157
  hIntFeature[:type] = 'Feature'
157
158
  hIntFeature[:geometryObject] = hIntGeo
158
- hIntFeature[:nativeGeoJson] = hFeature.to_json
159
+ hIntFeature[:nativeGeoJson] = hFeature
159
160
  hIntFeature[:properties] = hIntProps
160
161
 
161
162
  hIntCollect = intMetadataClass.newFeatureCollection
162
163
  hIntCollect[:type] = 'FeatureCollection'
163
164
  hIntCollect[:features] << hIntFeature
164
- hIntCollect[:nativeGeoJson] = hCollection.to_json
165
+ hIntCollect[:nativeGeoJson] = hCollection
165
166
 
166
167
  hGeoExtent[:geographicElements] << hIntCollect
167
- hGeoExtent[:nativeGeoJson] = geoJson
168
+ hGeoExtent[:nativeGeoJson] << geoJson
168
169
 
169
- hExtent[:geographicExtents] << hGeoExtent
170
170
  hExtent[:description] = 'FGDC spatial domain'
171
171
 
172
172
  end
@@ -2,7 +2,8 @@
2
2
  # Reader - ScienceBase JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-06-21 original script
5
+ # Stan Smith 2017-09-13 remove fail restriction on contactType
6
+ # Stan Smith 2016-06-21 original script
6
7
 
7
8
  require 'uuidtools'
8
9
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
@@ -65,20 +66,21 @@ module ADIWG
65
66
 
66
67
  hContact[:contactId] = UUIDTools::UUID.random_create.to_s
67
68
 
68
- # contact - contactType (required) [ person | organization ]
69
+ # contact - contactType [ person | organization ]
69
70
  if hSbContact.has_key?('contactType')
70
- if %w(person organization).include?(hSbContact['contactType'])
71
+ if hSbContact['contactType'].nil? || hSbContact['contactType'] == ''
72
+ hResponseObj[:readerExecutionMessages] << 'Contact contactType is missing'
73
+ hContact[:isOrganization] = false
74
+ elsif %w(person organization).include?(hSbContact['contactType'])
71
75
  hContact[:isOrganization] = true if hSbContact['contactType'] == 'organization'
72
76
  else
73
77
  hResponseObj[:readerExecutionMessages] << 'Contact contactType must be person or organization'
74
78
  hResponseObj[:readerExecutionPass] = false
75
79
  return nil
76
80
  end
77
- end
78
- if hSbContact['contactType'].nil? || hSbContact['contactType'] == ''
81
+ else
79
82
  hResponseObj[:readerExecutionMessages] << 'Contact contactType is missing'
80
- hResponseObj[:readerExecutionPass] = false
81
- return nil
83
+ hContact[:isOrganization] = false
82
84
  end
83
85
 
84
86
  # contact - name (required)
@@ -1,6 +1,7 @@
1
1
  # adiwg mdTranslator
2
2
 
3
3
  # version 2 history
4
+ # 2.3.1 2017-09-13 fixed fgdc reader: removed conversion of hash to json
4
5
  # 2.3.0 2017-09-11 add fgdc 1998 CSDGM reader
5
6
  # 2.2.0 2017-08-31 refactor for schema changes to Lineage and Funding
6
7
  # 2.1.2 2017-08-24 remove schema version from sbJson
@@ -25,7 +26,7 @@
25
26
  module ADIWG
26
27
  module Mdtranslator
27
28
  # current mdtranslator version
28
- VERSION = "2.3.0"
29
+ VERSION = "2.3.1"
29
30
  end
30
31
  end
31
32
 
@@ -48,7 +48,11 @@ module ADIWG
48
48
  unless hAllocation[:sourceId].nil?
49
49
  hContact = Html_Document.getContact(hAllocation[:sourceId])
50
50
  @html.em('Source Contact: ')
51
- @html.a(hContact[:contactId], 'href' => '#CID_'+hContact[:contactId])
51
+ if hContact.empty?
52
+ @html.text!("Contact #{hAllocation[:sourceId]} not found!")
53
+ else
54
+ @html.a(hContact[:contactId], 'href' => '#CID_'+hContact[:contactId])
55
+ end
52
56
  @html.br
53
57
  end
54
58
 
@@ -56,7 +60,11 @@ module ADIWG
56
60
  unless hAllocation[:recipientId].nil?
57
61
  hContact = Html_Document.getContact(hAllocation[:recipientId])
58
62
  @html.em('Recipient Contact: ')
59
- @html.a(hContact[:contactId], 'href' => '#CID_'+hContact[:contactId])
63
+ if hContact.empty?
64
+ @html.text!("Contact #{hAllocation[:recipientId]} not found!")
65
+ else
66
+ @html.a(hContact[:contactId], 'href' => '#CID_'+hContact[:contactId])
67
+ end
60
68
  @html.br
61
69
  end
62
70
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adiwg-mdtranslator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-12 00:00:00.000000000 Z
12
+ date: 2017-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler