geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
428 stars 489 forks source link

ISO 19115-3 rules validation for "Associated resources" never validates #4623

Closed chiarachiarelli closed 3 years ago

chiarachiarelli commented 4 years ago

Trying to add one or more "Associated resource" with "Association Type" and "Initiative Type" the ISO validator for ISO19115-3 gives 10 times the same error "When a resource is associated, a name or a metadata reference MUST be specified" which though doesn't seem resolvable.

Here follows an exampe of xml that gives 10 times the same error: "When a resource is associated, a name or a metadata reference MUST be specified."

        <mri:associatedResource>
            <mri:MD_AssociatedResource>
               <mri:name>
                  <cit:CI_Citation>
                     <cit:title>
                        <gco:CharacterString>EU Project: Weburn - IEA (International Energy Agency) Weyburn CO2 monitoring and storage project</gco:CharacterString>
                     </cit:title>
                  </cit:CI_Citation>
               </mri:name>
               <mri:associationType>
                  <mri:DS_AssociationTypeCode codeList="http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#DS_AssociationTypeCode"
                                              codeListValue="dependency"/>
               </mri:associationType>
               <mri:initiativeType>
                  <mri:DS_InitiativeTypeCode codeList="http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#DS_InitiativeTypeCode"
                                             codeListValue="project"/>
               </mri:initiativeType>
            </mri:MD_AssociatedResource>
         </mri:associatedResource>

Screenshots image

GeoNetwork Version 3.10.*

ioulosve commented 4 years ago

I'm investigating this and I found that the reason why it happens is that in the schematron rules file, the variable where the associated resource name is stored is empty.

I'm referring to the variable $nameTitle here: https://github.com/metadata101/iso19115-3.2018/blob/24ae19dddd0cd791d3978f8e99e080798eef001e/src/main/plugin/iso19115-3.2018/schematron/schematron-rules-iso.sch#L1536

I also checked with a online XPath tester that the context xpath of the rule is correct.

Hope these findings can be helpful.

pvgenuchten commented 3 years ago

Maybe it is related to #4805, geonetwork expects a uuid, not a hyperink?

josegar74 commented 3 years ago

The problem is that the metadata validated is enhanced with the geonet namespace, to link the UI elements with the validation rules. The rule matches any element in //mri:MD_DataIdentification/mri:associatedResource/*, checking also these elements and causing the validation error.

Going to update it to discard elements in the geonet namespace