Hi Nuno,
I believe your schema violates GML encoding rules; this issue has bitten me
in the past, you should find in the mailing list archives several
discussions on this topic.

You could also go through the GML 3.2.1 specification, in partucular
paragraph 7.1.

I'm copying here a few passages, that were also cited in this ML:

*A GML object is an XML element of a type derived directly or indirectly
from gml:AbstractGMLType. From this derivation, a GML object shall have a
gml:id attribute.*

*A GML property shall not be derived from gml:AbstractGMLType, shall not
have a gml:id attribute, or any other attribute of XML type ID.*

*An element is a GML property if and only if it is a child element of a GML
object.*

*A GML object shall not appear as the immediate child of a GML object.*
*Consequently, no element may be both a GML object and a GML property.*

Here's the rationale behind these rules:

*This encoding pattern is sometimes referred to as the "object-property
model" and has been the basis of the GML encoding model since the first
version was adopted by OGC. While in some cases this encoding pattern adds
extra levels of elements in instance documents it also provides significant
benefits: It helps to make a GML instance document understandable on its
own, provides a predictable structure and avoids too heavy reliance on XML
Schema as it is expected that GML instance documents may outlive the common
use of W3C XML Schema language.*


So, going back to your schema, you DO need to wrap your Measurement object
in a measurement property:

<st:measurement>
  <st:Measurement>
    <st:name>...</st:name>
    ...
  </st:Measurement>
</st:measurement>


App-Schema's feature chaining and the GML encoder are based on the
assumption that the schema abides by the GML encoding rules and won't work
otherwise...

Ben, please correct me if I'm wrong :-)


This is probably bad news for you, sorry about that...


On Wed, Nov 2, 2016 at 11:09 AM, Nuno Oliveira <
nuno.olive...@geo-solutions.it> wrote:

> Hi,
>
> I have a doubt regarding the way GML complex features encoder handles a
> sub collection of features, i.e. chained features.
>
> The example use case is the representation of some meteorological stations
> measurements in GML. The complex feature
> represents a station were the measurements are represented as a sub
> collection of features. The XML expected representation
> would be something like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wfs:FeatureCollection ...>
>     <st:featureMember>
>         <st:StationFeature gml:id="1">
>             <st:name>station 1</st:name>
>             <st:contact>
>                 <st:mail>stati...@mail.com</st:mail>
>             </st:contact>
>             <st:measurement>
>                 <st:name>temp</st:name>
>                 <st:unit>c</st:unit>
>                 <st:value>35.5</st:value>
>             </st:measurement>
>             <st:measurement>
>                 <st:name>wind</st:name>
>                 <st:unit>km/h</st:unit>
>                 <st:value>110.5</st:value>
>             </st:measurement>
>             <st:geometry>
>                 <gml:Point srsName="http://www.opengis.ne
> t/gml/srs/epsg.xml#4326">
> <gml:coordinates>50.0,60.0</gml:coordinates>
>                 </gml:Point>
>             </st:geometry>
>         </st:StationFeature>
>     </gml:featureMember>
> </wfs:FeatureCollection>
>
> The first GML based schema I wrote for this didn't work, i.e. the
> measurements sub collection was not encoded by
> the encoder, please find that schema attached with name stations1.xsd.
> After some investigation I found that my
> problem was in this piece of code:
>
> https://github.com/geotools/geotools/blob/master/modules/ext
> ension/xsd/xsd-gml3/src/main/java/org/geotools/gml3/binding
> s/ComplexSupportXSAnyTypeBinding.java#L176-L177
>
> Basically no child elements were extracted, and in this case the child
> elements were the station measurements. After checking
> the app-schema examples I came up with this second schema that worked,
> please find that schema attached with name stations2.xsd.
>
> The main difference is that I wrapped the measurement element with the
> MeasurmentPropertyType:
>
> <xs:complexType name="MeasurementPropertyType">
>   <xs:sequence minOccurs="0">
>     <xs:element ref="st:Measurement"/>
>   </xs:sequence>
>   <xs:attributeGroup ref="gml:AssociationAttributeGroup"/>
> </xs:complexType>
>
> This stations use case is just an example, I have a much more complex use
> case with the same problem were I cannot change the schema.
> So I'm wondering, did anyone had a similar use case ? did I made something
> wrong in the app-schema mappings-file ? is this something is
> just not supported by the encoder ? and did my first schema actually makes
> sense (in my point of view it looks sane) ?
>
> Any help with this will be very very welcomed :)
>
> Regards,
>
> Nuno Oliveira
>
> --
> ==
> GeoServer Professional Services from the experts!
> Visit http://goo.gl/it488V for more information.
> ==
> Nuno Miguel Carvalho Oliveira
> @nmcoliveira
> Software Engineer
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054  Massarosa (LU)
> Italy
>
> phone: +39 0584 962313
> fax:   +39 0584 1660272
> mob:   +39 333 8128928
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono
> da considerarsi strettamente riservate. Il loro utilizzo è consentito
> esclusivamente al destinatario del messaggio, per le finalità indicate
> nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il
> destinatario, Vi preghiamo cortesemente di darcene notizia via e
> -mail e di procedere alla distruzione del messaggio stesso, cancellandolo
> dal Vostro sistema. Conservare il messaggio stesso, divulgarlo
> anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo
> per finalità diverse, costituisce comportamento contrario ai
> principi dettati dal D.Lgs. 196/2003.
>  The information in this message and/or attachments, is intended solely
> for the attention and use of
> the named addressee(s) and may be confidential or proprietary in nature or
> covered by the provisions of privacy act (Legislative Decree
> June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in
> accord with its purpose, any disclosure, reproduction, copying,
> distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender
> does not give any warranty or accept liability as the content,
> accuracy or completeness of sent messages and accepts no responsibility
> for changes made after they were sent or for other risks which
> arise as a result of e-mail transmission, viruses, etc.
>
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>


-- 

Best regards,
Stefano Costa

==
GeoServer Professional Services from the experts!
Visithttp://goo.gl/it488V for more information.
==
Dott. Stefano Costa
Senior Software Engineer

GeoSolutions S.A.S.Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272
http://www.geo-solutions.ithttp://twitter.com/geosolutions_it

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate.
Il loro utilizzo è consentito esclusivamente al destinatario del
messaggio, per le finalità indicate nel messaggio stesso. Qualora
riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
diverse, costituisce comportamento contrario ai principi dettati dal
D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely
for the attention and use of the named addressee(s) and may be
confidential or proprietary in nature or covered by the provisions of
privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New
Data Protection Code).Any use not in accord with its purpose, any
disclosure, reproduction, copying, distribution, or either
dissemination, either whole or partial, is strictly forbidden except
previous formal approval of the named addressee(s). If you are not the
intended recipient, please contact immediately the sender by
telephone, fax or e-mail and delete the information in this message
that has been received in error. The sender does not give any warranty
or accept liability as the content, accuracy or completeness of sent
messages and accepts no responsibility  for changes made after they
were sent or for other risks which arise as a result of e-mail
transmission, viruses, etc.
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to