adiwg-mdtranslator 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +552 -500
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +1 -0
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +63 -16
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +7 -16
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +1 -1
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +1 -0
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +7 -1
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +4 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +4 -3
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +15 -11
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +134 -134
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -4
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +52 -36
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +65 -51
  19. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +133 -121
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +1 -1
  21. data/lib/adiwg/mdtranslator/version.rb +4 -1
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +178 -0
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataDomain.rb +122 -0
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dictionary.rb +66 -0
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_digitalForm.rb +81 -0
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_distribution.rb +156 -0
  27. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityDetail.rb +78 -0
  28. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityOverview.rb +48 -0
  29. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +41 -4
  30. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_metadataInfo.rb +215 -0
  31. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_offlineOption.rb +86 -0
  32. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_onlineOption.rb +77 -0
  33. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_orderProcess.rb +100 -0
  34. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +9 -7
  35. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +135 -0
  36. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +4 -4
  37. data/lib/adiwg/mdtranslator/writers/html/sections/html_distribution.rb +18 -0
  38. data/lib/adiwg/mdtranslator/writers/html/sections/html_domainItem.rb +18 -3
  39. data/lib/adiwg/mdtranslator/writers/html/sections/html_metadataInfo.rb +20 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +1 -1
  41. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +14 -0
  42. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +21 -2
  43. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +44 -44
  44. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_legalConstraints.rb +67 -66
  45. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +53 -54
  46. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -23
  47. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +1 -1
  48. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_distribution.rb +2 -0
  49. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_domainItem.rb +4 -0
  50. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadataInfo.rb +2 -0
  51. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb +7 -1
  52. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +12 -1
  53. metadata +16 -4
