Hi, I'm trying to continue Justin's work on simple features backed by arrays of Objects and I'm having issues with validation, it seems to me I've found a design flaw with restrictions.
Restrictions in the new feature model are created by using Filter objects attached to the attribute type definition, the filter is applied to the value and it has to decide whether it's valid or not. With the standard Feature implementation the "value" is in fact an Attribute, meaning not really just the value, but also its name and whatnot. Given a filter such as "len(myStrAtt) < 3" to be used as a restriction, the evaluation over the "value" goes fine because we have a PropertyAccessor that is able to evaluate myStrAtt against a Property, which Attribute is a subclass. Enter the "real" simple feature. There is no Attribute around, we only have the AttributeDescriptor on one side, and the actual value on the other. Trying to apply the above filter on the value fails. Trying to wrap the value into a Attribute built just for the sake of validation works, but seems "wrong". Given the AttributeType and the value the validation should have all it needs, no? The problem seems to be logical to me thought. The validation is expressed at the level of AttributeType, a level where the attribute name is not even known (the actual attribute name is in the descriptor). As such, the filter that sets up a restriction should not try to use the attribute name at all, but use a generic way to say "the value", whatever is the value passed to the filter for evaluation. The fact that the validation works with the current simple features is purely incidental, because AttributeType and AttributeDescriptor share the same name, but that's not true in general. Yet, a filter specified of a restriction of the type should be logically using the name of the type, and not the name of the descriptor (whilst the Attribute name is the one of the descriptor). Is there any way to setup an expression that returns the "feature" itself, that is, one that always does satisfy: expr.evaluate(a) -> a If we had that kind of expression, let's call it <theValue>, then the attribute validation above could be expessed as: "len(<theValue>) < 3" and that could work in all cases. It seems to me that the opengis model does not have such a thing, which would imply the validation on GeoAPI is ill defined? Opinions? Cheers Andrea ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel