Expression Pattern Language (eXPL)

eXPL Calls

Calls temporarily transfer control to elsewhere to either perform an operation using an external library or access eXPL script shared by several queries to avoid duplication. To call an external library in eXPL is easy to do, but does require coding a library provider which contains an eXPL adapter for each supported function. A particular "calculator query" format is used to make calls which execute queries and is described next page.

The use of calls is discouraged as they can be inefficient and a source of obscure bugs which are hard to fix.

Function Call

The declaration for a function call has format:

[ name = ] library.function ( [ arguments ] );

The library function is identified by a 2-part name. The library will have a function provider implementation containing functions which are referenced by name. Optional are:

  1. The function returns a value. If it does, the function can be used in an assignment expression.
  2. The function takes a comma-delimited set of arguments consisting of constants, variables or expressions

On the programming side, two interfaces in package au.com.cybersearch2.classy_logic.interfaces must be implemented:

  1. CallEvaluator, an eXPL adapter interface which wraps each library function
  2. FunctionProvider, a container interface for obtaining CallEvaluator objects

Note that FunctionProvider has a generic function return type, which can be a specific type supported by eXPL, such as String. When more than one type is returned, then choose Object and when no value is returned, choose Void. All of the just mentioned classes are in package java.lang.

A function must never return null. If a value is needed to indicate an error has occurred, return Double.NaN for a Number type, otherwise return an unkown object (au.com.cybersearch2.classy_logic.helper.Unkown).