@@ -0,0 +1,156 @@
1
+ # FGDC <<Class>> Distribution
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-28 original script
6
+
7
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
8
+ require_relative 'class_contact'
9
+ require_relative 'class_orderProcess'
10
+ require_relative 'class_timePeriod'
11
+
12
+ module ADIWG
13
+ module Mdtranslator
14
+ module Writers
15
+ module Fgdc
16
+
17
+ class Distribution
18
+
19
+ def initialize(xml, hResponseObj)
20
+ @xml = xml
21
+ @hResponseObj = hResponseObj
22
+ end
23
+
24
+ def writeXML(hDistribution)
25
+
26
+ # classes used
27
+ intMetadataClass = InternalMetadata.new
28
+ contactClass = Contact.new(@xml, @hResponseObj)
29
+ orderClass = OrderProcess.new(@xml, @hResponseObj)
30
+ timePeriodClass = TimePeriod.new(@xml, @hResponseObj)
31
+
32
+ # in FGDC each distribution can have only one distributor
33
+ # the passed in mdJson hDistribution may contain multiple distributors
34
+ # therefore, create a separate FGDC distribution record for each distributor
35
+ # and repeat the distribution information
36
+
37
+ hDistribution[:distributor].each do |hDistributor|
38
+
39
+ @xml.tag!('distinfo') do
40
+
41
+ # distribution 6.1 (distrib) - distributor {contact} (required)
42
+ # <- distribution.distributor.contact{}.responsibility.roleName = 'distributor'
43
+ haveContact = false
44
+ unless hDistributor.empty?
45
+ unless hDistributor[:contact].empty?
46
+ contactId = hDistributor[:contact][:parties][0][:contactId]
47
+ hContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(contactId)
48
+ unless hContact.empty?
49
+ @xml.tag!('distrib') do
50
+ contactClass.writeXML(hContact)
51
+ end
52
+ haveContact = true
53
+ end
54
+ end
55
+ end
56
+ unless haveContact
57
+ @hResponseObj[:writerPass] = false
58
+ @hResponseObj[:writerMessages] << 'Distributor is missing contact information'
59
+ end
60
+
61
+ # distribution 6.2 (resdesc) - resource description
62
+ # <- distribution.description
63
+ unless hDistribution[:description].nil?
64
+ @xml.tag!('resdesc', hDistribution[:description])
65
+ end
66
+ if hDistribution[:description].nil?
67
+ @xml.tag!('resdesc')
68
+ end
69
+
70
+ # distribution 6.3 (distliab) - liability (required)
71
+ # <- distribution.liabilityStatement
72
+ unless hDistribution[:liabilityStatement].nil?
73
+ @xml.tag!('distliab', hDistribution[:liabilityStatement])
74
+ end
75
+ if hDistribution[:liabilityStatement].nil?
76
+ @hResponseObj[:writerPass] = false
77
+ @hResponseObj[:writerMessages] << 'Distributor is missing liability statement'
78
+ end
79
+
80
+ # distribution 6.4 (stdorder) - standard order [] {standardOrder}
81
+ # <- distribution.distributor.orderProcess
82
+ # in FGDC transferOptions are children of orderProcess
83
+ # pass the entire distribution object
84
+ haveOrder = false
85
+ unless hDistributor.empty?
86
+ unless hDistributor[:orderProcess].empty?
87
+ @xml.tag!('stdorder') do
88
+ orderClass.writeXML(hDistributor)
89
+ end
90
+ haveOrder = true
91
+ end
92
+ end
93
+ if !haveOrder && @hResponseObj[:writerShowTags]
94
+ @xml.tag!('custom')
95
+ end
96
+
97
+ # distribution 6.5 (custom) - custom order process
98
+ # <- where transferOptions[] is empty
99
+ # <- distribution.distributor.orderProcess[0].orderingInstructions
100
+ haveCustom = false
101
+ unless hDistributor.empty?
102
+ if hDistributor[:transferOptions].empty?
103
+ unless hDistributor[:orderProcess].empty?
104
+ unless hDistributor[:orderProcess][0].empty?
105
+ unless hDistributor[:orderProcess][0][:orderingInstructions].nil?
106
+ @xml.tag!('custom', hDistributor[:orderProcess][0][:orderingInstructions])
107
+ end
108
+ end
109
+ haveCustom = true
110
+ end
111
+ end
112
+ end
113
+ if !haveCustom && @hResponseObj[:writerShowTags]
114
+ @xml.tag!('custom')
115
+ end
116
+
117
+ # distribution 6.6 (techpreq) - technical prerequisites
118
+ # <- distribution.technicalPrerequisite
119
+ unless hDistribution[:technicalPrerequisite].nil?
120
+ @xml.tag!('techpreq', hDistribution[:technicalPrerequisite])
121
+ end
122
+ if hDistribution[:technicalPrerequisite].nil?
123
+ @xml.tag!('techpreq')
124
+ end
125
+
126
+ # distribution 6.7 (availabl) - available timePeriod {timePeriod}
127
+ # <- distribution.distributor[0].orderProcess[0].plannedAvailability
128
+ # for FGDC only the first orderProcess can be accepted
129
+ haveTime = false
130
+ unless hDistributor.empty?
131
+ unless hDistributor[:orderProcess].empty?
132
+ unless hDistributor[:orderProcess][0][:plannedAvailability].empty?
133
+ hAvailDate = hDistributor[:orderProcess][0][:plannedAvailability]
134
+ hTimePeriod = intMetadataClass.newTimePeriod
135
+ hTimePeriod[:startDateTime] = hAvailDate
136
+ @xml.tag!('availabl') do
137
+ timePeriodClass.writeXML(hTimePeriod, nil)
138
+ end
139
+ haveTime = true
140
+ end
141
+ end
142
+ end
143
+ if !haveTime && @hResponseObj[:writerShowTags]
144
+ @xml.tag!('availabl')
145
+ end
146
+ end
147
+
148
+ end
149
+
150
+ end # writeXML
151
+ end # Distribution
152
+
153
+ end
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,78 @@
1
+ # FGDC <<Class>> EntityDetail
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-22 original script
6
+
7
+ require_relative 'class_attribute'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Fgdc
13
+
14
+ class EntityDetail
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ end
20
+
21
+ def writeXML(hEntity)
22
+
23
+ # classes used
24
+ attrClass = Attribute.new(@xml, @hResponseObj)
25
+
26
+ # entity detail 5.1.1 (enttype) - entity type
27
+ @xml.tag!('enttype') do
28
+
29
+ # entity type 5.1.1.1 (enttypl) - entity type label (required)
30
+ # <- entity.entityCode
31
+ unless hEntity[:entityCode].nil?
32
+ @xml.tag!('enttypl', hEntity[:entityCode])
33
+ end
34
+ if hEntity[:entityCode].nil?
35
+ @hResponseObj[:writerPass] = false
36
+ @hResponseObj[:writerMessages] << 'Entity Attribute Detail missing entity type label'
37
+ end
38
+
39
+ # entity type 5.1.1.2 (enttypd) - entity type definition (required)
40
+ # <- entity.entityDefinition
41
+ unless hEntity[:entityDefinition].nil?
42
+ @xml.tag!('enttypd', hEntity[:entityDefinition])
43
+ end
44
+ if hEntity[:entityDefinition].nil?
45
+ @hResponseObj[:writerPass] = false
46
+ @hResponseObj[:writerMessages] << 'Entity Attribute Detail missing entity definition'
47
+ end
48
+
49
+ # entity type 5.1.1.3 (enttypds) - entity definition source (required)
50
+ # <- take title from first entityReference {citation}
51
+ unless hEntity[:entityReferences].empty?
52
+ unless hEntity[:entityReferences][0].empty?
53
+ @xml.tag!('enttypds', hEntity[:entityReferences][0][:title])
54
+ end
55
+ end
56
+ if hEntity[:entityReferences].empty?
57
+ @hResponseObj[:writerPass] = false
58
+ @hResponseObj[:writerMessages] << 'Entity Attribute Detail missing entity definition citation'
59
+ end
60
+
61
+ end
62
+
63
+ # attribute 5.1.2 (attr) - attribute
64
+ hEntity[:attributes].each do |hAttribute|
65
+ unless hAttribute.empty?
66
+ @xml.tag!('attr') do
67
+ attrClass.writeXML(hAttribute)
68
+ end
69
+ end
70
+ end
71
+
72
+ end # writeXML
73
+ end # EntityOverview
74
+
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,48 @@
1
+ # FGDC <<Class>> EntityOverview
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-22 original script
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Fgdc
11
+
12
+ class EntityOverview
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hEntity)
20
+
21
+ # entity overview 5.2.1 (eaover) - entity and attribute overview (required)
22
+ # <- entity.definition
23
+ unless hEntity[:entityDefinition].nil?
24
+ @xml.tag!('eaover', hEntity[:entityDefinition])
25
+ end
26
+ if hEntity[:entityDefinition].nil?
27
+ @hResponseObj[:writerPass] = false
28
+ @hResponseObj[:writerMessages] << 'Entity Attribute Overview missing definition'
29
+ end
30
+
31
+ # entity overview 5.2.2 (eadetcit) - entity and attribute detail citation []
32
+ # <- entity.entityReferences[]
33
+ hEntity[:entityReferences].each do |hCitation|
34
+ unless hCitation.empty?
35
+ @xml.tag!('eadetcit', hCitation[:title])
36
+ end
37
+ end
38
+ if hEntity[:entityReferences].empty? && @hResponseObj[:writerShowTags]
39
+ @xml.tag!('eadetcit')
40
+ end
41
+
42
+ end # writeXML
43
+ end # EntityOverview
44
+
45
+ end
46
+ end
47
+ end
48
+ end
@@ -8,6 +8,9 @@ require_relative 'class_identification'
8
8
  require_relative 'class_quality'
