adiwg-mdtranslator 2.15.0 → 2.18.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +29 -2
  3. data/Rakefile +9 -12
  4. data/adiwg-mdtranslator.gemspec +2 -2
  5. data/lib/adiwg/mdtranslator/internal/acquisition.json +108 -0
  6. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +278 -18
  7. data/lib/adiwg/mdtranslator/internal/qualityReport.json +64 -0
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +6 -2
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -2
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +11 -1
  11. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +4 -0
  12. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +15 -0
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_algorithm.rb +65 -0
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -0
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +18 -2
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +9 -0
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +9 -0
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +10 -0
  19. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +7 -1
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_nominalResolution.rb +78 -0
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +25 -10
  22. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +9 -2
  23. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processReport.rb +66 -0
  24. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +35 -9
  25. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processing.rb +103 -0
  26. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_rangeElementDescription.rb +38 -0
  27. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +27 -2
  28. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +10 -0
  29. data/lib/adiwg/mdtranslator/version.rb +6 -1
  30. data/lib/adiwg/mdtranslator/writers/html/sections/html_algorithm.rb +48 -0
  31. data/lib/adiwg/mdtranslator/writers/html/sections/html_georectifiedRepresentation.rb +12 -0
  32. data/lib/adiwg/mdtranslator/writers/html/sections/html_georeferenceableRepresentation.rb +13 -0
  33. data/lib/adiwg/mdtranslator/writers/html/sections/html_gridRepresentation.rb +13 -0
  34. data/lib/adiwg/mdtranslator/writers/html/sections/html_nominalResolution.rb +51 -0
  35. data/lib/adiwg/mdtranslator/writers/html/sections/html_onlineResource.rb +14 -0
  36. data/lib/adiwg/mdtranslator/writers/html/sections/html_processReport.rb +47 -0
  37. data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +35 -8
  38. data/lib/adiwg/mdtranslator/writers/html/sections/html_processing.rb +89 -0
  39. data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +27 -2
  40. data/lib/adiwg/mdtranslator/writers/html/sections/html_vectorRepresentation.rb +13 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +20 -15
  42. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +4 -4
  43. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_algorithm.rb +61 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCatalog.rb +53 -0
  45. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +9 -0
  46. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +10 -0
  47. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +11 -1
  48. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +2 -2
  49. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +21 -0
  50. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leProcessStep.rb +167 -0
  51. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leSource.rb +150 -0
  52. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liProcessStep.rb +130 -0
  53. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liSource.rb +126 -0
  54. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +5 -4
  55. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +18 -3
  56. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_nominalResolution.rb +61 -0
  57. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +19 -2
  58. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +23 -0
  59. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_partyIdentifier.rb +92 -0
  60. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processReport.rb +66 -0
  61. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +22 -101
  62. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processing.rb +110 -0
  63. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeElementDescription.rb +45 -0
  64. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +8 -0
  65. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +19 -95
  66. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +9 -0
  67. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +11 -0
  68. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_algorithm.rb +61 -0
  69. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leProcessStep.rb +153 -0
  70. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leSource.rb +134 -0
  71. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liProcessStep.rb +126 -0
  72. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liSource.rb +114 -0
  73. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +13 -11
  74. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_nominalResolution.rb +61 -0
  75. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +26 -20
  76. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processReport.rb +66 -0
  77. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +22 -96
  78. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processing.rb +110 -0
  79. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +20 -82
  80. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +2 -2
  81. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +9 -0
  82. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_algorithm.rb +31 -0
  83. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_attribute.rb +1 -0
  84. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_contact.rb +1 -0
  85. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georectifiedRepresentation.rb +1 -0
  86. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georeferenceableRepresentation.rb +1 -0
  87. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_gridRepresentation.rb +1 -0
  88. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_nominalResolution.rb +31 -0
  89. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_onlineResource.rb +6 -3
  90. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processReport.rb +31 -0
  91. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processStep.rb +5 -0
  92. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processing.rb +37 -0
  93. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_source.rb +7 -2
  94. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_vectorRepresentation.rb +1 -0
  95. data/lib/adiwg/mdtranslator_cli.rb +1 -1
  96. metadata +45 -12
