adiwg-mdtranslator 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +552 -500
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +1 -0
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +63 -16
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +7 -16
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +1 -1
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +1 -0
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +7 -1
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +4 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +4 -3
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +15 -11
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +134 -134
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -4
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +52 -36
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +65 -51
  19. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +133 -121
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +1 -1
  21. data/lib/adiwg/mdtranslator/version.rb +4 -1
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +178 -0
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataDomain.rb +122 -0
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dictionary.rb +66 -0
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_digitalForm.rb +81 -0
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_distribution.rb +156 -0
  27. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityDetail.rb +78 -0
  28. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityOverview.rb +48 -0
  29. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +41 -4
  30. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_metadataInfo.rb +215 -0
  31. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_offlineOption.rb +86 -0
  32. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_onlineOption.rb +77 -0
  33. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_orderProcess.rb +100 -0
  34. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +9 -7
  35. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +135 -0
  36. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +4 -4
  37. data/lib/adiwg/mdtranslator/writers/html/sections/html_distribution.rb +18 -0
  38. data/lib/adiwg/mdtranslator/writers/html/sections/html_domainItem.rb +18 -3
  39. data/lib/adiwg/mdtranslator/writers/html/sections/html_metadataInfo.rb +20 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +1 -1
  41. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +14 -0
  42. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +21 -2
  43. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +44 -44
  44. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_legalConstraints.rb +67 -66
  45. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +53 -54
  46. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -23
  47. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +1 -1
  48. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_distribution.rb +2 -0
  49. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_domainItem.rb +4 -0
  50. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadataInfo.rb +2 -0
  51. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb +7 -1
  52. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +12 -1
  53. metadata +16 -4
