metadata101 / iso19139.ca.HNAP

ISO Harmonized North American Profile (HNAP)
GNU General Public License v2.0
4 stars 18 forks source link

validate missing contact email field to be sync as iso19139.nap #355

Closed wangf1122 closed 8 months ago

wangf1122 commented 10 months ago

Due to some legacy data that was attempted to publish to FGP, we have validation error at FGP level that contact email is missing. There is no such validation rule in HNAP. So we brought in the validation to be synchronized with this https://github.com/metadata101/iso19139.ca.HNAP/blob/5a2ca4838d95c7c7cc17bc9ec0eb61275311c4fa/src/main/plugin/iso19139.nap/schematron/schematron-rules-ec-multilingual.sch#L265-L269

ianwallen commented 9 months ago

@josegar74 This error occurred when we imported a record from FGP(HNAP 3.6) and attempted to push it back to FGP(HNAP 3.6). The record was valid in HNA(3.12)P but when pushed back to FGP(HNAP 3.6) it failed validation because HNAP 3.6 has this validation. So we simply added the same validation that exists in FGP(HNAP 3.6) so that we are consistent with the checking.

As you mention, this can only happen if external tool does not enforce this or if the user manually attempts to remove it using the XML editing.

ianwallen commented 8 months ago

@josegar74 This seems to be the issue

Your reference to electronicMailAddress https://github.com/metadata101/iso19139.ca.HNAP/blob/a4dd5e0d6aa240b74bff29879e2a31d0fc610ec4/src/main/plugin/iso19139.ca.HNAP/schema/gmd/citation.xsd#L87

is only required for the dtd if there is a <gmd:CI_Address>

For the record in question that was failing to publish to FGP, there was a contact but no <gmd:CI_Address>

<gmd:contact xmlns="http://www.isotc211.org/2005/gmd">
<gmd:CI_ResponsibleParty>
<gmd:individualName gco:nilReason="missing">
<gco:CharacterString/>
</gmd:individualName>
<gmd:organisationName xsi:type="gmd:PT_FreeText_PropertyType">
<gco:CharacterString>Government of Canada; Fisheries and Oceans Canada</gco:CharacterString>
<gmd:PT_FreeText>
<gmd:textGroup>
<gmd:LocalisedCharacterString locale="#fra">Gouvernement du Canada; Pêches et Océans Canada</gmd:LocalisedCharacterString>
</gmd:textGroup>
</gmd:PT_FreeText>
</gmd:organisationName>
<gmd:positionName gco:nilReason="missing" xsi:type="gmd:PT_FreeText_PropertyType">
<gco:CharacterString/>
</gmd:positionName>
<gmd:role>
<gmd:CI_RoleCode codeList="https://schemas.metadata.geo.ca/register/napMetadataRegister.xml#IC_90" codeListValue="RI_420">editor; réviseur</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>

So the DTD passed validation however it failed FGP validation due to the missing email that was required.

This PR will fix the issue however I'm not sure if you would prefer a fix in the schema. Please advise if you would prefer a different fix.