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
@@ -2,31 +2,32 @@
2
2
  # 19115-2 writer output in XML.
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-11-15 refactored for mdTranslator/mdJson 2.0
6
- # Stan Smith 2015-08-27 added support for content information
7
- # Stan Smith 2015-07-30 added support for grid information
8
- # Stan Smith 2015-07-28 added support for PT_Locale
9
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
10
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
11
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
12
- # Stan Smith 2015-06-12 added support for user to specify metadataCharacterSet
13
- # Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
14
- # Stan Smith 2014-12-29 set builder object '@xml' into string 'metadata'
15
- # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
16
- # Stan Smith 2014-11-06 changed hierarchy level to load values from resourceInfo > resourceType
17
- # Stan Smith 2014-10-10 modified to pass minimum metadata input test
5
+ # Stan Smith 2018-01-27 add metadata constraints
6
+ # Stan Smith 2016-11-15 refactored for mdTranslator/mdJson 2.0
7
+ # Stan Smith 2015-08-27 added support for content information
8
+ # Stan Smith 2015-07-30 added support for grid information
9
+ # Stan Smith 2015-07-28 added support for PT_Locale
10
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
11
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
12
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
13
+ # Stan Smith 2015-06-12 added support for user to specify metadataCharacterSet
14
+ # Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
15
+ # Stan Smith 2014-12-29 set builder object '@xml' into string 'metadata'
16
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
17
+ # Stan Smith 2014-11-06 changed hierarchy level to load values from resourceInfo > resourceType
18
+ # Stan Smith 2014-10-10 modified to pass minimum metadata input test
18
19
  # ... test were added to handle a missing metadata > metadataInfo block in the input
19
- # Stan Smith 2014-10-07 changed source of dataSetURI to
20
+ # Stan Smith 2014-10-07 changed source of dataSetURI to
20
21
  # ... metadata: {resourceInfo: {citation: {citOlResources[0]: {olResURI:}}}}
21
- # Stan Smith 2014-09-19 changed file identifier to read from internal storage as
22
+ # Stan Smith 2014-09-19 changed file identifier to read from internal storage as
22
23
  # ... an MD_Identifier class. To support version 0.8.0 json.
23
- # Stan Smith 2014-09-03 replaced spatial reference system code with named, epsg, and
24
+ # Stan Smith 2014-09-03 replaced spatial reference system code with named, epsg, and
24
25
  # ... wkt reference system descriptions using RS_Identifier for 0.7.0
25
- # Stan Smith 2014-08-18 add dataSetURI
26
- # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
27
- # Stan Smith 2014-05-28 added resource URI
28
- # Stan Smith 2014-05-14 refactored method calls to be consistent w/ other classes
29
- # Stan Smith 2014-05-14 modify for JSON schema 0.4.0
26
+ # Stan Smith 2014-08-18 add dataSetURI
27
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
28
+ # Stan Smith 2014-05-28 added resource URI
29
+ # Stan Smith 2014-05-14 refactored method calls to be consistent w/ other classes
30
+ # Stan Smith 2014-05-14 modify for JSON schema 0.4.0
30
31
  # Stan Smith 2013-12-27 added parent identifier
31
32
  # Stan Smith 2013-09-25 added reference system info
32
33
  # Stan Smith 2013-09-25 added metadata maintenance
@@ -47,6 +48,9 @@ require_relative 'class_dataIdentification'
47
48
  require_relative 'class_coverageDescription'
48
49
  require_relative 'class_distribution'
49
50
  require_relative 'class_dataQuality'
51
+ require_relative 'class_useConstraints'
52
+ require_relative 'class_legalConstraints'
53
+ require_relative 'class_securityConstraints'
50
54
  require_relative 'class_maintenance'
51
55
  require_relative 'class_gcoDateTime'
52
56
 
@@ -77,6 +81,9 @@ module ADIWG
77
81
  coverageClass = CoverageDescription.new(@xml, @hResponseObj)
78
82
  distClass = MD_Distribution.new(@xml, @hResponseObj)
79
83
  dqClass = DQ_DataQuality.new(@xml, @hResponseObj)
84
+ uConClass = MD_Constraints.new(@xml, @hResponseObj)
85
+ lConClass = MD_LegalConstraints.new(@xml, @hResponseObj)
86
+ sConClass = MD_SecurityConstraints.new(@xml, @hResponseObj)
80
87
  maintenanceClass = MD_MaintenanceInformation.new(@xml, @hResponseObj)
81
88
  dateTimeClass = GcoDateTime.new(@xml, @hResponseObj)
