adiwg-mdtranslator 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -1
- data/Rakefile +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +10 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +100 -86
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_timePeriod.rb +3 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/readme.md +4 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +157 -157
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_body.rb +4 -7
- data/lib/adiwg/mdtranslator/version.rb +7 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb +87 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +172 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +164 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +73 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +54 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb +49 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +60 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +78 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicRange.rb +54 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +152 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +99 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb +73 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb +67 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb +47 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +200 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb +63 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +102 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb +49 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/readme.md +22 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/version.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/html/version.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +29 -27
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/mdJson_writer.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/version.rb +3 -5
- data/lib/adiwg/mdtranslator/writers/sbJson/sbJson_writer.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +21 -9
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +21 -3
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +27 -7
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_webLink.rb +17 -4
- data/lib/adiwg/mdtranslator/writers/sbJson/version.rb +1 -4
- data/lib/adiwg/mdtranslator.rb +5 -4
- metadata +24 -2
@@ -0,0 +1,164 @@
|
|
1
|
+
# FGDC <<Class>> Contact
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-27 original script
|
6
|
+
|
7
|
+
require_relative 'class_address'
|
8
|
+
require_relative 'class_phone'
|
9
|
+
|
10
|
+
module ADIWG
|
11
|
+
module Mdtranslator
|
12
|
+
module Writers
|
13
|
+
module Fgdc
|
14
|
+
|
15
|
+
class Contact
|
16
|
+
|
17
|
+
def initialize(xml, hResponseObj)
|
18
|
+
@xml = xml
|
19
|
+
@hResponseObj = hResponseObj
|
20
|
+
end
|
21
|
+
|
22
|
+
def writeXML(hContact)
|
23
|
+
|
24
|
+
# classes used
|
25
|
+
addressClass = Address.new(@xml, @hResponseObj)
|
26
|
+
phoneClass = Phone.new(@xml, @hResponseObj)
|
27
|
+
|
28
|
+
# set contact type and names
|
29
|
+
contactType = nil
|
30
|
+
personName = nil
|
31
|
+
orgName = nil
|
32
|
+
if hContact[:isOrganization]
|
33
|
+
contactType = 'organization'
|
34
|
+
orgName = hContact[:name]
|
35
|
+
if orgName.nil?
|
36
|
+
@hResponseObj[:writerPass] = false
|
37
|
+
@hResponseObj[:writerMessages] << 'Organization Contact is missing name'
|
38
|
+
end
|
39
|
+
else
|
40
|
+
contactType = 'person'
|
41
|
+
personName = hContact[:name]
|
42
|
+
if personName.nil?
|
43
|
+
@hResponseObj[:writerPass] = false
|
44
|
+
@hResponseObj[:writerMessages] << 'Person Contact is missing name'
|
45
|
+
end
|
46
|
+
unless hContact[:memberOfOrgs].empty?
|
47
|
+
hOrgContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(hContact[:memberOfOrgs][0])
|
48
|
+
unless hOrgContact.empty?
|
49
|
+
orgName = hOrgContact[:name]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
if contactType.nil?
|
54
|
+
@hResponseObj[:writerPass] = false
|
55
|
+
@hResponseObj[:writerMessages] << 'Contact is missing contact type'
|
56
|
+
end
|
57
|
+
|
58
|
+
# contact 10 (cntinfo) - contact information
|
59
|
+
@xml.tag!('cntinfo') do
|
60
|
+
|
61
|
+
# contact 10.1 (cntperp) - contact person primary
|
62
|
+
if contactType == 'person'
|
63
|
+
@xml.tag!('cntperp') do
|
64
|
+
|
65
|
+
# contact 10.1.1 (cntper) - contact person name
|
66
|
+
unless personName.nil?
|
67
|
+
@xml.tag!('cntper', personName)
|
68
|
+
end
|
69
|
+
if personName == ''
|
70
|
+
@hResponseObj[:writerPass] = false
|
71
|
+
@hResponseObj[:writerMessages] << 'Person Contact is missing name'
|
72
|
+
end
|
73
|
+
|
74
|
+
# contact 10.1.1 (cntorg) - contact organization name
|
75
|
+
unless orgName.nil?
|
76
|
+
@xml.tag!('cntorg', orgName)
|
77
|
+
end
|
78
|
+
if orgName.nil? && @hResponseObj[:writerShowTags]
|
79
|
+
@xml.tag!('cntorg')
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# contact 10.2 (cntorgp) - contact organization primary
|
86
|
+
if contactType == 'organization'
|
87
|
+
@xml.tag!('cntorgp') do
|
88
|
+
|
89
|
+
# contact 10.2.1 (cntper) - contact person name
|
90
|
+
unless personName.nil?
|
91
|
+
@xml.tag!('cntper', personName)
|
92
|
+
end
|
93
|
+
|
94
|
+
# contact 10.2.1 (cntorg) - contact organization name
|
95
|
+
unless orgName == ''
|
96
|
+
@xml.tag!('cntorg', orgName)
|
97
|
+
end
|
98
|
+
if orgName.nil?
|
99
|
+
@hResponseObj[:writerPass] = false
|
100
|
+
@hResponseObj[:writerMessages] << 'Organization Contact is missing name'
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# contact 10.3 (cntpos) - contact position name
|
107
|
+
unless hContact[:positionName].nil?
|
108
|
+
@xml.tag!('cntpos', hContact[:positionName])
|
109
|
+
end
|
110
|
+
if hContact[:positionName].nil? && @hResponseObj[:writerShowTags]
|
111
|
+
@xml.tag!('cntpos')
|
112
|
+
end
|
113
|
+
|
114
|
+
# contact 10.4 (cntaddr) - contact address (required)
|
115
|
+
hContact[:addresses].each do |hAddress|
|
116
|
+
unless hAddress.empty?
|
117
|
+
@xml.tag!('cntaddr') do
|
118
|
+
addressClass.writeXML(hAddress)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
if hContact[:addresses].empty?
|
123
|
+
@hResponseObj[:writerPass] = false
|
124
|
+
@hResponseObj[:writerMessages] << 'Contact is missing address'
|
125
|
+
end
|
126
|
+
|
127
|
+
# contact 10.5..7 - phone (voice phone required)
|
128
|
+
# requirement testing is done in phoneClass
|
129
|
+
phoneClass.writeXML(hContact[:phones])
|
130
|
+
|
131
|
+
# contact 10.8 - email addresses []
|
132
|
+
hContact[:eMailList].each do |email|
|
133
|
+
@xml.tag!('cntemail', email)
|
134
|
+
end
|
135
|
+
if hContact[:eMailList].empty? && @hResponseObj[:writerShowTags]
|
136
|
+
@xml.tag!('cntemail')
|
137
|
+
end
|
138
|
+
|
139
|
+
# contact 10.9 - hours of service
|
140
|
+
# <- hContact[:hoursOfService][0]
|
141
|
+
unless hContact[:hoursOfService].empty?
|
142
|
+
@xml.tag!('hours', hContact[:hoursOfService][0])
|
143
|
+
end
|
144
|
+
if hContact[:hoursOfService].empty? && @hResponseObj[:writerShowTags]
|
145
|
+
@xml.tag!('hours')
|
146
|
+
end
|
147
|
+
|
148
|
+
# contact 10.10 (cntinst) - contact instructions
|
149
|
+
unless hContact[:contactInstructions].nil?
|
150
|
+
@xml.tag!('cntinst', hContact[:contactInstructions])
|
151
|
+
end
|
152
|
+
if hContact[:contactInstructions].nil? && @hResponseObj[:writerShowTags]
|
153
|
+
@xml.tag!('cntinst')
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
end # writeXML
|
159
|
+
end # Contact
|
160
|
+
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# FGDC <<Class>> DateRange
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-23 original script
|
6
|
+
|
7
|
+
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Fgdc
|
13
|
+
|
14
|
+
class DateRange
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
end
|
20
|
+
|
21
|
+
def writeXML(hStartDT, hEndDT)
|
22
|
+
|
23
|
+
sSDate = AdiwgDateTimeFun.stringDateFromDateTime(hStartDT[:dateTime], hStartDT[:dateResolution])
|
24
|
+
sSTime = AdiwgDateTimeFun.stringTimeFromDateTime(hStartDT[:dateTime], hStartDT[:dateResolution])
|
25
|
+
sEDate = AdiwgDateTimeFun.stringDateFromDateTime(hEndDT[:dateTime], hEndDT[:dateResolution])
|
26
|
+
sETime = AdiwgDateTimeFun.stringTimeFromDateTime(hEndDT[:dateTime], hEndDT[:dateResolution])
|
27
|
+
|
28
|
+
# single date 9.3 (rngdates) - date range
|
29
|
+
@xml.tag!('rngdates') do
|
30
|
+
|
31
|
+
# range date 9.3.1 (begdate) - range start date (required)
|
32
|
+
unless sSDate == 'ERROR'
|
33
|
+
@xml.tag!('begdate', sSDate)
|
34
|
+
end
|
35
|
+
if sSDate == 'ERROR'
|
36
|
+
@hResponseObj[:writerPass] = false
|
37
|
+
@hResponseObj[:writerMessages] << 'Date Range start date is missing or invalid'
|
38
|
+
end
|
39
|
+
|
40
|
+
# range date 9.3.2 (begtime) - range start date
|
41
|
+
unless sSTime == 'ERROR'
|
42
|
+
@xml.tag!('begtime', sSTime)
|
43
|
+
end
|
44
|
+
if sSTime == 'ERROR' && @hResponseObj[:writerShowTags]
|
45
|
+
@xml.tag!('begtime')
|
46
|
+
end
|
47
|
+
|
48
|
+
# range date 9.3.3 (enddate) - range end date (required)
|
49
|
+
unless sEDate == 'ERROR'
|
50
|
+
@xml.tag!('enddate', sEDate)
|
51
|
+
end
|
52
|
+
if sEDate == 'ERROR'
|
53
|
+
@hResponseObj[:writerPass] = false
|
54
|
+
@hResponseObj[:writerMessages] << 'Date Range end date is missing or invalid'
|
55
|
+
end
|
56
|
+
|
57
|
+
# range date 9.3.4 (endtime) - range end date
|
58
|
+
unless sETime == 'ERROR'
|
59
|
+
@xml.tag!('endtime', sETime)
|
60
|
+
end
|
61
|
+
if sETime == 'ERROR' && @hResponseObj[:writerShowTags]
|
62
|
+
@xml.tag!('endtime')
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end # writeXML
|
68
|
+
end # DateRange
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# FGDC <<Class>> DateSingle
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-23 original script
|
6
|
+
|
7
|
+
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Fgdc
|
13
|
+
|
14
|
+
class DateSingle
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
end
|
20
|
+
|
21
|
+
def writeXML(hDate)
|
22
|
+
|
23
|
+
sDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:dateTime], hDate[:dateResolution])
|
24
|
+
sTime = AdiwgDateTimeFun.stringTimeFromDateTime(hDate[:dateTime], hDate[:dateResolution])
|
25
|
+
|
26
|
+
# single date 9.1 (sngdate) - single date (required)
|
27
|
+
@xml.tag!('sngdate') do
|
28
|
+
|
29
|
+
# single date 9.1.1 (caldate) - calendar date
|
30
|
+
unless sDate == 'ERROR'
|
31
|
+
@xml.tag!('caldate', sDate)
|
32
|
+
end
|
33
|
+
if sDate == 'ERROR'
|
34
|
+
@hResponseObj[:writerPass] = false
|
35
|
+
@hResponseObj[:writerMessages] << 'single date is missing or invalid'
|
36
|
+
end
|
37
|
+
|
38
|
+
# single date 9.1.2 (time) - time
|
39
|
+
unless sTime == 'ERROR'
|
40
|
+
@xml.tag!('time', sTime)
|
41
|
+
end
|
42
|
+
if sTime == 'ERROR' && @hResponseObj[:writerShowTags]
|
43
|
+
@xml.tag!('time')
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end # writeXML
|
49
|
+
end # SingleDate
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# FGDC <<Class>> Description
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-22 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class Description
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(hResourceInfo)
|
20
|
+
|
21
|
+
# description 1.2.1 (abstract) - abstract (required)
|
22
|
+
# <- hResourceInfo[:abstract] (required)
|
23
|
+
unless hResourceInfo[:abstract].nil?
|
24
|
+
@xml.tag!('abstract', hResourceInfo[:abstract])
|
25
|
+
end
|
26
|
+
|
27
|
+
# description 1.2.2 (purpose) - purpose (required)
|
28
|
+
# <- hResourceInfo[:purpose] (required)
|
29
|
+
unless hResourceInfo[:purpose].nil?
|
30
|
+
@xml.tag!('purpose', hResourceInfo[:purpose])
|
31
|
+
end
|
32
|
+
if hResourceInfo[:purpose].nil?
|
33
|
+
@hResponseObj[:writerPass] = false
|
34
|
+
@hResponseObj[:writerMessages] << 'Description is missing purpose'
|
35
|
+
end
|
36
|
+
|
37
|
+
# description 1.2.3 (supplinf) - supplemental information (required)
|
38
|
+
# <- hResourceInfo[:supplementalInfo]
|
39
|
+
unless hResourceInfo[:supplementalInfo].nil?
|
40
|
+
@xml.tag!('supplinf', hResourceInfo[:supplementalInfo])
|
41
|
+
end
|
42
|
+
|
43
|
+
end # writeXML
|
44
|
+
end # Description
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# ISO 19110 <<Class>> FGDC
|
2
|
+
# writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-16 original script
|
6
|
+
|
7
|
+
require_relative 'class_identification'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Fgdc
|
13
|
+
|
14
|
+
class Fgdc
|
15
|
+
|
16
|
+
def initialize(xml, responseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = responseObj
|
19
|
+
end
|
20
|
+
|
21
|
+
def writeXML(intObj)
|
22
|
+
|
23
|
+
# classes used
|
24
|
+
idClass = Identification.new(@xml, @hResponseObj)
|
25
|
+
version = @hResponseObj[:translatorVersion]
|
26
|
+
|
27
|
+
# document head
|
28
|
+
metadata = @xml.instruct! :xml, encoding: 'UTF-8'
|
29
|
+
@xml.comment!('FGDC METADATA (FGDC-STD-001-1998)')
|
30
|
+
@xml.comment!('Includes Biological Data Profile (FGDC-STD-001.1-1999)')
|
31
|
+
@xml.comment!('The following metadata file was constructed using the ADIwg mdTranslator, http://mdtranslator.adiwg.org')
|
32
|
+
@xml.comment!('mdTranslator software is an open-source project of the Alaska Data Integration working group (ADIwg)')
|
33
|
+
@xml.comment!('mdTranslator and other metadata tools are available at https://github.com/adiwg')
|
34
|
+
@xml.comment!('ADIwg is not responsible for the content of this metadata record')
|
35
|
+
@xml.comment!('This metadata record was generated by mdTranslator ' + version + ' at ' + Time.now.to_s)
|
36
|
+
|
37
|
+
# metadata
|
38
|
+
@xml.tag!('metadata') do
|
39
|
+
|
40
|
+
# metadata 1 (idinfo) - identification information
|
41
|
+
idClass.writeXML(intObj)
|
42
|
+
|
43
|
+
# metadata 2 (dataqual) - data quality information
|
44
|
+
# metadata 3 (spdoinfo) - spatial domain information
|
45
|
+
# metadata 4 (spref) - spatial reference systems
|
46
|
+
# metadata 5 (eainfo) - entity attribute information
|
47
|
+
# metadata 6 (distinfo) - distribution information
|
48
|
+
# metadata 7 (metainfo) - metadata information
|
49
|
+
|
50
|
+
return metadata
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# FGDC <<Class>> GeologicAge
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-24 original script
|
6
|
+
|
7
|
+
require_relative 'class_citation'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Fgdc
|
13
|
+
|
14
|
+
class GeologicAge
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
end
|
20
|
+
|
21
|
+
def writeXML(hGeoAge)
|
22
|
+
|
23
|
+
# classes used
|
24
|
+
citationClass = Citation.new(@xml, @hResponseObj)
|
25
|
+
|
26
|
+
# geologic age (geolscal) - geologic scale (required)
|
27
|
+
unless hGeoAge[:ageTimeScale].nil?
|
28
|
+
@xml.tag!('geolscal', hGeoAge[:ageTimeScale])
|
29
|
+
end
|
30
|
+
if hGeoAge[:ageTimeScale].nil?
|
31
|
+
@hResponseObj[:writerPass] = false
|
32
|
+
@hResponseObj[:writerMessages] << 'Geologic Age is missing time scale'
|
33
|
+
end
|
34
|
+
|
35
|
+
# geologic age (geolest) - age estimate (required)
|
36
|
+
unless hGeoAge[:ageEstimate].nil?
|
37
|
+
@xml.tag!('geolest', hGeoAge[:ageEstimate])
|
38
|
+
end
|
39
|
+
if hGeoAge[:ageEstimate].nil?
|
40
|
+
@hResponseObj[:writerPass] = false
|
41
|
+
@hResponseObj[:writerMessages] << 'Geologic Age is missing age estimate'
|
42
|
+
end
|
43
|
+
|
44
|
+
# geologic age (geolun) - age uncertainty
|
45
|
+
unless hGeoAge[:ageUncertainty].nil?
|
46
|
+
@xml.tag!('geolun', hGeoAge[:ageUncertainty])
|
47
|
+
end
|
48
|
+
if hGeoAge[:ageUncertainty].nil? && @hResponseObj[:writerShowTags]
|
49
|
+
@xml.tag!('geolun')
|
50
|
+
end
|
51
|
+
|
52
|
+
# geologic age (geolexpl) - age determination methodology
|
53
|
+
unless hGeoAge[:ageExplanation].nil?
|
54
|
+
@xml.tag!('geolexpl', hGeoAge[:ageExplanation])
|
55
|
+
end
|
56
|
+
if hGeoAge[:ageExplanation].nil? && @hResponseObj[:writerShowTags]
|
57
|
+
@xml.tag!('geolexpl')
|
58
|
+
end
|
59
|
+
|
60
|
+
# geologic age (geolcit) - age references [{citation}]
|
61
|
+
hGeoAge[:ageReferences].each do |hCitation|
|
62
|
+
unless hCitation.empty?
|
63
|
+
@xml.tag!('geolcit') do
|
64
|
+
citationClass.writeXML(hCitation, {})
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
if hGeoAge[:ageReferences].empty? && @hResponseObj[:writerShowTags]
|
69
|
+
@xml.tag!('geolcit')
|
70
|
+
end
|
71
|
+
|
72
|
+
end # writeXML
|
73
|
+
end # GeologicAge
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# FGDC <<Class>> GeologicRange
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-24 original script
|
6
|
+
|
7
|
+
require_relative 'class_geologicAge'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Fgdc
|
13
|
+
|
14
|
+
class GeologicRange
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
end
|
20
|
+
|
21
|
+
def writeXML(hAgeStart, hAgeEnd)
|
22
|
+
|
23
|
+
# classes used
|
24
|
+
ageClass = GeologicAge.new(@xml, @hResponseObj)
|
25
|
+
|
26
|
+
# geologic age range (beggeol) - starting geologic age (required)
|
27
|
+
unless hAgeStart.empty?
|
28
|
+
@xml.tag!('beggeol') do
|
29
|
+
ageClass.writeXML(hAgeStart)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
if hAgeStart.empty?
|
33
|
+
@hResponseObj[:writerPass] = false
|
34
|
+
@hResponseObj[:writerMessages] << 'Geologic Age Range is missing starting age'
|
35
|
+
end
|
36
|
+
|
37
|
+
# geologic age range (endgeol) - ending geologic age (required)
|
38
|
+
unless hAgeStart.empty?
|
39
|
+
@xml.tag!('endgeol') do
|
40
|
+
ageClass.writeXML(hAgeEnd)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
if hAgeEnd.empty?
|
44
|
+
@hResponseObj[:writerPass] = false
|
45
|
+
@hResponseObj[:writerMessages] << 'Geologic Age Range is missing ending age'
|
46
|
+
end
|
47
|
+
|
48
|
+
end # writeXML
|
49
|
+
end # GeologicAge
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# FGDC <<Class>> Identification Information
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-17 original script
|
6
|
+
|
7
|
+
require_relative '../fgdc_writer'
|
8
|
+
require_relative 'class_citation'
|
9
|
+
require_relative 'class_description'
|
10
|
+
require_relative 'class_timePeriod'
|
11
|
+
require_relative 'class_status'
|
12
|
+
require_relative 'class_spatialDomain'
|
13
|
+
require_relative 'class_keyword'
|
14
|
+
require_relative 'class_contact'
|
15
|
+
|
16
|
+
module ADIWG
|
17
|
+
module Mdtranslator
|
18
|
+
module Writers
|
19
|
+
module Fgdc
|
20
|
+
|
21
|
+
class Identification
|
22
|
+
|
23
|
+
def initialize(xml, hResponseObj)
|
24
|
+
@xml = xml
|
25
|
+
@hResponseObj = hResponseObj
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_responsibility(aResponsibility, roleName)
|
29
|
+
aParties = []
|
30
|
+
aResponsibility.each do |hRParty|
|
31
|
+
if hRParty[:roleName] == roleName
|
32
|
+
hRParty[:parties].each do |hParty|
|
33
|
+
aParties << hParty[:contactId]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
aParties = aParties.uniq
|
38
|
+
return aParties
|
39
|
+
end
|
40
|
+
|
41
|
+
def writeXML(intObj)
|
42
|
+
|
43
|
+
# classes used
|
44
|
+
citationClass = Citation.new(@xml, @hResponseObj)
|
45
|
+
descriptionClass = Description.new(@xml, @hResponseObj)
|
46
|
+
timePeriodClass = TimePeriod.new(@xml, @hResponseObj)
|
47
|
+
statusClass = Status.new(@xml, @hResponseObj)
|
48
|
+
spDomainClass = SpatialDomain.new(@xml, @hResponseObj)
|
49
|
+
keywordClass = Keyword.new(@xml, @hResponseObj)
|
50
|
+
contactClass = Contact.new(@xml, @hResponseObj)
|
51
|
+
|
52
|
+
hResourceInfo = intObj[:metadata][:resourceInfo]
|
53
|
+
|
54
|
+
@xml.tag!('idinfo') do
|
55
|
+
|
56
|
+
# identification information 1.1 (citation) - citation (required)
|
57
|
+
# <- hResourceInfo[:citation]
|
58
|
+
hCitation = hResourceInfo[:citation]
|
59
|
+
aAssocResource = intObj[:metadata][:associatedResources]
|
60
|
+
unless hCitation.empty?
|
61
|
+
@xml.tag!('citation') do
|
62
|
+
citationClass.writeXML(hCitation, aAssocResource)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
if hCitation.empty?
|
66
|
+
@hResponseObj[:writerPass] = false
|
67
|
+
@hResponseObj[:writerMessages] << 'Identification section is missing citation'
|
68
|
+
end
|
69
|
+
|
70
|
+
# identification information 1.2 (descript) - description (required)
|
71
|
+
# <- hResourceInfo[:abstract,:purpose,:supplementalInfo] (required)
|
72
|
+
unless hResourceInfo[:abstract].nil? && hResourceInfo[:purpose].nil? && hResourceInfo[:supplementalInfo].nil?
|
73
|
+
@xml.tag!('descript') do
|
74
|
+
descriptionClass.writeXML(hResourceInfo)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
if hResourceInfo[:abstract].nil?
|
78
|
+
@hResponseObj[:writerPass] = false
|
79
|
+
@hResponseObj[:writerMessages] << 'Identification section is missing abstract'
|
80
|
+
end
|
81
|
+
if hResourceInfo[:purpose].nil?
|
82
|
+
@hResponseObj[:writerPass] = false
|
83
|
+
@hResponseObj[:writerMessages] << 'Identification section is missing purpose'
|
84
|
+
end
|
85
|
+
|
86
|
+
# identification information 1.3 (timeperd) - time period of content (required)
|
87
|
+
# <- hResourceInfo[:timePeriod]
|
88
|
+
unless hResourceInfo[:timePeriod].empty?
|
89
|
+
@xml.tag!('timeperd') do
|
90
|
+
timePeriodClass.writeXML(hResourceInfo[:timePeriod])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
if hResourceInfo[:timePeriod].empty?
|
94
|
+
@hResponseObj[:writerPass] = false
|
95
|
+
@hResponseObj[:writerMessages] << 'Identification section is missing time period'
|
96
|
+
end
|
97
|
+
|
98
|
+
# identification information 1.4 (status) - status
|
99
|
+
statusClass.writeXML(hResourceInfo)
|
100
|
+
|
101
|
+
# identification information 1.5 (spdom) - spatial domain
|
102
|
+
# not required under biological extension rules
|
103
|
+
unless hResourceInfo[:extents].empty?
|
104
|
+
spDomainClass.writeXML(hResourceInfo[:extents])
|
105
|
+
end
|
106
|
+
|
107
|
+
# identification information 1.6 (keywords) - keywords [] (required)
|
108
|
+
unless hResourceInfo[:keywords].empty?
|
109
|
+
@xml.tag!('keywords') do
|
110
|
+
keywordClass.writeXML(hResourceInfo[:keywords])
|
111
|
+
end
|
112
|
+
end
|
113
|
+
if hResourceInfo[:keywords].empty?
|
114
|
+
@hResponseObj[:writerPass] = false
|
115
|
+
@hResponseObj[:writerMessages] << 'Identification section is missing keywords'
|
116
|
+
end
|
117
|
+
|
118
|
+
# identification information bio (taxonomy) - taxonomy
|
119
|
+
# identification information 1.7 (accconst) - access constraint (required)
|
120
|
+
# identification information 1.8 (useconst) - use constraint (required)
|
121
|
+
|
122
|
+
# identification information 1.9 (ptcontac) - point of contact
|
123
|
+
unless hResourceInfo[:pointOfContacts].empty?
|
124
|
+
aParties = find_responsibility(hResourceInfo[:pointOfContacts], 'pointOfContact')
|
125
|
+
unless aParties.empty?
|
126
|
+
hContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(aParties[0])
|
127
|
+
unless hContact.empty?
|
128
|
+
@xml.tag!('ptcontac') do
|
129
|
+
contactClass.writeXML(hContact)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
if hResourceInfo[:pointOfContacts].empty? && @hResponseObj[:writerShowTags]
|
135
|
+
@xml.tag!('ptcontac')
|
136
|
+
end
|
137
|
+
|
138
|
+
# identification information 1.10 (browse) - browse graphic []
|
139
|
+
# identification information 1.11 (datacred) - dataset credit
|
140
|
+
# identification information 1.12 (secinfo) - security information
|
141
|
+
# identification information 1.13 (native) - native dataset environment
|
142
|
+
# identification information 1.14 (crossref) - cross reference []
|
143
|
+
# identification information bio (tool) - analytical tool [] (not supported)
|
144
|
+
|
145
|
+
end # idinfo tag
|
146
|
+
end # writeXML
|
147
|
+
end # Identification
|
148
|
+
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|