adiwg-mdtranslator 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +402 -0
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +7 -2
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +196 -0
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +8 -0
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +1 -1
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +80 -26
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +13 -2
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +58 -0
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +101 -0
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +21 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +48 -0
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +83 -0
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_timePeriod.rb +10 -1
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +92 -71
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +49 -43
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +113 -90
  19. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_sbJson.rb +2 -1
  20. data/lib/adiwg/mdtranslator/version.rb +2 -1
  21. data/lib/adiwg/mdtranslator/writers/html/sections/html_allocation.rb +23 -0
  22. data/lib/adiwg/mdtranslator/writers/html/sections/html_funding.rb +9 -0
  23. data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +37 -0
  24. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +103 -91
  25. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_allocation.rb +7 -1
  26. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_funding.rb +4 -2
  27. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processStep.rb +6 -2
  28. metadata +11 -5
@@ -2,6 +2,7 @@
2
2
  # process step
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-08-30 added support for process step sources
5
6
  # Stan Smith 2017-04-03 refactored for mdTranslator 2.0
6
7
  # Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS
7
8
  # Stan Smith 2015-03-27 original script
@@ -10,6 +11,7 @@ require_relative 'html_temporalExtent'
10
11
  require_relative 'html_responsibility'
11
12
  require_relative 'html_citation'
12
13
  require_relative 'html_scope'
14
+ require_relative 'html_source'
13
15
 
14
16
  module ADIWG
15
17
  module Mdtranslator
@@ -29,6 +31,7 @@ module ADIWG
29
31
  responsibilityClass = Html_Responsibility.new(@html)
30
32
  citationClass = Html_Citation.new(@html)
31
33
  scopeClass = Html_Scope.new(@html)
34
+ sourceClass = Html_Source.new(@html)
32
35
 
33
36
  # process step - id
34
37
  unless hStep[:stepId].nil?
@@ -78,6 +81,40 @@ module ADIWG
78
81
  end
79
82
  end
80
83
 
84
+ # process step - step sources [] {source}
85
+ unless hStep[:stepSources].empty?
86
+ @html.details do
87
+ @html.summary('Step Source Datasets', {'class' => 'h5'})
88
+ @html.section(:class => 'block') do
89
+ hStep[:stepSources].each do |hSource|
90
+ @html.details do
91
+ @html.summary('Data Source', {'class' => 'h5'})
92
+ @html.section(:class => 'block') do
93
+ sourceClass.writeHtml(hSource)
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+
101
+ # process step - step products [] {source}
102
+ unless hStep[:stepProducts].empty?
103
+ @html.details do
104
+ @html.summary('Step Product Datasets', {'class' => 'h5'})
105
+ @html.section(:class => 'block') do
106
+ hStep[:stepProducts].each do |hSource|
107
+ @html.details do
108
+ @html.summary('Data Product', {'class' => 'h5'})
109
+ @html.section(:class => 'block') do
110
+ sourceClass.writeHtml(hSource)
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+
81
118
  # process step - processors [] {responsibility}
82
119
  hStep[:processors].each do |hResponsibility|
83
120
  @html.details do
@@ -2,106 +2,118 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-13 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
5
+ # Stan Smith 2017-08-30 added support for step sources
6
+ # Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
7
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
8
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
9
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
10
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
11
+ # Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
11
12
  # Stan Smith 2013-11-20 original script.
12
13
 
13
14
  require_relative 'class_responsibleParty'
15
+ require_relative 'class_source'
14
16
 
15
17
  module ADIWG
16
- module Mdtranslator
17
- module Writers
18
- module Iso19115_2
18
+ module Mdtranslator
19
+ module Writers
20
+ module Iso19115_2
19
21
 
20
- class LI_ProcessStep
22
+ class LI_ProcessStep
21
23
 
22
- def initialize(xml, hResponseObj)
23
- @xml = xml
24
- @hResponseObj = hResponseObj
25
- end
24
+ def initialize(xml, hResponseObj)
25
+ @xml = xml
26
+ @hResponseObj = hResponseObj
27
+ end
26
28
 
27
- def writeXML(hStep)
29
+ def writeXML(hStep)
28
30
 
29
- # classes used
30
- partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
31
+ # classes used
32
+ partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
33
+ sourceClass = LI_Source.new(@xml, @hResponseObj)
31
34
 
32
- # process step - id
33
- attributes = {}
34
- s = hStep[:stepId]
35
- unless s.nil?
36
- attributes['id' => s]
37
- end
35
+ # process step - id
36
+ attributes = {}
37
+ s = hStep[:stepId]
38
+ unless s.nil?
39
+ attributes['id' => s]
40
+ end
41
+
42
+ @xml.tag!('gmd:LI_ProcessStep', attributes) do
38
43
 
