adiwg-mdtranslator 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -1
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +33 -2
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +68 -35
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +66 -0
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +7 -1
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +10 -1
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +38 -19
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +68 -19
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +3 -0
  11. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +4 -2
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +87 -79
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +150 -115
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +184 -113
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +56 -0
  16. data/lib/adiwg/mdtranslator/version.rb +7 -1
  17. data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +3 -3
  18. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +6 -6
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb +74 -38
  20. data/lib/adiwg/mdtranslator/writers/html/sections/html_ellipsoidParameters.rb +68 -0
  21. data/lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb +130 -76
  22. data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +78 -0
  23. data/lib/adiwg/mdtranslator/writers/html/sections/html_identifier.rb +1 -1
  24. data/lib/adiwg/mdtranslator/writers/html/sections/html_obliqueLinePoint.rb +37 -0
  25. data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +229 -0
  26. data/lib/adiwg/mdtranslator/writers/html/sections/html_referenceSystemParameters.rb +65 -0
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialReference.rb +19 -1
  28. data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +69 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_address.rb +103 -103
  30. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_citation.rb +185 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb +60 -0
  32. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionReference.rb +45 -0
  33. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_domain.rb +107 -0
  34. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +187 -187
  35. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureAttribute.rb +123 -117
  36. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureType.rb +155 -141
  37. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_gcoDateTime.rb +48 -0
  38. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +54 -55
  39. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_mdIdentifier.rb +56 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_series.rb +63 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_attributeGroup.rb +51 -50
  42. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +181 -180
  43. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +96 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_ellipsoidParameters.rb +62 -0
  45. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +54 -54
  46. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +301 -298
  47. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_obliqueLinePoint.rb +53 -0
  48. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb +229 -0
  49. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +49 -32
  50. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_domain.rb +5 -2
  51. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entity.rb +7 -1
  52. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +18 -2
  53. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_valueRange.rb +28 -0
  54. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +33 -13
  55. metadata +22 -4
  56. data/lib/adiwg/mdtranslator/readers/mdJson/version.rb +0 -16
@@ -0,0 +1,68 @@
1
+ # HTML writer
2
+ # spatial reference system ellipsoid parameters
3
+
4
+ # History:
5
+ # Stan Smith 2017-10-24 original script
6
+
7
+ require_relative 'html_identifier'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Html
13
+
14
+ class Html_EllipsoidParameters
15
+
16
+ def initialize(html)
17
+ @html = html
18
+ end
19
+
20
+ def writeHtml(hEllipsoid)
21
+
22
+ # classes used
23
+ identifierClass = Html_Identifier.new(@html)
24
+
25
+ # ellipsoid parameters - ellipsoid name
26
+ unless hEllipsoid[:ellipsoidName].nil?
27
+ @html.em('Ellipsoid Name: ')
28
+ @html.text!(hEllipsoid[:ellipsoidName])
29
+ @html.br
30
+ end
31
+
32
+ # ellipsoid parameters - semi-major axis
33
+ unless hEllipsoid[:semiMajorAxis].nil?
34
+ @html.em('Semi-major Axis: ')
35
+ @html.text!(hEllipsoid[:semiMajorAxis].to_s)
36
+ @html.br
37
+ end
38
+
39
+ # ellipsoid parameters - axis units
40
+ unless hEllipsoid[:axisUnits].nil?
41
+ @html.em('Axis Units: ')
42
+ @html.text!(hEllipsoid[:axisUnits])
43
+ @html.br
44
+ end
45
+
46
+ # ellipsoid parameters - denominator of flattening ratio
47
+ unless hEllipsoid[:denominatorOfFlatteningRatio].nil?
48
+ @html.em('Denominator or Flattening Ratio: ')
49
+ @html.text!(hEllipsoid[:denominatorOfFlatteningRatio].to_s)
50
+ end
51
+
52
+ # ellipsoid parameters - ellipsoid identifier
53
+ unless hEllipsoid[:ellipsoidIdentifier].empty?
54
+ @html.details do
55
+ @html.summary('Ellipsoid Identifier', {'id' => 'ellipsoid-identifier', 'class' => 'h5'})
56
+ @html.section(:class => 'block') do
57
+ identifierClass.writeHtml(hEllipsoid[:ellipsoidIdentifier])
58
+ end
59
+ end
60
+ end
61
+
62
+ end # writeHtml
63
+ end # Html_ProjectionParameters
64
+
65
+ end
66
+ end
67
+ end
68
+ end
@@ -2,6 +2,7 @@
2
2
  # entity
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-11-03 added new elements to support fgdc
5
6
  # Stan Smith 2017-04-05 refactored for mdTranslator 2.0
