You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sis.apache.org by Martin Desruisseaux <ma...@geomatys.fr> on 2012/11/29 18:34:48 UTC

Back on "real work" object: NilReason

Hello all

After a very long while committing accessory stuff, I have been back on 
"serious" objects today. I just committed the following interface 
together with support classes:

https://builds.apache.org/job/sis-jdk7/site/apidocs/org/apache/sis/xml/NilObject.html

In summary, the ISO 19115 standard (the standard which define metadata) 
declare some metadata as optional, and some metadata as mandatory. 
However the ISO 19139 standard (the standard which specify how to 
express ISO 19115 in XML) said that we are allowed to omit a mandatory 
metadata, provided that we explain why we omitted it. There is a list of 
predefined NilReason which include: INAPPLICABLE, MISSING, TEMPLATE, 
UNKNOWN, WITHHELD and OTHER.

In Java, we can not really express "nil value" by null, because "nil 
value" are not completely nil... They may still be associated to XLink 
or the above-cited NilReason. So the proposed approach, which was 
implemented in Geotk, is to still return an instance of the metadata 
object, but the instance additionally implements the NilObject marker 
interface - meaning "I'm totally empty from an ISO 19115 point of view - 
but I may still have some ISO 19139 attributes, in particular a 
NilReason attribute" (sorry for the headache... The OGC/ISO standards 
are very complex...). The above-cited javadoc contains an example of 
what it looks like in XML.

Is there any comment about this approach?

     Martin


Re: Back on "real work" object: NilReason

Posted by Greg Reddin <gr...@gmail.com>.
On Thu, Nov 29, 2012 at 11:34 AM, Martin Desruisseaux <
martin.desruisseaux@geomatys.fr> wrote:

> In Java, we can not really express "nil value" by null, because "nil
> value" are not completely nil... They may still be associated to XLink or
> the above-cited NilReason. So the proposed approach, which was implemented
> in Geotk, is to still return an instance of the metadata object, but the
> instance additionally implements the NilObject marker interface - meaning
> "I'm totally empty from an ISO 19115 point of view - but I may still have
> some ISO 19139 attributes, in particular a NilReason attribute" (sorry for
> the headache... The OGC/ISO standards are very complex...). The above-cited
> javadoc contains an example of what it looks like in XML.
>
> Is there any comment about this approach?


I think this looks like a good approach. On first glance I wondered if
using some kind of enum or constant would be preferable, but it sounds like
a marker interface is more flexible. It gives you the flexibility to
include the other attributes you were referring to.

Greg

Re: Back on "real work" object: NilReason

Posted by "Mattmann, Chris A (388J)" <ch...@jpl.nasa.gov>.
+1 I like the interface approach as the flag b/c we can always sense it using
instanceof, or use a method typing approach to signal it.

Cheers,
Chris

On Nov 29, 2012, at 9:34 AM, Martin Desruisseaux wrote:

> Hello all
> 
> After a very long while committing accessory stuff, I have been back on "serious" objects today. I just committed the following interface together with support classes:
> 
> https://builds.apache.org/job/sis-jdk7/site/apidocs/org/apache/sis/xml/NilObject.html
> 
> In summary, the ISO 19115 standard (the standard which define metadata) declare some metadata as optional, and some metadata as mandatory. However the ISO 19139 standard (the standard which specify how to express ISO 19115 in XML) said that we are allowed to omit a mandatory metadata, provided that we explain why we omitted it. There is a list of predefined NilReason which include: INAPPLICABLE, MISSING, TEMPLATE, UNKNOWN, WITHHELD and OTHER.
> 
> In Java, we can not really express "nil value" by null, because "nil value" are not completely nil... They may still be associated to XLink or the above-cited NilReason. So the proposed approach, which was implemented in Geotk, is to still return an instance of the metadata object, but the instance additionally implements the NilObject marker interface - meaning "I'm totally empty from an ISO 19115 point of view - but I may still have some ISO 19139 attributes, in particular a NilReason attribute" (sorry for the headache... The OGC/ISO standards are very complex...). The above-cited javadoc contains an example of what it looks like in XML.
> 
> Is there any comment about this approach?
> 
>    Martin
>