39
- @xml.tag!('gmd:LI_ProcessStep', attributes) do
40
-
41
- # process step - description (required)
42
- s = hStep[:description]
43
- unless s.nil?
44
- @xml.tag!('gmd:description') do
45
- @xml.tag!('gco:CharacterString', s)
46
- end
47
- end
48
- if s.nil?
49
- @xml.tag!('gmd:description', {'gco:nilReason' => 'missing'})
50
- end
51
-
52
- # process step - rationale
53
- s = hStep[:rationale]
54
- unless s.nil?
55
- @xml.tag!('gmd:rationale') do
56
- @xml.tag!('gco:CharacterString', s)
57
- end
58
- end
59
- if s.nil? && @hResponseObj[:writerShowTags]
60
- @xml.tag!('gmd:rationale')
61
- end
62
-
63
- # process step - datetime
64
- hPeriod = hStep[:timePeriod]
65
- unless hPeriod.empty?
66
- hDate = hPeriod[:startDateTime]
67
- if hDate.empty?
68
- hDate = hPeriod[:endDateTime]
69
- end
70
- date = hDate[:dateTime]
71
- dateResolution = hDate[:dateResolution]
72
- s = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateResolution)
73
- if s != 'ERROR'
74
- @xml.tag!('gmd:dateTime') do
75
- @xml.tag!('gco:DateTime', s)
76
- end
77
- end
78
- end
79
- if hPeriod.empty? && @hResponseObj[:writerShowTags]
80
- @xml.tag!('gmd:dateTime')
81
- end
82
-
83
- # process step - processor [{CI_ResponsibleParty}]
84
- aParties = hStep[:processors]
85
- aParties.each do |hRParty|
86
- role = hRParty[:roleName]
87
- aParties = hRParty[:parties]
88
- aParties.each do |hParty|
89
- @xml.tag!('gmd:processor') do
90
- partyClass.writeXML(role, hParty)
91
- end
92
- end
93
- end
94
- if aParties.empty? && @hResponseObj[:writerShowTags]
95
- @xml.tag!('gmd:processor')
96
- end
97
-
98
- # process step - source (not implemented)
99
-
100
- end # gmd:LI_ProcessStep tag
101
- end # writeXML
102
- end # LI_ProcessStep class
103
-
104
- end
105
- end
106
- end
44
+ # process step - description (required)
45
+ s = hStep[:description]
46
+ unless s.nil?
47
+ @xml.tag!('gmd:description') do
48
+ @xml.tag!('gco:CharacterString', s)
49
+ end
50
+ end
51
+ if s.nil?
52
+ @xml.tag!('gmd:description', {'gco:nilReason' => 'missing'})
53
+ end
54
+
55
+ # process step - rationale
56
+ s = hStep[:rationale]
57
+ unless s.nil?
58
+ @xml.tag!('gmd:rationale') do
59
+ @xml.tag!('gco:CharacterString', s)
60
+ end
61
+ end
62
+ if s.nil? && @hResponseObj[:writerShowTags]
63
+ @xml.tag!('gmd:rationale')
64
+ end
65
+
66
+ # process step - datetime
67
+ hPeriod = hStep[:timePeriod]
68
+ unless hPeriod.empty?
69
+ hDate = hPeriod[:startDateTime]
70
+ if hDate.empty?
71
+ hDate = hPeriod[:endDateTime]
72
+ end
73
+ date = hDate[:dateTime]
74
+ dateResolution = hDate[:dateResolution]
75
+ s = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateResolution)
76
+ if s != 'ERROR'
77
+ @xml.tag!('gmd:dateTime') do
78
+ @xml.tag!('gco:DateTime', s)
79
+ end
80
+ end
81
+ end
82
+ if hPeriod.empty? && @hResponseObj[:writerShowTags]
83
+ @xml.tag!('gmd:dateTime')
84
+ end
85
+
86
+ # process step - processor [] {CI_ResponsibleParty}
87
+ aParties = hStep[:processors]
88
+ aParties.each do |hRParty|
89
+ role = hRParty[:roleName]
90
+ aParties = hRParty[:parties]
91
+ aParties.each do |hParty|
92
+ @xml.tag!('gmd:processor') do
93
+ partyClass.writeXML(role, hParty)
94
+ end
95
+ end
96
+ end
97
+ if aParties.empty? && @hResponseObj[:writerShowTags]
98
+ @xml.tag!('gmd:processor')
99
+ end
100
+
101
+ # process step - source [] {LI_Source}
102
+ aSources = hStep[:stepSources]
103
+ aSources.each do |hSource|
104
+ @xml.tag!('gmd:source') do
105
+ sourceClass.writeXML(hSource)
106
+ end
107
+ end
108
+ if aSources.empty? && @hResponseObj[:writerShowTags]
109
+ @xml.tag!('gmd:source')
110
+ end
111
+
112
+ end # gmd:LI_ProcessStep tag
113
+ end # writeXML
114
+ end # LI_ProcessStep class
115
+
116
+ end
117
+ end
118
+ end
107
119
  end
@@ -1,9 +1,11 @@
1
1
  # mdJson 2.0 writer - allocation
2
2
 
3
3
  # History:
4
- # Stan Smith 2017-03-20 original script
4
+ # Stan Smith 2017-08-31 refactored for mdJson schema 2.3
5
+ # Stan Smith 2017-03-20 original script
5
6
 