@@ -0,0 +1,86 @@
1
+ # FGDC <<Class>> OfflineOption
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-31 original script
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Fgdc
11
+
12
+ class OfflineOption
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hOffline)
20
+
21
+ # offline option 6.4.2.2.2.1 (offmedia) - offline media name (required)
22
+ # <- hOffline.mediaSpecification.title
23
+ haveTitle = false
24
+ unless hOffline[:mediumSpecification].empty?
25
+ unless hOffline[:mediumSpecification][:title].nil?
26
+ @xml.tag!('offmedia', hOffline[:mediumSpecification][:title])
27
+ haveTitle = true
28
+ end
29
+ end
30
+ unless haveTitle
31
+ @hResponseObj[:writerPass] = false
32
+ @hResponseObj[:writerMessages] << 'Offline Option is missing media name'
33
+ end
34
+
35
+ # offline option 6.4.2.2.2.2 (reccap) - recording capacity (compound)
36
+ # <- hOffline.density and or hOffline.units
37
+ haveCapacity = false
38
+ haveCapacity = true unless hOffline[:density].nil?
39
+ haveCapacity = true unless hOffline[:units].nil?
40
+ if haveCapacity
41
+
42
+ # recording capacity 6.4.2.2.2.2.1 (recden) - recording density
43
+ unless hOffline[:density].nil?
44
+ @xml.tag!('recden', hOffline[:density])
45
+ end
46
+ if hOffline[:density].nil? && @hResponseObj[:writerShowTags]
47
+ @xml.tag!('recden')
48
+ end
49
+
50
+ # recording capacity 6.4.2.2.2.2.2 (recdenu) - recording density units
51
+ unless hOffline[:units].nil?
52
+ @xml.tag!('recdenu', hOffline[:units])
53
+ end
54
+ if hOffline[:units].nil? && @hResponseObj[:writerShowTags]
55
+ @xml.tag!('recdenu')
56
+ end
57
+
58
+ end
59
+
60
+ # offline option 6.4.2.2.2.3 (recfmt) - recording format []
61
+ # <- hOffline.mediumFormat[]
62
+ hOffline[:mediumFormat].each do |format|
63
+ unless format == ''
64
+ @xml.tag!('recfmt', format)
65
+ end
66
+ end
67
+ if hOffline[:mediumFormat].empty?
68
+ @xml.tag!('recfmt')
69
+ end
70
+
71
+ # offline option 6.4.2.2.2.4 (compat) - compatibility information
72
+ # <- hOffline.note
73
+ unless hOffline[:note].nil?
74
+ @xml.tag!('compat', hOffline[:note])
75
+ end
76
+ if hOffline[:note].nil? && @hResponseObj[:writerShowTags]
77
+ @xml.tag!('compat')
78
+ end
79
+
80
+ end # writeXML
81
+ end # OfflineOption
82
+
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,77 @@
1
+ # FGDC <<Class>> OnlineOption
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-31 original script
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Fgdc
11
+
12
+ class OnlineOption
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hOnline)
20
+
21
+ # online option 6.4.2.2.1.1 (computer) - computer contact information (compound)
22
+ @xml.tag!('computer') do
23
+
24
+ # online option 6.4.2.2.1.1.1 (networka) - network address (compound)
25
+ @xml.tag!('networka') do
26
+
27
+ # online option 6.4.2.2.1.1.1.1 (networkr) - network resource name (required)
28
+ # <- onlineOption.olResURI
29
+ unless hOnline[:olResURI].nil?
30
+ @xml.tag!('networkr', hOnline[:olResURI])
31
+ end
32
+ if hOnline[:olResURI].nil?
33
+ @hResponseObj[:writerPass] = false
34
+ @hResponseObj[:writerMessages] << 'Online Option is missing network address'
35
+ end
36
+
37
+ end
38
+
39
+ # online option 6.4.2.2.1.1.2 (dialinst) - dial-up instructions
40
+ # not supporting this section - no longer used
41
+ # dial-up 6.4.2.2.1.1.2.1 (lowbps) - lowest bits per second
42
+ # dial-up 6.4.2.2.1.1.2.2 (highbps) - highest bits per second
43
+ # dial-up 6.4.2.2.1.1.2.3 (numdata) - number of data bits
44
+ # dial-up 6.4.2.2.1.1.2.4 (numstop) - number of stop bits
45
+ # dial-up 6.4.2.2.1.1.2.5 (parity) - parity (odd, even, none)
46
+ # dial-up 6.4.2.2.1.1.2.6 (compress) - compression support
47
+ # dial-up 6.4.2.2.1.1.2.7 (dialtel) - dial-up number
48
+ # dial-up 6.4.2.2.1.1.2.8 (dialfile) - file name
49
+
50
+ end
51
+
52
+
53
+ # online option 6.4.2.2.1.2 (accinstr) - access instructions
54
+ # <- onlineOption.olResProtocol
55
+ unless hOnline[:olResProtocol].nil?
56
+ @xml.tag!('accinstr', hOnline[:olResProtocol])
57
+ end
58
+ if hOnline[:olResProtocol].nil?
59
+ @xml.tag!('accinstr')
60
+ end
61
+
62
+ # online option 6.4.2.2.1.3 (oncomp) - distribution computer make and operating system
63
+ # <- onlineOption.olResDesc
64
+ unless hOnline[:olResDesc].nil?
65
+ @xml.tag!('oncomp', hOnline[:olResDesc])
66
+ end
67
+ if hOnline[:olResDesc].nil?
68
+ @xml.tag!('oncomp')
69
+ end
70
+
71
+ end # writeXML
72
+ end # OnlineOption
73
+
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,100 @@
1
+ # FGDC <<Class>> OrderProcess
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-31 original script
6
+
7
+ require_relative 'class_digitalForm'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Fgdc
13
+
14
+ class OrderProcess
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ end
20
+
21
+ def writeXML(hDistributor)
22
+
23
+ # classes used
24
+ digiClass = DigitalFormat.new(@xml, @hResponseObj)
25
+
26
+ # for FGDC only the first orderProcess can be accepted because ...
27
+ # in FGDC transferOptions are children of orderProcess
28
+ # in mdJson/ISO transferOptions are children of distributor
29
+ # therefore in FGDC all transferOptions will be collected and mapped to
30
+ # the first orderProcess
31
+ # all other orderProcess records will be lost
32
+ hOrder = hDistributor[:orderProcess][0]
33
+ aTransfer = hDistributor[:transferOptions]
34
+
35
+ # order process 6.4.1 (nondig) - non-digital form
36
+ # non-digital are 'offline' transferOptions that have ONLY 'note' populated
37
+ # if a transferOption is written as non-digital take care not to write again as digital
38
+ # only one non-digital transfer is allowed per orderProcess
39
+ doBreak = false
40
+ aTransfer.each do |hTransOpt|
41
+ hTransOpt[:offlineOptions].each do |hOffline|
42
+ isNonDig = false
43
+ isNonDig = true unless hOffline[:note].nil?
44
+ isNonDig = false unless hOffline[:mediumSpecification].empty?
45
+ isNonDig = false unless hOffline[:density].nil?
46
+ isNonDig = false unless hOffline[:units].nil?
47
+ isNonDig = false unless hOffline[:numberOfVolumes].nil?
48
+ isNonDig = false unless hOffline[:mediumFormat].empty?
49
+ isNonDig = false unless hOffline[:identifier].empty?
50
+ if isNonDig
51
+ @xml.tag!('nondig', hOffline[:note])
52
+ doBreak = true
53
+ end
54
+ break if doBreak
55
+ end
56
+ break if doBreak
57
+ end
58
+
59
+ # order process 6.4.2 (digform) - digital form
60
+ # handles transferOptions for online and offline options
61
+ aTransfer.each do |hTransOpt|
62
+ @xml.tag!('digform') do
63
+ digiClass.writeXML(hTransOpt)
64
+ end
65
+ end
66
+ if aTransfer.empty? && @hResponseObj[:writerShowTags]
67
+ @xml.tag!('digform')
68
+ end
69
+
70
+ # order process 6.4.3 (fees) - fees
71
+ unless hOrder[:fees].nil?
72
+ @xml.tag!('fees', hOrder[:fees])
73
+ end
74
+ if hOrder[:fees].nil? && @hResponseObj[:writerShowTags]
75
+ @xml.tag!('fees')
76
+ end
77
+
78
+ # order process 6.4.4 (ordering) - order instructions
79
+ unless hOrder[:orderingInstructions].nil?
80
+ @xml.tag!('ordering', hOrder[:orderingInstructions])
81
+ end
82
+ if hOrder[:orderingInstructions].nil? && @hResponseObj[:writerShowTags]
83
+ @xml.tag!('ordering')
84
+ end
85
+
86
+ # order process 6.4.5 (turnarnd) - turnaround
87
+ unless hOrder[:turnaround].nil?
88
+ @xml.tag!('turnarnd', hOrder[:turnaround])
89
+ end
90
+ if hOrder[:turnaround].nil? && @hResponseObj[:writerShowTags]
91
+ @xml.tag!('turnarnd')
92
+ end
93
+
94
+ end # writeXML
95
+ end # OrderProcess
96
+
97
+ end
98
+ end
99
+ end
100
+ end
@@ -90,13 +90,15 @@ module ADIWG
90
90
 
