adiwg-mdtranslator 2.10.0 → 2.12.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +23 -24
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +2 -1
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +2 -1
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +4 -2
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +13 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +38 -0
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +2 -2
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +5 -0
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +2 -1
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +17 -6
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +1 -2
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +24 -5
  16. data/lib/adiwg/mdtranslator/version.rb +8 -1
  17. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb +10 -10
  18. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +21 -16
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_browse.rb +8 -7
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +11 -11
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb +6 -4
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +14 -14
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataDomain.rb +18 -18
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +10 -7
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +5 -2
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb +10 -4
  27. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dictionary.rb +7 -9
  28. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_digitalForm.rb +7 -4
  29. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_distribution.rb +9 -5
  30. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityDetail.rb +15 -11
  31. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityOverview.rb +7 -4
  32. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +1 -1
  33. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +7 -6
  34. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +8 -7
  35. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +5 -4
  36. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicRange.rb +6 -5
  37. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +22 -18
  38. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +32 -12
  39. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_lineage.rb +4 -2
  40. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +17 -6
  41. data/lib/adiwg/mdtranslator/writers/fgdc/classes/{class_mapProjection.rb → class_mapProjectionTags.rb} +33 -57
  42. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_metadataInfo.rb +9 -12
  43. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +7 -8
  44. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +16 -8
  45. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_offlineOption.rb +24 -19
  46. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_onlineOption.rb +7 -4
  47. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_orderProcess.rb +8 -5
  48. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb +6 -3
  49. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarGrid.rb +146 -0
  50. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarInfo.rb +168 -0
  51. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarLocal.rb +42 -0
  52. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarMap.rb +294 -0
  53. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +47 -328
  54. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +6 -6
  55. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb +6 -4
  56. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb +3 -2
  57. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_security.rb +5 -6
  58. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb +4 -4
  59. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +11 -14
  60. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +8 -8
  61. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +5 -2
  62. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +22 -7
  63. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb +8 -7
  64. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomy.rb +4 -2
  65. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyClassification.rb +5 -4
  66. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +17 -10
  67. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +11 -15
  68. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +9 -7
  69. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +4 -2
  70. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +11 -17
  71. data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb +53 -3
  72. data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer_messages_eng.yml +213 -0
  73. data/lib/adiwg/mdtranslator/writers/fgdc/version.rb +3 -2
  74. data/lib/adiwg/mdtranslator/writers/html/sections/html_allocation.rb +13 -1
  75. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +11 -1
  76. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +10 -10
  77. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomyClass.rb +4 -4
  78. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_baseUnit.rb +27 -27
  79. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_citation.rb +5 -2
  80. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_codelist.rb +38 -38
  81. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_contact.rb +79 -79
  82. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_conventionalUnit.rb +49 -49
  83. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb +5 -2
  84. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionUnit.rb +24 -24
  85. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_derivedUnit.rb +36 -36
  86. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_domain.rb +28 -21
  87. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +12 -9
  88. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureAttribute.rb +9 -3
  89. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureType.rb +8 -3
  90. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +7 -4
  91. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_locale.rb +52 -49
  92. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_mdIdentifier.rb +4 -1
  93. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +15 -0
  94. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_onlineResource.rb +79 -76
  95. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_phone.rb +67 -67
  96. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_responsibleParty.rb +117 -108
  97. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_unitsOfMeasure.rb +246 -246
  98. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +44 -6
  99. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +40 -0
  100. data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +6 -5
  101. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +13 -6
  102. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +1 -1
  103. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_allocation.rb +3 -0
  104. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_resourceInfo.rb +5 -4
  105. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_taxonomicClassification.rb +6 -4
  106. data/lib/adiwg/mdtranslator_cli.rb +18 -8
  107. metadata +14 -8
  108. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapCoordinateInfo.rb +0 -167
@@ -2,8 +2,10 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-17 refactored error and warning messaging
5
6
  # Stan Smith 2018-01-22 original script
6
7
 
8
+ require_relative '../fgdc_writer'
7
9
  require_relative 'class_attribute'
8
10
 
9
11
  module ADIWG