6
7
  require 'jbuilder'
8
+ require_relative 'mdJson_onlineResource'
7
9
 
8
10
  module ADIWG
9
11
  module Mdtranslator
@@ -12,14 +14,18 @@ module ADIWG
12
14
 
13
15
  module Allocation
14
16
 
17
+ @Namespace = ADIWG::Mdtranslator::Writers::MdJson
18
+
15
19
  def self.build(hAllocation)
16
20
 
17
21
  Jbuilder.new do |json|
22
+ json.sourceAllocationId hAllocation[:id]
18
23
  json.amount hAllocation[:amount]
19
24
  json.currency hAllocation[:currency]
20
25
  json.sourceId hAllocation[:sourceId]
21
26
  json.recipientId hAllocation[:recipientId]
22
27
  json.matching hAllocation[:matching]
28
+ json.onlineResource @Namespace.json_map(hAllocation[:onlineResources], OnlineResource)
23
29
  json.comment hAllocation[:comment]
24
30
  end
25
31
 
@@ -1,7 +1,8 @@
1
1
  # mdJson 2.0 writer - funding
2
2
 
3
3
  # History:
4
- # Stan Smith 2017-03-20 original script
4
+ # Stan Smith 2017-08-31 refactored for mdJson schema 2.3
5
+ # Stan Smith 2017-03-20 original script
5
6
 
6
7
  require 'jbuilder'
7
8
  require_relative 'mdJson_allocation'
@@ -19,8 +20,9 @@ module ADIWG
19
20
  def self.build(hFunding)
20
21
 
21
22
  Jbuilder.new do |json|
22
- json.allocation @Namespace.json_map(hFunding[:allocations], Allocation)
23
+ json.description hFunding[:description]
23
24
  json.timePeriod TimePeriod.build(hFunding[:timePeriod]) unless hFunding[:timePeriod].empty?
25
+ json.allocation @Namespace.json_map(hFunding[:allocations], Allocation)
24
26
  end
25
27
 
26
28
  end # build
@@ -1,14 +1,16 @@
1
1
  # mdJson 2.0 writer - process step
2
2
 
3
3
  # History:
4
- # Stan Smith 2017-03-19 refactored for mdJson/mdTranslator 2.0
5
- # Josh Bradley original script
4
+ # Stan Smith 2017-08-30 add support for process step sources and products
5
+ # Stan Smith 2017-03-19 refactored for mdJson/mdTranslator 2.0
6
+ # Josh Bradley original script
6
7
 
7
8
  require 'jbuilder'
8
9
  require_relative 'mdJson_timePeriod'
9
10
  require_relative 'mdJson_responsibleParty'
10
11
  require_relative 'mdJson_citation'
11
12
  require_relative 'mdJson_scope'
13
+ require_relative 'mdJson_source'
12
14
 
13
15
  module ADIWG
14
16
  module Mdtranslator
@@ -28,6 +30,8 @@ module ADIWG
28
30
  json.timePeriod TimePeriod.build(hStep[:timePeriod]) unless hStep[:timePeriod].empty?
29
31
  json.processor @Namespace.json_map(hStep[:processors], ResponsibleParty)
30
32
  json.reference @Namespace.json_map(hStep[:references], Citation)
33
+ json.stepSource @Namespace.json_map(hStep[:stepSources], Source)
34
+ json.stepProduct @Namespace.json_map(hStep[:stepProducts], Source)
31
35
  json.scope Scope.build(hStep[:scope]) unless hStep[:scope].empty?
32
36
  end
33
37
 
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.1.2
4
+ version: 2.2.0
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-08-25 00:00:00.000000000 Z
12
+ date: 2017-08-31 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.2'
132
+ version: '2.3'
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.2'
139
+ version: '2.3'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: adiwg-mdcodes
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -224,6 +224,7 @@ files:
224
224
  - ".gitmodules"
225
225
  - ".jsbeautifyrc"
226
226
  - ".travis.yml"
227
+ - CHANGELOG.md
227
228
  - Gemfile
228
229
  - LICENSE.txt
229
230
  - README.md
@@ -237,6 +238,7 @@ files:
237
238
  - lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb
238
239
  - lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb
239
240
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb
241
+ - lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb
240
242
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb
241
243
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb
242
244
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb
@@ -244,12 +246,16 @@ files:
244
246
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb
245
247
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb
246
248
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb
249
+ - lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb
247
250
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb
248
251
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineResource.rb
252
+ - lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb
249
253
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb
250
254
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb
251
255
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_responsibility.rb
256
+ - lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb
252
257
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb
258
+ - lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb
253
259
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb
254
260
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialOrganization.rb
255
261
  - lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialReference.rb
@@ -694,7 +700,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
694
700
  version: '0'
695
701
  requirements: []
696
702
  rubyforge_project:
697
- rubygems_version: 2.5.2
703
+ rubygems_version: 2.6.8
698
704
  signing_key:
699
705
  specification_version: 4
700
706
  summary: The mdtranslator (metadata translator) is a tool for translating metadata