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
@@ -10,163 +10,163 @@ require_relative 'module_address'
|
|
10
10
|
require_relative 'module_graphic'
|
11
11
|
|
12
12
|
module ADIWG
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
end
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module MdJson
|
16
|
+
|
17
|
+
module Contact
|
18
|
+
|
19
|
+
def self.unpack(hContact, responseObj)
|
20
|
+
|
21
|
+
|
22
|
+
# return nil object if input is empty
|
23
|
+
if hContact.empty?
|
24
|
+
responseObj[:readerExecutionMessages] << 'Contact object is empty'
|
25
|
+
responseObj[:readerExecutionPass] = false
|
26
|
+
return nil
|
27
|
+
end
|
28
|
+
|
29
|
+
# instance classes needed in script
|
30
|
+
intMetadataClass = InternalMetadata.new
|
31
|
+
intContact = intMetadataClass.newContact
|
32
|
+
|
33
|
+
# contact - contact id (required)
|
34
|
+
if hContact.has_key?('contactId')
|
35
|
+
intContact[:contactId] = hContact['contactId']
|
36
|
+
end
|
37
|
+
if intContact[:contactId].nil? || intContact[:contactId] == ''
|
38
|
+
responseObj[:readerExecutionMessages] << 'Contact is missing contactId'
|
39
|
+
responseObj[:readerExecutionPass] = false
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
|
43
|
+
# contact - is organization (required)
|
44
|
+
if hContact.has_key?('isOrganization')
|
45
|
+
if hContact['isOrganization'] === true
|
46
|
+
intContact[:isOrganization] = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# contact - position name
|
51
|
+
if hContact.has_key?('positionName')
|
52
|
+
if hContact['positionName'] != ''
|
53
|
+
intContact[:positionName] = hContact['positionName']
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# contact - name (required if ...)
|
58
|
+
# ... isOrganization = true
|
59
|
+
# ... isOrganization = false && positionName = nil
|
60
|
+
if hContact.has_key?('name')
|
61
|
+
if hContact['name'] != ''
|
62
|
+
intContact[:name] = hContact['name']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
if intContact[:name].nil? || intContact[:name] == ''
|
66
|
+
if intContact[:isOrganization] === true
|
67
|
+
responseObj[:readerExecutionMessages] << 'Organization contact is missing name'
|
68
|
+
responseObj[:readerExecutionPass] = false
|
69
|
+
return nil
|
70
|
+
end
|
71
|
+
if intContact[:positionName].nil? || intContact[:positionName] == ''
|
72
|
+
responseObj[:readerExecutionMessages] << 'Individual contact is missing name and position'
|
73
|
+
responseObj[:readerExecutionPass] = false
|
74
|
+
return nil
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# contact - member of organization []
|
79
|
+
if hContact.has_key?('memberOfOrganization')
|
80
|
+
hContact['memberOfOrganization'].each do |item|
|
81
|
+
if item != ''
|
82
|
+
intContact[:memberOfOrgs] << item
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# contact - logo graphic [graphic]
|
88
|
+
if hContact.has_key?('logoGraphic')
|
89
|
+
aItems = hContact['logoGraphic']
|
90
|
+
aItems.each do |item|
|
91
|
+
hReturn = Graphic.unpack(item, responseObj)
|
92
|
+
unless hReturn.nil?
|
93
|
+
intContact[:logos] << hReturn
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# contact - phone [phone]
|
99
|
+
if hContact.has_key?('phone')
|
100
|
+
aItems = hContact['phone']
|
101
|
+
aItems.each do |item|
|
102
|
+
hReturn = Phone.unpack(item, responseObj)
|
103
|
+
unless hReturn.nil?
|
104
|
+
intContact[:phones] << hReturn
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# contact - address [address]
|
110
|
+
if hContact.has_key?('address')
|
111
|
+
aItems = hContact['address']
|
112
|
+
aItems.each do |item|
|
113
|
+
hReturn = Address.unpack(item, responseObj)
|
114
|
+
unless hReturn.nil?
|
115
|
+
intContact[:addresses] << hReturn
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# contact - electronic mail addresses []
|
121
|
+
if hContact.has_key?('electronicMailAddress')
|
122
|
+
hContact['electronicMailAddress'].each do |item|
|
123
|
+
if item != ''
|
124
|
+
intContact[:eMailList] << item
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# contact - online resource [onlineResource]
|
130
|
+
if hContact.has_key?('onlineResource')
|
131
|
+
aItems = hContact['onlineResource']
|
132
|
+
aItems.each do |item|
|
133
|
+
hReturn = OnlineResource.unpack(item, responseObj)
|
134
|
+
unless hReturn.nil?
|
135
|
+
intContact[:onlineResources] << hReturn
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# contact - hours of service []
|
141
|
+
if hContact.has_key?('hoursOfService')
|
142
|
+
hContact['hoursOfService'].each do |item|
|
143
|
+
if item != ''
|
144
|
+
intContact[:hoursOfService] << item
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# contact - contact instructions
|
150
|
+
if hContact.has_key?('contactInstructions')
|
151
|
+
if hContact['contactInstructions'] != ''
|
152
|
+
intContact[:contactInstructions] = hContact['contactInstructions']
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# contact - contact type
|
157
|
+
if hContact.has_key?('contactType')
|
158
|
+
if hContact['contactType'] != ''
|
159
|
+
intContact[:contactType] = hContact['contactType']
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
return intContact
|
164
|
+
|
165
|
+
end
|
168
166
|
|
169
167
|
end
|
170
|
-
|
171
|
-
|
168
|
+
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
172
|
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
# Reader - ScienceBase JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
5
|
+
# Stan Smith 2017-11-29 do not import short abstract
|
6
|
+
# Stan Smith 2016-06-19 original script
|
6
7
|
|
7
8
|
module ADIWG
|
8
9
|
module Mdtranslator
|
@@ -22,12 +23,8 @@ module ADIWG
|
|
22
23
|
end
|
23
24
|
|
24
25
|
# summary
|
25
|
-
|
26
|
-
|
27
|
-
unless sbShort.nil? || sbShort == ''
|
28
|
-
hResourceInfo[:shortAbstract] = sbShort
|
29
|
-
end
|
30
|
-
end
|
26
|
+
# do not import short abstract
|
27
|
+
# sbJson forces summary to first 300 characters of abstract
|
31
28
|
|
32
29
|
return hResourceInfo
|
33
30
|
|
@@ -1,6 +1,12 @@
|
|
1
1
|
# adiwg mdTranslator
|
2
2
|
|
3
3
|
# version 2 history
|
4
|
+
# 2.6.1 2017-11-30 add agreement number to sbJson budget facet
|
5
|
+
# 2.6.1 2017-11-30 add metadataOnlineResources and citation onlineResources to sbJson
|
6
|
+
# 2.6.1 2017-11-30 remove duplicate citation identifiers from sbJson
|
7
|
+
# 2.6.1 2017-11-30 handle keywords greater than 80 characters in sbJson
|
8
|
+
# 2.6.1 2017-11-30 do not import short abstract in sbJson
|
9
|
+
# 2.6.0 2017-11-09 add metadataIdentifier to sbJson identifier
|
4
10
|
# 2.6.0 2017-11-09 added data dictionary description
|
5
11
|
# 2.6.0 2017-11-09 added readers and writers for geologic age
|
6
12
|
# 2.5.0 2017-11-03 bug fix, add test to verify mdJson reader version is compatible with schema version
|
@@ -46,7 +52,7 @@
|
|
46
52
|
module ADIWG
|
47
53
|
module Mdtranslator
|
48
54
|
# current mdtranslator version
|
49
|
-
VERSION = "2.6.
|
55
|
+
VERSION = "2.6.1"
|
50
56
|
end
|
51
57
|
end
|
52
58
|
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# FGDC <<Class>> Address
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-27 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class Address
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(hAddress)
|
20
|
+
|
21
|
+
# contact 10.4 (cntaddr) - address information
|
22
|
+
|
23
|
+
# contact 10.4.1 (addrtype) - contact type
|
24
|
+
# <- hAddress[:addressTypes][0]
|
25
|
+
unless hAddress[:addressTypes].empty?
|
26
|
+
@xml.tag!('addrtype', hAddress[:addressTypes][0])
|
27
|
+
end
|
28
|
+
if hAddress[:addressTypes].empty?
|
29
|
+
@hResponseObj[:writerPass] = false
|
30
|
+
@hResponseObj[:writerMessages] << 'Address is missing type'
|
31
|
+
end
|
32
|
+
|
33
|
+
# contact 10.4.2 (address) - address lines
|
34
|
+
# <- hAddress[:deliveryPoints]
|
35
|
+
hAddress[:deliveryPoints].each do |addLine|
|
36
|
+
@xml.tag!('address', addLine)
|
37
|
+
end
|
38
|
+
if hAddress[:deliveryPoints].empty? && @hResponseObj[:writerShowTags]
|
39
|
+
@xml.tag!('address')
|
40
|
+
end
|
41
|
+
|
42
|
+
# contact 10.4.3 (city) - city (required)
|
43
|
+
# <- hAddress[:city]
|
44
|
+
unless hAddress[:city].nil?
|
45
|
+
@xml.tag!('city', hAddress[:city])
|
46
|
+
end
|
47
|
+
if hAddress[:city].nil?
|
48
|
+
@hResponseObj[:writerPass] = false
|
49
|
+
@hResponseObj[:writerMessages] << 'Address is missing city'
|
50
|
+
end
|
51
|
+
|
52
|
+
# contact 10.4.4 (state) - state (required)
|
53
|
+
# <- hAddress[:adminArea]
|
54
|
+
unless hAddress[:adminArea].nil?
|
55
|
+
@xml.tag!('state', hAddress[:adminArea])
|
56
|
+
end
|
57
|
+
if hAddress[:adminArea].nil?
|
58
|
+
@hResponseObj[:writerPass] = false
|
59
|
+
@hResponseObj[:writerMessages] << 'Address is missing state'
|
60
|
+
end
|
61
|
+
|
62
|
+
# contact 10.4.5 (postal) - postal code (required)
|
63
|
+
# <- hAddress[:postalCode]
|
64
|
+
unless hAddress[:postalCode].nil?
|
65
|
+
@xml.tag!('postal', hAddress[:postalCode])
|
66
|
+
end
|
67
|
+
if hAddress[:postalCode].nil?
|
68
|
+
@hResponseObj[:writerPass] = false
|
69
|
+
@hResponseObj[:writerMessages] << 'Address is missing postal code'
|
70
|
+
end
|
71
|
+
|
72
|
+
# contact 10.4.6 (country) - country
|
73
|
+
# <- hAddress[:country]
|
74
|
+
unless hAddress[:country].nil?
|
75
|
+
@xml.tag!('country', hAddress[:country])
|
76
|
+
end
|
77
|
+
if hAddress[:country].nil? && @hResponseObj[:writerShowTags]
|
78
|
+
@xml.tag!('country')
|
79
|
+
end
|
80
|
+
|
81
|
+
end # writeXML
|
82
|
+
end # Address
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# FGDC <<Class>> Citation
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-11-17 original script
|
6
|
+
|
7
|
+
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
8
|
+
require_relative 'class_series'
|
9
|
+
require_relative 'class_publisher'
|
10
|
+
require_relative 'class_citation'
|
11
|
+
|
12
|
+
module ADIWG
|
13
|
+
module Mdtranslator
|
14
|
+
module Writers
|
15
|
+
module Fgdc
|
16
|
+
|
17
|
+
class Citation
|
18
|
+
|
19
|
+
def initialize(xml, hResponseObj)
|
20
|
+
@xml = xml
|
21
|
+
@hResponseObj = hResponseObj
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_responsibility(hCitation, roleName)
|
25
|
+
aParties = []
|
26
|
+
hCitation[:responsibleParties].each do |hRParty|
|
27
|
+
if hRParty[:roleName] == roleName
|
28
|
+
hRParty[:parties].each do |hParty|
|
29
|
+
aParties << hParty[:contactId]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
aParties = aParties.uniq
|
34
|
+
return aParties
|
35
|
+
end
|
36
|
+
|
37
|
+
def writeXML(hCitation, aAssocResource)
|
38
|
+
|
39
|
+
seriesClass = Series.new(@xml, @hResponseObj)
|
40
|
+
pubClass = Publisher.new(@xml, @hResponseObj)
|
41
|
+
citationClass = Citation.new(@xml, @hResponseObj)
|
42
|
+
|
43
|
+
@xml.tag!('citeinfo') do
|
44
|
+
|
45
|
+
# citation 8.1 (origin) - originator [] (required)
|
46
|
+
# <- hCitation[:responsibleParties] role = 'originator'
|
47
|
+
haveOriginator = false
|
48
|
+
aOriginators = find_responsibility(hCitation, 'originator')
|
49
|
+
aOriginators.each do |contactId|
|
50
|
+
hContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(contactId)
|
51
|
+
unless hContact.empty?
|
52
|
+
name = hContact[:name]
|
53
|
+
unless name.nil?
|
54
|
+
@xml.tag!('origin', name)
|
55
|
+
haveOriginator = true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
unless haveOriginator
|
60
|
+
@hResponseObj[:writerPass] = false
|
61
|
+
@hResponseObj[:writerMessages] << 'Citation is missing originator'
|
62
|
+
end
|
63
|
+
|
64
|
+
# citation 8.2 (pubdate) - publication date (required)
|
65
|
+
# citation 8.3 (pubtime) - publication time
|
66
|
+
# <- hCitation[:dates] dateType = 'publication'
|
67
|
+
havePubDate = false
|
68
|
+
hCitation[:dates].each do |hDate|
|
69
|
+
unless hDate.empty?
|
70
|
+
unless hDate[:dateType].nil?
|
71
|
+
if hDate[:dateType] == 'publication'
|
72
|
+
pubDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:date], hDate[:dateResolution])
|
73
|
+
pubTime = AdiwgDateTimeFun.stringTimeFromDateTime(hDate[:date], hDate[:dateResolution])
|
74
|
+
unless pubDate == 'ERROR'
|
75
|
+
@xml.tag!('pubdate', pubDate)
|
76
|
+
havePubDate = true
|
77
|
+
end
|
78
|
+
unless pubTime == 'ERROR'
|
79
|
+
@xml.tag!('pubtime', pubTime)
|
80
|
+
end
|
81
|
+
break
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
unless havePubDate
|
87
|
+
@hResponseObj[:writerPass] = false
|
88
|
+
@hResponseObj[:writerMessages] << 'Citation is missing publication date'
|
89
|
+
end
|
90
|
+
|
91
|
+
# citation 8.4 (title) - title (required)
|
92
|
+
# <- hCitation[:title]
|
93
|
+
unless hCitation[:title].nil? || hCitation[:title] == ''
|
94
|
+
@xml.tag!('title', hCitation[:title])
|
95
|
+
end
|
96
|
+
if hCitation[:title].nil? || hCitation[:title] == ''
|
97
|
+
@hResponseObj[:writerPass] = false
|
98
|
+
@hResponseObj[:writerMessages] << 'Citation is missing title'
|
99
|
+
end
|
100
|
+
|
101
|
+
# citation 8.5 (edition) - edition
|
102
|
+
# <- hCitation[:edition]
|
103
|
+
unless hCitation[:edition].nil?
|
104
|
+
@xml.tag!('edition', hCitation[:edition])
|
105
|
+
end
|
106
|
+
|
107
|
+
# citation 8.6 (geoform) - geospatial data presentation form
|
108
|
+
# <- hCitation[:presentationForm] [] - take first
|
109
|
+
hCitation[:presentationForms].each do |geoForm|
|
110
|
+
unless geoForm.empty?
|
111
|
+
@xml.tag!('geoform', geoForm)
|
112
|
+
break
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# citation 8.7 (serinfo) - series information
|
117
|
+
# <- hCitation[:series]
|
118
|
+
unless hCitation[:series].empty?
|
119
|
+
@xml.tag!('serinfo') do
|
120
|
+
seriesClass.writeXML(hCitation[:series])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# citation 8.8 (pubinfo) - publication information
|
125
|
+
# <- hCitation[:responsibleParties] role = 'publisher'
|
126
|
+
# only take first publisher
|
127
|
+
aPublisher = find_responsibility(hCitation, 'publisher')
|
128
|
+
unless aPublisher.empty?
|
129
|
+
hContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(aPublisher[0])
|
130
|
+
unless hContact.empty?
|
131
|
+
@xml.tag!('pubinfo') do
|
132
|
+
pubClass.writeXML(hContact)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# citation 8.9 (othercit) - other citation details
|
138
|
+
# <- hCitation[:otherDetails][0] - take first
|
139
|
+
unless hCitation[:otherDetails].empty?
|
140
|
+
@xml.tag!('othercit', hCitation[:otherDetails][0])
|
141
|
+
end
|
142
|
+
|
143
|
+
# citation 8.10 (onlink) - online linkage []
|
144
|
+
# <- hCitation[:onlineResources][:uri]
|
145
|
+
hCitation[:onlineResources].each do |hOnline|
|
146
|
+
unless hOnline[:olResURI].nil?
|
147
|
+
@xml.tag!('onlink', hOnline[:olResURI])
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# citation 8.11 (lworkcit) - larger work citation
|
152
|
+
# <- associatedResource[] - associationType = 'largerWorkCitation' take first
|
153
|
+
# <- associatedResource[:resourceCitation]
|
154
|
+
aAssocResource.each do |hResource|
|
155
|
+
if hResource[:associationType] == 'largerWorkCitation'
|
156
|
+
unless hResource[:resourceCitation].empty?
|
157
|
+
@xml.tag!('lworkcit') do
|
158
|
+
citationClass.writeXML(hResource[:resourceCitation], [])
|
159
|
+
end
|
160
|
+
break
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
end # citeinfo tag
|
166
|
+
end # writeXML
|
167
|
+
end # Citation
|
168
|
+
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|