@@ -0,0 +1,61 @@
1
+ # ISO <<Class>> LE_NominalResolution
2
+ # 19115-2 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 201-09-25 original script.
6
+
7
+ require_relative '../iso19115_2_writer'
8
+ require_relative 'class_measure'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_2
14
+
15
+ class LE_NominalResolution
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
21
+ end
22
+
23
+ def writeXML(hResolution, inContext = nil)
24
+
25
+ # classes used
26
+ measureClass = Measure.new(@xml, @hResponseObj)
27
+
28
+ outContext = 'resolution'
29
+ outContext = inContext + ' ' + outContext unless inContext.nil?
30
+
31
+ @xml.tag!('gmi:LE_NominalResolution') do
32
+
33
+ haveResolution = false
34
+
35
+ # resolution - scanning resolution {Measure} (required if)
36
+ unless hResolution[:scanningResolution].empty?
37
+ @xml.tag!('gmi:scanningResolution') do
38
+ measureClass.writeXML(hResolution[:scanningResolution], outContext)
39
+ haveResolution = true
40
+ end
41
+ end
42
+
43
+ unless hResolution[:groundResolution].empty?
44
+ @xml.tag!('gmi:groundResolution') do
45
+ measureClass.writeXML(hResolution[:groundResolution], outContext)
46
+ haveResolution = true
47
+ end
48
+ end
49
+
50
+ unless haveResolution
51
+ @NameSpace.issueWarning(400, 'gmi:scanningResolution', outContext)
52
+ end
53
+
54
+ end # gmi:LE_NominalResolution
55
+ end # writeXML
56
+ end # LE_NominalResolution class
57
+
58
+ end
59
+ end
60
+ end
61
+ end
@@ -2,6 +2,7 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-09-18 add applicationProfile
5
6
  # Stan Smith 2018-04-10 add error and warning messaging
6
7
  # Stan Smith 2016-11-18 refactored for mdTranslator/mdJson 2.0
7
8
  # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
@@ -37,57 +38,62 @@ module ADIWG
37
38
  @xml.tag! 'gmd:CI_OnlineResource' do
38
39
 
39
40
  # online resource - link - required
40
- s = hOlResource[:olResURI]
41
- unless s.nil?
41
+ unless hOlResource[:olResURI].nil?
42
42
  @xml.tag!('gmd:linkage') do
43
- @xml.tag!('gmd:URL', s)
43
+ @xml.tag!('gmd:URL', hOlResource[:olResURI])
44
44
  end
45
45
  end
46
- if s.nil?
46
+ if hOlResource[:olResURI].nil?
47
47
  @NameSpace.issueWarning(250, 'gmd:linkage', inContext)
48
48
  end
49
49
 
50
50
  # online resource - protocol
51
- s = hOlResource[:olResProtocol]
52
- unless s.nil?
51
+ unless hOlResource[:olResProtocol].nil?
53
52
  @xml.tag!('gmd:protocol') do
54
- @xml.tag!('gco:CharacterString', s)
53
+ @xml.tag!('gco:CharacterString', hOlResource[:olResProtocol])
55
54
  end
56
55
  end
57
- if s.nil? && @hResponseObj[:writerShowTags]
56
+ if hOlResource[:olResProtocol].nil? && @hResponseObj[:writerShowTags]
58
57
  @xml.tag!('gmd:protocol')
59
58
  end
60
59
 
60
+ # online resource - application profile
61
+ unless hOlResource[:olResApplicationProfile].nil?
62
+ @xml.tag!('gmd:applicationProfile') do
63
+ @xml.tag!('gco:CharacterString', hOlResource[:olResApplicationProfile])
64
+ end
65
+ end
66
+ if hOlResource[:olResApplicationProfile].nil? && @hResponseObj[:writerShowTags]
67
+ @xml.tag!('gmd:applicationProfile')
68
+ end
69
+
61
70
  # online resource - link name
62
- s = hOlResource[:olResName]
63
- unless s.nil?
71
+ unless hOlResource[:olResName].nil?
64
72
  @xml.tag!('gmd:name') do
65
- @xml.tag!('gco:CharacterString', s)
73
+ @xml.tag!('gco:CharacterString', hOlResource[:olResName])
66
74
  end
67
75
  end
68
- if s.nil? && @hResponseObj[:writerShowTags]
76
+ if hOlResource[:olResName].nil? && @hResponseObj[:writerShowTags]
69
77
  @xml.tag!('gmd:name')
70
78
  end
71
79
 
72
80
  # online resource - link description
73
- s = hOlResource[:olResDesc]
74
- unless s.nil?
81
+ unless hOlResource[:olResDesc].nil?
75
82
  @xml.tag!('gmd:description') do
76
- @xml.tag!('gco:CharacterString', s)
83
+ @xml.tag!('gco:CharacterString', hOlResource[:olResDesc])
77
84
  end
78
85
  end
79
- if s.nil? && @hResponseObj[:writerShowTags]
86
+ if hOlResource[:olResDesc].nil? && @hResponseObj[:writerShowTags]
80
87
  @xml.tag!('gmd:description')
81
88
  end
82
89
 
83
90
  # online resource - link function {CI_OnLineFunctionCode}
84
- s = hOlResource[:olResFunction]
85
- unless s.nil?
91
+ unless hOlResource[:olResFunction].nil?
86
92
  @xml.tag!('gmd:function') do
87
- codelistClass.writeXML('gmd', 'iso_onlineFunction', s)
93
+ codelistClass.writeXML('gmd', 'iso_onlineFunction', hOlResource[:olResFunction])
88
94
  end
89
95
  end
90
- if s.nil? && @hResponseObj[:writerShowTags]
96
+ if hOlResource[:olResFunction].nil? && @hResponseObj[:writerShowTags]
91
97
  @xml.tag!('gmd:function')
92
98
  end
93
99
 
@@ -0,0 +1,66 @@
1
+ # ISO <<Class>> LE_ProcessStepReport
2
+ # 19115-2 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-09-25 original script.
6
+
7
+ require_relative '../iso19115_2_writer'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Iso19115_2
13
+
14
+ class LE_ProcessStepReport
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
20
+ end
21
+
22
+ def writeXML(hReport, inContext = nil)
23
+
24
+ outContext = 'process step report'
25
+ outContext = inContext + ' ' + outContext unless inContext.nil?
26
+
27
+ @xml.tag!('gmi:LE_ProcessStepReport') do
28
+
29
+ # process step report - name (required)
30
+ unless hReport[:name].nil?
31
+ @xml.tag!('gmi:name') do
32
+ @xml.tag!('gco:CharacterString', hReport[:name])
33
+ end
34
+ end
35
+ if hReport[:name].nil?
36
+ @NameSpace.issueWarning(410, 'gmi:name', outContext)
37
+ end
38
+
39
+ # process step report - description
40
+ unless hReport[:description].nil?
41
+ @xml.tag!('gmi:description') do
42
+ @xml.tag!('gco:CharacterString', hReport[:description])
43
+ end
44
+ end
45
+ if hReport[:description].nil? && @hResponseObj[:writerShowTags]
46
+ @xml.tag!('gmi:description')
47
+ end
48
+
49
+ # process step report - file type
50
+ unless hReport[:fileType].nil?
51
+ @xml.tag!('gmi:fileType') do
52
+ @xml.tag!('gco:CharacterString', hReport[:fileType])
53
+ end
54
+ end
55
+ if hReport[:fileType].nil? && @hResponseObj[:writerShowTags]
56
+ @xml.tag!('gmi:fileType')
57
+ end
58
+
59
+ end # gmi:LE_ProcessStepReport
60
+ end # writeXML
61
+ end # LE_ProcessStepReport class
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -1,123 +1,49 @@
1
- # ISO <<Class>> LI_ProcessStep
1
+ # ISO <<Abstract>> ProcessStep
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-04-10 add error and warning messaging
6
- # Stan Smith 2017-08-30 added support for step sources
7
- # Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
8
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
9
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
10
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
11
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
12
- # Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
13
- # Stan Smith 2013-11-20 original script.
5
+ # Stan Smith 2019-09-25 original script.
14
6
 
