data.gov
data.gov copied to clipboard
Remove incorrect "required" element check in ISO19115-3 reader modules
User Story
In order to ensure the ISO19115-3 reader works correctly, datagov wants to remove conditions checking for incorrect "required" elements in the mdtranslator ISO19115-3 reader.
Acceptance Criteria
[ACs should be clearly demoable/verifiable whenever possible. Try specifying them using BDD.]
- [ ] GIVEN the ISO19115-3 reader and all its modules
WHEN the incorrect required element check if removed
THEN it should no longer be in the codebase
AND there shouldn't be any errors/warnings caused by them.
Background
- related to 4843
- an incorrect pattern had been followed during the ISO19115-3 reader feature development. specifically, there's often a check at the beginning of each module for a "required" element that isn't actually required. Let's take
module_browse_graphic.rb
as an example. The condition at the start ofself.unpack
checks ifmcc:MD_BrowseGraphic
is withinxLogo
( i.e. the parent element ) when in fact these elements represent the same thing.cit:logo
is amcc:MD_BrowseGraphic_PropertyType
element type which can 0 or many times within aCI_Organisation_Type
element ( i.e.cit:CI_Organisation
). Acit:CI_Organisation
element may have a valid self-closingcit:logo
element (e.g.<cit:logo/>
) which won't have themcc:MD_BrowseGraphic
element within it. this condition indicating it's required is incorrect. the purpose of this ticket is to remove these incorrect checks from all ISO19115-3 reader modules.
#...
module BrowseGraphic
# xpaths for finding xml elements
@@nameXPath = 'mcc:fileName//gco:CharacterString'
@@descXPath = 'mcc:fileDescription//gco:CharacterString'
@@typeXPath = 'mcc:fileType//gco:CharacterString'
@@browseGraphicXPath = 'mcc:MD_BrowseGraphic'
@@imageConstraintsXPath = 'mcc:imageConstraints'
@@linkageXPath = 'mcc:linkage'
def self.unpack(xLogo, hResponseObj)
intMetadataClass = InternalMetadata.new
hGraphic = intMetadataClass.newGraphic
xBrowseGraphic = xLogo.xpath(@@browseGraphicXPath)[0]
if xBrowseGraphic.nil?
msg = 'WARNING: ISO19115-3 reader: element \'mcc:MD_BrowseGraphic\' '\
'is missing in logo'
hResponseObj[:readerExecutionMessages] << msg
hResponseObj[:readerExecutionPass] = false
return nil
end
#...
<!-- ... -->
<cit:party>
<cit:CI_Organisation>
<cit:name>
<gco:CharacterString>U.S. Geological Survey, Alaska Science Center</gco:CharacterString>
</cit:name>
<cit:logo>
<mcc:MD_BrowseGraphic/>
<!-- ... -->
Security Considerations (required)
[Any security concerns that might be implicated in the change. "None" is OK, just be explicit here!]
Sketch
[Notes or a checklist reflecting our understanding of the selected approach]