adiwg-mdtranslator 2.18.0rc1 → 2.18.0rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. checksums.yaml +4 -4
  2. data/adiwg-mdtranslator.gemspec +1 -1
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +11 -11
  4. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +0 -4
  5. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +5 -5
  6. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +5 -10
  7. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +1 -7
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +2 -9
  9. data/lib/adiwg/mdtranslator/version.rb +1 -1
  10. data/lib/adiwg/mdtranslator/writers/html/sections/html_attribute.rb +12 -0
  11. data/lib/adiwg/mdtranslator/writers/html/sections/html_rangeElementDescription.rb +40 -0
  12. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +4 -3
  13. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +2 -3
  14. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +1 -1
  15. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_attribute.rb +1 -1
  16. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_contact.rb +1 -1
  17. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georectifiedRepresentation.rb +1 -1
  18. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georeferenceableRepresentation.rb +1 -1
  19. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_gridRepresentation.rb +1 -1
  20. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_vectorRepresentation.rb +1 -1
  21. metadata +8 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67548c26ee946f10c11bb16593fea2bff705209467ffd4fbe9b9ce5db971803e
4
- data.tar.gz: c4c6850208bbf1e47621c741777862cc6f30c2f6668d1753309c4f7397618311
3
+ metadata.gz: ecb7704090196204491ef42a0817dd4e9980188e3e63852d61cb7f0406b57f80
4
+ data.tar.gz: 396c316ebdabbbe7acccf9deacbc45cd662799bb379e2a97389ecf546d04477d
5
5
  SHA512:
6
- metadata.gz: 76385a2877ccbb04739c2aac4a2526912f97d1d3a3863c9779ff948f447b5434f34d68030ad2a143466ac2fa804887d1edd60b56587e14b3a069545651fb52fb
7
- data.tar.gz: 53326a9899e781aaa171bbaa25a18a6d0e736d3d615bb1f6f24c7818a65885b42cb3345bfb37d4d2f5155727cb3aee6660e56088b31ce8303999dac4ad2f8634
6
+ metadata.gz: 69eb88558f05db637609abe2047853a6517ce0a5ee7e85e2ad9c7fd679d52cde0d3fd4af206a73bb2ebd9cafde309e97e10dc49f02bc0e0ab0a076cfa9fc6fcb
7
+ data.tar.gz: 806fcca0134b19ea6da6619eb60c1480f73ef0f4323c847d51165fd5b377741b4ce48248f57a92276d4c6a7f6c24882ea554cc95efe6eaf0cb72f9c46af2ca7d
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency "thor", "~> 0.19"
35
35
  spec.add_runtime_dependency "uuidtools", "~> 2.1"
36
36
  spec.add_runtime_dependency "json-schema", "~> 2.7"
37
- spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.8.0.pre.beta"
37
+ spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.8.0.pre.beta2"
38
38
  spec.add_runtime_dependency "adiwg-mdcodes", "~> 2.8"
39
39
  spec.add_runtime_dependency "jbuilder", "~> 2.5"
40
40
  spec.add_runtime_dependency "kramdown", "~> 1.13"
@@ -303,6 +303,7 @@ class InternalMetadata
303
303
  contactId: nil,
304
304
  isOrganization: false,
305
305
  name: nil,
306
+ externalIdentifier: [],
306
307
  positionName: nil,
307
308
  memberOfOrgs: [],
308
309
  logos: [],
@@ -311,9 +312,8 @@ class InternalMetadata
311
312
  eMailList: [],
312
313
  onlineResources: [],
313
314
  hoursOfService: [],
314
- externalIdentifiers: [],
315
315
  contactInstructions: nil,
316
- contactType: nil,
316
+ contactType: nil
317
317
  }
318
318
  end
319
319
 
@@ -493,12 +493,12 @@ class InternalMetadata
493
493
  maxValue: nil,
494
494
  units: nil,
495
495
  scaleFactor: nil,
496
- rangeElementDescriptions: [],
497
496
  offset: nil,
498
497
  meanValue: nil,
499
498
  numberOfValues: nil,
500
499
  standardDeviation: nil,
501
500
  bitsPerValue: nil,
501
+ rangeElementDescription: [],
502
502
  boundMin: nil,
503
503
  boundMax: nil,
504
504
  boundUnits: nil,
@@ -1180,11 +1180,11 @@ class InternalMetadata
1180
1180
 
1181
1181
  def newGridInfo
