lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb in adiwg-mdtranslator-2.9.2 vs lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb in adiwg-mdtranslator-2.10.0
- old
+ new
@@ -23,35 +23,44 @@
# instance classes needed in script
intMetadataClass = InternalMetadata.new
hAttribute = intMetadataClass.newEntityAttribute
- # entity attribute 5.1.2.1 (attrlabl) - attribute name
+ # entity attribute 5.1.2.1 (attrlabl) - attribute name (required)
# -> dataDictionary.entities.attributes.attributeCode
code = xAttribute.xpath('./attrlabl').text
unless code.empty?
hAttribute[:attributeName] = code
hAttribute[:attributeCode] = code
end
+ if code.empty?
+ hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: attribute label is missing'
+ end
- # entity attribute 5.1.2.2 (attrdef) - attribute definition
+ # entity attribute 5.1.2.2 (attrdef) - attribute definition (required)
# -> dataDictionary.entities.attributes.attributeDefinition
definition = xAttribute.xpath('./attrdef').text
unless definition.empty?
hAttribute[:attributeDefinition] = definition
end
+ if definition.empty?
+ hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: attribute definition is missing'
+ end
- # entity attribute 5.1.2.3 (attrdefs) - attribute definition source
+ # entity attribute 5.1.2.3 (attrdefs) - attribute definition source (required)
# -> dataDictionary.entities.attributes.attributeReference.title
reference = xAttribute.xpath('./attrdefs').text
unless reference.empty?
hCitation = intMetadataClass.newCitation
hCitation[:title] = reference
hAttribute[:attributeReference] = hCitation
end
+ if reference.empty?
+ hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: attribute reference source is missing'
+ end
- # entity attribute 5.1.2.4 (attrdomv) - attribute domain value
+ # entity attribute 5.1.2.4 (attrdomv) - attribute domain value (required)
axDomain = xAttribute.xpath('./attrdomv')
unless axDomain.empty?
# entity attribute 5.1.2.4.1 (edom) - enumerated domain
unless axDomain.empty?
@@ -85,9 +94,12 @@
hDomain[:domainDescription] = unRep
hDictionary[:domains] << hDomain
end
end
+ end
+ if axDomain.empty?
+ hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: attribute domain is missing'
end
# add domainId to attribute
# fgdc allows multiple domain definitions
# mdJson allows only one domain definition for an attribute