15
- require_relative '../iso19115_2_writer'
16
- require_relative 'class_responsibleParty'
17
- require_relative 'class_source'
7
+ require_relative 'class_liProcessStep'
8
+ require_relative 'class_leProcessStep'
18
9
 
19
10
  module ADIWG
20
11
  module Mdtranslator
21
12
  module Writers
22
13
  module Iso19115_2
23
14
 
24
- class LI_ProcessStep
15
+ class ProcessStep
25
16
 
26
17
  def initialize(xml, hResponseObj)
27
18
  @xml = xml
28
19
  @hResponseObj = hResponseObj
29
- @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
30
20
  end
31
21
 
32
- def writeXML(hStep)
22
+ def writeXML(hProcess, inContext = nil)
33
23
 
34
24
  # classes used
35
- partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
36
- sourceClass = LI_Source.new(@xml, @hResponseObj)
25
+ liProcessClass = LI_ProcessStep.new(@xml, @hResponseObj)
26
+ leProcessClass = LE_ProcessStep.new(@xml, @hResponseObj)
37
27
 
38
- outContext = 'process step'
39
- outContext = 'process step ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
28
+ outContext = inContext
40
29
 
41
- # process step - id
42
- attributes = {}
43
- s = hStep[:stepId]
44
- unless s.nil?
45
- attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
46
- end
47
-
48
- @xml.tag!('gmd:LI_ProcessStep', attributes) do
49
-
50
- # process step - description (required)
51
- s = hStep[:description]
52
- unless s.nil?
53
- @xml.tag!('gmd:description') do
54
- @xml.tag!('gco:CharacterString', s)
55
- end
56
- end
57
- if s.nil?
58
- @NameSpace.issueWarning(260, 'gmd:description')
59
- end
30
+ # use LE_ProcessStep if hProcess has any ...
31
+ # processingInformation, reports
32
+ # stepProducts (output)
60
33
 
61
- # process step - rationale
62
- s = hStep[:rationale]
63
- unless s.nil?
64
- @xml.tag!('gmd:rationale') do
65
- @xml.tag!('gco:CharacterString', s)
66
- end
67
- end
68
- if s.nil? && @hResponseObj[:writerShowTags]
69
- @xml.tag!('gmd:rationale')
70
- end
34
+ useLE = false
35
+ useLE = true unless hProcess[:processingInformation].empty?
36
+ useLE = true unless hProcess[:reports].empty?
37
+ useLE = true unless hProcess[:stepProducts].empty?
71
38
 
72
- # process step - datetime
73
- hPeriod = hStep[:timePeriod]
74
- unless hPeriod.empty?
75
- hDate = hPeriod[:startDateTime]
76
- if hDate.empty?
77
- hDate = hPeriod[:endDateTime]
78
- end
79
- date = hDate[:dateTime]
80
- dateResolution = hDate[:dateResolution]
81
- s = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateResolution)
82
- if s != 'ERROR'
83
- @xml.tag!('gmd:dateTime') do
84
- @xml.tag!('gco:DateTime', s)
85
- end
86
- end
87
- end
88
- if hPeriod.empty? && @hResponseObj[:writerShowTags]
89
- @xml.tag!('gmd:dateTime')
90
- end
91
-
92
- # process step - processor [] {CI_ResponsibleParty}
93
- aParties = hStep[:processors]
94
- aParties.each do |hRParty|
95
- role = hRParty[:roleName]
96
- aParties = hRParty[:parties]
97
- aParties.each do |hParty|
98
- @xml.tag!('gmd:processor') do
99
- partyClass.writeXML(role, hParty, outContext)
100
- end
101
- end
102
- end
103
- if aParties.empty? && @hResponseObj[:writerShowTags]
104
- @xml.tag!('gmd:processor')
105
- end
106
-
107
- # process step - source [] {LI_Source}
108
- aSources = hStep[:stepSources]
109
- aSources.each do |hSource|
110
- @xml.tag!('gmd:source') do
111
- sourceClass.writeXML(hSource)
112
- end
113
- end
114
- if aSources.empty? && @hResponseObj[:writerShowTags]
115
- @xml.tag!('gmd:source')
116
- end
39
+ if useLE
40
+ leProcessClass.writeXML(hProcess, outContext)
41
+ else
42
+ liProcessClass.writeXML(hProcess, outContext)
43
+ end
117
44
 
