[GeoNetwork-devel] [GeoNetwork opensource Developer website] #1123: MCP MEF export/import fails... with possible data corruption

#1123: MCP MEF export/import fails... with possible data corruption
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: critical | Milestone: v2.8.0
Component: General | Version: v2.8.0RC2
Keywords: |
-----------------------+----------------------------------------------------
MEF import fails on MCP record.

Step to reproduce
  - I creat at dummy MCP 1.4 record.
  - Search for the record
  - Check the checkbox related to the record found and then select "action
on selected item" and then select "Export Zip" - this seems to have
generated a proper MEF file.
  - I unzipped the files
  - Edited the metadata.xml file - as a test I changed the title of the
document.
  - I rezipped - the new metadata.xml into the zip/MEF file.
  - I upload the MEF file specifying to overwrite changes.

Expected results
   -I expected the title of the document to have changed to the new one bug
it did not.
   - Also it seems to have corrupted the document because if I try to
export it again I get the following error "Root element not set"

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1123&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1123: MCP MEF export/import fails... with possible data corruption
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: critical | Milestone: v2.8.0
Component: General | Version: v2.8.0RC2
Keywords: |
-----------------------+----------------------------------------------------

Comment(by ianwallen):

I believe I found the source of the problem. I noticed exported MCP
exported MEF file contain a folder called metadata which contains
"metadata.iso19139.xml" and "metadata.xml"

If I remove the metadata.iso19139.xml file then the import is successful.
The info.xml specifies <schema>iso19139.mcp-1.4</schema> so I'm not sure
why it would be attempting to load the "metadata.iso19139.xml" file.

Based on the current documentation for MEF V2 on http://geonetwork-
opensource.org/manuals/trunk/developer/mef/index.html it does mention that
there can be an "(optional) metadata.profil.xml (ISO19139profil)" however
it does not indicate the purpose and if it is ignored during the load.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1123#comment:1&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1123: MCP MEF export/import fails... with possible data corruption
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: critical | Milestone: v2.8.0
Component: General | Version: v2.8.0RC2
Keywords: |
-----------------------+----------------------------------------------------

Comment(by ianwallen):

Note: From a recent test it seems that when the metadata.iso19139.xml file
exists, it is putting the "metadata.iso19139.xml" content in the
"metadata" field of the database and ignoring the "metadata.xml" record.
it is putting "gmd:MD_Metadata" in the "root" field of the database when
it should have been "mcp:MD_Metadata" - it did seem to leave the SchemaID
as "iso19139.mcp-1.4".

In this case the metadata table contain a mix of iso19139.mcp-1.4 and
iso19139 which is causing the errors noted above.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1123#comment:2&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1123: MCP MEF export/import fails... with possible data corruption
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: critical | Milestone: v2.8.0
Component: General | Version: v2.8.0RC2
Keywords: |
-----------------------+----------------------------------------------------

Comment(by fxp):

In config.xml, you could update the preferredSchema to iso19139.mcp-1.4 so
it should load by default mcp record if found. But it looks like there is
an issue with the schema detection.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1123#comment:3&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1123: MCP MEF export/import fails... with possible data corruption
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: critical | Milestone: v2.8.0
Component: General | Version: v2.8.0RC2
Keywords: |
-----------------------+----------------------------------------------------

Comment(by ianwallen):

If I remove the metadata.iso19139.xml file from the MEF file, it load
correctly. It does not seem to be related to schema detection. It seems
more related to the MEF import process attempting to load the wrong file
(or attempting to load both).

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1123#comment:4&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1123: MCP MEF export/import fails... with possible data corruption
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: critical | Milestone: v2.8.0
Component: General | Version: v2.8.0RC2
Keywords: |
-----------------------+----------------------------------------------------

Comment(by ianwallen):

I believe there are 2 issues

1 - I was just looking at the java code and this is what I think it is
currently doing.

{{{
if metadata is the preferred schema the load that schema.
else if it is a recognized schema then load that schema.
else generate error
}}}

      But I think the logic should be

{{{
if the metadata is a recognized schema and it is the schemaid specified in
the info.xml then load that schema.
else if metadata is the preferred schema the load that schema.
else if it is a recognized schema then load that schema.
else generate error
}}}

      I found some comment which specifies

{{{
    // Schema in info.xml is not used anymore.
    // as we use autodetect schema to define
    // metadata schema.
    // String schema = null;

}}}

      But in this case, it seems like the schema in the info.xml would be
useful in picking the right schema.

2 - The other issue seems to be that it is inserting the wrong schemaid in
the database. Not sure if I'm reading the code correctly but it seems that
"handleInfo" uses a different method than "handleMetadataFiles" in
detecting the metadata schema - they should probably use a common
function.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1123#comment:5&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1123: MCP MEF export/import fails... with possible data corruption
------------------------+---------------------------------------------------
  Reporter: ianwallen | Owner: geonetwork-devel@…
      Type: defect | Status: closed
  Priority: critical | Milestone: v2.8.0
Component: General | Version: v2.8.0RC2
Resolution: fixed | Keywords:
------------------------+---------------------------------------------------
Changes (by simonp):

  * status: new => closed
  * resolution: => fixed

Comment:

Also just looked at this now (been busy on other things for some time so
couldn't until now) - seems that the to19139.xsl should reset the
metadataStandardName and metadataStandardVersion to something other than
MCP otherwise the metadata.iso19139.xml file will not be recognized as
belonging to iso19139 schema.

Check out commit 78cc76f346bdce434867f2ad1bc579684d96cfdb

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1123#comment:6&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.