[GeoNetwork-devel] Convert FGDC to ISO on import

I'm trying to convert FGDC metadata to ISO on import, but am running into a problem. I have an xsl that does the transformation, and verified that it works by transforming an example FGDC metadata to ISO with Saxon, then importing the ISO into GeoNetwork (2.6.0). However, when I do the whole process in GeoNetwork (I added the xsl to xsl/conversion/import), I get the error "Root element not set". I did a little digging in the code, and found that the incoming metadata gets transformed twice. First, it does the FGDC -> ISO transformation, and it looks like that works as expected. Then, it does the extract-uuid.xsl transformation. The problem is that the extract-uuid.xsl being used is the one from the fgdc-std schemas folder, instead of the one from the iso19139 folder, so it's trying to transform an iso19139 metadata with an fgdc xsl. My question: is this a bug or the desired behavior? And if this is the desired behavior, is there any other way to do the conversion on import (storing the metadata in 19139)?

Thanks,
Ryan

Hi Ryan, looks like a bug.

Here is a patch to be tested:
http://trac.osgeo.org/geonetwork/ticket/344

Thanks for your feedback.

Francois

2010/10/8 Ryan Zoerb <razoerb@anonymised.com>:

I'm trying to convert FGDC metadata to ISO on import, but am running into a problem. I have an xsl that does the transformation, and verified that it works by transforming an example FGDC metadata to ISO with Saxon, then importing the ISO into GeoNetwork (2.6.0). However, when I do the whole process in GeoNetwork (I added the xsl to xsl/conversion/import), I get the error "Root element not set". I did a little digging in the code, and found that the incoming metadata gets transformed twice. First, it does the FGDC -> ISO transformation, and it looks like that works as expected. Then, it does the extract-uuid.xsl transformation. The problem is that the extract-uuid.xsl being used is the one from the fgdc-std schemas folder, instead of the one from the iso19139 folder, so it's trying to transform an iso19139 metadata with an fgdc xsl. My question: is this a bug or the desired behavior? And if this is the desired behavior, is there any other way to do the conversion on import (storing the metadata in 19139)?

Thanks,
Ryan
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hi Ryan,
Can those XSLT files be shared? If so, could you provide your work as a patch for integration into GeoNetwork?
Kind regards,
Jeroen

On 8 okt 2010, at 18:24, Ryan Zoerb wrote:

I'm trying to convert FGDC metadata to ISO on import, but am running into a problem. I have an xsl that does the transformation, and verified that it works by transforming an example FGDC metadata to ISO with Saxon, then importing the ISO into GeoNetwork (2.6.0). However, when I do the whole process in GeoNetwork (I added the xsl to xsl/conversion/import), I get the error "Root element not set". I did a little digging in the code, and found that the incoming metadata gets transformed twice. First, it does the FGDC -> ISO transformation, and it looks like that works as expected. Then, it does the extract-uuid.xsl transformation. The problem is that the extract-uuid.xsl being used is the one from the fgdc-std schemas folder, instead of the one from the iso19139 folder, so it's trying to transform an iso19139 metadata with an fgdc xsl. My question: is this a bug or the desired behavior? And if this is the desired behavior, is there any other way to do the conversion on import (storing the metadata in 19139)?

Thanks,
Ryan
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

  On 10/12/10 4:25 AM, Jeroen Ticheler wrote:

Hi Ryan,
Can those XSLT files be shared? If so, could you provide your work as a patch for integration into GeoNetwork?
Kind regards,
Jeroen

NOAA has developed a suite of XSLTs for converting variants of FGDC CSGDM metadata into ISO 19139. We'd like to contribute these and other enhancements to the harvest scripts into the trunk.

Doug.

On 8 okt 2010, at 18:24, Ryan Zoerb wrote:

I'm trying to convert FGDC metadata to ISO on import, but am running into a problem. I have an xsl that does the transformation, and verified that it works by transforming an example FGDC metadata to ISO with Saxon, then importing the ISO into GeoNetwork (2.6.0). However, when I do the whole process in GeoNetwork (I added the xsl to xsl/conversion/import), I get the error "Root element not set". I did a little digging in the code, and found that the incoming metadata gets transformed twice. First, it does the FGDC -> ISO transformation, and it looks like that works as expected. Then, it does the extract-uuid.xsl transformation. The problem is that the extract-uuid.xsl being used is the one from the fgdc-std schemas folder, instead of the one from the iso19139 folder, so it's trying to transform an iso19139 metadata with an fgdc xsl. My question: is this a bug or the desired behavior? And if this is the desired behavior, is there any other way to do the conversion on import (storing the metadata in 19139)?

Thanks,
Ryan
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

--
Douglas D. Nebert
Senior Advisor for Geospatial Technology, System-of-Systems Architect
FGDC Secretariat T:703 648 4151 F:703 648-5755 C:703 459-5860

We had a similar problem with a DIF-to-ISO19139 xsl conversion to run before
import. I made a patch like this to work around it. The current proposed
patch would still throw an exception for unknown schema formats such as DIF
when it does the initial autodetectSchema() although it would fix FGDC-ISO
xsl issue
Cheers
Murray

### Eclipse Workspace Patch 1.0
#P geonetwork
Index: web/src/main/java/org/fao/geonet/kernel/mef/Importer.java

--- web/src/main/java/org/fao/geonet/kernel/mef/Importer.java (revision
6646)
+++ web/src/main/java/org/fao/geonet/kernel/mef/Importer.java (working copy)
@@ -193,6 +193,16 @@
         Element categs = null;
         Element privileges;
         boolean validate = false;
+
+
+ String style = Util.getParam(params, Params.STYLESHEET,
+ "_none_");
+
+ // Apply a stylesheet transformation if requested
+ if (!style.equals("_none_"))
+ md.add(index, Xml.transform(md.get(index), stylePath
+ + FS + style));
+

         Element metadata = md.get(index);
         String schema = dm.autodetectSchema(metadata);
@@ -229,13 +239,7 @@
           privileges.addContent(new Element("operation")
               .setAttribute("name", "featured"));

- String style = Util.getParam(params, Params.STYLESHEET,
- "_none_");

- // Apply a stylesheet transformation if requested
- if (!style.equals("_none_"))
- md.add(index, Xml.transform(md.get(index), stylePath
- + FS + style));

           // Get the Metadata uuid if it's not a template.
           if (isTemplate.equals("n"))
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Convert-FGDC-to-ISO-on-import-tp5615564p5639170.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.