82
89
 
@@ -85,6 +92,7 @@ module ADIWG
85
92
  hMetaInfo = hMetadata[:metadataInfo]
86
93
  hResInfo = hMetadata[:resourceInfo]
87
94
  aAssocRes = hMetadata[:associatedResources]
95
+ aDistInfo = hMetadata[:distributorInfo]
88
96
  version = @hResponseObj[:translatorVersion]
89
97
 
90
98
  # document head
@@ -114,6 +122,7 @@ module ADIWG
114
122
 
115
123
  # remote schema location - for deployment
116
124
  # ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/schema.xsd
125
+
117
126
  # local schema location - for development
118
127
  # C:\Users\StanSmith\Projects\ISO\19115\NOAA\schema.xsd
119
128
 
@@ -286,7 +295,7 @@ module ADIWG
286
295
  # metadata information - identification info - required
287
296
  unless hResInfo.empty?
288
297
  @xml.tag!('gmd:identificationInfo') do
289
- dataIdClass.writeXML(hResInfo, aAssocRes)
298
+ dataIdClass.writeXML(hResInfo, aAssocRes, aDistInfo)
290
299
  end
291
300
  end
292
301
  if hResInfo.empty?
@@ -307,7 +316,6 @@ module ADIWG
307
316
  end
308
317
 
309
318
  # metadata information - distribution info [0]
310
- aDistInfo = hMetadata[:distributorInfo]
311
319
  unless aDistInfo.empty?
312
320
  hDistInfo = aDistInfo[0]
313
321
  unless hDistInfo.empty?
@@ -331,6 +339,26 @@ module ADIWG
331
339
  @xml.tag!('gmd:dataQualityInfo')
332
340
  end
333
341
 
342
+ # metadata information - metadata constraints {}
343
+ aCons = hMetaInfo[:metadataConstraints]
344
+ aCons.each do |hCon|
345
+ @xml.tag!('gmd:metadataConstraints') do
346
+ type = hCon[:type]
347
+ if type == 'use'
348
+ uConClass.writeXML(hCon)
349
+ end
350
+ if type == 'legal'
351
+ lConClass.writeXML(hCon)
352
+ end
353
+ if type == 'security'
354
+ sConClass.writeXML(hCon)
355
+ end
356
+ end
357
+ end
358
+ if aCons.nil? && @hResponseObj[:writerShowTags]
359
+ @xml.tag!('gmd:metadataConstraints')
360
+ end
361
+
334
362
  # metadata information - metadata maintenance
335
363
  hMaintenance = hMetaInfo[:metadataMaintenance]
336
364
  unless hMaintenance.empty?
@@ -30,7 +30,7 @@ module ADIWG
30
30
  json.recommendedUse hDictionary[:recommendedUses] unless hDictionary[:recommendedUses].empty?
31
31
  json.locale @Namespace.json_map(hDictionary[:locales], Locale)
32
32
  json.responsibleParty ResponsibleParty.build(hDictionary[:responsibleParty])
33
- json.dictionaryFormat hDictionary[:dictionaryFormat]
33
+ json.dictionaryFunctionalLanguage hDictionary[:dictionaryFunctionalLanguage]
34
34
  json.dictionaryIncludedWithResource hDictionary[:includedWithDataset]
35
35
  json.domain @Namespace.json_map(hDictionary[:domains], Domain)
36
36
  json.entity @Namespace.json_map(hDictionary[:entities], Entity)
@@ -20,6 +20,8 @@ module ADIWG
20
20
 
21
21
  Jbuilder.new do |json|
22
22
  json.description hDistribution[:description]
23
+ json.liabilityStatement hDistribution[:liabilityStatement]
24
+ json.technicalPrerequisite hDistribution[:technicalPrerequisite]
23
25
  json.distributor @Namespace.json_map(hDistribution[:distributor], Distributor)
24
26
  end
25
27
 
@@ -4,6 +4,7 @@
4
4
  # Stan Smith 2017-03-19 original script
5
5
 
6
6
  require 'jbuilder'
7
+ require_relative 'mdJson_citation'
7
8
 
8
9
  module ADIWG
9
10
  module Mdtranslator
@@ -18,6 +19,9 @@ module ADIWG
18
19
  json.name hItem[:itemName]
19
20
  json.value hItem[:itemValue]
20
21
  json.definition hItem[:itemDefinition]
22
+ unless hItem[:itemReference].empty?
23
+ json.reference Citation.build(hItem[:itemReference])
24
+ end
21
25
  end
22
26
 
23
27
  end # build