@@ -16,34 +18,37 @@ module ADIWG
16
18
  def initialize(xml, hResponseObj)
17
19
  @xml = xml
18
20
  @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
19
22
  end
20
23
 
21
- def writeXML(hEntity)
22
-
24
+ def writeXML(hEntity, inContext = nil)
25
+
23
26
  # classes used
24
27
  attrClass = Attribute.new(@xml, @hResponseObj)
25
28
 
29
+ # set context
30
+ outContext = hEntity[:entityCode]
31
+ outContext = 'entity code ' + outContext unless outContext.nil?
32
+
26
33
  # entity detail 5.1.1 (enttype) - entity type
27
34
  @xml.tag!('enttype') do
28
35
 
29
36
  # entity type 5.1.1.1 (enttypl) - entity type label (required)
30
37
  # <- entity.entityCode
31
- unless hEntity[:entityCode].nil?
38
+ unless hEntity[:entityCode].nil?
32
39
  @xml.tag!('enttypl', hEntity[:entityCode])
33
40
  end
34
41
  if hEntity[:entityCode].nil?
35
- @hResponseObj[:writerPass] = false
36
- @hResponseObj[:writerMessages] << 'Entity Attribute Detail missing entity type label'
42
+ @NameSpace.issueWarning(90, 'enttypl', inContext)
37
43
  end
38
44
 
39
45
  # entity type 5.1.1.2 (enttypd) - entity type definition (required)
40
46
  # <- entity.entityDefinition
41
- unless hEntity[:entityDefinition].nil?
47
+ unless hEntity[:entityDefinition].nil?
42
48
  @xml.tag!('enttypd', hEntity[:entityDefinition])
43
49
  end
44
50
  if hEntity[:entityDefinition].nil?
45
- @hResponseObj[:writerPass] = false
46
- @hResponseObj[:writerMessages] << 'Entity Attribute Detail missing entity definition'
51
+ @NameSpace.issueWarning(91, 'enttypd', inContext)
47
52
  end
48
53
 
49
54
  # entity type 5.1.1.3 (enttypds) - entity definition source (required)
@@ -54,8 +59,7 @@ module ADIWG
54
59
  end
55
60
  end
56
61
  if hEntity[:entityReferences].empty?
57
- @hResponseObj[:writerPass] = false
58
- @hResponseObj[:writerMessages] << 'Entity Attribute Detail missing entity definition citation'
62
+ @NameSpace.issueWarning(92, 'enttypds', inContext)
59
63
  end
60
64
 
61
65
  end
@@ -64,7 +68,7 @@ module ADIWG
64
68
  hEntity[:attributes].each do |hAttribute|
65
69
  unless hAttribute.empty?
66
70
  @xml.tag!('attr') do
67
- attrClass.writeXML(hAttribute)
71
+ attrClass.writeXML(hAttribute, outContext)
68
72
  end
69
73
  end
70
74
  end
@@ -2,8 +2,11 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-26 refactored error and warning messaging
5
6
  # Stan Smith 2018-01-22 original script
6
7
 
8
+ require_relative '../fgdc_writer'
9
+
7
10
  module ADIWG
8
11
  module Mdtranslator
9
12
  module Writers
@@ -14,18 +17,18 @@ module ADIWG
14
17
  def initialize(xml, hResponseObj)
15
18
  @xml = xml
16
19
  @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
17
21
  end
18
22
 
19
- def writeXML(hEntity)
20
-
23
+ def writeXML(hEntity, inContext = nil)
24
+
21
25
  # entity overview 5.2.1 (eaover) - entity and attribute overview (required)
22
26
  # <- entity.definition
23
27
  unless hEntity[:entityDefinition].nil?
24
28
  @xml.tag!('eaover', hEntity[:entityDefinition])
25
29
  end
26
30
  if hEntity[:entityDefinition].nil?
27
- @hResponseObj[:writerPass] = false
28
- @hResponseObj[:writerMessages] << 'Entity Attribute Overview missing definition'
31
+ @NameSpace.issueWarning(100, 'eaover', inContext)
29
32
  end
30
33
 
31
34
  # entity overview 5.2.2 (eadetcit) - entity and attribute detail citation []
