adiwg-mdtranslator 2.17.1 → 2.18.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -0
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +11 -5
  5. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +4 -0
  6. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -0
  7. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +18 -2
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +9 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +9 -0
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +10 -0
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +7 -1
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +9 -2
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_rangeElementDescription.rb +38 -0
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +10 -0
  15. data/lib/adiwg/mdtranslator/version.rb +1 -1
  16. data/lib/adiwg/mdtranslator/writers/html/sections/html_georectifiedRepresentation.rb +12 -0
  17. data/lib/adiwg/mdtranslator/writers/html/sections/html_georeferenceableRepresentation.rb +13 -0
  18. data/lib/adiwg/mdtranslator/writers/html/sections/html_gridRepresentation.rb +13 -0
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_vectorRepresentation.rb +13 -0
  20. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +9 -0
  21. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +10 -0
  22. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +11 -1
  23. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +2 -2
  24. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +21 -0
  25. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +23 -0
  26. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_partyIdentifier.rb +92 -0
  27. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeElementDescription.rb +45 -0
  28. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +8 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +9 -0
  30. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_attribute.rb +1 -0
  31. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_contact.rb +1 -0
  32. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georectifiedRepresentation.rb +1 -0
  33. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georeferenceableRepresentation.rb +1 -0
  34. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_gridRepresentation.rb +1 -0
  35. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_vectorRepresentation.rb +1 -0
  36. metadata +12 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b362845af6332b68c79bd86eefb21288c3571eb77673bb54fb2354d60ea947f
4
- data.tar.gz: a62c78bf1888b263870db379c5303c1d7d07e89fd7d5712b0584b6f0b44d6457
3
+ metadata.gz: 67548c26ee946f10c11bb16593fea2bff705209467ffd4fbe9b9ce5db971803e
4
+ data.tar.gz: c4c6850208bbf1e47621c741777862cc6f30c2f6668d1753309c4f7397618311
5
5
  SHA512:
6
- metadata.gz: 9aca1d45a359ac891958c803f880716bdb6016e00cf510e43ef7462e407c2678608c12affee79f5340d16c7e29ffeafb3f2fa146578fe4ea1921d6073a651e7c
7
- data.tar.gz: 47db90725c67976476de6cc3c7f3c92eeac6fee01c5c6a943b696abc6e9c72f03c23174224e38954e0df6e38d897d63f4376f661be0d7508067f4b995cb725b3
6
+ metadata.gz: 76385a2877ccbb04739c2aac4a2526912f97d1d3a3863c9779ff948f447b5434f34d68030ad2a143466ac2fa804887d1edd60b56587e14b3a069545651fb52fb
7
+ data.tar.gz: 53326a9899e781aaa171bbaa25a18a6d0e736d3d615bb1f6f24c7818a65885b42cb3345bfb37d4d2f5155727cb3aee6660e56088b31ce8303999dac4ad2f8634
data/Rakefile CHANGED
@@ -26,6 +26,7 @@ Rake::TestTask.new do |t|
26
26
  'test/translator/tc*.rb'
27
27
  ]
28
28
  t.verbose = true
29
+ t.warning = false
29
30
  end
30
31
 
31
32
  desc 'Run tests'
@@ -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.7"
37
+ spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.8.0.pre.beta"
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"
@@ -311,8 +311,9 @@ class InternalMetadata
311
311
  eMailList: [],
312
312
  onlineResources: [],
313
313
  hoursOfService: [],
314
+ externalIdentifiers: [],
314
315
  contactInstructions: nil,
315
- contactType: nil
316
+ contactType: nil,
316
317
  }
317
318
  end
318
319
 
@@ -492,6 +493,7 @@ class InternalMetadata
492
493
  maxValue: nil,
493
494
  units: nil,
494
495
  scaleFactor: nil,
496
+ rangeElementDescriptions: [],
495
497
  offset: nil,
496
498
  meanValue: nil,
497
499
  numberOfValues: nil,
@@ -1181,7 +1183,8 @@ class InternalMetadata
1181
1183
  numberOfDimensions: nil,
1182
1184
  dimension: [],
1183
1185
  cellGeometry: nil,
1184
- transformationParameterAvailable: false
1186
+ transformationParameterAvailable: false,
1187
+ scope: []
1185
1188
  }
1186
1189
  end
1187
1190
 
@@ -1198,7 +1201,8 @@ class InternalMetadata
1198
1201
  def newVectorInfo
1199
1202
  {
1200
1203
  topologyLevel: nil,
1201
- vectorObject: []
1204
+ vectorObject: [],
1205
+ scope: []
1202
1206
  }
1203
1207
  end
1204
1208
 
@@ -1218,7 +1222,8 @@ class InternalMetadata
1218
1222
  centerPoint: [],
1219
1223
  pointInPixel: nil,
1220
1224
  transformationDimensionDescription: nil,
1221
- transformationDimensionMapping: nil
1225
+ transformationDimensionMapping: nil,
1226
+ scope: []
1222
1227
  }
1223
1228
  end
1224
1229
 
@@ -1229,7 +1234,8 @@ class InternalMetadata
1229
1234
  orientationParameterAvailable: false,
1230
1235
  orientationParameterDescription: nil,
1231
1236
  georeferencedParameter: nil,
1232
- parameterCitation: []
1237
+ parameterCitation: [],
1238
+ scope: []
1233
1239
  }
1234
1240
  end
1235
1241
 
@@ -43,6 +43,10 @@ module ADIWG
43
43
  return {}
44
44
  end
45
45
 
46
+ if hMdJson.is_a?(Array)
47
+ hMdJson = hMdJson.first
48
+ end
49
+
46
50
  # file must contain an mdJson object
47
51
  if hMdJson.empty?
48
52
  hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: object is empty'
@@ -6,6 +6,8 @@
6
6
  # Stan Smith 2016-10-18 original script
7
7
 
8
8
  require_relative 'module_identifier'
9
+ require_relative 'module_rangeElementDescription'
10
+
9
11
 
10
12
  module ADIWG
11
13
  module Mdtranslator
@@ -101,6 +103,16 @@ module ADIWG
101
103
  end
102
104
  end
103
105
 
106
+ if hAttribute.has_key?('rangeElementDescriptions')
107
+ unless hAttribute['rangeElementDescriptions'].nil?
108
+ intAttGroup[:rangeElementDescriptions] = []
109
+
110
+ hAttribute['rangeElementDescriptions'].each do |item|
111
+ intAttGroup[:rangeElementDescriptions] << RangeElementDescription.unpack(item, responseObj, outContext)
112
+ end
113
+ end
114
+ end
115
+
104
116
  # attribute group - offset
105
117
  if hAttribute.has_key?('offset')
106
118
  unless hAttribute['offset'] == ''
@@ -9,6 +9,7 @@ require_relative 'module_onlineResource'
9
9
  require_relative 'module_phone'
10
10
  require_relative 'module_address'
11
11
  require_relative 'module_graphic'
12
+ require_relative 'module_identifier'
12
13
 
13
14
  module ADIWG
14
15
  module Mdtranslator
@@ -35,13 +36,28 @@ module ADIWG
35
36
 
36
37
  # contact - contact id (required)
37
38
  if hContact.has_key?('contactId')
