InsertObservations schema XML transformation

Added by Alessandro Oggioni almost 2 years ago

Dear all,
we tried to transform CSV file of observations into InsertObservation O&M XML schema.
Hale validates the instance but exporting in XML custom the results is only the first observation of the CSV, and the root XML elements was not closed.

In the Hale report we obtained this error:
javax.xml.stream.XMLStreamException: Attribute not associated with any element
at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeAttribute(XMLStreamWriterImpl.java:532)
at eu.esdihumboldt.hale.io.gml.writer.internal.GmlWriterUtil.writeAtt(GmlWriterUtil.java:187)
at eu.esdihumboldt.hale.io.gml.writer.internal.GmlWriterUtil.writeAttribute(GmlWriterUtil.java:174)
at eu.esdihumboldt.hale.io.gml.writer.internal.StreamGmlWriter.writeAttribute(StreamGmlWriter.java:1262)
at eu.esdihumboldt.hale.io.gml.writer.internal.StreamGmlWriter.writeProperties(StreamGmlWriter.java:971)
at eu.esdihumboldt.hale.io.gml.writer.internal.StreamGmlWriter.writeProperties(StreamGmlWriter.java:917)
at eu.esdihumboldt.hale.io.gml.writer.internal.StreamGmlWriter.writeMember(StreamGmlWriter.java:892)
at eu.esdihumboldt.hale.io.gml.writer.internal.StreamGmlWriter.write(StreamGmlWriter.java:608)
at eu.esdihumboldt.hale.io.gml.writer.internal.StreamGmlWriter.execute(StreamGmlWriter.java:245)
at eu.esdihumboldt.hale.common.core.io.impl.AbstractIOProvider.execute(AbstractIOProvider.java:102)
at eu.esdihumboldt.hale.ui.io.IOWizard$3.run(IOWizard.java:687)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

We attach the Hale project and the XML generated.

Thanks a lot for any answers.

Alessandro Oggioni and Simone Lanucara

InsertObsFromHale.halez - Hale project (18.3 kB)

InsertObsFromHale.xml - xml file (2.7 kB)


Replies (4)

RE: InsertObservations schema XML transformation - Added by Thorsten Reitz almost 2 years ago

Hi Alessandro,

Thanks for the repro case. There are two potential issues:

  1. I've checked the project and found that there is an issue with how the geometry inside SF_SpatialSamplingFeature is created. There is an error on the console on hale that hints at a problem when the assignment of lat lon value si made to pos. I've modified the project so that the assignment is made to coordinates instead.
  2. Did you use GML (WFS 2.0 FeatureCollection) as an export configuration? At least one of the releases of hale had an error that resulted in the stack trace you've shown in the older (by now, deprecated) GML (FeatureCollection) configuration.

HTH,
Thorsten

RE: InsertObservations schema XML transformation - Added by Alessandro Oggioni almost 2 years ago

Hi Thorsten,
thanks a lot for your support.

About two potential issues:
1. In order to verify if the issue was about geometry, we have completely deleted all the elements in featureOfInterst (is not a mandatory element). Anyway when we export the error is the same javax.xml.stream.XMLStreamException: Attribute not associated with any element ... .
2. About the export configuration we use the Transformed data - XML (Custom root element) and we define InsertObservation as root element. This is a root element of the O&M sosInsertObservation.xsd schema.

Regards

Alessandro

RE: InsertObservations schema XML transformation - Added by Thorsten Reitz almost 2 years ago

Hi Alessandro,

we've checked your project.

The core of the problem is that hale does normally expect to write objects to a collection object, e.g. Features to a FeatureCollection. In this case, the error message here seems to arise because there are multiple objects for the root element.

What we think you probably want is to have is 29 Observations instead of 29 InsertObservation. InsertObservation could serve as container for the observations, with the downside that offering, service and version attributes on the container cannot be provided right now in hale studio, because the collection element can't be actively mapped. This is something for which we did see the need occasionally before though, but haven't got around to implementing a solution.

So, the solutions I would see:

  • Create observations and use InsertObservation as container, the mandatory attributes service, version and offering are not filled.
  • Follow the approach as above and extend hale to allow configuration of the container element
  • Implement a custom writer that a) creates an InsertObservation file or b) even uploads the stuff to the SOS (similar to the WFS writer)

Let me know if you need more details on this.

All the best,
Thorsten

RE: InsertObservations schema XML transformation - Added by Alessandro Oggioni almost 2 years ago

Hi Thorsten.

Thanks a lot for your suggestions.

We have resolve our issue follow your first solution.

For as the thread is closed.

All the best,
Alessandro

(1-4/4)