@@ -43,7 +43,7 @@ module ADIWG
43
43
  # document head
44
44
  metadata = @xml.instruct! :xml, encoding: 'UTF-8'
45
45
  @xml.comment!('FGDC METADATA (FGDC-STD-001-1998)')
46
- @xml.comment!('This file conforms to the Biological Data Profile (FGDC-STD-001.1-1999)')
46
+ @xml.comment!('This metadata record conforms to the Biological Data Profile (FGDC-STD-001.1-1999)')
47
47
  @xml.comment!('The following metadata file was constructed using the ADIwg mdTranslator, http://mdtranslator.adiwg.org')
48
48
  @xml.comment!('mdTranslator software is an open-source project of the Alaska Data Integration working group (ADIwg)')
49
49
  @xml.comment!('mdTranslator and other metadata tools are available at https://github.com/adiwg')
@@ -2,8 +2,11 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-18 refactored error and warning messaging
5
6
  # Stan Smith 2018-01-15 original script
6
7
 
8
+ require_relative '../fgdc_writer'
9
+
7
10
  module ADIWG
8
11
  module Mdtranslator
9
12
  module Writers
@@ -14,6 +17,7 @@ module ADIWG
14
17
  def initialize(xml, hResponseObj)
15
18
  @xml = xml
16
19
  @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
17
21
  end
18
22
 
19
23
  def writeXML(hGeodetic)
@@ -31,8 +35,7 @@ module ADIWG
31
35
  @xml.tag!('ellips', hGeodetic[:ellipsoidName])
32
36
  end
33
37
  if hGeodetic[:ellipsoidName].nil?
34
- @hResponseObj[:writerPass] = false
35
- @hResponseObj[:writerMessages] << 'Geodetic Coordinate System is missing ellipsoid name'
38
+ @NameSpace.issueWarning(150, 'ellips')
36
39
  end
37
40
 
38
41
  # geodetic reference system 4.1.4.3 (semiaxis) - ellipsoid semi-major axis (required)
@@ -40,8 +43,7 @@ module ADIWG
40
43
  @xml.tag!('semiaxis', hGeodetic[:semiMajorAxis])
41
44
  end
42
45
  if hGeodetic[:semiMajorAxis].nil?
43
- @hResponseObj[:writerPass] = false
44
- @hResponseObj[:writerMessages] << 'Geodetic Coordinate System is missing semi-major axis'
46
+ @NameSpace.issueWarning(151, 'semiaxis')
45
47
  end
46
48
 
47
49
  # geodetic reference system 4.1.4.4 (denflat) - ellipsoid denominator of flattening ratio (required)
@@ -49,8 +51,7 @@ module ADIWG
49
51
  @xml.tag!('denflat', hGeodetic[:denominatorOfFlatteningRatio])
50
52
  end
51
53
  if hGeodetic[:denominatorOfFlatteningRatio].nil?
52
- @hResponseObj[:writerPass] = false
53
- @hResponseObj[:writerMessages] << 'Geodetic Coordinate System is missing denominator of flattening ratio'
54
+ @NameSpace.issueWarning(152, 'denflat')
54
55
  end
55
56
 
56
57
  end # writeXML
@@ -2,8 +2,11 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-12-29 original script
6
7
 
8
+ require_relative '../fgdc_writer'
9
+
7
10
  module ADIWG
8
11
  module Mdtranslator
9
12
  module Writers
@@ -14,10 +17,11 @@ module ADIWG
14
17
  def initialize(xml, hResponseObj)
15
18
  @xml = xml
16
19
  @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
17
21
  end
18
22
 
19
23
  def writeXML(hGeoRes)
20
-
24
+
21
25
  # horizontal reference 4.1.1 (geograph) - geographic resolution
22
26
 
23
27
  # geographic resolution 4.1.1.1 (latres) - latitude resolution (required)
@@ -25,8 +29,7 @@ module ADIWG
25
29
  @xml.tag!('latres', hGeoRes[:latitudeResolution]).to_s
26
30
  end
27
31
  if hGeoRes[:latitudeResolution].nil?
28
- @hResponseObj[:writerPass] = false
29
- @hResponseObj[:writerMessages] << 'Geographic Resolution is missing latitude resolution'
32
+ @NameSpace.issueWarning(160, 'latres')
30
33
  end
31
34
 
32
35
  # geographic resolution 4.1.1.2 (longres) - longitude resolution (required)
@@ -34,8 +37,7 @@ module ADIWG
34
37
  @xml.tag!('longres', hGeoRes[:longitudeResolution]).to_s
35
38
  end
36
39
  if hGeoRes[:longitudeResolution].nil?
37
- @hResponseObj[:writerPass] = false
38
- @hResponseObj[:writerMessages] << 'Geographic Resolution is missing longitude resolution'
40
+ @NameSpace.issueWarning(161, 'longres')
39
41
  end
40
42
 
41
43
  # geographic resolution 4.1.1.3 (geogunit) - longitude resolution (required)
@@ -43,8 +45,7 @@ module ADIWG
43
45
  @xml.tag!('geogunit', hGeoRes[:unitOfMeasure])
44
46
  end
45
47
  if hGeoRes[:unitOfMeasure].nil?
46
- @hResponseObj[:writerPass] = false
47
- @hResponseObj[:writerMessages] << 'Geographic Resolution is missing unit of measure'
48
+ @NameSpace.issueWarning(162, 'geogunit')
48
49
  end
49
50
 
50
51
  end # writeXML
@@ -2,8 +2,10 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-11-24 original script
6
7
 
8
+ require_relative '../fgdc_writer'
7
9
  require_relative 'class_citation'
8
10
 
9
11
  module ADIWG
@@ -16,6 +18,7 @@ module ADIWG
16
18
  def initialize(xml, hResponseObj)
17
19
  @xml = xml
18
20
  @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
19
22
  end
20
23
 
21
24
  def writeXML(hGeoAge)
@@ -28,8 +31,7 @@ module ADIWG
28
31
  @xml.tag!('geolscal', hGeoAge[:ageTimeScale])
29
32
  end
30
33
  if hGeoAge[:ageTimeScale].nil?
31
- @hResponseObj[:writerPass] = false
32
- @hResponseObj[:writerMessages] << 'Geologic Age is missing time scale'
34
+ @NameSpace.issueWarning(170, 'geolscal')
33
35
  end
34
36
 
35
37
  # geologic age (geolest) - age estimate (required)
@@ -37,8 +39,7 @@ module ADIWG
37
39
  @xml.tag!('geolest', hGeoAge[:ageEstimate])
38
40
  end
39
41
  if hGeoAge[:ageEstimate].nil?
40
- @hResponseObj[:writerPass] = false
41
- @hResponseObj[:writerMessages] << 'Geologic Age is missing age estimate'
42
+ @NameSpace.issueWarning(171, 'geolest')
42
43
  end
43
44
 
44
45
  # geologic age (geolun) - age uncertainty
@@ -2,8 +2,10 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2017-11-24 original script
5
+ # Stan Smith 2018-03-19 refactored error and warning messaging
6
+ # Stan Smith 2017-11-24 original script
6
7
 
8
+ require_relative '../fgdc_writer'
7
9
  require_relative 'class_geologicAge'
8
10
 
9
11
  module ADIWG
@@ -16,6 +18,7 @@ module ADIWG
16
18
  def initialize(xml, hResponseObj)
17
19
  @xml = xml
18
20
  @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
19
22
  end
20
23
 
21
24
  def writeXML(hAgeStart, hAgeEnd)
@@ -30,8 +33,7 @@ module ADIWG
30
33
  end
31
34
  end
32
35
  if hAgeStart.empty?
33
- @hResponseObj[:writerPass] = false
34
- @hResponseObj[:writerMessages] << 'Geologic Age Range is missing starting age'
36
+ @NameSpace.issueWarning(172, nil)
35
37
  end
36
38
 
37
39
  # geologic age range (endgeol) - ending geologic age (required)
@@ -41,8 +43,7 @@ module ADIWG
41
43
  end
42
44
  end
43
45
  if hAgeEnd.empty?
