Validation of InsertSensor XML ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Validation of InsertSensor XML ?

Derek Hohls
Hi

I am trying to run an InsertSensor against a 52N SOS instance.

I have pre-validated the XML file against the OGC schema downloaded from http://www.opengeospatial.org/standards/sensorml#schemas

i.e.
xmllint -schema schemas/sos/2.0/sosInsertSensor.xsd --noout /tmp/sensor.xml

But I get numerous errors from the insert operation - please see https://pastebin.com/a5dWbBW5 for the file and  https://pastebin.com/X0sv8T5y for the errors.

Is there a difference between the schema that 52N SOS uses vs the one available from OGC; if so, how do I proceed to make sure that I am creating valid InsertSensor files?

Thanks
Derek
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

Please consider the environment before printing this email.
_______________________________________________
SWE mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: Validation of InsertSensor XML ?

Carsten Hollmann
Hi Derek,

the SOS uss the OGC schema but I am not sure if the "xmllint" command
checks elements in an XML document which are defined as "any" (as it is
done for the content of the "procedureDesription").
Because the exceptions are thrown because the procedureDesciption is
invalid.

As the first exception said, the description element is defined at the
wrong place. It has to be before the gml:identifier.

"Attribute not allowed (no wildcards allowed): name in element
identifier@http://www.opengis.net/sensorml/2.0" means that the "name"
attribute is not allowed in the "sml:identifier" element.

"Expected element 'label@http://www.opengis.net/sensorml/2.0' instead of
'value@http://www.opengis.net/sensorml/2.0' here in element
Term@http://www.opengis.net/sensorml/2.0" means that the required
"sml:label" element is missing.

"string value 'Intestinal Enterococci' does not match pattern for
xs:NCName" means that the value is invalid. For NCName the value should
not contain blank spaces. In your case all "name" attributes in the
"sml:output" elements.

There are some differences in the element definitions between SensorML
1.0.1 and SensorML 2.0. SO it is not always possible to define the
elements of a SensorML 2.0 description similar to the elements of a
SensorML 1.0.1 description.

Best,
Carsten
_______________________________________________
SWE mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: Validation of InsertSensor XML ?

Derek Hohls
Thanks Carsten

By trial-and-error I nailed down the last few problems (as highlighted by yourself); unfortunately, it seems even using lxml (a Python library) its actually impossible to fully validate against the official OGC schema where these "any" elements are included.

My last issue is try and get the featureOfInterestType working; below is a fragment of some of my jinja template code (which I hope is understandable?):

{% if feature_type == 'point' %}
<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint</sos:featureOfInterestType>{% endif %}
{% if feature_type == 'curve' %}
<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingCurve</sos:featureOfInterestType>{% endif %}
{% if feature_type == 'surface' %}
<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingSurface</sos:featureOfInterestType>{% endif %}
{% if feature_type == 'solid' %}
<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingSolid</sos:featureOfInterestType>{% endif %}
{% if feature_type == 'feature' %}
<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SpatialSamplingFeature</sos:featureOfInterestType>{% endif %}
{% if feature_type == 'specimen' %}
<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_Specimen</sos:featureOfInterestType>{% endif %}


Anyway, I get an error if, for example, I try and use:

<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SpatialSamplingFeature</sos:featureOfInterestType>

but:

<sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint</sos:featureOfInterestType>

works without a problem.

I have tried digging into the schema to see why, but its not very clear.  Should any of these options be allowed?  Or is there a restriction?

Any help, guidance or pointers appreciated.

Thanks
Derek


>>> Carsten Hollmann <[hidden email]> 09/27/17 10:33 AM >>>
Hi Derek,

the SOS uss the OGC schema but I am not sure if the "xmllint" command
checks elements in an XML document which are defined as "any" (as it is
done for the content of the "procedureDesription").
Because the exceptions are thrown because the procedureDesciption is
invalid.

As the first exception said, the description element is defined at the
wrong place. It has to be before the gml:identifier.

"Attribute not allowed (no wildcards allowed): name in element
identifier@http://www.opengis.net/sensorml/2.0" means that the "name"
attribute is not allowed in the "sml:identifier" element.

