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
420 stars 489 forks source link

Errors in converting ISO19115-3 metadata to ISO19139 #8220

Open ByronCinNZ opened 3 months ago

ByronCinNZ commented 3 months ago

Describe the bug In GeoNetwork 4.2.5, when exporting a metadata record to ISO19139 using the API and formatted for ISO19139. some elements produced are incorrect to ISO19139.

To Reproduce Steps to reproduce the behaviour:

  1. Create a validation ISO19115-3 metadata record that includes a thumbnail browse graphic and linage statement but no data quality elements
  2. Export this record via the API - curl -X GET http://localhost:8080/geonetwork/srv/api/records/46a6b1b7-642d-4d3a-bd6d-2d679d3a92a9/formatters/iso19139 > output139md.xml
  3. View this record in an XML editor and examine the gmd:graphicOverview element - a child gmd:linkage element will (incorrectly) be present. (This gmd:linkage element disappears if the record is imported into GeoNetwork.)
  4. In your XML editor, view the gmd:dataQualityInfo element - the child element to gmd:scope will be gmd:MD_Scope when it should be gmd:DQ_Scope

Expected behavior Output for gmd:scope on export to ISO19139 when a linage element is present and a dataaQualityInfo is not, should be:

<gmd:dataQualityInfo>
    <gmd:DQ_DataQuality>
      <gmd:scope>
        <gmd:DQ_Scope>
          <gmd:level>
            <gmd:MD_ScopeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#MD_ScopeCode" codeListValue="dataset" />
          </gmd:level>
        </gmd:DQ_Scope>
      </gmd:scope>
      <gmd:lineage>
        <gmd:LI_Lineage>
          <gmd:statement>
            <gco:CharacterString>Information that lets the user understand how the dataset was created over time.</gco:CharacterString>
          </gmd:statement>
          <gmd:source>
            <gmd:LI_Source>
              <gmd:description>
                <gco:CharacterString>Describe the Information Sources that went into building this dataset</gco:CharacterString>
              </gmd:description>
            </gmd:LI_Source>
          </gmd:source>
        </gmd:LI_Lineage>
      </gmd:lineage>
    </gmd:DQ_DataQuality>
  </gmd:dataQualityInfo>

And for Browse Graphic -

         <gmd:graphicOverview>
            <gmd:MD_BrowseGraphic>
               <gmd:fileName>
                  <gco:CharacterString>http://192.168.178.90:8082/geonetwork/srv/api/records/34321f47-08a0-4044-b76a-36d2d135126e/attachments/102718_1656_Differencea3.jpg</gco:CharacterString>
               </gmd:fileName>
               <gmd:fileDescription>
                  <gco:CharacterString>102718_1656_Differencea3.jpg</gco:CharacterString>
               </gmd:fileDescription>
            </gmd:MD_BrowseGraphic>
         </gmd:graphicOverview>

Instead of -

<gmd:graphicOverview>
        <gmd:MD_BrowseGraphic>
          <gmd:fileName>
            <gco:CharacterString>Filename for thumbnail image for the dataset</gco:CharacterString>
          </gmd:fileName>
          <gmd:fileDescription>
            <gco:CharacterString>Graphic thumbnail</gco:CharacterString>
          </gmd:fileDescription>
          <gmd:linkage>
            <gmd:CI_OnlineResource>
              <gmd:linkage>
                <gmd:URL>http://192.168.178.90:8082/geonetwork/srv/api/records/34321f47-08a0-4044-b76a-36d2d135126e/attachments/102718_1656_Differencea3.jpg</gmd:URL>
              </gmd:linkage>
              <gmd:protocol>
                <gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
              </gmd:protocol>
              <gmd:name gco:nilReason="missing">
                <gco:CharacterString />
              </gmd:name>
              <gmd:description gco:nilReason="missing">
                <gco:CharacterString />
              </gmd:description>
              <gmd:function>
                <gmd:CI_OnLineFunctionCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_OnLineFunctionCode" codeListValue="" />
              </gmd:function>
            </gmd:CI_OnlineResource>
          </gmd:linkage>
        </gmd:MD_BrowseGraphic>
      </gmd:graphicOverview>

Screenshots If applicable, add screenshots to help explain your problem.

Log file If applicable, add the server log file to help trace your problem.

Desktop (please complete the following information):

Additional context Cannot test in GN 4.4 as the ISO19139 formatted is not functioning - submitted separate bug report

fxprunayre commented 3 months ago

@ByronCinNZ , can you check https://github.com/geonetwork/core-geonetwork/pull/8224 and https://github.com/geonetwork/core-geonetwork/pull/8225. For the overview GeoNetwork does not encode it using linkage element so I'm not sure we should add more global support of it but at least the PR will fix the invalid ISO19139 document. Thanks