1182
1182
  {
1183
+ scope: [],
1183
1184
  numberOfDimensions: nil,
1184
1185
  dimension: [],
1185
1186
  cellGeometry: nil,
1186
- transformationParameterAvailable: false,
1187
- scope: []
1187
+ transformationParameterAvailable: false
1188
1188
  }
1189
1189
  end
1190
1190
 
@@ -1200,9 +1200,9 @@ class InternalMetadata
1200
1200
 
1201
1201
  def newVectorInfo
1202
1202
  {
1203
+ scope: [],
1203
1204
  topologyLevel: nil,
1204
- vectorObject: [],
1205
- scope: []
1205
+ vectorObject: []
1206
1206
  }
1207
1207
  end
1208
1208
 
@@ -1215,6 +1215,7 @@ class InternalMetadata
1215
1215
 
1216
1216
  def newGeorectifiedInfo
1217
1217
  {
1218
+ scope: [],
1218
1219
  gridRepresentation: {},
1219
1220
  checkPointAvailable: false,
1220
1221
  checkPointDescription: nil,
@@ -1222,20 +1223,19 @@ class InternalMetadata
1222
1223
  centerPoint: [],
1223
1224
  pointInPixel: nil,
1224
1225
  transformationDimensionDescription: nil,
1225
- transformationDimensionMapping: nil,
1226
- scope: []
1226
+ transformationDimensionMapping: nil
1227
1227
  }
1228
1228
  end
1229
1229
 
1230
1230
  def newGeoreferenceableInfo
1231
1231
  {
1232
+ scope: [],
1232
1233
  gridRepresentation: {},
1233
1234
  controlPointAvailable: false,
1234
1235
  orientationParameterAvailable: false,
1235
1236
  orientationParameterDescription: nil,
1236
1237
  georeferencedParameter: nil,
1237
- parameterCitation: [],
1238
- scope: []
1238
+ parameterCitation: []
1239
1239
  }
1240
1240
  end
1241
1241
 
@@ -43,10 +43,6 @@ module ADIWG
43
43
  return {}
44
44
  end
45
45
 
46
- if hMdJson.is_a?(Array)
47
- hMdJson = hMdJson.first
48
- end
49
-
50
46
  # file must contain an mdJson object
51
47
  if hMdJson.empty?
52
48
  hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: object is empty'
@@ -103,12 +103,12 @@ module ADIWG
103
103
  end
104
104
  end
105
105
 
106
- if hAttribute.has_key?('rangeElementDescriptions')
107
- unless hAttribute['rangeElementDescriptions'].nil?
108
- intAttGroup[:rangeElementDescriptions] = []
106
+ if hAttribute.has_key?('rangeElementDescription')
107
+ unless hAttribute['rangeElementDescription'].nil?
108
+ intAttGroup[:rangeElementDescription] = []
109
109
 
110
- hAttribute['rangeElementDescriptions'].each do |item|
111
- intAttGroup[:rangeElementDescriptions] << RangeElementDescription.unpack(item, responseObj, outContext)
110
+ hAttribute['rangeElementDescription'].each do |item|
111
+ intAttGroup[:rangeElementDescription] << RangeElementDescription.unpack(item, responseObj, outContext)
112
112
  end
113
113
  end
114
114
  end
@@ -36,24 +36,19 @@ module ADIWG
36
36
 
37
37
  # contact - contact id (required)
38
38
  if hContact.has_key?('contactId')
39
- if hContact['contactId'].is_a?(Hash)
40
- outContext = 'contact ID ' + hContact['contactId']['identifier']
41
- intContact[:contactId] = hContact['contactId'].transform_keys(&:to_sym)
42
- elsif hContact['contactId'].is_a?(String)
43
- outContext = 'contact ID ' + hContact['contactId']
44
- intContact[:contactId] = hContact['contactId']
45
- end
39
+ intContact[:contactId] = hContact['contactId']
40
+ outContext = 'contact ID ' + hContact['contactId']
46
41
  end
47
42
  if intContact[:contactId].nil? || intContact[:contactId] == ''
48
43
  @MessagePath.issueError(101, responseObj)
49
44
  end
50
45
 
51
- if hContact.has_key?('externalIdentifiers')
52
- aItems = hContact['externalIdentifiers']
46
+ if hContact.has_key?('externalIdentifier')
47
+ aItems = hContact['externalIdentifier']
53
48
  aItems.each do |item|
54
49
  hReturn = Identifier.unpack(item, responseObj, outContext)
55
50
  unless hReturn.nil?
56
- intContact[:externalIdentifiers] << hReturn
51
+ intContact[:externalIdentifier] << hReturn
57
52
  end
58
53
  end
59
54
  end
@@ -123,13 +123,7 @@ module ADIWG
123
123
  contactType = nil
124
124
  contactName = nil
125
125
  @contacts.each_with_index do |contact, i|
126
- if contact[:contactId] == contactId ||
127
- (
128
- contact[:contactId].is_a?(Hash) &&
129
- contactId.is_a?(Hash) &&
130
- contact[:contactId][:identifier] == contactId['identifier']
131
- )
132
-
126
+ if contact[:contactId] == contactId
133
127
  contactIndex = i
134
128
  if contact[:isOrganization]
135
129
  contactType = 'organization'
@@ -30,18 +30,11 @@ module ADIWG
30
30
  # load party with contact index, contact type, and name
31
31
  # return nil if contact ID does not exist in contact array
32
32
  if hParty.has_key?('contactId')
33
- if hParty['contactId'].is_a?(Hash)
34
- intParty[:contactId] = hParty['contactId'].transform_keys(&:to_sym)
35
- context = hParty['contactId']['identifier']
36
- elsif hParty['contactId'].is_a?(String)
37
- intParty[:contactId] = hParty['contactId']
38
- context = hParty['contactId']
39
- end
40
-
33
+ intParty[:contactId] = hParty['contactId']
41
34
  unless intParty[:contactId].nil? || intParty[:contactId] == ''
42
35
  hContact = @MessagePath.findContact(hParty['contactId'])
43
36
  if hContact[0].nil?
44
- outContext = 'contact ID ' + context
37
+ outContext = 'contact ID ' + intParty[:contactId]
45
38
  outContext = inContext + ' > ' + outContext unless inContext.nil?
46
39
  @MessagePath.issueError(622, responseObj, outContext)
47
40
  else
@@ -109,7 +109,7 @@
109
109
  module ADIWG
110
110
  module Mdtranslator
111
111
  # current mdtranslator version
112
- VERSION = "2.18.0rc1"
112
+ VERSION = "2.18.0rc2"
113
113
  end
114
114
  end
115
115
 
@@ -5,6 +5,7 @@
5
5
  # Stan Smith 2017-04-02 original script
6
6
 
7
7
  require_relative 'html_identifier'
8
+ require_relative 'html_rangeElementDescription'
8
9
 
9
10
  module ADIWG
10
11
  module Mdtranslator
@@ -20,6 +21,7 @@ module ADIWG
20
21
  def writeHtml(hAttribute)
21
22
  # classes used
22
23
  identifierClass = Html_Identifier.new(@html)
24
+ rangeElementDescriptionClass = Html_RangeElementDescription.new(@html)
23
25
 
24
26
  # attribute - sequence identifier
25
27
  unless hAttribute[:sequenceIdentifier].nil?
@@ -116,6 +118,16 @@ module ADIWG
116
118
  @html.br
117
119
  end
118
120
 
121
+ # attribute - range element description
122
+ hAttribute[:rangeElementDescription].each do |red|
123
+ @html.details do
124
+ @html.summary('Range Element Description', 'class' => 'h5')
125
+ @html.section(:class => 'block') do
126
+ rangeElementDescriptionClass.writeHtml(red)
127
+ end
128
+ end
129
+ end
130
+
119
131
  # attribute - bound minimum
120
132
  unless hAttribute[:boundMinimum].nil?
121
133
  @html.em('Bound Minimum: ')
@@ -0,0 +1,40 @@
1
+ # HTML writer
2
+ # range element description
3
+
4
+ module ADIWG
5
+ module Mdtranslator
6
+ module Writers
7
+ module Html
8
+
9
+ class Html_RangeElementDescription
10
+
11
+ def initialize(html)
12
+ @html = html
13
+ end
14
+
15
+ def writeHtml(red)
16
+ unless red[:name].nil?
17
+ @html.em('Name:')
18
+ @html.text!(red[:name])
19
+ @html.br
20
+ end
21
+
22
+ unless red[:definition].nil?
23
+ @html.em('Definition:')
24
+ @html.text!(red[:definition])
25
+ @html.br
26
+ end
27
+
28
+ red[:rangeElements].each do |hRangeElement|
29
+ @html.em('Range Element:')
30
+ @html.text!(hRangeElement)
31
+ end
32
+
33
+ @html.br
34
+ end # writeHtml
35
+ end # Html_RangeElementDescription
36
+
37
+ end
38
+ end
39
+ end
40
+ end
@@ -72,8 +72,9 @@ module ADIWG
72
72
  @xml.tag!('cit:positionName')
