From: Dustin P. <dparker@Forwardslope.com> - 2011-10-04 04:12:29
|
Our use case is classifying features into different SLD rules depending on whether they have at least one attribute of a certain name or if they have zero of that attribute. The attribute in question happens to be a subfeature. The logic for IsNullImpl is: 1. Evaluate the expression 2. "Unpack" the expression 3. Check that value against null In 2.7-M2 (pre-3576), "unpacking" meant "if this is an Attribute, return the value of the attribute. Otherwise, just return the object unchanged." Now "unpacking" means "if this is a ComplexAttribute, return the value of the child attribute named 'simpleContent', returning null if it has no such attribute. If this is an Attribute, return the value of the attribute. Otherwise, just return the object unchanged." I don't know why such specific logic was included in the patch in the first place, so I don't feel comfortable just writing a patch to revert the behavior. A little searching seems to suggest it's an internal property: http://docs.geotools.org/latest/javadocs/org/geotools/gml3/bindings/GML3EncodingUtils.html#encodeSimpleContent%28org.opengis.feature.ComplexAttribute,%20org.w3c.dom.Document,%20org.w3c.dom.Element%29 Here's what I think IsNull should do: 1. Evaluate the expression 2. If the result is a nillable Property, return true iff getValue() is null 3. Return true iff the object is null But I don't know how to work that simpleContent check in there since I don't know what it's for. Sorry if this seems like an awful lot of verbosity for such a trivial thing, I just don't want to break anything :) On 10/3/2011 6:45 PM, Jody Garnett wrote: > Well it is hard because XML would not really let you have a "null" value > for a ComplexAttribute. It is more like "occurs" = 0 in the sense of > minOccurs and maxOccurs? Basically the representation of "null" is > simply not to include the complex attribute? > > You could try and have some weasel room with a ComplexAttribute that is > empty returning true for isNull? Basically indicating that it holds no > content. > > What is the use case you are trying to solve? > -- > Jody Garnett > > On Tuesday, 4 October 2011 at 9:46 AM, Dustin Parker wrote: > > > I don't have a patch yet because I'm not sure what the right > behavior for ComplexAttribute should be. Any hints? > > -----Original Message----- > From: Jody Garnett [mailto:jod...@gm...] > Sent: Mon 10/3/2011 3:36 PM > To: Dustin Parker > Cc: geo...@li... > <mailto:geo...@li...> > Subject: Re: [Geotools-gt2-users] GEOT-3576 patch breaks isNull test > forcomplex attributes - Email found in subject - Email found in subject > > Okay I am in the Process of releasing 8.0-M2 now; so what I need is > someone to review your GEOT-3576 patch and get it applied (and I can > apply it just before the release here). > > The trouble is not many developers work on the application schema > codebase; so we need to be sure to include a test case with each > patch on this topic (so the person reviewing can confirm your fix > does something). > > -- > Jody Garnett > > > On Tuesday, 4 October 2011 at 6:15 AM, Dustin Parker wrote: > > > No dice; 8-SNAPSHOT executes the same codepath as 8.0-M1 and > achieves the same result. > > -----Original Message----- > From: Dustin Parker [mailto:dparker@Forwardslope.com] > Sent: Mon 10/3/2011 10:15 AM > To: Jody Garnett > Cc: geo...@li... > <mailto:geo...@li...> > (mailto:geo...@li...) > Subject: Re: [Geotools-gt2-users] GEOT-3576 patch breaks isNull > test forcomplex attributes - Email found in subject - Email > found in subject > > > Yes sir, I will try 8-SNAPSHOT. > > -----Original Message----- > From: Jody Garnett [mailto:jod...@gm...] > Sent: Sun 10/2/2011 4:24 AM > To: Dustin Parker > Cc: geo...@li... > <mailto:geo...@li...> > (mailto:geo...@li...) > Subject: Re: [Geotools-gt2-users] GEOT-3576 patch breaks isNull > test for complex attributes - Email found in subject > > There has been a change with respect to handling of all filters > - specifically for AppSchema. I was going to release a M2 > shortly; if you would not rechecking the functionality of > 8-SNAPSHOT to see how / if it addresses your problem it would be > appreciated. > > Indeed on the geotools-devel list we have been discussing > (today) the difference between an isNull and a WFS2 isNil filter > (where isNil is supposed to test the existence; rather than just > the value). > -- > Jody Garnett > > > On Saturday, 1 October 2011 at 5:53 AM, Dustin Parker wrote: > > Hey all, > > Our app uses GeoTools and app-schema features. We've been > using 2.7-M2 > for a while, and I wanted to update to 8.0-M1 since it fixes > some > concurrency bugs in the factory implementation. However, it > breaks > isNull expressions that are testing for the existence of > complex > attributes. It all comes down to this method in > org.geotools.filter.FilterAbstract: > > private Object unpack(Object value) { > > if (value instanceof org.opengis.feature.ComplexAttribute){ > Property simpleContent = > ((org.opengis.feature.ComplexAttribute)value).getProperty(new > NameImpl("simpleContent")); > if (simpleContent == null) { > return null; > } else { > return simpleContent.getValue(); > } > } > > if(value instanceof org.opengis.feature.Attribute){ > return ((org.opengis.feature.Attribute)value).getValue(); > } > > return value; > } > > Because we really are testing for the existence of a complex > attribute, > and that attribute doesn't have a property named > {}simpleContent, this > returns null and isNull always returns true. > > Is this the correct behavior? It's changed from 2.7-M2, and > it just > seems counterintuitive. If this is the correct behavior, is > there a > better way to check for null complex attributes? > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is > seriously valuable. > Why? It contains a definitive record of application > performance, security > threats, fraudulent activity, and more. Splunk takes this > data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2dcopy2 > _______________________________________________ > Geotools-gt2-users mailing list > Geo...@li... > <mailto:Geo...@li...> > (mailto:Geo...@li...) > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data > and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Geotools-gt2-users mailing list > Geo...@li... > <mailto:Geo...@li...> > (mailto:Geo...@li...) > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > |