adiwg-mdtranslator 2.9.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95e15d92713059c8c6ebf9fe68e8e470ba617d96
4
- data.tar.gz: '0094df70ff7fbb3e469bafcf5e888028937315dc'
3
+ metadata.gz: c04d44033db92fd29e5b27c5d27637df4821286a
4
+ data.tar.gz: 83a94131c5336d7daa69243d1c33b8e36f5e6a24
5
5
  SHA512:
6
- metadata.gz: 1df4d37ba5555ca5ed687bea01eca86059d963d73633095a5b83dd1424da28d087617e1ad553c903a471b5c427e18d0665d3b1d5e441ad667d7860f49a18c007
7
- data.tar.gz: 8e87753759f7592cc5c94563243a0a0e95fb0d2d698ffdf80234a28b642c56ccf9042da5fdf2ce80345b266fdff2a64eec8c1c650116dea129e6e0793be56f66
6
+ metadata.gz: 5e34810ae12393670524ae6c2c15625b88f89d6ef866731b55148190809544729a291f91ab5afc010cd7f473f62ebfdf211c2f4bf65e8919a70d2003982ee071
7
+ data.tar.gz: 40d1a52a6846532882102144fce79a72eea9450b3d8c77bda03fda3027e6d9304979f2099558df5aae2ac2239b2c7b58d56b2a06afa44391b86ff0ca63c3ddb0
data/CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.9.0](https://github.com/adiwg/mdTranslator/tree/v2.9.0)
3
+ ## [v2.9.1](https://github.com/adiwg/mdTranslator/tree/v2.9.1)
4
4
 
5
- [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.8.0...v2.9.0)
5
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.8.0...v2.9.1)
6
6
 
7
7
  **Merged pull requests:**
8
8
 
@@ -516,7 +516,6 @@ class InternalMetadata
516
516
  {
517
517
  description: nil,
518
518
  liabilityStatement: nil,
519
- technicalPrerequisite: nil,
520
519
  distributor: []
521
520
  }
522
521
  end
@@ -565,7 +564,8 @@ class InternalMetadata
565
564
  {
566
565
  formatSpecification: {},
567
566
  amendmentNumber: nil,
568
- compressionMethod: nil
567
+ compressionMethod: nil,
568
+ technicalPrerequisite: nil
569
569
  }
570
570
  end
571
571
 
@@ -18,7 +18,7 @@ module ADIWG
18
18
 
19
19
  module DigitalForm
20
20
 
21
- def self.unpack(xDigiForm, hResponseObj)
21
+ def self.unpack(xDigiForm, techPre, hResponseObj)
22
22
 
23
23
  # instance classes needed in script
24
24
  intMetadataClass = InternalMetadata.new
@@ -27,7 +27,7 @@ module ADIWG
27
27
  # distribution 6.4.2.1 (digtinfo) - digital transfer information
28
28
  xTranInfo = xDigiForm.xpath('./digtinfo')
29
29
  unless xTranInfo.empty?
30
- TransferInfo.unpack(xTranInfo, hTransfer, hResponseObj)
30
+ TransferInfo.unpack(xTranInfo, hTransfer, techPre, hResponseObj)
31
31
  end
32
32
 
33
33
  # distribution 6.4.2.2 (digtopt) - digital transfer option
@@ -50,11 +50,16 @@ module ADIWG
50
50
  hDistribution[:liabilityStatement] = liability
51
51
  end
52
52
 
53
+ # distribution 6.6 (techpreq) - technical prerequisites
54
+ # -> distribution.distributor[all].transferOption[all].distributionFormat[all].technicalPrerequisite
55
+ # pass it down the line
56
+ techPre = xDistribution.xpath('./techpreq').text
57
+
53
58
  # distribution 6.4 (stdorder) - standard order process []
54
59
  axOrders = xDistribution.xpath('./stdorder')
55
60
  unless axOrders.empty?
56
61
  axOrders.each do |xOrder|
57
- OrderProcess.unpack(xOrder, hDistributor, hResponseObj)
62
+ OrderProcess.unpack(xOrder, hDistributor, techPre, hResponseObj)
58
63
  end
59
64
  end
60
65
 
@@ -67,13 +72,6 @@ module ADIWG
67
72
  hDistributor[:orderProcess] << hOrder
68
73
  end
69
74
 
70
- # distribution 6.6 (techpreq) - technical prerequisites
71
- # -> distribution.technicalPrerequisite
72
- techPre = xDistribution.xpath('./techpreq').text
73
- unless techPre.empty?
74
- hDistribution[:technicalPrerequisite] = techPre
75
- end
76
-
77
75
  # distribution 6.7 (availabl) - available time period {time period}
78
76
  # -> distribution.distributor.orderProcess.plannedAvailability
79
77
  xTimePeriod = xDistribution.xpath('./availabl')
@@ -15,7 +15,7 @@ module ADIWG
15
15
 
16
16
  module OrderProcess
17
17
 
18
- def self.unpack(xOrder, hDistributor, hResponseObj)
18
+ def self.unpack(xOrder, hDistributor, techPre, hResponseObj)
19
19
 
20
20
  # instance classes needed in script
21
21
  intMetadataClass = InternalMetadata.new
@@ -37,7 +37,7 @@ module ADIWG
37
37
  axDigital = xOrder.xpath('./digform')
38
38
  unless axDigital.empty?
39
39
  axDigital.each do |xDigiForm|
40
- hReturn = DigitalForm.unpack(xDigiForm, hResponseObj)
40
+ hReturn = DigitalForm.unpack(xDigiForm, techPre, hResponseObj)
41
41
  unless hReturn.nil?
42
42
  hDistributor[:transferOptions] << hReturn
43
43
  end
@@ -15,7 +15,7 @@ module ADIWG
15
15
 
16
16
  module TransferInfo
17
17
 
18
- def self.unpack(xTranInfo, hTransfer, hResponseObj)
18
+ def self.unpack(xTranInfo, hTransfer, techPre, hResponseObj)
19
19
 
20
20
  # instance classes needed in script
21
21
  intMetadataClass = InternalMetadata.new
@@ -26,6 +26,11 @@ module ADIWG
26
26
  hFormat[:formatSpecification] = hSpecification
27
27
  hTransfer[:distributionFormats] << hFormat
28
28
 
29
+ # add technical prerequisite to resourceFormat
30
+ unless techPre.empty?
31
+ hFormat[:technicalPrerequisite] = techPre
32
+ end
33
+
29
34
  # distribution 6.4.2.1.1 (formname) - format name
30
35
  # -> transferOption.distributionFormat.formatSpecification.title
31
36
  # -> transferOption.distributionFormat.formatSpecification.identifier[].identifier
@@ -2,7 +2,6 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-01-30 add technicalPrerequisite
6
5
  # Stan Smith 2018-01-29 add liabilityStatement
7
6
  # Stan Smith 2016-10-21 original script
8
7
 
@@ -42,13 +41,6 @@ module ADIWG
42
41
  end
43
42
  end
44
43
 
45
- # distribution - technical prerequisite
46
- if hDistribution.has_key?('technicalPrerequisite')
47
- if hDistribution['technicalPrerequisite'] != ''
48
- intDistribution[:technicalPrerequisite] = hDistribution['technicalPrerequisite']
49
- end
50
- end
51
-
52
44
  # distribution - distributor [distributor]
53
45
  if hDistribution.has_key?('distributor')
54
46
  aItems = hDistribution['distributor']
@@ -2,67 +2,75 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-05 add 'technicalPrerequisite'
5
6
  # Stan Smith 2016-10-20 original script
6
7
 
7
8
  require_relative 'module_citation'
8
9
 
9
10
  module ADIWG
10
- module Mdtranslator
11
- module Readers
12
- module MdJson
11
+ module Mdtranslator
12
+ module Readers
13
+ module MdJson
13
14
 
14
- module Format
15
+ module Format
15
16
 
16
- def self.unpack(hFormat, responseObj)
17
+ def self.unpack(hFormat, responseObj)
17
18
 
18
- # return nil object if input is empty
19
- if hFormat.empty?
20
- responseObj[:readerExecutionMessages] << 'Format object is empty'
21
- responseObj[:readerExecutionPass] = false
22
- return nil
23
- end
19
+ # return nil object if input is empty
20
+ if hFormat.empty?
21
+ responseObj[:readerExecutionMessages] << 'Format object is empty'
22
+ responseObj[:readerExecutionPass] = false
23
+ return nil
24
+ end
24
25
 
25
- # instance classes needed in script
26
- intMetadataClass = InternalMetadata.new
27
- intFormat = intMetadataClass.newResourceFormat
26
+ # instance classes needed in script
27
+ intMetadataClass = InternalMetadata.new
28
+ intFormat = intMetadataClass.newResourceFormat
28
29
 
29
- # format - format specification {citation} (required)
30
- if hFormat.has_key?('formatSpecification')
31
- hObject = hFormat['formatSpecification']
32
- unless hObject.empty?
33
- hReturn = Citation.unpack(hObject, responseObj)
34
- unless hReturn.nil?
35
- intFormat[:formatSpecification] = hReturn
36
- end
37
- end
38
- end
39
- if intFormat[:formatSpecification].empty?
40
- responseObj[:readerExecutionMessages] << 'Format is missing formatSpecification'
41
- responseObj[:readerExecutionPass] = false
42
- return nil
30
+ # format - format specification {citation} (required)
31
+ if hFormat.has_key?('formatSpecification')
32
+ hObject = hFormat['formatSpecification']
33
+ unless hObject.empty?
34
+ hReturn = Citation.unpack(hObject, responseObj)
35
+ unless hReturn.nil?
36
+ intFormat[:formatSpecification] = hReturn
43
37
  end
38
+ end
39
+ end
40
+ if intFormat[:formatSpecification].empty?
41
+ responseObj[:readerExecutionMessages] << 'Format is missing formatSpecification'
42
+ responseObj[:readerExecutionPass] = false
43
+ return nil
44
+ end
44
45
 
45
- # format - amendment number
46
- if hFormat.has_key?('amendmentNumber')
47
- if hFormat['amendmentNumber'] != ''
48
- intFormat[:amendmentNumber] = hFormat['amendmentNumber']
49
- end
50
- end
46
+ # format - amendment number
47
+ if hFormat.has_key?('amendmentNumber')
48
+ if hFormat['amendmentNumber'] != ''
49
+ intFormat[:amendmentNumber] = hFormat['amendmentNumber']
50
+ end
51
+ end
51
52
 
52
- # format - compression method
53
- if hFormat.has_key?('compressionMethod')
54
- if hFormat['compressionMethod'] != ''
55
- intFormat[:compressionMethod] = hFormat['compressionMethod']
56
- end
57
- end
53
+ # format - compression method
54
+ if hFormat.has_key?('compressionMethod')
55
+ if hFormat['compressionMethod'] != ''
56
+ intFormat[:compressionMethod] = hFormat['compressionMethod']
57
+ end
58
+ end
58
59
 
59
- return intFormat
60
+ # format - compression method
61
+ if hFormat.has_key?('technicalPrerequisite')
62
+ if hFormat['technicalPrerequisite'] != ''
63
+ intFormat[:technicalPrerequisite] = hFormat['technicalPrerequisite']
64
+ end
65
+ end
60
66
 
61
- end
67
+ return intFormat
62
68
 
63
- end
69
+ end
64
70
 
65
71
  end
66
- end
67
- end
72
+
73
+ end
74
+ end
75
+ end
68
76
  end
@@ -1,6 +1,8 @@
1
1
  # adiwg mdTranslator
2
2
 
3
3
  # version 2 history
4
+ # 2.9.1 2018-02-05 move 'technicalPrerequisite' to 'resourceFormat'
5
+ # 2.9.1 2018-02-05 fix variable name in fgdc spatial domain writer
4
6
  # 2.9.0 2018-02-01 added fgdc writer distribution information section
5
7
  # 2.9.0 2018-01-26 deprecate dictionaryFormat in favor of dictionaryFunctionalLanguage
6
8
  # 2.9.0 2018-01-25 added fgdc writer entity and attribute section
@@ -61,7 +63,7 @@
61
63
  module ADIWG
62
64
  module Mdtranslator
63
65
  # current mdtranslator version
64
- VERSION = "2.9.0"
66
+ VERSION = "2.9.1"
65
67
  end
66
68
  end
67
69
 
@@ -115,11 +115,28 @@ module ADIWG
115
115
  end
116
116
 
117
117
  # distribution 6.6 (techpreq) - technical prerequisites
118
- # <- distribution.technicalPrerequisite
119
- unless hDistribution[:technicalPrerequisite].nil?
120
- @xml.tag!('techpreq', hDistribution[:technicalPrerequisite])
118
+ # -> distribution.distributor[all].transferOption[all].distributionFormat[all].technicalPrerequisite
119
+ # collect these and string unique together
120
+ techPre = ''
121
+ aTechPre = []
122
+ unless hDistributor.empty?
123
+ hDistributor[:transferOptions].each do |hTransOpt|
124
+ hTransOpt[:distributionFormats].each do |hFormat|
125
+ unless hFormat[:technicalPrerequisite].nil?
126
+ aTechPre << hFormat[:technicalPrerequisite]
127
+ end
128
+ end
129
+ end
130
+ end
131
+ aTechPre = aTechPre.uniq
132
+ aTechPre.each do |prereq|
133
+ techPre += prereq + '; '
134
+ end
135
+ techPre.chomp!('; ')
136
+ unless techPre == ''
137
+ @xml.tag!('techpreq', techPre)
121
138
  end
122
- if hDistribution[:technicalPrerequisite].nil?
139
+ if techPre == ''
123
140
  @xml.tag!('techpreq')
124
141
  end
125
142
 
@@ -2,7 +2,8 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2017-11-25 original script
5
+ # Stan Smith 2018-02-05 fixed typo in variable name 'aBPoly'
6
+ # Stan Smith 2017-11-25 original script
6
7
 
7
8
  module ADIWG
8
9
  module Mdtranslator
@@ -18,7 +19,7 @@ module ADIWG
18
19
 
19
20
  def writeXML(aExtents)
20
21
 
21
- # spatial domain section is no required under bio extension rules
22
+ # spatial domain section is not required under biological extension rules
22
23
 
23
24
  # look for geographic description - take first
24
25
  # <- geographicExtent[:description]
@@ -54,7 +55,7 @@ module ADIWG
54
55
 
55
56
  # look for bounding polygon
56
57
  # <- geographicExtent[:geographicElements]
57
- # polygon must be in FeatureCollection with properties description of 'FGDC bounding polygon'
58
+ # polygon must be in a FeatureCollection with properties description of 'FGDC bounding polygon'
58
59
  aBPoly = []
59
60
  aExtents.each do |hExtent|
60
61
  unless hExtent.empty?
@@ -81,7 +82,7 @@ module ADIWG
81
82
  end
82
83
 
83
84
  # spatial domain 1.5 (spdom)
84
- unless geoDescription.empty? && hBBox.empty? && hBPoly.empty?
85
+ unless geoDescription.empty? && hBBox.empty? && aBPoly.empty?
85
86
  @xml.tag!('spdom') do
86
87
 
87
88
  # spatial domain bio (descgeog) - geographic description (required)