@@ -11,6 +11,7 @@ require_relative 'mdJson_locale'
11
11
  require_relative 'mdJson_date'
12
12
  require_relative 'mdJson_responsibleParty'
13
13
  require_relative 'mdJson_onlineResource'
14
+ require_relative 'mdJson_constraint'
14
15
  require_relative 'mdJson_maintenance'
15
16
 
16
17
  module ADIWG
@@ -32,6 +33,7 @@ module ADIWG
32
33
  json.metadataContact @Namespace.json_map(hMetaInfo[:metadataContacts], ResponsibleParty)
33
34
  json.metadataDate @Namespace.json_map(hMetaInfo[:metadataDates], Date)
34
35
  json.metadataOnlineResource @Namespace.json_map(hMetaInfo[:metadataLinkages], OnlineResource)
36
+ json.metadataConstraint @Namespace.json_map(hMetaInfo[:metadataConstraints], Constraint)
35
37
  json.metadataMaintenance Maintenance.build(hMetaInfo[:metadataMaintenance]) unless hMetaInfo[:metadataMaintenance].empty?
36
38
  json.alternateMetadataReference @Namespace.json_map(hMetaInfo[:alternateMetadataReferences], Citation)
37
39
  json.metadataStatus hMetaInfo[:metadataStatus]
@@ -12,7 +12,7 @@ module ADIWG
12
12
 
13
13
  module Rights
14
14
 
15
- def self.build(aConstraints)
15
+ def self.build(aConstraints, aDistributionInfo)
16
16
 
17
17
  rights = ''
18
18
 
@@ -37,6 +37,12 @@ module ADIWG
37
37
  end
38
38
  end
39
39
 
40
+ aDistributionInfo.each do |hDistribution|
41
+ unless hDistribution[:liabilityStatement].nil?
42
+ rights += hDistribution[:liabilityStatement] + '; '
43
+ end
44
+ end
45
+
40
46
  # clean off last semicolon
41
47
  if rights.length > 2
42
48
  rights = rights[0...-2]
@@ -85,7 +85,18 @@ module ADIWG
85
85
  json.identifiers @Namespace.json_map(aUniqIds, Identifier) unless aIdentifiers.empty?
86
86
 
87
87
  json.purpose resourceInfo[:purpose]
88
- json.rights Rights.build(resourceInfo[:constraints]) unless resourceInfo[:constraints].empty?
88
+
89
+ haveRights = false
90
+ haveRights = true unless resourceInfo[:constraints].empty?
91
+ distributorInfo.each do |hDistribution|
92
+ unless hDistribution[:liabilityStatement].nil?
93
+ haveRights = true
94
+ end
95
+ end
96
+ if haveRights
97
+ json.rights Rights.build(resourceInfo[:constraints], distributorInfo)
98
+ end
99
+
89
100
  json.provenance Provenance.build
90
101
  json.materialRequestInstructions MaterialRequest.build(distributorInfo) unless distributorInfo.empty?
91
102
  json.parentId ParentId.build(metadataInfo[:parentMetadata]) unless metadataInfo[:parentMetadata].empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adiwg-mdtranslator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-24 00:00:00.000000000 Z
12
+ date: 2018-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 2.4.1
132
+ version: 2.4.2
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 2.4.1
139
+ version: 2.4.2
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: adiwg-mdcodes
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -443,13 +443,20 @@ files:
443
443
  - lib/adiwg/mdtranslator/readers/sbJson/version.rb
444
444
  - lib/adiwg/mdtranslator/version.rb
445
445
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb
446
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb
446
447
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_browse.rb
447
448
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb
448
449
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb
449
450
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb
451
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataDomain.rb
450
452
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb
451
453
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb
452
454
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb
455
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_dictionary.rb
456
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_digitalForm.rb
457
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_distribution.rb
458
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityDetail.rb
459
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityOverview.rb
453
460
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb
454
461
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb
455
462
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb
@@ -461,8 +468,12 @@ files:
461
468
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb
462
469
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapCoordinateInfo.rb
463
470
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapProjection.rb
471
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_metadataInfo.rb
464
472
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb
465
473
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb
474
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_offlineOption.rb
475
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_onlineOption.rb
476
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_orderProcess.rb
466
477
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb
467
478
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb
468
479
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb
@@ -480,6 +491,7 @@ files:
480
491
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb
481
492
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb
482
493
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb
494
+ - lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb
483
495
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb
484
496
  - lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb
485
497
  - lib/adiwg/mdtranslator/writers/fgdc/readme.md