9
9
  require_relative 'class_spatialOrganization'
10
10
  require_relative 'class_spatialReference'
11
+ require_relative 'class_dictionary'
12
+ require_relative 'class_distribution'
13
+ require_relative 'class_metadataInfo'
11
14
 
12
15
  module ADIWG
13
16
  module Mdtranslator
@@ -25,12 +28,17 @@ module ADIWG
25
28
 
26
29
  version = @hResponseObj[:translatorVersion]
27
30
  hResourceInfo = intObj[:metadata][:resourceInfo]
31
+ aDistributorInfo = intObj[:metadata][:distributorInfo]
32
+ hMetadataInfo = intObj[:metadata][:metadataInfo]
28
33
 
29
34
  # classes used
30
35
  idClass = Identification.new(@xml, @hResponseObj)
31
36
  qualityClass = Quality.new(@xml, @hResponseObj)
32
37
  spaceOrgClass = SpatialOrganization.new(@xml, @hResponseObj)
33
38
  spaceRefClass = SpatialReference.new(@xml, @hResponseObj)
39
+ dictionaryClass = DataDictionary.new(@xml, @hResponseObj)
40
+ distributorClass = Distribution.new(@xml, @hResponseObj)
41
+ metaInfoClass = MetadataInformation.new(@xml, @hResponseObj)
34
42
 