118
- end # gmd:LI_ProcessStep tag
119
45
  end # writeXML
120
- end # LI_ProcessStep class
46
+ end # processStep class
121
47
 
122
48
  end
123
49
  end
@@ -0,0 +1,110 @@
1
+ # ISO <<Class>> LE_Processing
2
+ # 19115-2 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 201-09-25 original script.
6
+
7
+ require_relative '../iso19115_2_writer'
8
+ require_relative 'class_rsIdentifier'
9
+ require_relative 'class_citation'
10
+ require_relative 'class_algorithm'
11
+
12
+ module ADIWG
13
+ module Mdtranslator
14
+ module Writers
15
+ module Iso19115_2
16
+
17
+ class LE_Processing
18
+
19
+ def initialize(xml, hResponseObj)
20
+ @xml = xml
21
+ @hResponseObj = hResponseObj
22
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
23
+ end
24
+
25
+ def writeXML(hProcessing, inContext = nil)
26
+
27
+ # classes used
28
+ identifierClass = RS_Identifier.new(@xml, @hResponseObj)
29
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
30
+ algorithmClass = LE_Algorithm.new(@xml, @hResponseObj)
31
+
32
+ outContext = 'processing'
33
+ outContext = inContext + ' ' + outContext unless inContext.nil?
34
+
35
+ @xml.tag!('gmi:LE_Processing') do
36
+
37
+ # processing - identifier {RS_Identifier} (required)
38
+ unless hProcessing[:identifier].empty?
39
+ hIdentifier = hProcessing[:identifier]
40
+ unless hIdentifier.empty?
41
+ @xml.tag!('gmi:identifier') do
42
+ identifierClass.writeXML(hIdentifier, outContext)
43
+ end
44
+ end
45
+ end
46
+ if hProcessing[:identifier].nil?
47
+ @NameSpace.issueWarning(420, 'gmi:identifier', outContext)
48
+ end
49
+
50
+ # processing - software reference {CI_Citation}
51
+ hCitation = hProcessing[:softwareReference]
52
+ unless hCitation.empty?
53
+ @xml.tag!('gmi:softwareReference') do
54
+ citationClass.writeXML(hCitation, outContext)
55
+ end
56
+ end
57
+ if hCitation.empty? && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('gmi:softwareReference')
59
+ end
60
+
61
+ # processing - procedure description
62
+ unless hProcessing[:procedureDescription].nil?
63
+ @xml.tag!('gmi:procedureDescription') do
64
+ @xml.tag!('gco:CharacterString', hProcessing[:procedureDescription])
65
+ end
66
+ end
67
+ if hProcessing[:procedureDescription].nil? && @hResponseObj[:writerShowTags]
68
+ @xml.tag!('gmi:procedureDescription')
69
+ end
70
+
71
+ # processing - documentation [] {CI_Citation}
72
+ aCitations = hProcessing[:documentation]
73
+ aCitations.each do |hCitation|
74
+ @xml.tag!('gmi:documentation') do
75
+ citationClass.writeXML(hCitation, outContext)
76
+ end
77
+ end
78
+ if aCitations.empty? && @hResponseObj[:writerShowTags]
79
+ @xml.tag!('gmi:documentation')
80
+ end
81
+
82
+ # processing - runtime parameters
83
+ unless hProcessing[:runtimeParameters].nil?
84
+ @xml.tag!('gmi:runTimeParameters') do
85
+ @xml.tag!('gco:CharacterString', hProcessing[:runtimeParameters])
86
+ end
87
+ end
88
+ if hProcessing[:runtimeParameters].nil? && @hResponseObj[:writerShowTags]
89
+ @xml.tag!('gmi:runTimeParameters')
90
+ end
91
+
92
+ # processing - algorithm [] {LE_Algorithm}
93
+ aAlgorithms = hProcessing[:algorithms]
94
+ aAlgorithms.each do |hAlgorithm|
95
+ @xml.tag!('gmi:algorithm') do
96
+ algorithmClass.writeXML(hAlgorithm, outContext)
97
+ end
98
+ end
99
+ if aAlgorithms.empty? && @hResponseObj[:writerShowTags]
100
+ @xml.tag!('gmi:algorithm')
101
+ end
102
+
103
+ end # gmi:LE_ProcessStepReport
104
+ end # writeXML
105
+ end # LE_ProcessStepReport class
106
+
107
+ end
108
+ end
109
+ end
110
+ end
@@ -1,109 +1,47 @@
1
- # ISO <<Class>> LI_Source
1
+ # ISO <<Abstract>> Source
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-07 refactored for mdTranslator/mdJson 2.0
6
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
8
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
9
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
10
- # Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
11
- # Stan Smith 2013-11-20 original script.
5
+ # Stan Smith 2019-09-25 original script.
12
6
 