6
7
  # Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS
7
8
  # Stan Smith 2015-03-26 original script
@@ -9,6 +10,7 @@
9
10
  require_relative 'html_entityIndex'
10
11
  require_relative 'html_entityAttribute'
11
12
  require_relative 'html_entityForeignKey'
13
+ require_relative 'html_citation'
12
14
 
13
15
  module ADIWG
14
16
  module Mdtranslator
@@ -21,91 +23,143 @@ module ADIWG
21
23
  @html = html
22
24
  end
23
25
 
24
- def writeHtml(hEntity)
25
-
26
- # classes used
27
- indexClass = Html_EntityIndex.new(@html)
28
- attributeClass = Html_EntityAttribute.new(@html)
29
- foreignClass = Html_EntityForeignKey.new(@html)
30
-
31
- # entity - entity id
32
- unless hEntity[:entityId].nil?
33
- @html.em('ID: ')
34
- @html.text!(hEntity[:entityId])
35
- @html.br
36
- end
37
-
38
- # entity - name
39
- unless hEntity[:entityName].nil?
40
- @html.em('Name: ')
41
- @html.text!(hEntity[:entityName])
42
- @html.br
43
- end
44
-
45
- # entity - code
46
- unless hEntity[:entityCode].nil?
47
- @html.em('Code: ')
48
- @html.text!(hEntity[:entityCode])
49
- @html.br
50
- end
51
-
52
- # entity - alias names
53
- hEntity[:entityAlias].each do |otherName|
54
- @html.em('Alias: ')
55
- @html.section(:class => 'block') do
56
- @html.text!(otherName)
57
- end
58
- end
26
+ def writeHtml(aEntities)
59
27
 
60
- # entity - definition
61
- unless hEntity[:entityDefinition].nil?
62
- @html.em('Definition: ')
63
- @html.section(:class => 'block') do
64
- @html.text!(hEntity[:entityDefinition])
65
- end
66
- end
67
-
68
- # entity - primary key
69
- unless hEntity[:primaryKey].empty?
70
- @html.em('Primary Key Attribute(s):')
71
- @html.section(:class => 'block') do
72
- hEntity[:primaryKey].each do |attribute|
73
- @html.text!(attribute)
74
- @html.br
75
- end
76
- end
77
- end
28
+ aEntities.each do |hEntity|
78
29
 
79
- # entity - indexes [] {entityIndex}
80
- hEntity[:indexes].each do |hIndex|
81
- @html.details do
82
- @html.summary('Index: '+hIndex[:indexCode], {'class' => 'h5'})
83
- @html.section(:class => 'block') do
84
- indexClass.writeHtml(hIndex)
85
- end
86
- end
87
- end
30
+ # classes used
31
+ indexClass = Html_EntityIndex.new(@html)
32
+ attributeClass = Html_EntityAttribute.new(@html)
33
+ foreignClass = Html_EntityForeignKey.new(@html)
34
+ citationClass = Html_Citation.new(@html)
88
35
 
89
- # entity - attributes [] {entityAttribute}
90
- hEntity[:attributes].each do |hAttribute|
91
- @html.details do
92
- @html.summary('Attribute: '+hAttribute[:attributeCode], {'class' => 'h5'})
93
- @html.section(:class => 'block') do
94
- attributeClass.writeHtml(hAttribute)
95
- end
96
- end
97
- end
36
+ eName = 'entity'
37
+ eName = hEntity[:entityCode] unless hEntity[:entityCode].nil?
38
+ eName = hEntity[:entityName] unless hEntity[:entityName].nil?
98
39
 
99
- # entity - foreign keys [] {entityForeignKey}
100
- hEntity[:foreignKeys].each do |hForeign|
101
40
  @html.details do
102
- @html.summary('ForeignKey', {'class' => 'h5'})
41
+ @html.summary(eName, {'class' => 'h5'})
103
42
  @html.section(:class => 'block') do
104
- foreignClass.writeHtml(hForeign)
43
+
44
+ # entity - entity id
45
+ unless hEntity[:entityId].nil?
46
+ @html.em('ID: ')
47
+ @html.text!(hEntity[:entityId])
48
+ @html.br
49
+ end
50
+
51
+ # entity - name
52
+ unless hEntity[:entityName].nil?
53
+ @html.em('Name: ')
54
+ @html.text!(hEntity[:entityName])
55
+ @html.br
56
+ end
57
+
58
+ # entity - code
59
+ unless hEntity[:entityCode].nil?
60
+ @html.em('Code: ')
61
+ @html.text!(hEntity[:entityCode])
62
+ @html.br
63
+ end
64
+
65
+ # entity - alias names
66
+ hEntity[:entityAlias].each do |otherName|
67
+ @html.em('Alias: ')
68
+ @html.section(:class => 'block') do
69
+ @html.text!(otherName)
70
+ end
71
+ end
72
+
73
+ # entity - definition
74
+ unless hEntity[:entityDefinition].nil?
75
+ @html.em('Definition: ')
76
+ @html.section(:class => 'block') do
77
+ @html.text!(hEntity[:entityDefinition])
78
+ end
79
+ end
80
+
81
+ # entity - primary key
82
+ unless hEntity[:primaryKey].empty?
83
+ @html.em('Primary Key Attribute(s):')
84
+ @html.section(:class => 'block') do
85
+ hEntity[:primaryKey].each do |attribute|
86
+ @html.text!(attribute)
87
+ @html.br
88
+ end
89
+ end
90
+ end
91
+
92
+ # entity - field separator character
93
+ unless hEntity[:fieldSeparatorCharacter].nil?
94
+ @html.em('Field Separator Character: ')
95
+ @html.text!(hEntity[:fieldSeparatorCharacter])
96
+ @html.br
97
+ end
98
+
99
+ # entity - number of header lines
100
+ unless hEntity[:numberOfHeaderLines].nil?
101
+ @html.em('Number of Header Lines: ')
102
+ @html.text!(hEntity[:numberOfHeaderLines].to_s)
103
+ @html.br
104
+ end
105
+
106
+ # entity - quote character
107
+ unless hEntity[:quoteCharacter].nil?
108
+ @html.em('Quote Character: ')
109
+ @html.text!(hEntity[:quoteCharacter])
110
+ @html.br
111
+ end
112
+
113
+ # entity - indexes [] {entityIndex}
114
+ hEntity[:indexes].each do |hIndex|
115
+ iName = 'index'
116
+ iName = hIndex[:indexCode] unless hIndex[:indexCode].nil?
117
+ iName = hIndex[:indexName] unless hIndex[:indexName].nil?
118
+ @html.details do
119
+ @html.summary('Index: '+iName, {'class' => 'h5'})
120
+ @html.section(:class => 'block') do
121
+ indexClass.writeHtml(hIndex)
122
+ end
123
+ end
124
+ end
125
+
126
+ # entity - foreign keys [] {entityForeignKey}
127
+ hEntity[:foreignKeys].each do |hForeign|
128
+ @html.details do
129
+ @html.summary('ForeignKey', {'class' => 'h5'})
130
+ @html.section(:class => 'block') do
131
+ foreignClass.writeHtml(hForeign)
132
+ end
133
+ end
134
+ end
135
+
136
+ # entity - entity reference [] {citation}
137
+ hEntity[:entityReferences].each do |hReference|
138
+ @html.details do
139
+ @html.summary('Reference', {'class' => 'h5'})
140
+ @html.section(:class => 'block') do
141
+ citationClass.writeHtml(hReference)
142
+ end
143
+ end
144
+ end
145
+
146
+ # entity - attributes [] {entityAttribute}
147
+ hEntity[:attributes].each do |hAttribute|
148
+ aName = 'attribute'
149
+ aName = hAttribute[:attributeCode] unless hAttribute[:attributeCode].nil?
150
+ aName = hAttribute[:attributeName] unless hAttribute[:attributeName].nil?
151
+ @html.details do
152
+ @html.summary('Attribute: '+aName, {'class' => 'h5'})
153
+ @html.section(:class => 'block') do
154
+ attributeClass.writeHtml(hAttribute)
155
+ end
156
+ end
157
+ end
158
+
105
159
  end
106
160
  end
107
- end
108
161
 
162
+ end # aEntity
109
163
  end # writeHtml
110
164
  end # Html_Entity
111
165
 
@@ -2,9 +2,13 @@
2
2
  # data attribute
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-11-03 added new elements for fgdc
5
6
  # Stan Smith 2017-04-05 refactored for mdTranslator 2.0
6
7
  # Stan Smith 2015-03-26 original script
7
8
 
9
+ require_relative 'html_timePeriod'
10
+ require_relative 'html_citation'
11
+
8
12
  module ADIWG
9
13
  module Mdtranslator
10
14
  module Writers
@@ -18,6 +22,10 @@ module ADIWG
18
22
 
19
23
  def writeHtml(hAttribute)
20
24
 
25
+ # classes used
26
+ periodClass = Html_TimePeriod.new(@html)
27
+ citationClass = Html_Citation.new(@html)
28
+
21
29
  # entity attribute - common name
22
30
  unless hAttribute[:attributeName].nil?
23
31
  @html.em('Name: ')
@@ -71,6 +79,32 @@ module ADIWG
71
79
  @html.br
72
80
  end
73
81
 
82
+ # entity attribute - measure resolution {real}
83
+ unless hAttribute[:measureResolution].nil?
84
+ @html.em('Unit of Measure Resolution: ')
85
+ @html.text!(hAttribute[:measureResolution].to_s)
86
+ @html.br
87
+ end
88
+
89
+ # entity attribute - case sensitive {Boolean}
90
+ @html.em('Value is Case Sensitive: ')
91
+ @html.text!(hAttribute[:isCaseSensitive].to_s)
92
+ @html.br
93
+
94
+ # entity attribute - field width {integer}
95
+ unless hAttribute[:fieldWidth].nil?
96
+ @html.em('Field Width: ')
97
+ @html.text!(hAttribute[:fieldWidth].to_s)
98
+ @html.br
99
+ end
100
+
101
+ # entity attribute - missing value
102
+ unless hAttribute[:missingValue].nil?
103
+ @html.em('Missing Value: ')
104
+ @html.text!(hAttribute[:missingValue])
105
+ @html.br
106
+ end
107
+
74
108
  # entity attribute - domain ID
75
109
  unless hAttribute[:domainId].nil?
76
110
  @html.em('Domain ID: ')
@@ -92,6 +126,50 @@ module ADIWG
92
126
  @html.br
93
127
  end
94
128
 
129
+ # entity attribute - range of values [] {citation}
130
+ hAttribute[:rangeOfValues].each do |hRange|
131
+ @html.details do
132
+ @html.summary('Range of Values', {'class' => 'h5'})
133
+ @html.section(:class => 'block') do
134
+
135
+ # range of values - minimum value
136
+ unless hRange[:minRangeValue].nil?
137
+ @html.em('Range Minimum: ')
138
+ @html.text!(hRange[:minRangeValue].to_s)
139
+ @html.br
140
+ end
141
+
142
+ # range of values - maximum value
143
+ unless hRange[:maxRangeValue].nil?
144
+ @html.em('Range Maximum: ')
145
+ @html.text!(hRange[:maxRangeValue].to_s)
146
+ @html.br
147
+ end
148
+
149
+ end
150
+ end
151
+ end
152
+
153
+ # entity attribute - time period of values {timePeriod}
154
+ hAttribute[:timePeriodOfValues].each do |hPeriod|
155
+ @html.details do
156
+ @html.summary('Time Period of Values', {'class' => 'h5'})
157
+ @html.section(:class => 'block') do
158
+ periodClass.writeHtml(hPeriod)
159
+ end
160
+ end
161
+ end
162
+
163
+ # entity attribute - attribute reference {citation}
164
+ unless hAttribute[:attributeReference].empty?
165
+ @html.details do
166
+ @html.summary('Reference', {'class' => 'h5'})
167
+ @html.section(:class => 'block') do
168
+ citationClass.writeHtml(hAttribute[:attributeReference])
169
+ end
170
+ end
171
+ end
172
+
95
173
  end # writeHtml
96
174
  end # Html_EntityAttribute
97
175
 
@@ -57,7 +57,7 @@ module ADIWG
57
57
  # identifier - authority {citation}
58
58
  unless hIdentifier[:citation].empty?
59
59
  @html.details do
60
- @html.summary('Authority', {'id' => 'metadata-identifier', 'class' => 'h4'})
60
+ @html.summary('Authority', {'id' => 'metadata-identifier', 'class' => 'h5'})
61
61
  @html.section(:class => 'block') do
62
62
  citationClass.writeHtml(hIdentifier[:citation])
63
63
  end
@@ -0,0 +1,37 @@
1
+ # HTML writer
2
+ # spatial reference system oblique line point
3
+
4
+ # History:
5
+ # Stan Smith 2017-10-24 original script
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Html
11
+
12
+ class Html_ObliqueLinePoint
13
+
14
+ def writeHtml(hLinePoint)
15
+
16
+ long = 'missing'
17
+ lat = 'missing'
18
+
19
+ # oblique line point - point latitude
20
+ unless hLinePoint[:azimuthLineLatitude].nil?
21
+ long = hLinePoint[:azimuthLineLatitude].to_s
22
+ end
23
+
24
+ # oblique line point - point longitude
25
+ unless hLinePoint[:azimuthLineLongitude].nil?
26
+ lat = hLinePoint[:azimuthLineLongitude].to_s
27
+ end
28
+
29
+ return '( Longitude: ' + long + ', Latitude: ' + lat + ' )'
30
+
31
+ end # writeHtml
32
+ end # Html_ObliqueLinePoint
33
+
34
+ end
35
+ end
36
+ end
37
+ end