73
73
  end
74
74
 
75
- if hContact[:externalIdentifiers] && hContact[:externalIdentifiers].length > 0
76
- hContact[:externalIdentifiers].each do |identifier|
75
+ # individual - party identifier
76
+ if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0
77
+ hContact[:externalIdentifier].each do |identifier|
77
78
  @xml.tag!('cit:partyIdentifier') do
78
79
  identifierClass.writeXML(identifier);
79
80
  end
@@ -90,7 +91,7 @@ module ADIWG
90
91
  end
91
92
  end
92
93
  end
93
-
94
+
94
95
  end
95
96
  end
96
97
  if hContact.empty?
@@ -94,9 +94,8 @@ module ADIWG
94
94
  end
95
95
 
96
96
  # organization - party identifier
97
-
98
- if hContact[:externalIdentifiers] && hContact[:externalIdentifiers].length > 0
99
- hContact[:externalIdentifiers].each do |identifier|
97
+ if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0
98
+ hContact[:externalIdentifier].each do |identifier|
100
99
  @xml.tag!('cit:partyIdentifier') do
101
100
  identifierClass.writeXML(identifier);
102
101
  end
@@ -67,7 +67,7 @@ module ADIWG
67
67
  @xml.tag!('mrc:scaleFactor')
68
68
  end
69
69
 
70
- hAttribute[:rangeElementDescriptions].each do |red|
70
+ hAttribute[:rangeElementDescription].each do |red|
71
71
  @xml.tag!('mrc:rangeElementDescription') do
72
72
  rangeElementDescription.writeXML(red, inContext)
73
73
  end
@@ -27,12 +27,12 @@ module ADIWG
27
27
  json.maxValue hAttribute[:maxValue]
28
28
  json.units hAttribute[:units]
29
29
  json.scaleFactor hAttribute[:scaleFactor]
30
- json.rangeElementDescriptions hAttribute[:rangeElementDescriptions]
31
30
  json.offset hAttribute[:offset]
32
31
  json.meanValue hAttribute[:meanValue]
33
32
  json.numberOfValues hAttribute[:numberOfValues]
34
33
  json.standardDeviation hAttribute[:standardDeviation]
35
34
  json.bitsPerValue hAttribute[:bitsPerValue]
35
+ json.rangeElementDescription hAttribute[:rangeElementDescription]
36
36
  json.boundMin hAttribute[:boundMin]
37
37
  json.boundMax hAttribute[:boundMax]
38
38
  json.boundUnits hAttribute[:boundUnits]
@@ -25,13 +25,13 @@ module ADIWG
25
25
  json.contactId hContact[:contactId]
26
26
  json.isOrganization hContact[:isOrganization]
27
27
  json.name hContact[:name]
28
+ json.externalIdentifier hContact[:externalIdentifier] unless hContact[:externalIdentifier].empty?
28
29
  json.positionName hContact[:positionName]
29
30
  json.memberOfOrganization hContact[:memberOfOrgs] unless hContact[:memberOfOrgs].empty?
30
31
  json.logoGraphic @Namespace.json_map(hContact[:logos], GraphicOverview)
31
32
  json.phone @Namespace.json_map(hContact[:phones], Phone)
32
33
  json.address @Namespace.json_map(hContact[:addresses], Address)
33
34
  json.electronicMailAddress hContact[:eMailList] unless hContact[:eMailList].empty?
34
- json.externalIdentifiers hContact[:externalIdentifiers] unless hContact[:externalIdentifiers].empty?
35
35
  json.onlineResource @Namespace.json_map(hContact[:onlineResources], OnlineResource)
36
36
  json.hoursOfService hContact[:hoursOfService] unless hContact[:hoursOfService].empty?
37
37
  json.contactInstructions hContact[:contactInstructions]
@@ -16,6 +16,7 @@ module ADIWG
16
16
  def self.build(hGeoRec)
17
17
 
18
18
  Jbuilder.new do |json|
19
+ json.scope hGeoRec[:scope]
19
20
  json.gridRepresentation Grid.build(hGeoRec[:gridRepresentation]) unless hGeoRec[:gridRepresentation].empty?
20
21
  json.checkPointAvailable hGeoRec[:checkPointAvailable]
21
22
  json.checkPointDescription hGeoRec[:checkPointDescription]
@@ -24,7 +25,6 @@ module ADIWG
24
25
  json.pointInPixel hGeoRec[:pointInPixel]
25
26
  json.transformationDimensionDescription hGeoRec[:transformationDimensionDescription]
26
27
  json.transformationDimensionMapping hGeoRec[:transformationDimensionMapping]
27
- json.scope hGeoRec[:scope]
28
28
  end
29
29
 
30
30
  end # build
@@ -19,13 +19,13 @@ module ADIWG
19
19
  @Namespace = ADIWG::Mdtranslator::Writers::MdJson
20
20
 
21
21
  Jbuilder.new do |json|
22
+ json.scope hGeoRef[:scope]
22
23
  json.gridRepresentation Grid.build(hGeoRef[:gridRepresentation]) unless hGeoRef[:gridRepresentation].empty?
23
24
  json.controlPointAvailable hGeoRef[:controlPointAvailable]
24
25
  json.orientationParameterAvailable hGeoRef[:orientationParameterAvailable]
25
26
  json.orientationParameterDescription hGeoRef[:orientationParameterDescription]
26
27
  json.georeferencedParameter hGeoRef[:georeferencedParameter]
27
28
  json.parameterCitation @Namespace.json_map(hGeoRef[:parameterCitation], Citation)
28
- json.scope hGeoRef[:scope]
29
29
  end
30
30
 
31
31
  end # build
@@ -19,11 +19,11 @@ module ADIWG
19
19
  @Namespace = ADIWG::Mdtranslator::Writers::MdJson
20
20
 
21
21
  Jbuilder.new do |json|
22
+ json.scope hGrid[:scope]
22
23
  json.numberOfDimensions hGrid[:numberOfDimensions]
23
24
  json.dimension @Namespace.json_map(hGrid[:dimension], Dimension)
24
25
  json.cellGeometry hGrid[:cellGeometry]
25
26
  json.transformationParameterAvailable hGrid[:transformationParameterAvailable]
26
- json.scope hGrid[:scope]
27
27
  end
28
28
 
29
29
  end # build
@@ -18,9 +18,9 @@ module ADIWG
18
18
  @Namespace = ADIWG::Mdtranslator::Writers::MdJson
19
19
 
20
20
  Jbuilder.new do |json|
21
+ json.scope hVector[:scope]
21
22
  json.topologyLevel hVector[:topologyLevel]
22
23
  json.vectorObject @Namespace.json_map(hVector[:vectorObject], VectorObject)
23
- json.scope hVector[:scope]
24
24
  end
25
25
 
26
26
  end # build
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adiwg-mdtranslator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.0rc1
4
+ version: 2.18.0rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith
8
8
  - Josh Bradley
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-07-12 00:00:00.000000000 Z
12
+ date: 2022-08-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: 2.8.0.pre.beta
132
+ version: 2.8.0.pre.beta2
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - '='
138
138
  - !ruby/object:Gem::Version
139
- version: 2.8.0.pre.beta
139
+ version: 2.8.0.pre.beta2
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: adiwg-mdcodes
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -586,6 +586,7 @@ files:
586
586
  - lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb
587
587
  - lib/adiwg/mdtranslator/writers/html/sections/html_processing.rb
588
588
  - lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb
589
+ - lib/adiwg/mdtranslator/writers/html/sections/html_rangeElementDescription.rb
589
590
  - lib/adiwg/mdtranslator/writers/html/sections/html_referenceSystemParameters.rb
590
591
  - lib/adiwg/mdtranslator/writers/html/sections/html_releasability.rb
591
592
  - lib/adiwg/mdtranslator/writers/html/sections/html_resourceFormat.rb
@@ -968,7 +969,7 @@ homepage: http://www.adiwg.org/mdTranslator
968
969
  licenses:
969
970
  - UNLICENSED
970
971
  metadata: {}
971
- post_install_message:
972
+ post_install_message:
972
973
  rdoc_options: []
973
974
  require_paths:
974
975
  - lib
@@ -984,7 +985,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
984
985
  version: 1.3.1
985
986
  requirements: []
986
987
  rubygems_version: 3.1.6
987
- signing_key:
988
+ signing_key:
988
989
  specification_version: 4
989
990
  summary: The mdtranslator (metadata translator) is a tool for translating metadata
990
991
  in one format to another. The tool is written and maintained by the Alaska Data