91
91
  end
92
92
 
93
- # add timeInfo currentness (required)
94
- unless current.nil?
95
- @xml.tag!(currentTag, current)
96
- end
97
- if current.nil?
98
- @hResponseObj[:writerPass] = false
99
- @hResponseObj[:writerMessages] << 'Time Info is missing time currentness'
93
+ # add timeInfo currentness (required if currentTag not nil)
94
+ unless currentTag.nil?
95
+ unless current.nil?
96
+ @xml.tag!(currentTag, current)
97
+ end
98
+ if current.nil?
99
+ @hResponseObj[:writerPass] = false
100
+ @hResponseObj[:writerMessages] << 'Time Info is missing time currentness'
101
+ end
100
102
  end
101
103
 
102
104
  end # writeXML
@@ -0,0 +1,135 @@
1
+ # FGDC <<Class>> TransferInformation
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-31 original script
6
+
7
+ require 'adiwg/mdtranslator/internal/module_dateTimeFun'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Fgdc
13
+
14
+ class TransferInformation
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ end
20
+
21
+ def writeXML(hTransOpt)
22
+
23
+ hSpec = {}
24
+ unless hTransOpt[:distributionFormats].empty?
25
+ unless hTransOpt[:distributionFormats][0][:formatSpecification].empty?
26
+ hSpec = hTransOpt[:distributionFormats][0][:formatSpecification]
27
+ end
28
+ end
29
+
30
+ # transfer information 6.4.2.1.1 (formname) - format name (required)
31
+ # <- formatSpecification.identifier.identifier
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
34
+ haveId = false
35
+ unless hSpec.empty?
36
+ unless hSpec[:identifiers].empty?
37
+ unless hSpec[:identifiers][0][:identifier].nil?
38
+ @xml.tag!('formname', hSpec[:identifiers][0][:identifier])
39
+ haveId = true
40
+ end
41
+ end
42
+ end
43
+ unless haveId
44
+ @hResponseObj[:writerPass] = false
45
+ @hResponseObj[:writerMessages] << 'Distribution Format is mission format name'
46
+ end
47
+
48
+ # transfer information 6.4.2.1.2 (formvern) - format version number
49
+ # <- formatSpecification.edition
50
+ haveVersion = false
51
+ unless hSpec.empty?
52
+ unless hSpec[:edition].nil?
53
+ @xml.tag!('formvern', hSpec[:edition])
54
+ haveVersion = true
55
+ end
56
+ end
57
+ if !haveVersion && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('formvern')
59
+ end
60
+
61
+ # transfer information 6.4.2.1.3 (formverd) - format version date
62
+ # <- formatSpecification.dates[].dateType='revision'
63
+ haveRevDate = false
64
+ unless hSpec.empty?
65
+ hSpec[:dates].each do |hDate|
66
+ if hDate[:dateType] == 'revision'
67
+ revDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:date], hDate[:dateResolution])
68
+ revDate.gsub!(/[-]/,'')
69
+ unless revDate == 'ERROR'
70
+ @xml.tag!('formverd', revDate)
71
+ haveRevDate = true
72
+ end
73
+ break
74
+ end
75
+ end
76
+ end
77
+ if !haveRevDate && @hResponseObj[:writerShowTags]
78
+ @xml.tag!('formverd')
79
+ end
80
+
81
+ # transfer information 6.4.2.1.4 (formspec) - format specification
82
+ # <- formatSpecification.title
83
+ haveTitle = false
84
+ unless hSpec.empty?
85
+ unless hSpec[:title].nil?
86
+ @xml.tag!('formspec', hSpec[:title])
87
+ haveTitle = true
88
+ end
89
+ end
90
+ if !haveTitle && @hResponseObj[:writerShowTags]
91
+ @xml.tag!('formspec')
92
+ end
93
+
94
+ # transfer information 6.4.2.1.5 (formcont) - format information content
95
+ # <- formatSpecification.otherDetails[0]
96
+ haveContent = false
97
+ unless hSpec.empty?
98
+ unless hSpec[:otherDetails].empty?
99
+ @xml.tag!('formcont', hSpec[:otherDetails][0])
100
+ haveContent = true
101
+ end
102
+ end
103
+ if !haveContent && @hResponseObj[:writerShowTags]
104
+ @xml.tag!('formcont')
105
+ end
106
+
107
+ # transfer information 6.4.2.1.6 (filedec) - decompression method
108
+ # <- transferOption.distributionFormat[0].compressionMethod
109
+ haveCompress = false
110
+ unless hTransOpt[:distributionFormats].empty?
111
+ unless hTransOpt[:distributionFormats][0][:compressionMethod].nil?
112
+ @xml.tag!('filedec',hTransOpt[:distributionFormats][0][:compressionMethod])
113
+ haveCompress = true
114
+ end
115
+ end
116
+ if !haveCompress && @hResponseObj[:writerShowTags]
117
+ @xml.tag!('filedec')
118
+ end
119
+
120
+ # transfer information 6.4.2.1.7 (transize) - transfer size
121
+ # <- transferOption.transferSize
122
+ unless hTransOpt[:transferSize].nil?
123
+ @xml.tag!('transize', hTransOpt[:transferSize])
124
+ end
125
+ if hTransOpt[:transferSize].nil? && @hResponseObj[:writerShowTags]
126
+ @xml.tag!('transize')
127
+ end
128
+
129
+ end # writeXML
130
+ end # DigitalFormat
131
+
132
+ end
133
+ end
134
+ end
135
+ end
@@ -105,10 +105,10 @@ module ADIWG
105
105
  @html.br