38
- intContact[:contactId] = hContact['contactId']
39
- outContext = 'contact ID ' + hContact['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
40
46
  end
41
47
  if intContact[:contactId].nil? || intContact[:contactId] == ''
42
48
  @MessagePath.issueError(101, responseObj)
43
49
  end
44
50
 
51
+ if hContact.has_key?('externalIdentifiers')
52
+ aItems = hContact['externalIdentifiers']
53
+ aItems.each do |item|
54
+ hReturn = Identifier.unpack(item, responseObj, outContext)
55
+ unless hReturn.nil?
56
+ intContact[:externalIdentifiers] << hReturn
57
+ end
58
+ end
59
+ end
60
+
45
61
  # contact - is organization (required)
46
62
  if hContact.has_key?('isOrganization')
47
63
  if hContact['isOrganization'] === true
@@ -104,6 +104,15 @@ module ADIWG
104
104
  end
105
105
  end
106
106
 
107
+ if hGeoRec.has_key?('scope')
108
+ hGeoRec['scope'].each do |item|
109
+ scope = Scope.unpack(item, responseObj, inContext)
110
+ unless scope.nil?
111
+ intGeoRec[:scope] << scope
112
+ end
113
+ end
114
+ end
115
+
107
116
  return intGeoRec
108
117
 
109
118
  end
@@ -88,6 +88,15 @@ module ADIWG
88
88
  end
89
89
  end
90
90
 
91
+ if hGeoRef.has_key?('scope')
92
+ hGeoRef['scope'].each do |item|
93
+ scope = Scope.unpack(item, responseObj, inContext)
94
+ unless scope.nil?
95
+ intGeoRef[:scope] << scope
96
+ end
97
+ end
98
+ end
99
+
91
100
  return intGeoRef
92
101
 
93
102
  end
@@ -6,6 +6,7 @@
6
6
  # Stan Smith 2016-10-19 original script
7
7
 
8
8
  require_relative 'module_dimension'
9
+ require_relative 'module_scope'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -71,6 +72,15 @@ module ADIWG
71
72
  end
72
73
  end
73
74
 
75
+ if hGrid.has_key?('scope')
76
+ hGrid['scope'].each do |item|
77
+ scope = Scope.unpack(item, responseObj, outContext)
78
+ unless scope.nil?
79
+ intGrid[:scope] << scope
80
+ end
81
+ end
82
+ end
83
+
74
84
  return intGrid
75
85
 
76
86
  end
@@ -123,7 +123,13 @@ module ADIWG
123
123
  contactType = nil
124
124
  contactName = nil
125
125
  @contacts.each_with_index do |contact, i|
126
- if contact[:contactId] == contactId
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
+
127
133
  contactIndex = i
128
134
  if contact[:isOrganization]
129
135
  contactType = 'organization'
@@ -30,11 +30,18 @@ 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
- intParty[:contactId] = hParty['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
+
34
41
  unless intParty[:contactId].nil? || intParty[:contactId] == ''
35
42
  hContact = @MessagePath.findContact(hParty['contactId'])
36
43
  if hContact[0].nil?
37
- outContext = 'contact ID ' + intParty[:contactId]
44
+ outContext = 'contact ID ' + context
38
45
  outContext = inContext + ' > ' + outContext unless inContext.nil?
39
46
  @MessagePath.issueError(622, responseObj, outContext)
40
47
  else
@@ -0,0 +1,38 @@
1
+ # unpack range element description
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Readers
6
+ module MdJson
7
+
8
+ module RangeElementDescription
9
+
10
+ def self.unpack(hRangeElementDescription, responseObj, inContext = nil)
11
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
12
+
13
+ outContext = 'range element description'
14
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
15
+
16
+ intRangeElementDescription = {}
17
+
18
+ if hRangeElementDescription.has_key?('name')
19
+ intRangeElementDescription[:name] = hRangeElementDescription['name']
20
+ end
21
+
22
+ if hRangeElementDescription.has_key?('definition')
23
+ intRangeElementDescription[:definition] = hRangeElementDescription['definition']
24
+ end
25
+
26
+ if hRangeElementDescription.has_key?('rangeElements')
27
+ intRangeElementDescription[:rangeElements] = hRangeElementDescription['rangeElements']
28
+ end
29
+
30
+ return intRangeElementDescription
31
+
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -6,6 +6,7 @@
6
6
  # Stan Smith 2016-10-19 original script
7
7
 
8
8
  require_relative 'module_vectorObject'
9
+ require_relative 'module_scope'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -52,6 +53,15 @@ module ADIWG
52
53
  end
53
54
  end
54
55
 
56
+ if hVector.has_key?('scope')
57
+ hVector['scope'].each do |item|
58
+ scope = Scope.unpack(item, responseObj, outContext)
59
+ unless scope.nil?
60
+ intVector[:scope] << scope
61
+ end
62
+ end
63
+ end
64
+
55
65
  # error messages
56
66
  unless haveVector
57
67
  @MessagePath.issueError(911, responseObj, inContext)
@@ -109,7 +109,7 @@
109
109
  module ADIWG
110
110
  module Mdtranslator
111
111
  # current mdtranslator version
112
- VERSION = "2.17.1"
112
+ VERSION = "2.18.0rc1"
113
113
  end
114
114
  end
115
115
 
@@ -5,6 +5,7 @@
5
5
  # Stan Smith 2017-03-28 original script
6
6
 
7
7
  require_relative 'html_gridRepresentation'
8
+ require_relative 'html_scope'
8
9
 
9
10
  module ADIWG
10
11
  module Mdtranslator
@@ -21,6 +22,17 @@ module ADIWG
21
22
 
22
23
  # classes used
23
24
  gridClass = Html_GridRepresentation.new(@html)
25
+ scopeClass = Html_Scope.new(@html)
26
+
27
+ # georectified representation - scope
28
+ hGeorectified[:scope].each do |scope|
29
+ @html.details do
30
+ @html.summary('Scope ', 'class' => 'h5')
31
+ @html.section(:class => 'block') do
32
+ scopeClass.writeHtml(hGeorectified[:scope])
33
+ end
34
+ end
35
+ end
24
36
 
25
37
  # georectified representation - grid {gridRepresentation}
26
38
  unless hGeorectified[:gridRepresentation].empty?
@@ -6,6 +6,7 @@
6
6
 
7
7
  require_relative 'html_gridRepresentation'
8
8
  require_relative 'html_citation'
9
+ require_relative 'html_scope'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -23,6 +24,18 @@ module ADIWG
23
24
  # classes used
24
25
  gridClass = Html_GridRepresentation.new(@html)
25
26
  citationClass = Html_Citation.new(@html)
27
+ scopeClass = Html_Scope.new(@html)
28
+
29
+ # georeferenceable representation - scope
30
+ hGeoreferenceable[:scope].each do |scope|
31
+ @html.details do
32
+ @html.summary('Scope ', 'class' => 'h5')
33
+ @html.section(:class => 'block') do
34
+ scopeClass.writeHtml(hGeoreferenceable[:scope])
35
+ end
36
+ end
37
+ end
38
+
26
39
 
27
40
  # georeferenceable representation - grid {gridRepresentation}
28
41
  unless hGeoreferenceable[:gridRepresentation].empty?
@@ -6,6 +6,7 @@
6
6
  # Stan Smith 2015-07-31 original script
7
7
 
8
8
  require_relative 'html_dimension'
9
+ require_relative 'html_scope'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -22,6 +23,18 @@ module ADIWG
22
23
 
23
24
  # classes used
24
25
  dimensionClass = Html_Dimension.new(@html)
26
+ scopeClass = Html_Scope.new(@html)
27
+
28
+ # grid representation - scope
29
+ hGrid[:scope].each do |scope|
30
+ @html.details do
31
+ @html.summary('Scope ', 'class' => 'h5')
32
+ @html.section(:class => 'block') do
33
+ scopeClass.writeHtml(hGrid[:scope])
34
+ end
35
+ end
36
+ end
37
+
25
38
 
26
39
  # grid representation - number of dimensions
27
40
  unless hGrid[:numberOfDimensions].nil?
@@ -6,6 +6,7 @@
6
6
  # Stan Smith 2017-03-28 original script
7
7
 
8
8
  require_relative 'html_vectorObject'
9
+ require_relative 'html_scope'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -22,6 +23,18 @@ module ADIWG
22
23
 
23
24
  # classes used
24
25
  objectClass = Html_VectorObject.new(@html)
26
+ scopeClass = Html_Scope.new(@html)
27
+
28
+ # vector representation - scope
29
+ hVector[:scope].each do |scope|
30
+ @html.details do
31
+ @html.summary('Scope ', 'class' => 'h5')
32
+ @html.section(:class => 'block') do
33
+ scopeClass.writeHtml(hVector[:scope])
34
+ end
35
+ end
36
+ end
37
+
25
38
 
26
39
  # vector representation - topology level
27
40
  unless hVector[:topologyLevel].nil?
@@ -7,6 +7,7 @@
7
7
  require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_grid'
9
9
  require_relative 'class_point'
10
+ require_relative 'class_scope'
10
11
 
11
12
  module ADIWG
12
13
  module Mdtranslator
@@ -26,12 +27,20 @@ module ADIWG
26
27
  # classes used
27
28
  gridClass = Grid.new(@xml, @hResponseObj)
28
29
  pointClass = Point.new(@xml, @hResponseObj)
30
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
31
+
29
32
 
30
33
  outContext = 'georectified representation'
31
34
  outContext = inContext + ' georectified representation' unless inContext.nil?
32
35
 
33
36
  @xml.tag!('msr:MD_Georectified') do
34
37
 
38
+ hGeoRec[:scope].each do |scope|
39
+ @xml.tag!('msr:scope') do
40
+ scopeClass.writeXML(scope, inContext)
41
+ end
42
+ end
43
+
35
44
  # georectified - add grid info
36
45
  hGrid = hGeoRec[:gridRepresentation]
37
46
  gridClass.writeXML(hGrid, outContext)
@@ -7,6 +7,7 @@
7
7
  require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_grid'
9
9
  require_relative 'class_citation'
10
+ require_relative 'class_scope'
10
11
 
11
12
  module ADIWG
12
13
  module Mdtranslator
@@ -26,12 +27,21 @@ module ADIWG
26
27
  # classes used
27
28
  gridClass = Grid.new(@xml, @hResponseObj)
28
29
  citationClass = CI_Citation.new(@xml, @hResponseObj)
30
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
31
+
29
32
 
30
33
  outContext = 'georeferenceable representation'
31
34
  outContext = inContext + ' georeferenceable representation' unless inContext.nil?
32
35
 
33
36
  @xml.tag!('msr:MD_Georeferenceable') do
34
37
 
38
+ # georeferenceable - scope
39
+ hGeoRef[:scope].each do |scope|
40
+ @xml.tag!('msr:scope') do
41
+ scopeClass.writeXML(scope, inContext)
42
+ end
43
+ end
44
+
35
45
  # georeferenceable - add grid info (required)
36
46
  hGrid = hGeoRef[:gridRepresentation]
37
47
  gridClass.writeXML(hGrid, outContext)
@@ -6,6 +6,7 @@
6
6
 
7
7
  require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_dimension'
9
+ require_relative 'class_scope'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -25,7 +26,15 @@ module ADIWG
25
26
  # classes used
26
27
  codelistClass = MD_Codelist.new(@xml, @hResponseObj)
27
28
  dimensionClass = MD_Dimension.new(@xml, @hResponseObj)
28
-
29
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
30
+
31
+ # grid - scope
32
+ hGrid[:scope].each do |scope|
33
+ @xml.tag!('msr:scope') do
34
+ scopeClass.writeXML(scope, inContext)
35
+ end
36
+ end
37
+
29
38
  # grid - number of dimensions (required)
30
39
  unless hGrid[:numberOfDimensions].nil?
31
40
  @xml.tag!('msr:numberOfDimensions') do
@@ -62,6 +71,7 @@ module ADIWG
62
71
  @xml.tag!('gco:Boolean', hGrid[:transformationParameterAvailable])
63
72
  end
64
73
 
74
+
65
75
  end # writeXML
66
76
  end # Grid class
67
77
 
@@ -32,12 +32,12 @@ module ADIWG
32
32
 
33
33
  # identifier - authority {CI_Citation}
34
34
  hCitation = hIdentifier[:citation]
35
- unless hCitation.empty?
35
+ unless hCitation.nil? || hCitation.empty?
36
36
  @xml.tag!('mcc:authority') do
37
37
  citationClass.writeXML(hCitation, outContext)
38
38
  end
39
39
  end
40
- if hCitation.empty? && @hResponseObj[:writerShowTags]
40
+ if hCitation.nil? || hCitation.empty? && @hResponseObj[:writerShowTags]
41
41
  @xml.tag!('mcc:authority')
42
42
  end
43
43
 
@@ -6,6 +6,7 @@
6
6
 
7
7
  require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_contact'
9
+ require_relative 'class_partyIdentifier'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -24,6 +25,7 @@ module ADIWG
24
25
 
25
26
  # classes used
26
27
  contactClass = CI_Contact.new(@xml, @hResponseObj)
28
+ identifierClass = MD_PartyIdentifier.new(@xml, @hResponseObj)
27
29
 
28
30
  outContext = 'individual contact'
29
31
  outContext = inContext + ' individual contact' unless inContext.nil?
@@ -70,6 +72,25 @@ module ADIWG
70
72
  @xml.tag!('cit:positionName')
71
73
  end
72
74
 
75
+ if hContact[:externalIdentifiers] && hContact[:externalIdentifiers].length > 0
76
+ hContact[:externalIdentifiers].each do |identifier|
77
+ @xml.tag!('cit:partyIdentifier') do
78
+ identifierClass.writeXML(identifier);
79
+ end
80
+ end
81
+ else
82
+ if hContact[:contactId] &&
83
+ hContact[:contactId].is_a?(Hash)
84
+ @xml.tag!('cit:partyIdentifier') do
85
+ identifierClass.writeXML(hContact[:contactId]);
86
+ end
87
+ elsif hContact[:contactId].is_a?(String)
88
+ @xml.tag!('cit:partyIdentifier') do
89
+ identifierClass.writeXML({ identifier: hContact[:contactId] })
90
+ end
91
+ end
92
+ end
93
+
73
94
  end
74
95
  end
75
96
  if hContact.empty?
@@ -8,6 +8,7 @@ require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_contact'
9
9
  require_relative 'class_browseGraphic'
10
10
  require_relative 'class_individual'
11
+ require_relative 'class_partyIdentifier'
11
12
 
12
13
  module ADIWG
13
14
  module Mdtranslator
@@ -28,6 +29,7 @@ module ADIWG
28
29
  contactClass = CI_Contact.new(@xml, @hResponseObj)
29
30
  graphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
30
31
  individualClass = CI_Individual.new(@xml, @hResponseObj)
32
+ identifierClass = MD_PartyIdentifier.new(@xml, @hResponseObj)
31
33
 
32
34
  outContext = 'responsible party'
33
35
  outContext = inContext + ' responsible party' unless inContext.nil?
@@ -91,6 +93,27 @@ module ADIWG
91
93
  @xml.tag!('cit:individual')
92
94
  end
93
95
 
96
+ # organization - party identifier
97
+
98
+ if hContact[:externalIdentifiers] && hContact[:externalIdentifiers].length > 0
99
+ hContact[:externalIdentifiers].each do |identifier|
100
+ @xml.tag!('cit:partyIdentifier') do
101
+ identifierClass.writeXML(identifier);
102
+ end
103
+ end
104
+ else
105
+ if hContact[:contactId] &&
106
+ hContact[:contactId].is_a?(Hash)
107
+ @xml.tag!('cit:partyIdentifier') do
108
+ identifierClass.writeXML(hContact[:contactId]);
109
+ end
110
+ elsif hContact[:contactId].is_a?(String)
111
+ @xml.tag!('cit:partyIdentifier') do
112
+ identifierClass.writeXML({ identifier: hContact[:contactId] })
113
+ end
114
+ end
115
+ end
116
+
94
117
  end
95
118
  if hContact.empty?
96
119
  @NameSpace.issueWarning(271, nil, outContext)
@@ -0,0 +1,92 @@
1
+ # ISO <<Class>> MD_Identifier for specific party identfier features for individual and organization
2
+ # 19115-3 output for ISO 19115-1 XML
3
+
4
+ require_relative '../iso19115_1_writer'
5
+ require_relative 'class_citation'
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_1
11
+
12
+ class MD_PartyIdentifier
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
18
+ end
19
+
20
+ def writeXML(hIdentifier, inContext = nil)
21
+
22
+ outContext = 'identifier'
23
+ outContext = inContext + ' authority' unless inContext.nil?
24
+
25
+ # classes used in MD_Metadata
26
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
27
+
28
+ @xml.tag!('mcc:MD_Identifier') do
29
+
30
+ # identifier - authority {CI_Citation}
31
+ hCitation = hIdentifier[:citation]
32
+ unless hCitation.nil? || hCitation.empty?
33
+ @xml.tag!('mcc:authority') do
34
+ citationClass.writeXML(hCitation, outContext)
35
+ end
36
+ end
37
+ if hCitation.nil? || hCitation.empty? && @hResponseObj[:writerShowTags]
38
+ @xml.tag!('mcc:authority')
39
+ end
40
+
41
+ # identifier - code (required)
42
+ s = hIdentifier[:identifier]
43
+ unless s.nil?
44
+ @xml.tag!('mcc:code') do
45
+ @xml.tag!('gco:CharacterString', s)
46
+ end
47
+ end
48
+ if s.nil?
49
+ @NameSpace.issueWarning(230, 'mcc:code', inContext)
50
+ end
51
+
52
+ # identifier - codeSpace
53
+ s = hIdentifier[:namespace]
54
+ unless s.nil?
55
+ @xml.tag!('mcc:codeSpace') do
56
+ @xml.tag!('gco:CharacterString', s)
57
+ end
58
+ end
59
+ if s.nil? && @hResponseObj[:writerShowTags]
60
+ @xml.tag!('mcc:codeSpace')
61
+ end
62
+
63
+ # identifier - codeSpace version
64
+ s = hIdentifier[:version]
65
+ unless s.nil?
66
+ @xml.tag!('mcc:version') do
67
+ @xml.tag!('gco:CharacterString', s)
68
+ end
69
+ end
70
+ if s.nil? && @hResponseObj[:writerShowTags]
71
+ @xml.tag!('mcc:version')
72
+ end
73
+
74
+ # identifier - description
75
+ s = hIdentifier[:description]
76
+ unless s.nil?
77
+ @xml.tag!('mcc:description') do
78
+ @xml.tag!('gco:CharacterString', s)
79
+ end
80
+ end
81
+ if s.nil? && @hResponseObj[:writerShowTags]
82
+ @xml.tag!('mcc:description')
83
+ end
84
+
85
+ end # MD_Identifier tag
86
+ end # writeXML
87
+ end # MD_Identifier class
88
+
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,45 @@
1
+ # ISO <<Class>> MI_RangeElementDescription attributes
2
+ # 19115-1 writer output in XML
3
+
4
+ require_relative '../iso19115_1_writer'
5
+
6
+ module ADIWG
7
+ module Mdtranslator
8
+ module Writers
9
+ module Iso19115_1
10
+
11
+ class MI_RangeElementDescription
12
+
13
+ def initialize(xml, hResponseObj)
14
+ @xml = xml
15
+ @hResponseObj = hResponseObj
16
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
17
+ end
18
+
19
+ def writeXML(hAttribute, inContext = nil)
20
+
21
+ unless hAttribute[:name].nil?
22
+ @xml.tag!('mrc:name') do
23
+ @xml.tag!('gco:CharacterString', hAttribute[:name])
24
+ end
25
+ end
26
+
27
+ unless hAttribute[:definition].nil?
28
+ @xml.tag!('mrc:definition') do
29
+ @xml.tag!('gco:CharacterString', hAttribute[:definition])
30
+ end
31
+ end
32
+
33
+ hAttribute[:rangeElements].each do |hRangeElement|
34
+ @xml.tag!('mrc:rangeElement') do
35
+ @xml.tag!('gco:Record') do
36
+ @xml.tag!('gco:CharacterString', hRangeElement)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -6,6 +6,7 @@
6
6
 
7
7
  require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_unitsOfMeasure'
9
+ require_relative 'class_rangeElementDescription'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -24,6 +25,7 @@ module ADIWG
24
25
 
25
26
  # classes used
26
27
  uomClass = UnitsOfMeasure.new(@xml, @hResponseObj)
28
+ rangeElementDescription = MI_RangeElementDescription.new(@xml, @hResponseObj)
27
29
 
28
30
  # sample dimension - max value {real}
29
31
  unless hAttribute[:maxValue].nil?
@@ -65,6 +67,12 @@ module ADIWG
65
67
  @xml.tag!('mrc:scaleFactor')
66
68
  end
67
69
 
70
+ hAttribute[:rangeElementDescriptions].each do |red|
71
+ @xml.tag!('mrc:rangeElementDescription') do
72
+ rangeElementDescription.writeXML(red, inContext)
73
+ end
74
+ end
75
+
68
76
  # sample dimension - offset {real}
69
77
  unless hAttribute[:offset].nil?
70
78
  @xml.tag!('mrc:offset') do
@@ -6,6 +6,7 @@
6
6
 
7
7
  require_relative 'class_codelist'
8
8
  require_relative 'class_geometricObjects'
9
+ require_relative 'class_scope'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -24,12 +25,20 @@ module ADIWG
24
25
  # classes used
25
26
  codelistClass = MD_Codelist.new(@xml, @hResponseObj)
26
27
  geoObjClass = MD_GeometricObjects.new(@xml, @hResponseObj)
28
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
27
29
 
28
30
  outContext = 'vector representation'
29
31
  outContext = inContext + ' vector representation' unless inContext.nil?
30
32
 
31
33
  @xml.tag!('msr:MD_VectorSpatialRepresentation') do
32
34
 
35
+ # vector representation - scope
36
+ hVector[:scope].each do |scope|
37
+ @xml.tag!('msr:scope') do
38
+ scopeClass.writeXML(scope, inContext)
39
+ end
40
+ end
41
+
33
42
  # vector representation - topology level
34
43
  unless hVector[:topologyLevel].nil?
35
44
  @xml.tag!('msr:topologyLevel') do
@@ -27,6 +27,7 @@ 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]
30
31
  json.offset hAttribute[:offset]
31
32
  json.meanValue hAttribute[:meanValue]
32
33
  json.numberOfValues hAttribute[:numberOfValues]
@@ -31,6 +31,7 @@ module ADIWG
31
31
  json.phone @Namespace.json_map(hContact[:phones], Phone)
32
32
  json.address @Namespace.json_map(hContact[:addresses], Address)
33
33
  json.electronicMailAddress hContact[:eMailList] unless hContact[:eMailList].empty?
34
+ json.externalIdentifiers hContact[:externalIdentifiers] unless hContact[:externalIdentifiers].empty?
34
35
  json.onlineResource @Namespace.json_map(hContact[:onlineResources], OnlineResource)
35
36
  json.hoursOfService hContact[:hoursOfService] unless hContact[:hoursOfService].empty?
36
37
  json.contactInstructions hContact[:contactInstructions]
@@ -24,6 +24,7 @@ module ADIWG
24
24
  json.pointInPixel hGeoRec[:pointInPixel]
25
25
  json.transformationDimensionDescription hGeoRec[:transformationDimensionDescription]
26
26
  json.transformationDimensionMapping hGeoRec[:transformationDimensionMapping]
27
+ json.scope hGeoRec[:scope]
27
28
  end
28
29
 
29
30
  end # build
@@ -25,6 +25,7 @@ module ADIWG
25
25
  json.orientationParameterDescription hGeoRef[:orientationParameterDescription]
26
26
  json.georeferencedParameter hGeoRef[:georeferencedParameter]
27
27
  json.parameterCitation @Namespace.json_map(hGeoRef[:parameterCitation], Citation)
28
+ json.scope hGeoRef[:scope]
28
29
  end
29
30
 
30
31
  end # build
@@ -23,6 +23,7 @@ module ADIWG
23
23
  json.dimension @Namespace.json_map(hGrid[:dimension], Dimension)
24
24
  json.cellGeometry hGrid[:cellGeometry]
25
25
  json.transformationParameterAvailable hGrid[:transformationParameterAvailable]
26
+ json.scope hGrid[:scope]
26
27
  end
27
28
 
28
29
  end # build
@@ -20,6 +20,7 @@ module ADIWG
20
20
  Jbuilder.new do |json|
21
21
  json.topologyLevel hVector[:topologyLevel]
22
22
  json.vectorObject @Namespace.json_map(hVector[:vectorObject], VectorObject)
23
+ json.scope hVector[:scope]
23
24
  end
24
25
 
25
26
  end # build
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.17.1
4
+ version: 2.18.0rc1
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: 2019-11-09 00:00:00.000000000 Z
12
+ date: 2022-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -127,16 +127,16 @@ dependencies:
127
127
  name: adiwg-mdjson_schemas
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ">="
130
+ - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: '2.7'
132
+ version: 2.8.0.pre.beta
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.7'
139
+ version: 2.8.0.pre.beta
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: adiwg-mdcodes
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -397,6 +397,7 @@ files:
397
397
  - lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb
398
398
  - lib/adiwg/mdtranslator/readers/mdJson/modules/module_processing.rb
399
399
  - lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb
400
+ - lib/adiwg/mdtranslator/readers/mdJson/modules/module_rangeElementDescription.rb
400
401
  - lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb
401
402
  - lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb
402
403
  - lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb
@@ -706,6 +707,7 @@ files:
706
707
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb
707
708
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_orderProcess.rb
708
709
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb
710
+ - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_partyIdentifier.rb
709
711
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_phone.rb
710
712
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_point.rb
711
713
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_polygon.rb
@@ -713,6 +715,7 @@ files:
713
715
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb
714
716
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processing.rb
715
717
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeDimension.rb
718
+ - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeElementDescription.rb
716
719
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_referenceSystem.rb
717
720
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_releasability.rb
718
721
  - lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_resolution.rb
@@ -976,11 +979,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
976
979
  version: '2.3'
977
980
  required_rubygems_version: !ruby/object:Gem::Requirement
978
981
  requirements:
979
- - - ">="
982
+ - - ">"
980
983
  - !ruby/object:Gem::Version
981
- version: '0'
984
+ version: 1.3.1
982
985
  requirements: []
983
- rubygems_version: 3.0.3
986
+ rubygems_version: 3.1.6
984
987
  signing_key:
985
988
  specification_version: 4
986
989
  summary: The mdtranslator (metadata translator) is a tool for translating metadata