35
43
  # document head
36
44
  metadata = @xml.instruct! :xml, encoding: 'UTF-8'
@@ -45,7 +53,7 @@ module ADIWG
45
53
  # metadata
46
54
  @xml.tag!('metadata') do
47
55
 
48
- # metadata 1 (idinfo) - identification information
56
+ # metadata 1 (idinfo) - identification information (required)
49
57
  @xml.tag!('idinfo') do
50
58
  idClass.writeXML(intObj)
51
59
  end
@@ -57,7 +65,7 @@ module ADIWG
57
65
  qualityClass.writeXML(intObj)
58
66
  end
59
67
  end
60
- if intObj[:metadata][:lineageInfo].empty?
68
+ if intObj[:metadata][:lineageInfo].empty? && @hResponseObj[:writerShowTags]
61
69
  @xml.tag!('dataqual')
62
70
  end
63
71
 
@@ -93,8 +101,37 @@ module ADIWG
93
101
  end
94
102
 
95
103
  # metadata 5 (eainfo) - entity attribute information
96
- # metadata 6 (distinfo) - distribution information
97
- # metadata 7 (metainfo) - metadata information
104
+ # <- dataDictionaries[0]
105
+ haveDict = false
106
+ unless intObj[:dataDictionaries].empty?
107
+ hDictionary = intObj[:dataDictionaries][0]
108
+ unless hDictionary.empty?
109
+ @xml.tag!('eainfo') do
110
+ dictionaryClass.writeXML(hDictionary)
111
+ end
112
+ haveDict = true
113
+ end
114
+ end
115
+ if !haveDict && @hResponseObj[:writerShowTags]
116
+ @xml.tag!('eainfo')
117
+ end
118
+
119
+ # metadata 6 (distinfo) - distributor information []
120
+ # <- metadata.distributionInfo[]
121
+ aDistributorInfo.each do |hDistribution|
122
+ unless hDistribution.empty?
123
+ distributorClass.writeXML(hDistribution)
124
+ end
125
+ end
126
+ if aDistributorInfo.empty? && @hResponseObj[:writerShowTags]
127
+ @xml.tag!('distinfo')
128
+ end
129
+
130
+ # metadata 7 (metainfo) - metadata information (required)
131
+ # <- metadata.metadataInfo
132
+ @xml.tag!('metainfo') do
133
+ metaInfoClass.writeXML(hMetadataInfo)
134
+ end
98
135
 
99
136
  return metadata
100
137
  end
@@ -0,0 +1,215 @@
1
+ # FGDC <<Class>> MetadataInformation
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-01-26 original script
6
+
7
+ require_relative '../fgdc_writer'
8
+ require_relative 'class_contact'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Fgdc
14
+
15
+ class MetadataInformation
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
+
22
+ def writeXML(hMetadataInfo)
23
+
24
+ # classes used
25
+ contactClass = Contact.new(@xml, @hResponseObj)
26
+
27
+ # metadata information 7.1 (metd) - metadata date (required)
28
+ # <- metadataInfo.metadataDates[] type = 'creation' (required)
29
+ # take first
30
+ haveCreation = false
31
+ hMetadataInfo[:metadataDates].each do |hDate|
32
+ unless hDate.empty?
33
+ unless hDate[:dateType].nil?
34
+ if hDate[:dateType] == 'creation'
35
+ createDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:date], hDate[:dateResolution])
36
+ createDate.gsub!(/[-]/,'')
37
+ unless createDate == 'ERROR'
38
+ @xml.tag!('metd', createDate)
39
+ haveCreation = true
40
+ end
41
+ break
42
+ end
43
+ end
44
+ end
45
+ end
46
+ unless haveCreation
47
+ @hResponseObj[:writerPass] = false
48
+ @hResponseObj[:writerMessages] << 'Metadata Information section is missing creation date'
49
+ end
50
+
51
+ # metadata information 7.2 (metrd) - metadata review date
52
+ # <- metadataInfo.metadataDates[] type = 'review'
53
+ # take first
54
+ haveReview = false
55
+ hMetadataInfo[:metadataDates].each do |hDate|
56
+ unless hDate.empty?
57
+ unless hDate[:dateType].nil?
58
+ if hDate[:dateType] == 'review'
59
+ reviewDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:date], hDate[:dateResolution])
60
+ reviewDate.gsub!(/[-]/,'')
61
+ unless reviewDate == 'ERROR'
62
+ @xml.tag!('metrd', reviewDate)
63
+ haveReview = true
64
+ end
65
+ break
66
+ end
67
+ end
68
+ end
69
+ end
70
+ if !haveReview && @hResponseObj[:writerShowTags]
71
+ @xml.tag!('metrd')
72
+ end
73
+
74
+ # metadata information 7.3 (metfrd) - metadata future review date
75
+ # <- metadataInfo.metadataDates[] type = 'nextReview'
76
+ # take first
77
+ haveNext = false
78
+ hMetadataInfo[:metadataDates].each do |hDate|
79
+ unless hDate.empty?
80
+ unless hDate[:dateType].nil?
81
+ if hDate[:dateType] == 'nextReview'
82
+ nextDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:date], hDate[:dateResolution])
83
+ nextDate.gsub!(/[-]/,'')
84
+ unless nextDate == 'ERROR'
85
+ @xml.tag!('metfrd', nextDate)
86
+ haveNext = true
87
+ end
88
+ break
89
+ end
90
+ end
91
+ end
92
+ end
93
+ if !haveNext && @hResponseObj[:writerShowTags]
94
+ @xml.tag!('metfrd')
95
+ end
96
+
97
+ # metadata information 7.4 (metc) - metadata contact {contact} (required)
98
+ # <- metadataInfo.metadataContacts[] role = 'pointOfContact'
99
+ unless hMetadataInfo[:metadataContacts].empty?
100
+ aRParties = hMetadataInfo[:metadataContacts]
101
+ aParties = ADIWG::Mdtranslator::Writers::Fgdc.find_responsibility(aRParties, 'pointOfContact')
102
+ unless aParties.empty?
103
+ hContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(aParties[0])
104
+ unless hContact.empty?
105
+ @xml.tag!('metc') do
106
+ contactClass.writeXML(hContact)
107
+ end
108
+ end
109
+ end
110
+ end
111
+ if hMetadataInfo[:metadataContacts].empty?
112
+ @hResponseObj[:writerPass] = false
113
+ @hResponseObj[:writerMessages] << 'Metadata Information section is missing metadata contact'
114
+ end
115
+
116
+ # metadata information 7.5 (metstdn) - metadata standard name (required)
117
+ @xml.tag!('metstdn', 'Content Standard for Digital Geospatial Metadata with Biological Data Profile')
118
+
119
+ # metadata information 7.6 (metstdv) - metadata standard version (required)
120
+ @xml.tag!('metstdv', 'FGDC-STD-001.1-1999')
121
+
122
+ # metadata information 7.7 (mettc) - metadata time conversion (required)
123
+ # required if time elements are present in metadata
124
+ # don't know how to handle this, leaving it out
125
+
126
+ # metadata information 7.8 (metac) - metadata access constraint
127
+ # <- metadataInfo.metadataConstraints.type=legal.accessCode[0]
128
+ haveAccess = false
129
+ hMetadataInfo[:metadataConstraints].each do |hConstraint|
130
+ if hConstraint[:type] == 'legal'
131
+ unless hConstraint[:legalConstraint].empty?
132
+ unless hConstraint[:legalConstraint][:accessCodes].empty?
133
+ @xml.tag!('metac', hConstraint[:legalConstraint][:accessCodes][0])
134
+ haveAccess = true
135
+ end
136
+ end
137
+ end
138
+ end
139
+ if !haveAccess && @hResponseObj[:witerShowTags]
140
+ @xml.tag!('metac')
141
+ end
142
+
143
+ # metadata information 7.9 (metuc) - metadata user constraint
144
+ # <- metadataInfo.metadataConstraints.type=legal.useCode[0]
145
+ haveUse = false
146
+ hMetadataInfo[:metadataConstraints].each do |hConstraint|
147
+ if hConstraint[:type] == 'legal'
148
+ unless hConstraint[:legalConstraint].empty?
149
+ unless hConstraint[:legalConstraint][:useCodes].empty?
150
+ @xml.tag!('metuc', hConstraint[:legalConstraint][:useCodes][0])
151
+ haveUse = true
152
+ end
153
+ end
154
+ end
155
+ end
156
+ if !haveUse && @hResponseObj[:witerShowTags]
157
+ @xml.tag!('metuc')
158
+ end
159
+
160
+ # metadata information 7.10 (metsi) - metadata user constraint
161
+ # <- metadataInfo.metadataConstraints.type=security
162
+ haveSecurity = false
163
+ hMetadataInfo[:metadataConstraints].each do |hConstraint|
164
+ if hConstraint[:type] == 'security'
165
+ unless hConstraint[:securityConstraint].empty?
166
+ @xml.tag!('metsi') do
167
+
168
+ haveSecurity = true
169
+ hSecurity = hConstraint[:securityConstraint]
170
+
171
+ # security information 10.7.1 (metscs) - metadata security classification system (required)
172
+ # <- securityConstraint.classSystem
173
+ unless hSecurity[:classSystem].nil?
174
+ @xml.tag!('metscs', hSecurity[:classSystem])
175
+ end
176
+ if hSecurity[:classSystem].nil?
177
+ @hResponseObj[:writerPass] = false
178
+ @hResponseObj[:writerMessages] << 'Metadata Security Information section is missing classification system'
179
+ end
180
+
181
+ # security information 10.7.2 (metsc) - metadata security classification (required)
182
+ # <- securityConstraint.classCode
183
+ unless hSecurity[:classCode].nil?
184
+ @xml.tag!('metsc', hSecurity[:classCode])
185
+ end
186
+ if hSecurity[:classCode].nil?
187
+ @hResponseObj[:writerPass] = false
188
+ @hResponseObj[:writerMessages] << 'Metadata Security Information section is missing classification'
189
+ end
190
+
191
+ # security information 10.7.3 (metshd) - metadata security classification (required)
192
+ # <- securityConstraint.handling
193
+ unless hSecurity[:handling].nil?
194
+ @xml.tag!('metshd', hSecurity[:handling])
195
+ end
196
+ if hSecurity[:handling].nil?
197
+ @hResponseObj[:writerPass] = false
198
+ @hResponseObj[:writerMessages] << 'Metadata Security Information section is missing handling instructions'
199
+ end
200
+
201
+ end
202
+ end
203
+ end
204
+ end
205
+ if !haveSecurity && @hResponseObj[:writerShowTags]
206
+ @xml.tag!('metsi')
207
+ end
208
+
209
+ end # writeXML
210
+ end # MetadataInformation
211
+
212
+ end
213
+ end
214
+ end
215
+ end