106
106
  end
107
107
 
108
- # dictionary - dictionary format
109
- unless hDictionary[:dictionaryFormat].nil?
110
- @html.em('Dictionary Format: ')
111
- @html.text!(hDictionary[:dictionaryFormat])
108
+ # dictionary - dictionary functional language
109
+ unless hDictionary[:dictionaryFunctionalLanguage].nil?
110
+ @html.em('Dictionary Functional Language: ')
111
+ @html.text!(hDictionary[:dictionaryFunctionalLanguage])
112
112
  @html.br
113
113
  end
114
114
 
@@ -2,6 +2,8 @@
2
2
  # distribution
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-01-30 add technicalPrerequisite
6
+ # Stan Smith 2018-01-29 add liabilityStatement
5
7
  # Stan Smith 2017-04-04 original script
6
8
 
7
9
  require_relative 'html_distributor'
@@ -30,6 +32,22 @@ module ADIWG
30
32
  end
31
33
  end
32
34
 
35
+ # distribution - liability statement
36
+ unless hDistribution[:liabilityStatement].nil?
37
+ @html.em('Liability Statement:')
38
+ @html.section(:class => 'block') do
39
+ @html.text!(hDistribution[:liabilityStatement])
40
+ end
41
+ end
42
+
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
+
33
51
  # distribution - distributor [] {distributor}
34
52
  hDistribution[:distributor].each do |hDistributor|
35
53
  @html.details do