13
- require_relative 'class_fraction'
14
- require_relative 'class_referenceSystem'
15
- require_relative 'class_citation'
16
- require_relative 'class_processStep'
7
+ require_relative 'class_liSource'
8
+ require_relative 'class_leSource'
17
9
 
18
10
  module ADIWG
19
11
  module Mdtranslator
20
12
  module Writers
21
13
  module Iso19115_2
22
14
 
23
- class LI_Source
15
+ class Source
24
16
 
25
17
  def initialize(xml, hResponseObj)
26
18
  @xml = xml
27
19
  @hResponseObj = hResponseObj
28
20
  end
29
21
 
30
- def writeXML(hSource)
22
+ def writeXML(hSource, inContext = nil)
31
23
 
32
24
  # classes used
33
- fractionClass = MD_RepresentativeFraction.new(@xml, @hResponseObj)
34
- systemClass = MD_ReferenceSystem.new(@xml, @hResponseObj)
35
- citationClass = CI_Citation.new(@xml, @hResponseObj)
36
- stepClass = LI_ProcessStep.new(@xml, @hResponseObj)
25
+ liSourceClass = LI_Source.new(@xml, @hResponseObj)
26
+ leSourceClass = LE_Source.new(@xml, @hResponseObj)
37
27
 
38
- # source - id
39
- attributes = {}
40
- s = hSource[:sourceId]
41
- unless s.nil?
42
- attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
43
- end
44
-
45
- @xml.tag!('gmd:LI_Source', attributes) do
46
-
47
- # source - description
48
- s = hSource[:description]
49
- unless s.nil?
50
- @xml.tag!('gmd:description') do
51
- @xml.tag!('gco:CharacterString', s)
52
- end
53
- end
54
- if s.nil? && @hResponseObj[:writerShowTags]
55
- @xml.tag!('gmd:description')
56
- end
28
+ outContext = inContext
57
29
 
58
- # source - scale denominator
59
- hResolution = hSource[:spatialResolution]
60
- unless hResolution[:scaleFactor].nil?
61
- @xml.tag!('gmd:scaleDenominator') do
62
- fractionClass.writeXML(hResolution[:scaleFactor])
63
- end
64
- end
65
- if hResolution[:scaleFactor].nil? && @hResponseObj[:writerShowTags]
66
- @xml.tag!('gmd:scaleDenominator')
67
- end
30
+ # use LE_Source if hSource has any ...
31
+ # processedLevel, resolution
68
32
 
69
- # source - reference system
70
- hSystem = hSource[:referenceSystem]
71
- unless hSystem.empty?
72
- @xml.tag!('gmd:sourceReferenceSystem') do
73
- systemClass.writeXML(hSystem)
74
- end
75
- end
76
- if hSystem.empty? && @hResponseObj[:writerShowTags]
77
- @xml.tag!('gmd:sourceReferenceSystem')
78
- end
33
+ useLE = false
34
+ useLE = true unless hSource[:processedLevel].empty?
35
+ useLE = true unless hSource[:resolution].empty?
79
36
 
80
- # source - citation
81
- hCitation = hSource[:sourceCitation]
82
- unless hCitation.empty?
83
- @xml.tag!('gmd:sourceCitation') do
84
- citationClass.writeXML(hCitation, 'lineage source')
85
- end
86
- end
87
- if hCitation.empty? && @hResponseObj[:writerShowTags]
88
- @xml.tag!('gmd:sourceCitation')
89
- end
90
-
91
- # source - extent [] (not implemented)
92
-
93
- # source - process step []
94
- aSteps = hSource[:sourceSteps]
95
- aSteps.each do |hStep|
96
- @xml.tag!('gmd:sourceStep') do
97
- stepClass.writeXML(hStep)
98
- end
99
- end
100
- if aSteps.empty? && @hResponseObj[:writerShowTags]
101
- @xml.tag!('gmd:sourceStep')
102
- end
37
+ if useLE
38
+ leSourceClass.writeXML(hSource, outContext)
39
+ else
40
+ liSourceClass.writeXML(hSource, outContext)
41
+ end
103
42
 
104
- end # gmd:LI_Source tag
105
43
  end # writeXML
106
- end # LI_Source class
44
+ end # Source class
107
45
 
108
46
  end
109
47
  end
@@ -67,7 +67,7 @@ module ADIWG
67
67
  @xml.tag!('gmd:taxongen')
68
68
  end
69
69
 
70
- # taxon system - identification reference (required) [{citation}]
70
+ # taxon system - identification reference [] (required) {citation}
71
71
  # convert to RS_Identifier
72
72
  aCitations = hSystem[:idReferences]
73
73
  aCitations.each do |hCitation|
@@ -84,7 +84,7 @@ module ADIWG
84
84
  @NameSpace.issueWarning(311, 'gmd:idref')
85
85
  end
86
86
 
87
- # taxon system - observers [{CI_ResponsibleParty}]
87
+ # taxon system - observers [] {CI_ResponsibleParty}
88
88
  aObservers = hSystem[:observers]
89
89
  aObservers.each do |hObserver|
90
90
  role = hObserver[:roleName]
@@ -116,3 +116,12 @@ messageList:
116
116
  - {id: 370, message: "invalid obligation code"}
117
117
 
118
118
  - {id: 380, message: "invalid topic category"}
119
+
120
+ - {id: 390, message: "algorithm citation is missing"}
121
+ - {id: 391, message: "algorithm description is missing"}
122
+
123
+ - {id: 400, message: "nominal resolution is missing"}
124
+
125
+ - {id: 410, message: "process step report name is missing"}
126
+
127
+ - {id: 420, message: "processing identifier is missing"}
@@ -0,0 +1,31 @@
1
+ # mdJson 2.0 writer - algorithm
2
+
3
+ # History:
4
+ # Stan Smith 2019-09-24 original script
5
+
6
+ require 'jbuilder'
7
+ require_relative 'mdJson_citation'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module MdJson
13
+
14
+ module Algorithm
15
+
16
+ @Namespace = ADIWG::Mdtranslator::Writers::MdJson
17
+
18
+ def self.build(hAlgorithm)
19
+
20
+ Jbuilder.new do |json|
21
+ json.citation Citation.build(hAlgorithm[:citation]) unless hAlgorithm[:citation].empty?
22
+ json.description hAlgorithm[:description]
23
+ end
24
+
25
+ end # build
26
+ end # Algorithm
27
+
28
+ end
29
+ end
30
+ end
31
+ end