lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb in adiwg-mdtranslator-2.16.1 vs lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb in adiwg-mdtranslator-2.17.1
- old
+ new
@@ -57,10 +57,11 @@
if reference.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: attribute reference source is missing'
end
# entity attribute 5.1.2.4 (attrdomv) - attribute domain value (required)
+ domainLength = hDictionary[:domains].length
axDomain = xAttribute.xpath('./attrdomv')
unless axDomain.empty?
# entity attribute 5.1.2.4.1 (edom) - enumerated domain
unless axDomain.empty?
@@ -102,12 +103,15 @@
end
# add domainId to attribute
# fgdc allows multiple domain definitions
# mdJson allows only one domain definition for an attribute
- # take the first, if this is a problem the user will need to fix in the editor
+ # take the first domain that is assigned to the attribute,
+ # if this is a problem the user will need to fix in the editor
unless hDictionary[:domains].empty?
- hAttribute[:domainId] = hDictionary[:domains][0][:domainId]
+ if hDictionary[:domains].length > domainLength
+ hAttribute[:domainId] = hDictionary[:domains][domainLength][:domainId]
+ end
end
axBegin = xAttribute.xpath('./begdatea')
# entity attribute 5.1.2.5 (begdatea) - beginning date of attribute values
# entity attribute 5.1.2.6 (enddatea) - ending date of attribute values