@@ -30,10 +30,15 @@ module ADIWG
30
30
  # transfer information 6.4.2.1.1 (formname) - format name (required)
31
31
  # <- formatSpecification.identifier.identifier
32
32
  # FGDC requires a format name for digital options (online and offline)
33
- # the format name is saved in the format specification of the first distribution format
33
+ # the format name is saved in the identifier of the format specification
34
+ # of the first distribution format
35
+ # as backup, allow specification title to serve as format name
34
36
  haveId = false
35
37
  unless hSpec.empty?
36
- unless hSpec[:identifiers].empty?
38
+ if hSpec[:identifiers].empty?
39
+ @xml.tag!('formname', hSpec[:title])
40
+ haveId = true
41
+ else
37
42
  unless hSpec[:identifiers][0][:identifier].nil?
38
43
  @xml.tag!('formname', hSpec[:identifiers][0][:identifier])
39
44
  haveId = true
@@ -42,7 +47,7 @@ module ADIWG
42
47
  end
43
48
  unless haveId
44
49
  @hResponseObj[:writerPass] = false
45
- @hResponseObj[:writerMessages] << 'Distribution Format is mission format name'
50
+ @hResponseObj[:writerMessages] << 'Distribution Format is missing format name'
46
51
  end
47
52
 
48
53
  # transfer information 6.4.2.1.2 (formvern) - format version number
@@ -2,7 +2,6 @@
2
2
  # distribution
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-01-30 add technicalPrerequisite
6
5
  # Stan Smith 2018-01-29 add liabilityStatement
7
6
  # Stan Smith 2017-04-04 original script
8
7
 
@@ -40,14 +39,6 @@ module ADIWG
40
39
  end
41
40
  end
42
41
 
43
- # distribution - technical prerequisite
44
- unless hDistribution[:technicalPrerequisite].nil?
45
- @html.em('Technical Prerequisite:')
46
- @html.section(:class => 'block') do
47
- @html.text!(hDistribution[:technicalPrerequisite])
48
- end
49
- end
50
-
51
42
  # distribution - distributor [] {distributor}
52
43
  hDistribution[:distributor].each do |hDistributor|
53
44
  @html.details do
@@ -2,6 +2,7 @@
2
2
  # format
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-05 add 'technicalPrerequisite'
5
6
  # Stan Smith 2017-04-03 refactored for mdTranslator 2.0
6
7
  # Stan Smith 2015-09-21 added compression method element
7
8
  # Stan Smith 2015-03-27 original script
@@ -48,6 +49,14 @@ module ADIWG
48
49
  @html.br
49
50
  end
50
51
 
52
+ # distribution - technical prerequisite
53
+ unless hFormat[:technicalPrerequisite].nil?
54
+ @html.em('Technical Prerequisite:')
55
+ @html.section(:class => 'block') do
56
+ @html.text!(hFormat[:technicalPrerequisite])
57
+ end
58
+ end
59
+
51
60
  end # writeHtml
52
61
  end # Html_Format
53
62
 
@@ -21,7 +21,6 @@ module ADIWG
21
21
  Jbuilder.new do |json|
22
22
  json.description hDistribution[:description]
23
23
  json.liabilityStatement hDistribution[:liabilityStatement]
24
- json.technicalPrerequisite hDistribution[:technicalPrerequisite]
25
24
  json.distributor @Namespace.json_map(hDistribution[:distributor], Distributor)
26
25
  end
27
26
 
@@ -20,6 +20,7 @@ module ADIWG
20
20
  json.formatSpecification Citation.build(hFormat[:formatSpecification]) unless hFormat[:formatSpecification].empty?
21
21
  json.amendmentNumber hFormat[:amendmentNumber]
22
22
  json.compressionMethod hFormat[:compressionMethod]
23
+ json.technicalPrerequisite hFormat[:technicalPrerequisite]
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.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith