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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d221df1baafa2798101177f087793b3ffc2e856
4
- data.tar.gz: 51fbdedf28cdff42f3e79ae3ef534b2c2e4333a9
3
+ metadata.gz: bb0c0d37ead2cfe298db7453b5b8ace0b4fd8490
4
+ data.tar.gz: 51b9001ba20ca9e764ecabef3df963610aa348fd
5
5
  SHA512:
6
- metadata.gz: da2abcc1a090ec4aa5bb51229f08dc0071d14c02e2b951ae43556f51eae69e08046a0ba8ef42dd649af300e8b042255c0ab76d5f913bae2a69cff07139e02948
7
- data.tar.gz: d3a77722439c0570e126abbec4384dc97c787ea644ecdcb1eb53465a7da7352889a0fe8d725f306f5a0d6e593440704b01fc06da35b9f9b27bfe25c44a4a8603
6
+ metadata.gz: cb822ec8a2fd8733e99b63c1700f91af1d25ab3da05611f30541a262994f7590c9dcfe4209010d822ff339ac6a8707d280966fa1f378607b407d5aa955e87cd2
7
+ data.tar.gz: 925c1d8ff90ac2f608e205157be13aeb484218174d280069aac95d52c7ab31510626e3fb4f2afc323921221a27e1c3fc9f1e9cf04234faa4796998919b5c7716
data/CHANGELOG.md CHANGED
@@ -1,7 +1,26 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.10.0](https://github.com/adiwg/mdTranslator/tree/v2.10.0)
3
+ ## [v2.12.0.pre](https://github.com/adiwg/mdTranslator/tree/v2.12.0.pre)
4
4
 
5
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.10.0...v2.12.0.pre)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Issue warning when contact is not found [\#187](https://github.com/adiwg/mdTranslator/issues/187)
10
+ - Divide user messages into warning and error [\#183](https://github.com/adiwg/mdTranslator/issues/183)
11
+ - Add error messaging to ISO writers [\#178](https://github.com/adiwg/mdTranslator/issues/178)
12
+ - Allow mutiple taxonomic definitions [\#14](https://github.com/adiwg/mdTranslator/issues/14)
13
+
14
+ **Fixed bugs:**
15
+
16
+ - Missing FGDC writer option in CLI [\#192](https://github.com/adiwg/mdTranslator/issues/192)
17
+
18
+ **Merged pull requests:**
19
+
20
+ - Refactor taxonomy as an array [\#190](https://github.com/adiwg/mdTranslator/pull/190) ([stansmith907](https://github.com/stansmith907))
21
+ - Refactor FGDC writer messaging [\#189](https://github.com/adiwg/mdTranslator/pull/189) ([stansmith907](https://github.com/stansmith907))
22
+
23
+ ## [v2.10.0](https://github.com/adiwg/mdTranslator/tree/v2.10.0) (2018-03-13)
5
24
  [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.9.2...v2.10.0)
6
25
 
7
26
  **Merged pull requests:**
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency "uuidtools", "~> 2.1"
35
35
  spec.add_runtime_dependency "json-schema", "~> 2.7"
36
36
  spec.add_runtime_dependency "adiwg-mdjson_schemas", ">= 2.4.2"
37
- spec.add_runtime_dependency "adiwg-mdcodes", "~> 2.4.0"
37
+ spec.add_runtime_dependency "adiwg-mdcodes", "~> 2.6.2"
38
38
  spec.add_runtime_dependency "jbuilder", "~> 2.5"
39
39
  spec.add_runtime_dependency "kramdown", "~> 1.13"
40
40
  spec.add_runtime_dependency "coderay", "~> 1.1"
@@ -463,7 +463,7 @@ class InternalMetadata
463
463
  attributeReference: {},
464
464
  dataType: nil,
465
465
  allowNull: false,
466
- mustBeUnique: false,
466
+ mustBeUnique: true,
467
467
  unitOfMeasure: nil,
468
468
  measureResolution: nil,
469
469
  isCaseSensitive: false,
@@ -528,26 +528,6 @@ class InternalMetadata
528
528
  }
529
529
  end
530
530
 
531
- def newOrderProcess
532
- {
533
- fees: nil,
534
- plannedAvailability: {},
535
- orderingInstructions: nil,
536
- turnaround: nil
537
- }
538
- end
539
-
540
- def newTransferOption
541
- {
542
- unitsOfDistribution: nil,
543
- transferSize: nil,
544
- onlineOptions: [],
545
- offlineOptions: [],
546
- transferFrequency: {},
547
- distributionFormats: []
548
- }
549
- end
550
-
551
531
  def newMedium
552
532
  {
553
533
  mediumSpecification: {},
@@ -560,6 +540,15 @@ class InternalMetadata
560
540
  }
561
541
  end
562
542
 
543
+ def newOrderProcess
544
+ {
545
+ fees: nil,
546
+ plannedAvailability: {},
547
+ orderingInstructions: nil,
548
+ turnaround: nil
549
+ }
550
+ end
551
+
563
552
  def newResourceFormat
564
553
  {
565
554
  formatSpecification: {},
@@ -569,6 +558,17 @@ class InternalMetadata
569
558
  }
570
559
  end
571
560
 
561
+ def newTransferOption
562
+ {
563
+ unitsOfDistribution: nil,
564
+ transferSize: nil,
565
+ onlineOptions: [],
566
+ offlineOptions: [],
567
+ transferFrequency: {},
568
+ distributionFormats: []
569
+ }
570
+ end
571
+
572
572
 
573
573
  # funding --------------------------------
574
574
  def newAllocation
@@ -578,6 +578,7 @@ class InternalMetadata
578
578
  currency: nil,
579
579
  sourceId: nil,
580
580
  recipientId: nil,
581
+ responsibleParties: [],
581
582
  matching: false,
582
583
  onlineResources: [],
583
584
  comment: nil
@@ -772,7 +773,7 @@ class InternalMetadata
772
773
  temporalResolutions: [],
773
774
  extents: [],
774
775
  coverageDescriptions: [],
775
- taxonomy: {},
776
+ taxonomy: [],
776
777
  graphicOverviews: [],
777
778
  resourceFormats: [],
778
779
  keywords: [],
@@ -1025,8 +1026,6 @@ class InternalMetadata
1025
1026
  }
1026
1027
  end
1027
1028
 
1028
-
1029
- # taxonomy -------------------------------
1030
1029
  def newTaxonomy
1031
1030
  {
1032
1031
  taxonSystem: [],
@@ -2,6 +2,7 @@
2
2
  # unpack fgdc metadata identification
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-04-06 change mdJson taxonomy to an array
5
6
  # Stan Smith 2017-08-15 original script
6
7
 
7
8
  require 'nokogiri'
@@ -163,7 +164,7 @@ module ADIWG
163
164
  unless xTaxonomy.empty?
164
165
  hTaxonomy = Taxonomy.unpack(xTaxonomy, hResourceInfo, hResponseObj)
165
166
  unless hTaxonomy.nil?
166
- hResourceInfo[:taxonomy] = hTaxonomy
167
+ hResourceInfo[:taxonomy] << hTaxonomy
167
168
  end
168
169
  end
169
170
 
@@ -20,7 +20,8 @@ module ADIWG
20
20
  intMetadataClass = InternalMetadata.new
21
21
 
22
22
  hProjection = intMetadataClass.newProjection
23
- hProjection[:projectionName] = 'local'
23
+ hProjection[:projection] = 'localSystem'
24
+ hProjection[:projectionName] = 'local coordinate system'
24
25
 
25
26
  # local planar 4.1.3.1 (localdes) - local description
26
27
  # -> referenceSystemParameters.projection.localPlanarDescription
@@ -28,7 +28,8 @@ module ADIWG
28
28
  hTaxonClass[:taxonRank] = rankName
29
29
  end
30
30
  if rankName.empty?
31
- hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxon classification rank name is missing'
31
+ hResponseObj[:readerExecutionMessages] <<
32
+ 'WARNING: FGDC reader: BIO taxon classification rank name is missing'
32
33
  end
33
34
 
34
35
  # taxonomy bio.4.2 (taxonrv) - taxon rank value (required)
@@ -38,7 +39,8 @@ module ADIWG
38
39
  hTaxonClass[:taxonValue] = rankValue
39
40
  end
40
41
  if rankValue.empty?
41
- hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxon classification rank value is missing'
42
+ hResponseObj[:readerExecutionMessages] <<
43
+ 'WARNING: FGDC reader: BIO taxon classification rank value is missing'
42
44
  end
43
45
 
44
46
  # taxonomy bio.4.3 (common) - taxon common name []
@@ -2,10 +2,12 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-03-28 add responsible party array
5
6
  # Stan Smith 2018-02-18 refactored error and warning messaging
6
7
  # Stan Smith 2017-08-30 refactored for mdJson schema 2.3
7
8
  # Stan Smith 2016-10-30 original script
8
9
 
10
+ require_relative 'module_responsibleParty'
9
11
  require_relative 'module_onlineResource'
10
12
 
11
13
  module ADIWG
@@ -68,6 +70,17 @@ module ADIWG
68
70
  end
69
71
  end
70
72
 
73
+ # allocation - responsible party [] {responsibility}
74
+ if hAlloc.has_key?('responsibleParty')
75
+ aRParties = hAlloc['responsibleParty']
76
+ aRParties.each do |hRParty|
77
+ hReturn = ResponsibleParty.unpack(hRParty, responseObj)
78
+ unless hReturn.nil?
79
+ intAlloc[:responsibleParties] << hReturn
80
+ end
81
+ end
82
+ end
83
+
71
84
  # allocation - matching {Boolean}
72
85
  if hAlloc.has_key?('matching')
73
86
  if hAlloc['matching'] === true
@@ -0,0 +1,38 @@
1
+ # unpack contact
2
+ # Reader - ADIwg JSON to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2018-02-20 original script
6
+
7
+ require_relative 'module_mdJson'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Readers
12
+ module MdJson
13
+
14
+ module ContactPost
15
+
16
+ def self.examine(aContact, responseObj)
17
+
18
+ # test that all organizationMember IDs are in the contacts array
19
+ aContact.each do |hContact|
20
+ contactId = hContact[:contactId]
21
+ hContact[:memberOfOrgs].each do |orgId|
22
+ hOrg = MdJson.findContact(orgId)
23
+ if hOrg[0].nil?
24
+ responseObj[:readerExecutionMessages] <<
25
+ "ERROR: mdJson reader: contact #{contactId} organization contact ID #{orgId} not found"
26
+ responseObj[:readerExecutionPass] = false
27
+ end
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -104,7 +104,7 @@ module ADIWG
104
104
  # attribute - require value to be unique (required)
105
105
  # ... allowMany deprecated
106
106
  if hAttribute.has_key?('allowMany')
107
- if hAttribute['allowMany'] === true
107
+ if hAttribute['allowMany'] === false
108
108
  intAttribute[:mustBeUnique] = hAttribute['allowMany']
109
109
  responseObj[:readerExecutionMessages] <<
110
110
  'WARNING: mdJson reader: data dictionary entity attribute "allowMany" is deprecated, use "mustBeUnique"'
@@ -112,7 +112,7 @@ module ADIWG
112
112
  end
113
113
  end
114
114
  if hAttribute.has_key?('mustBeUnique')
115
- if hAttribute['mustBeUnique'] === true
115
+ if hAttribute['mustBeUnique'] === false
116
116
  intAttribute[:mustBeUnique] = hAttribute['mustBeUnique']
117
117
  end
118
118
  end
@@ -8,6 +8,7 @@
8
8
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
9
  require_relative 'module_schema'
10
10
  require_relative 'module_contact'
11
+ require_relative 'module_contactPostprocess'
11
12
  require_relative 'module_metadata'
12
13
  require_relative 'module_dataDictionary'
13
14
  require_relative 'module_metadataRepository'
@@ -58,6 +59,10 @@ module ADIWG
58
59
  @contacts = intObj[:contacts]
59
60
  end
60
61
  end
62
+ ContactPost.examine(@contacts, responseObj)
63
+ unless responseObj[:readerExecutionPass]
64
+ return nil
65
+ end
61
66
  end
62
67
  if intObj[:contacts].empty?
63
68
  responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: contact object is missing'
@@ -57,7 +57,8 @@ module ADIWG
57
57
  intProjection[:projection] = hProjection['projection']
58
58
  end
59
59
  if intProjection[:projection].nil? || intProjection[:projection] == ''
60
- responseObj[:readerExecutionMessages] << 'spatial reference projection is missing'
60
+ responseObj[:readerExecutionMessages] <<
61
+ 'ERROR: mdJson reader: spatial reference projection type is missing'
61
62
  responseObj[:readerExecutionPass] = false
62
63
  return nil
63
64
  end
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-04-06 change taxonomy to an array
5
6
  # Stan Smith 2018-02-19 refactored error and warning messaging
6
7
  # Stan Smith 2017-05-16 deprecated topic category
7
8
  # ... topic category is now handled as keyword list
@@ -155,7 +156,7 @@ module ADIWG
155
156
  intResInfo[:keywords] << hReturn[0]
156
157
  end
157
158
  responseObj[:readerExecutionMessages] <<
158
- 'WARNING: mdJson reader: TopicCategory is deprecated, items were moved to keywords "isoTopicCategory"'
159
+ 'NOTICE: mdJson reader: TopicCategory is deprecated, items were moved to keywords "isoTopicCategory"'
159
160
  end
160
161
  end
161
162
 
@@ -250,14 +251,24 @@ module ADIWG
250
251
  end
251
252
  end
252
253
 
253
- # resource information - taxonomy {taxonomy}
254
+ # resource information - taxonomy [] {taxonomy}
255
+ # support deprecated taxonomy{}
254
256
  if hResInfo.has_key?('taxonomy')
255
- hObject = hResInfo['taxonomy']
256
- unless hObject.empty?
257
- hReturn = Taxonomy.unpack(hObject, responseObj)
257
+ aTaxonomy = hResInfo['taxonomy']
258
+ if aTaxonomy.is_a?(Array)
259
+ aTaxonomy.each do |hTaxonomy|
260
+ hReturn = Taxonomy.unpack(hTaxonomy, responseObj)
261
+ unless hReturn.nil?
262
+ intResInfo[:taxonomy] << hReturn
263
+ end
264
+ end
265
+ else
266
+ hReturn = Taxonomy.unpack(aTaxonomy, responseObj)
258
267
  unless hReturn.nil?
259
- intResInfo[:taxonomy] = hReturn
268
+ intResInfo[:taxonomy] << hReturn
260
269
  end
270
+ responseObj[:readerExecutionMessages] <<
271
+ 'NOTICE: mdJson reader: taxonomy is an array, use of a single taxonomy object was deprecated'
261
272
  end
262
273
  end
263
274
 
@@ -104,8 +104,7 @@ module ADIWG
104
104
  # error messages
105
105
  unless haveOne
106
106
  responseObj[:readerExecutionMessages] <<
107
- 'ERROR: mdJson reader: spatial resolution did not have an object of supported type'
108
- responseObj[:readerExecutionPass] = false
107
+ 'WARNING: mdJson reader: spatial resolution did not have an object of supported type'
109
108
  return nil
110
109
  end
111
110
 
@@ -2,6 +2,8 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-04-06 renamed taxonomicRank to taxonomicLevel
6
+ # Stan Smith 2018-04-06 renamed latinName to taxonomicName
5
7
  # Stan Smith 2018-02-19 refactored error and warning messaging
6
8
  # Stan Smith 2017-01-31 added taxonomicSystemId
7
9
  # Stan Smith 2016-10-22 original script
@@ -19,7 +21,8 @@ module ADIWG
19
21
 
20
22
  # return nil object if input is empty
21
23
  if hTaxClass.empty?
22
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: taxonomic classification object is empty'
24
+ responseObj[:readerExecutionMessages] <<
25
+ 'WARNING: mdJson reader: taxonomic classification object is empty'
23
26
  return nil
24
27
  end
25
28
 
@@ -34,22 +37,38 @@ module ADIWG
34
37
  end
35
38
  end
36
39
 
37
- # taxonomic classification - taxon rank (required)
40
+ # taxonomic classification - taxon level (required)
41
+ # renamed from 'taxonomicRank'
42
+ if hTaxClass.has_key?('taxonomicLevel')
43
+ intTaxClass[:taxonRank] = hTaxClass['taxonomicLevel']
44
+ end
45
+ # support deprecation until schema version 3.0
38
46
  if hTaxClass.has_key?('taxonomicRank')
39
47
  intTaxClass[:taxonRank] = hTaxClass['taxonomicRank']
48
+ responseObj[:readerExecutionMessages] <<
49
+ 'NOTICE: mdJson reader: taxonomic classification taxonomicRank is deprecated, use taxonomicLevel'
40
50
  end
41
51
  if intTaxClass[:taxonRank].nil? || intTaxClass[:taxonRank] == ''
42
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: taxonomic classification rank is missing'
52
+ responseObj[:readerExecutionMessages] <<
53
+ 'ERROR: mdJson reader: taxonomic classification level is missing'
43
54
  responseObj[:readerExecutionPass] = false
44
55
  return nil
45
56
  end
46
57
 
47
- # taxonomic classification - latin name (required)
58
+ # taxonomic classification - taxonomic name (required)
59
+ # renamed from 'latinName'
60
+ if hTaxClass.has_key?('taxonomicName')
61
+ intTaxClass[:taxonValue] = hTaxClass['taxonomicName']
62
+ end
63
+ # support deprecation until schema version 3.0
48
64
  if hTaxClass.has_key?('latinName')
49
65
  intTaxClass[:taxonValue] = hTaxClass['latinName']
66
+ responseObj[:readerExecutionMessages] <<
67
+ 'NOTICE: mdJson reader: taxonomic classification latinName is deprecated, use taxonomicName'
50
68
  end
51
69
  if intTaxClass[:taxonValue].nil? || intTaxClass[:taxonValue] == ''
52
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: taxonomic classification latin name is missing'
70
+ responseObj[:readerExecutionMessages] <<
71
+ 'ERROR: mdJson reader: taxonomic classification name is missing'
53
72
  responseObj[:readerExecutionPass] = false
54
73
  return nil
55
74
  end
@@ -1,6 +1,13 @@
1
1
  # adiwg mdTranslator
2
2
 
3
3
  # version 2 history
4
+ # 2.12.0 2018-04-07 add 'fgdc' option to reader and writer enum list
5
+ # 2.12.0 2018-04-06 rename taxonomicRank to taxonomicLevel
6
+ # 2.12.0 2018-04-06 rename latinName to taxonomicNamel
7
+ # 2.12.0 2018-04-06 changed resourceInfo taxonomy from object to array
8
+ # 2.12.0 2018-04-05 refactored messaging for ISO19110
9
+ # 2.11.0 2018-03-28 add 'responsibleParties' to budget allocation
10
+ # 2.11.0 2018-03-27 refactor messaging for fgdc writer
4
11
  # 2.10.0 2018-02-26 add 'forceValid' parameter to mdTranslator.translate
5
12
  # 2.9.3 2018-02-24 add messaging to mdJson reader
6
13
  # 2.9.3 2018-02-20 add data and time format validation to module_dateTomeFun
@@ -71,7 +78,7 @@
71
78
  module ADIWG
72
79
  module Mdtranslator
73
80
  # current mdtranslator version
74
- VERSION = "2.10.0"
81
+ VERSION = "2.12.0.pre"
75
82
  end
76
83
  end
77
84
 
@@ -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 2017-11-27 original script
6
7
 
8
+ require_relative '../fgdc_writer'
9
+
7
10
  module ADIWG
8
11
  module Mdtranslator
9
12
  module Writers
@@ -14,20 +17,20 @@ 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(hAddress)
23
+ def writeXML(hAddress, inContext = nil)
20
24
 
21
25
  # contact 10.4 (cntaddr) - address information
22
26
 
23
- # contact 10.4.1 (addrtype) - contact type
27
+ # contact 10.4.1 (addrtype) - address type (required)
24
28
  # <- hAddress[:addressTypes][0]
25
29
  unless hAddress[:addressTypes].empty?
26
30
  @xml.tag!('addrtype', hAddress[:addressTypes][0])
27
31
  end
28
32
  if hAddress[:addressTypes].empty?
29
- @hResponseObj[:writerPass] = false
30
- @hResponseObj[:writerMessages] << 'Address is missing type'
33
+ @NameSpace.issueWarning(1, 'addrtype', inContext)
31
34
  end
32
35
 
33
36
  # contact 10.4.2 (address) - address lines
@@ -45,8 +48,7 @@ module ADIWG
45
48
  @xml.tag!('city', hAddress[:city])
46
49
  end
47
50
  if hAddress[:city].nil?
48
- @hResponseObj[:writerPass] = false
49
- @hResponseObj[:writerMessages] << 'Address is missing city'
51
+ @NameSpace.issueWarning(2, 'city', inContext)
50
52
  end
51
53
 
52
54
  # contact 10.4.4 (state) - state (required)
@@ -55,8 +57,7 @@ module ADIWG
55
57
  @xml.tag!('state', hAddress[:adminArea])
56
58
  end
57
59
  if hAddress[:adminArea].nil?
58
- @hResponseObj[:writerPass] = false
59
- @hResponseObj[:writerMessages] << 'Address is missing state'
60
+ @NameSpace.issueWarning(3, 'state', inContext)
60
61
  end
61
62
 
62
63
  # contact 10.4.5 (postal) - postal code (required)
@@ -65,8 +66,7 @@ module ADIWG
65
66
  @xml.tag!('postal', hAddress[:postalCode])
66
67
  end
67
68
  if hAddress[:postalCode].nil?
68
- @hResponseObj[:writerPass] = false
69
- @hResponseObj[:writerMessages] << 'Address is missing postal code'
69
+ @NameSpace.issueWarning(4, 'postal', inContext)
70
70
  end
71
71
 
72
72
  # contact 10.4.6 (country) - country
@@ -2,9 +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-24 original script
6
7
 
7
8
  require 'adiwg/mdtranslator/internal/module_dateTimeFun'
9
+ require_relative '../fgdc_writer'
8
10
  require_relative 'class_dataDomain'
9
11
 
10
12
  module ADIWG
@@ -17,10 +19,11 @@ module ADIWG
17
19
  def initialize(xml, hResponseObj)
18
20
  @xml = xml
19
21
  @hResponseObj = hResponseObj
22
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
20
23
  end
21
24
 
22
- def writeXML(hAttribute)
23
-
25
+ def writeXML(hAttribute, inContext = nil)
26
+
24
27
  # classes used
25
28
  domainClass = DataDomain.new(@xml, @hResponseObj)
26
29
 
@@ -30,8 +33,7 @@ module ADIWG
30
33
  @xml.tag!('attrlabl', hAttribute[:attributeCode])
31
34
  end
32
35
  if hAttribute[:attributeCode].nil?
33
- @hResponseObj[:writerPass] = false
34
- @hResponseObj[:writerMessages] << 'Attribute Detail missing label'
36
+ @NameSpace.issueWarning(10, 'attrlabl', inContext)
35
37
  end
36
38
 
37
39
  # attribute 5.1.2.2 (attrdef) - attribute definition (required)
@@ -40,8 +42,7 @@ module ADIWG
40
42
  @xml.tag!('attrdef', hAttribute[:attributeDefinition])
41
43
  end
42
44
  if hAttribute[:attributeDefinition].nil?
43
- @hResponseObj[:writerPass] = false
44
- @hResponseObj[:writerMessages] << 'Attribute missing definition'
45
+ @NameSpace.issueWarning(11, 'attrdef', inContext)
45
46
  end
46
47
 
47
48
  # attribute 5.1.2.3 (attrdefs) - attribute definition source (required)
@@ -52,8 +53,16 @@ module ADIWG
52
53
  end
53
54
  end
54
55
  if hAttribute[:attributeReference].empty?
55
- @hResponseObj[:writerPass] = false
56
- @hResponseObj[:writerMessages] << 'Attribute missing definition citation'
56
+ @NameSpace.issueWarning(12, 'attrdefs', inContext)
57
+ end
58
+
59
+ # set attribute context
60
+ outContext = nil
61
+ unless hAttribute[:attributeCode].nil?
62
+ outContext = 'attribute code ' + hAttribute[:attributeCode]
63
+ unless inContext.nil?
64
+ outContext = inContext + ' ' + outContext
65
+ end
57
66
  end
58
67
 
59
68
  # attribute 5.1.2.4 (attrdomv) - attribute domain value
@@ -78,8 +87,7 @@ module ADIWG
78
87
  @xml.tag!('rdommin', hRange[:minRangeValue])
79
88
  end
80
89
  if hRange[:minRangeValue].nil?
81
- @hResponseObj[:writerPass] = false
82
- @hResponseObj[:writerMessages] << 'Attribute Range Value missing minimum'
90
+ @NameSpace.issueWarning(13,'rdommin', outContext)
83
91
  end
84
92
 
85
93
  # value range 5.1.2.4.2.2 (rdommax) - range maximum (required)
@@ -88,8 +96,7 @@ module ADIWG
88
96
  @xml.tag!('rdommax', hRange[:maxRangeValue])
89
97
  end
90
98
  if hRange[:maxRangeValue].nil?
91
- @hResponseObj[:writerPass] = false
92
- @hResponseObj[:writerMessages] << 'Attribute Range Value missing maximum'
99
+ @NameSpace.issueWarning(14,'rdommax', outContext)
93
100
  end
94
101
 
95
102
  # value range 5.1.2.4.2.3 (attrunit) - unit of measure
@@ -129,8 +136,7 @@ module ADIWG
129
136
  @xml.tag!('begdatea', begDate)
130
137
  end
131
138
  if begDate == 'ERROR'
132
- @hResponseObj[:writerPass] = false
133
- @hResponseObj[:writerMessages] << 'Attribute Beginning Range Date error'
139
+ @NameSpace.issueWarning(15,nil, outContext)
134
140
  end
135
141
  end
136
142
  if hTimePeriod[:startDateTime].empty? && @hResponseObj[:writerShowTags]
@@ -147,8 +153,7 @@ module ADIWG
147
153
  @xml.tag!('enddatea', endDate)
148
154
  end
149
155
  if endDate == 'ERROR'
150
- @hResponseObj[:writerPass] = false
151
- @hResponseObj[:writerMessages] << 'Attribute Ending Range Date error'
156
+ @NameSpace.issueWarning(16,nil, outContext)
152
157
  end
153
158
  end
154
159
  if hTimePeriod[:endDateTime].empty? && @hResponseObj[:writerShowTags]