"Expected element 'label@http://www.opengis.net/sensorml/2.0' instead of
'value@http://www.opengis.net/sensorml/2.0' here in element
Term@http://www.opengis.net/sensorml/2.0" means that the required
"sml:label" element is missing.

"string value 'Intestinal Enterococci' does not match pattern for
xs:NCName" means that the value is invalid. For NCName the value should
not contain blank spaces. In your case all "name" attributes in the
"sml:output" elements.

There are some differences in the element definitions between SensorML
1.0.1 and SensorML 2.0. SO it is not always possible to define the
elements of a SensorML 2.0 description similar to the elements of a
SensorML 1.0.1 description.

Best,
Carsten
_______________________________________________
SWE mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines


_______________________________________________
SWE mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: Validation of InsertSensor XML ?

Carsten Hollmann
Hi Derek,

the 52N SOS expects the concrete types, e.g. .../SF_SamplingPoint,
...SF_SamplingCurve.

So the more general type
"http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SpatialSamplingFeature"
is not yet supported.

Best,
Carsten

Am 03.10.2017 um 11:05 schrieb Derek Hohls:

> Thanks Carsten
>
> By trial-and-error I nailed down the last few problems (as highlighted by yourself); unfortunately, it seems even using lxml (a Python library) its actually impossible to fully validate against the official OGC schema where these "any" elements are included.
>
> My last issue is try and get the featureOfInterestType working; below is a fragment of some of my jinja template code (which I hope is understandable?):
>
> {% if feature_type == 'point' %}
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint</sos:featureOfInterestType>{% endif %}
> {% if feature_type == 'curve' %}
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingCurve</sos:featureOfInterestType>{% endif %}
> {% if feature_type == 'surface' %}
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingSurface</sos:featureOfInterestType>{% endif %}
> {% if feature_type == 'solid' %}
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingSolid</sos:featureOfInterestType>{% endif %}
> {% if feature_type == 'feature' %}
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SpatialSamplingFeature</sos:featureOfInterestType>{% endif %}
> {% if feature_type == 'specimen' %}
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_Specimen</sos:featureOfInterestType>{% endif %}
>
>
> Anyway, I get an error if, for example, I try and use:
>
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SpatialSamplingFeature</sos:featureOfInterestType>
>
> but:
>
> <sos:featureOfInterestType>http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint</sos:featureOfInterestType>
>
> works without a problem.
>
> I have tried digging into the schema to see why, but its not very clear.  Should any of these options be allowed?  Or is there a restriction?
>
> Any help, guidance or pointers appreciated.
>
> Thanks
> Derek
>
>
>>>> Carsten Hollmann <[hidden email]> 09/27/17 10:33 AM >>>
> Hi Derek,
>
> the SOS uss the OGC schema but I am not sure if the "xmllint" command
> checks elements in an XML document which are defined as "any" (as it is
> done for the content of the "procedureDesription").
> Because the exceptions are thrown because the procedureDesciption is
> invalid.
>
> As the first exception said, the description element is defined at the
> wrong place. It has to be before the gml:identifier.
>
> "Attribute not allowed (no wildcards allowed): name in element
> identifier@http://www.opengis.net/sensorml/2.0" means that the "name"
> attribute is not allowed in the "sml:identifier" element.
>
> "Expected element 'label@http://www.opengis.net/sensorml/2.0' instead of
> 'value@http://www.opengis.net/sensorml/2.0' here in element
> Term@http://www.opengis.net/sensorml/2.0" means that the required
> "sml:label" element is missing.
>
> "string value 'Intestinal Enterococci' does not match pattern for
> xs:NCName" means that the value is invalid. For NCName the value should
> not contain blank spaces. In your case all "name" attributes in the
> "sml:output" elements.
>
> There are some differences in the element definitions between SensorML
> 1.0.1 and SensorML 2.0. SO it is not always possible to define the
> elements of a SensorML 2.0 description similar to the elements of a
> SensorML 1.0.1 description.
>
> Best,
> Carsten
> _______________________________________________
> SWE mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/swe
> http://sensorweb.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>
>
> _______________________________________________
> SWE mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/swe
> http://sensorweb.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>

--
Carsten Hollmann

52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Münster, Germany

E-Mail: [hidden email]
Fon: +49 (0)-251-396371-35
Fax: +49 (0)-251-396371-11
http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
_______________________________________________
SWE mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines