[wfs-dev] null values

Andreas v.Dömming v.doemming at tuhh.de
Mon Oct 30 05:13:40 EST 2006


John, list

thinking about use-cases where "nillable" is needed I found this:
Assume you have a list of 2 properties in your data model, null-values should 
be allowed, but also the order of the values has a meaning.
Here you can not use minOccurs="0" because you will loose the value's order.

<FeatureA>
  <orderedEntry>value<orderedEntry/>
  <!-- is the first or the second orderedEntry a null-value ?-->
</FeatureA>

But you can enforce to keep the order by using the nillable-attribute:

<xs:element name="orderedEntry" minOccurs="2" maxOccurs="2" nillable="true"
 type="xs:string">

<FeatureA>
  <orderedEntry xs:nil="true"/>
  <orderedEntry>value<orderedEntry/>
</FeatureA>

Nevertheless, I agree that in most use-cases the minOccurs="0" is the better 
choice. But depending on the model it is not allways possible.

Regards,
 Andreas

Am Freitag, 27. Oktober 2006 16:52 schrieb John Herring:
> Bart,
> 	I have a problem with "nillable". See XML Schema,
> Part 1, Section 3.3.3, bullet 2.2 at
> http://www.w3.org/TR/xmlschema11-1/#d0e5913
>
> 	If I am reading this right, if you use a "ref" (a
> global element specification) to specify a subelement of a
> type in a schema, then "nillable" cannot be used, and your
> only shot at NULL versus NOT NULL is "minOccurs=0".  Which
> means that any concept of a nillable subelement of a feature
> must be included in any global definition of the original
> element, not specified differently for different uses.
>
> 	That sounds a little off, and consideration the
> times we naturally use ref in application schemas, a bit
> dangerous.
>
> Regards,
> John
>
> You do what you can when you can because you can.
>
> The opinions expressed in this email are purely my own and
> do not necessarily represent the opinions of any
> organization
> or otherwise sane person or persons.
>
> John R. Herring
> Architect, Spatial Products
> Oracle Corporation
> One Oracle Drive
> Nashua, New Hampshire 03062
> ph: 1 603 897 3216
> fx: 1 603 897 3334
>
> Annue cœptis - Novus Ordo Seclorum
>
>
> -----Original Message-----
> From: Bart van den Eijnden (OSGIS) [mailto:bartvde at osgis.nl]
>
> Sent: Friday, October 27, 2006 10:31 AM
> To: John Herring; 'Bart van den Eijnden OSGIS';
> wfs-dev at opengeospatial.org
> Subject: RE: [wfs-dev] null values
>
> Hi John,
>
> I think XMLSchema deals with this by having the minOccurs as
> well as the nillable attribute on an element.
>
> So minOccurs="1" nillable="false" would mean NOT NULL.
>
> Best regards,
> Bart
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
>
>
> --------- Oorspronkelijk bericht --------
> Van: John Herring <john.herring at oracle.com>
> Naar: 'Bart van den Eijnden OSGIS' <bartvde at osgis.nl>,
> wfs-dev at opengeospatial.org <wfs-dev at opengeospatial.org>
> Onderwerp: RE: [wfs-dev] null values
> Datum: 27/10/06 11:36
>
> > Bart,
> >
> > 	Most systems have their own way of dealing with
>
> NULLs. In XML is
>
> > seems to be simply leaving out the element.
> > Which leads to an interesting philosophic question about
>
> your
>
> > proposal.
> >
> > 	If one writes:
> >
> > &lt;MYFIRSTITEM&gt;aaa&lt;/MYFIRSTITEM&gt;
> > &lt;PRIORITY/&gt;
> > &lt;MYTHIRDITEM&gt;zzz&lt;/MYTHIRDITEM&gt;
> >
> > 	And the original schema calls for PRIORITY's
>
> minOccurs to be 1, have
>
> > you violated the intent of the schema? In SQL you get to
>
> put in
>
> > &quot;NOT NULL&quot; and in XML you get to put in
> > &quot;minOccurs=1&quot; and force a value. In either of
>
> your
>
> > suggestions with a PRIORITY element, you are not in
>
> violation of a
>
> > &quot;minOccurs=1&quot; but you are in violation of the
>
> semantics of
>
> > not allowing a NULL.
> >
> > 	Personally, I thing that IONIC is right and the only
>
> way to do this
>
> > is the way the XML gurus meant us to do it, which is with
>
> minOccurs=0
>
> > and missing elements. On the other hand, GML's multiple
>
> flavors of
>
> > NULL does something else altogether, but at least you can
>
> force an
>
> > application schema not to use it (the equivalent of a NOT
>
> NULL).
>
> > Regards,
> > John
> >
> > You do what you can when you can because you can.
> >
> > The opinions expressed in this email are purely my own and
>
> do not
>
> > necessarily represent the opinions of any organization or
>
> otherwise
>
> > sane person or persons.
> >
> > John R. Herring
> > Architect, Spatial Products
> > Oracle Corporation
> > One Oracle Drive
> > Nashua, New Hampshire 03062
> > ph: 1 603 897 3216
> > fx: 1 603 897 3334
> >
> > Annue cœptis - Novus Ordo Seclorum
> >
> >
> > -----Original Message-----
> > From:
> > wfs-dev-bounces+john.herring=oracle.com at opengeospatial.org
>
> [mailto:wfs-dev-bounces+john.herring=oracle.com at opengeospati
>
> > al.org] On Behalf Of Bart van den Eijnden (OSGIS)
> > Sent: Friday, October 27, 2006 9:06 AM
> > To: wfs-dev at opengeospatial.org
> > Subject: [wfs-dev] null values
> >
> > Hi list,
> >
> > how is a WFS supposed to deal with null values?
> >
> > I can see 3 options (for instance an attribute named
> > PRIORITY):
> >
> >
> > 1) just output an empty element (I guess not the cleanest
>
> approach
>
> > since it cannot be distinguished from an empty
> > string)
> >
> > &lt;MYFIRSTITEM&gt;aaa&lt;/MYFIRSTITEM&gt;
> > &lt;PRIORITY&gt;&lt;/PRIORITY&gt;
> > &lt;MYTHIRDITEM&gt;zzz&lt;/MYTHIRDITEM&gt;
> >
> > I think this is how Mapserver WFS operates.
> >
> >
> > 2)
> > Leave out the respective element in the reponse.
> >
> > &lt;MYFIRSTITEM&gt;aaa&lt;/MYFIRSTITEM&gt;
> > &lt;MYTHIRDITEM&gt;zzz&lt;/MYTHIRDITEM&gt;
> >
> > This is what Ionic WFS does.
> >
> > 3)
> > An option I have not yet seen, output
>
> xsi:nil=&quot;true&quot; for the
>
> > respective element?
> >
> > &lt;MYFIRSTITEM&gt;aaa&lt;/MYFIRSTITEM&gt;
> > &lt;PRIORITY xsi:nil=&quot;true&quot;&gt;&lt;/PRIORITY&gt;
> > &lt;MYTHIRDITEM&gt;zzz&lt;/MYTHIRDITEM&gt;
> >
> > Ofcourse the 1) and 3) behaviour is easier to process (for
>
> instance
>
> > with
> > XSLT) than the second one.
> >
> > Should the WFS spec say something about this? Or is it up
>
> to the
>
> > vendor? It would make life easier if they all did the same
>
> thing IMHO.
>
> > And I guess 3) is the cleanest approach.
> >
> > Thanks in advance for any input on this.
> >
> > Best regards,
> > Bart
> >
> > --
> > Bart van den Eijnden
> > OSGIS, Open Source GIS
> > http://www.osgis.nl
> >
> >
> >
> >
> >
> > _______________________________________________
> > wfs-dev mailing list
> > wfs-dev at opengeospatial.org
> > https://mail.opengeospatial.org/mailman/listinfo/wfs-dev
>
> _______________________________________________
> wfs-dev mailing list
> wfs-dev at opengeospatial.org
> https://mail.opengeospatial.org/mailman/listinfo/wfs-dev



More information about the wfs-dev mailing list