44
- @hResponseObj[:writerPass] = false
45
- @hResponseObj[:writerMessages] << 'Geologic Age Range is missing ending age'
46
+ @NameSpace.issueWarning(173, nil)
46
47
  end
47
48
 
48
49
  end # writeXML
@@ -2,6 +2,7 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-11-17 original script
6
7
 
7
8
  require_relative '../fgdc_writer'
@@ -27,6 +28,7 @@ module ADIWG
27
28
  def initialize(xml, hResponseObj)
28
29
  @xml = xml
29
30
  @hResponseObj = hResponseObj
31
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
30
32
  end
31
33
 
32
34
  def writeXML(intObj)
@@ -47,33 +49,33 @@ module ADIWG
47
49
  hResourceInfo = intObj[:metadata][:resourceInfo]
48
50
  aAssocResource = intObj[:metadata][:associatedResources]
49
51
 
52
+ outContext = 'identification section'
53
+
50
54
  # identification information 1.1 (citation) - citation (required)
51
55
  # <- hResourceInfo[:citation]
52
56
  hCitation = hResourceInfo[:citation]
53
57
  unless hCitation.empty?
54
58
  @xml.tag!('citation') do
55
- citationClass.writeXML(hCitation, aAssocResource)
59
+ citationClass.writeXML(hCitation, aAssocResource, 'main resource citation')
56
60
  end
57
61
  end
58
62
  if hCitation.empty?
59
- @hResponseObj[:writerPass] = false
60
- @hResponseObj[:writerMessages] << 'Identification section is missing citation'
63
+ @NameSpace.issueWarning(180, nil, outContext)
61
64
  end
62
65
 
63
66
  # identification information 1.2 (descript) - description (required)
64
67
  # <- hResourceInfo[:abstract,:purpose,:supplementalInfo] (required)
65
- unless hResourceInfo[:abstract].nil? && hResourceInfo[:purpose].nil? && hResourceInfo[:supplementalInfo].nil?
68
+ haveDescription = false
69
+ haveDescription = true unless hResourceInfo[:abstract].nil?
70
+ haveDescription = true unless hResourceInfo[:purpose].nil?
71
+ haveDescription = true unless hResourceInfo[:supplementalInfo].nil?
72
+ if haveDescription
66
73
  @xml.tag!('descript') do
67
74
  descriptionClass.writeXML(hResourceInfo)
68
75
  end
69
76
  end
70
- if hResourceInfo[:abstract].nil?
71
- @hResponseObj[:writerPass] = false
72
- @hResponseObj[:writerMessages] << 'Identification section is missing abstract'
73
- end
74
- if hResourceInfo[:purpose].nil?
75
- @hResponseObj[:writerPass] = false
76
- @hResponseObj[:writerMessages] << 'Identification section is missing purpose'
77
+ unless haveDescription
78
+ @NameSpace.issueWarning(181, nil, outContext)
77
79
  end
78
80
 
79
81
  # identification information 1.3 (timeperd) - time period of content (required)
@@ -84,8 +86,7 @@ module ADIWG
84
86
  end
85
87
  end
86
88
  if hResourceInfo[:timePeriod].empty?
87
- @hResponseObj[:writerPass] = false
88
- @hResponseObj[:writerMessages] << 'Identification section is missing time period'
89
+ @NameSpace.issueWarning(182, nil, outContext)
89
90
  end
90
91
 
91
92
  # identification information 1.4 (status) - status
@@ -104,16 +105,19 @@ module ADIWG
104
105
  end
105
106
  end
106
107
  if hResourceInfo[:keywords].empty?
107
- @hResponseObj[:writerPass] = false
108
- @hResponseObj[:writerMessages] << 'Identification section is missing keywords'
108
+ @NameSpace.issueWarning(183, nil, outContext)
109
109
  end
110
110
 
111
111
  # identification information bio (taxonomy) - taxonomy
112
112
  unless hResourceInfo[:taxonomy].empty?
113
113
  @xml.tag!('taxonomy') do
114
- taxonomyClass.writeXML(hResourceInfo[:taxonomy], hResourceInfo[:keywords])
114
+ taxonomyClass.writeXML(hResourceInfo[:taxonomy][0], hResourceInfo[:keywords])
115
115
  end
116
116
  end
117
+ if hResourceInfo[:taxonomy].length > 1
118
+ @NameSpace.issueNotice(186)
119
+ @NameSpace.issueNotice(187)
120
+ end
117
121
  if hResourceInfo[:taxonomy].empty? && @hResponseObj[:writerShowTags]
118
122
  @xml.tag!('taxonomy')
119
123
  end
@@ -124,8 +128,8 @@ module ADIWG
124
128
  constraintClass.writeXML(hResourceInfo[:constraints])
125
129
  end
126
130
  if hResourceInfo[:constraints].empty?
127
- @hResponseObj[:writerPass] = false
128
- @hResponseObj[:writerMessages] << 'Identification section is missing access and use constraints'
131
+ @NameSpace.issueWarning(184,'accconst', outContext)
132
+ @NameSpace.issueWarning(185,'useconst', outContext)
129
133
  end
130
134
 
131
135
  # identification information 1.9 (ptcontac) - point of contact
@@ -2,7 +2,10 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2017-11-26 original script
5
+ # Stan Smith 2018-03-19 refactored error and warning messaging
6
+ # Stan Smith 2017-11-26 original script
7
+
8
+ require_relative '../fgdc_writer'
6
9
 
7
10
  module ADIWG
8
11
  module Mdtranslator
@@ -14,6 +17,7 @@ module ADIWG
14
17
  def initialize(xml, hResponseObj)
15
18
  @xml = xml
16
19
  @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
17
21
  end
18
22
 
19
23
  def writeXML(aKeywords)
@@ -24,21 +28,22 @@ module ADIWG
24
28
  # find the keyword set parts
25
29
  type = hKeySet[:keywordType]
26
30
  aKeywords = hKeySet[:keywords]
27
- thesaurus = hKeySet[:thesaurus]
31
+ hThesaurus = hKeySet[:thesaurus]
28
32
  thesaurusName = nil
29
- unless thesaurus.empty?
30
- thesaurusName = thesaurus[:title]
31
- end
32
- if thesaurus.empty?
33
- @hResponseObj[:writerPass] = false
34
- @hResponseObj[:writerMessages] << 'Keyword Set is missing thesaurus'
33
+ unless hThesaurus.empty?
34
+ thesaurusName = hThesaurus[:title]
35
35
  end
36
36
 
37
37
  # keyword 1.6.1 (theme) - theme keywords
38
38
  if type == 'theme' || type == 'isoTopicCategory'
39
39
  @xml.tag!('theme') do
40
40
  thesaurusName = 'ISO 19115 Topic Category' if type == 'isoTopicCategory'
41
- @xml.tag!('themekt', thesaurusName)
41
+ unless thesaurusName.nil?
42
+ @xml.tag!('themekt', thesaurusName)
43
+ end
44
+ if thesaurusName.nil?
45
+ @NameSpace.issueWarning(190, 'themekt', 'thematic keywords')
46
+ end
42
47
  aKeywords.each do |hKeyword|
43
48
  keyword = hKeyword[:keyword]
44
49
  unless keyword.nil?
@@ -51,7 +56,12 @@ module ADIWG
51
56
  # keyword 1.6.2 (place) - place keywords
52
57
  if type == 'place'
53
58
  @xml.tag!('place') do
54
- @xml.tag!('placekt', thesaurusName)
59
+ unless thesaurusName.nil?
60
+ @xml.tag!('placekt', thesaurusName)
61
+ end
62
+ if thesaurusName.nil?
63
+ @NameSpace.issueWarning(190, 'placekt', 'place keywords')
64
+ end
55
65
  aKeywords.each do |hKeyword|
56
66
  keyword = hKeyword[:keyword]
57
67
  unless keyword.nil?
@@ -64,7 +74,12 @@ module ADIWG
64
74
  # keyword 1.6.3 (stratum) - stratum keywords
65
75
  if type == 'stratum'
66
76
  @xml.tag!('stratum') do
67
- @xml.tag!('stratkt', thesaurusName)
77
+ unless thesaurusName.nil?
78
+ @xml.tag!('stratkt', thesaurusName)
79
+ end
80
+ if thesaurusName.nil?
81
+ @NameSpace.issueWarning(190, 'stratkt', 'stratigraphic keywords')
82
+ end
68
83
  aKeywords.each do |hKeyword|
69
84
  keyword = hKeyword[:keyword]
70
85
  unless keyword.nil?
@@ -77,7 +92,12 @@ module ADIWG
77
92
  # keyword 1.6.4 (temporal) - temporal keywords
78
93
  if type == 'temporal'
79
94
  @xml.tag!('temporal') do
80
- @xml.tag!('tempkt', thesaurusName)
95
+ unless thesaurusName.nil?
96
+ @xml.tag!('tempkt', thesaurusName)
97
+ end
98
+ if thesaurusName.nil?
99
+ @NameSpace.issueWarning(190, 'tempkt', 'temporal keywords')
100
+ end
81
101
  aKeywords.each do |hKeyword|
82
102
  keyword = hKeyword[:keyword]
83
103
  unless keyword.nil?
@@ -2,8 +2,10 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-12-15 original script
6
7
 
8
+ require_relative '../fgdc_writer'
7
9
  require_relative 'class_method'
8
10
  require_relative 'class_source'
9
11
  require_relative 'class_process'
@@ -18,6 +20,7 @@ module ADIWG
18
20
  def initialize(xml, hResponseObj)
19
21
  @xml = xml
20
22
  @hResponseObj = hResponseObj
23
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
24
  end
22
25
 
23
26
  def writeXML(aLineage)
@@ -76,8 +79,7 @@ module ADIWG
76
79
  end
77
80
  end
78
81
  unless haveStep
79
- @hResponseObj[:writerPass] = false
80
- @hResponseObj[:writerMessages] << 'Lineage Source is missing process steps'
82
+ @NameSpace.issueWarning(200, 'procstep')
81
83
  end
82
84
 
83
85
  # the search for process steps is circular, I'm stopping here.
@@ -2,8 +2,11 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-20 refactored error and warning messaging
5
6
  # Stan Smith 2018-01-15 original script
6
7
 
8
+ require_relative '../fgdc_writer'
9
+
7
10
  module ADIWG
8
11
  module Mdtranslator
9
12
  module Writers
@@ -14,26 +17,34 @@ module ADIWG
14
17
  def initialize(xml, hResponseObj)
15
18
  @xml = xml
16
19
  @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
17
21
  end
18
22
 
19
23
  def writeXML(hProjection)
20
24
 
21
- # local system (local) - local coordinate system description (required)
25
+ # localSYSTEM is not the same as localPLANAR in fgdc
26
+ # however the same projection parameters are used in mdJson to save info
27
+ # local system sets projection = 'localSystem'
28
+ # local planar sets projection = 'localPlanar'
29
+
30
+ if hProjection[:projectionName].nil?
31
+ hProjection[:projectionName] = 'local coordinate system not aligned with surface of earth'
32
+ end
33
+
34
+ # local system 4.1.3.1 (localdes) - local coordinate system description (required)
22
35
  unless hProjection[:localPlanarDescription].nil?
23
36
  @xml.tag!('localdes', hProjection[:localPlanarDescription])
24
37
  end
25
38
  if hProjection[:localPlanarDescription].nil?
26
- @hResponseObj[:writerPass] = false
27
- @hResponseObj[:writerMessages] << 'Local Coordinate System is missing description'
39
+ @NameSpace.issueError(250, hProjection[:projectionName])
28
40
  end
29
41
 
30
- # local system (local) - local coordinate system georeference information (required)
42
+ # local system 4.1.3.2 (localgeo) - local coordinate system georeference information (required)
31
43
  unless hProjection[:localPlanarGeoreference].nil?
32
44
  @xml.tag!('localgeo', hProjection[:localPlanarGeoreference])
33
45
  end
34
46
  if hProjection[:localPlanarGeoreference].nil?
35
- @hResponseObj[:writerPass] = false
36
- @hResponseObj[:writerMessages] << 'Local Coordinate System is missing georeference information'
47
+ @NameSpace.issueError(251, hProjection[:projectionName])
37
48
  end
38
49
 
39
50
  end # writeXML