Modifying FunctionName to support detailed info about argument/return parameters.
Currently the FunctionName interface only represents some limited information about a function in terms of its arguments:
- number of arguments
- argument names
This proposal is to extend the list to include:
- argument types
- min/max argument occurrences
- return type
The latest version of the OGC filter specification (FES 2.0) requires that the above information be included in a filter capabilities document when describing supported functions.
The current patch implementing this proposal can be found here.
Voting has not started yet:
- Andrea Aime: +1
- Ben Caradoc-Davies +0
- Christian Mueller +0
- Ian Turton +0
- Justin Deoliveira: +1
- Jody Garnett (current OSGeo representative): +1
- Simone Giannecchini +0
This section is used to make sure your proposal is complete (did you remember documentation?) and has enough paid or volunteer time lined up to be a success
- API changed based on BEFORE / AFTER
- Update default implementation
- Update the user guide
- Update the existing function implementations
Existing Parameter class to extend new interface:
In order to take advantage of the new api function implementations will have to be migrated in order to declare the required information. However since there are numerous function implementations out there a gradual migration path has to be put in place.
Since all functions today already declare either an argument count, or a set of argument names all the required information can be derived from that alone. For instance of a function simply declares that it takes 2 arguments we derive the following:
If a function declares two arguments named "foo" and "bar" we derive the following:
Moving forward it is expected that new function implementations will declare arguments explicitly. And that existing function implementations will do so as the need arises. The following is an example of how to do so. Consider a function named "strIn" that determines if a "String" is "in" a list of specified strings. The function arguments are the string being tested for existance, a boolean determining whether case should be taken into account, and finally a variable list of candidate string values.
functionName method is static and avaialble to all subclasses of
Since arguments declare min/max occurrences it is possible to have variable arguments (ie. arguments that take an arbitrary number of values) and optional arguments.
Obviously this presents challenges when attempting to dispatch a function call using the current mechanism in which filter functions are invoked. So to maintain backward compatibility and prevent requiring a different mechanism for invoking filter functions we adopt the same convention as the Java language in that only the last argument to a function may be variable or optional. This convention is enforced with the help of a convenience method on the function base class FunctionImpl.
Sanity check - Existing Variable Length Functions
Note existing variable length functions from app-schema and Symbology Encoding (concatenate, interpolate) has been defined without regards to the above convention.
Interpolate represents a worst case senario where repeating pairs are required as shown below:
In addition note the use of Parameter.OPTIONS to indicate arguments that are restricted to a small set of allowable values.