Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Friendly enough expression language (FEEL) for the purpose of giving standard executable semantics to many kinds of expressions in decision model has the following features;

...

There is no value for NaN, positiveInfinity, or negativeInfinity. Use null instead.

string

Literal strings can be double-quoted or single quoted sequence of characters. e.g. "abc" All strings compared as UTF-8 encoding.

boolean

Boolean literals are true and false.

time

Feel does not have time literals although time values can be expressed using a string literal and time built-in function.

Time values also have optional time zone offset. If no time zone offset specified, time is interpreted as local time of day.

Time data type has also provides an context of sequence of numbers for the hour, minute, second, and an optional time offset.

date

Feel does not have time literals although time values can be expressed using a string literal and date built-in function.

Date values has no time zone offset and interpreted as UTC time zone.

Date data type has also provides an context of sequence of numbers for the year, month, day of month.

date time

...

FEEL ExpressionValue
decimal(1,2)1.00
.25 + 0.20.45
0.10 * 30.003.0000
1 + 3/2*2 - 2 ** 3-4.0
1/30.333333333
decimal(1/3, 2)0.22
1 = 1.0000true
1.01 / 20.505
decimal(0.502, 2)0.50
decimal(0.515, 2)0.52
1.0*10**31000.0


string

Literal strings can be double-quoted or single quoted sequence of characters. e.g. "abc" All strings compared as UTF-8 encoding.

boolean

Boolean literals are true and false.

time

Feel does not have time literals although time values can be expressed using a string literal and date and time built built-in function.

Date time Time values also have optional time zone offset.  If If no time zone offset specified, time is interpreted as UTC local time zoneof day.

Date time Time data type has also provides an context of sequence of numbers for the year, month, day, numbers for the hour, minute, second, and an optional time offset.

...

date

Feel does not have time literals although time values can be expressed using a string literal and days and time durationdate built-in function. Duration format expressed in ISO 8601 duration syntax.

Days and time duration Date values has no time zone offset and interpreted as UTC time zone.

Date data type has also provides an context of sequence of numbers for the daysthe year, hours, minutes, and seconds of duration and normalized such that the sum of these numbers is minimized. For example; FEEL(duration("P0DT25H")) = P1DT1H

...

month, day of month.

date time

Feel does not have time literals although time values can be expressed using a string literal and years and months durationand date time built-in function. Duration format expressed in ISO 8601 duration syntax.Days and time duration data type has also provides an

Date time also have optional time zone offset. If no time zone offset specified, time is interpreted as UTC time zone.

Date time data type has also provides an context of sequence of numbers for the years and months of duration and normalized such that the sum of these numbers is minimized. For example; FEEL(duration("P0Y13M")) = P1Y1M

Lists and filters

Lists are immutable and may be nested. First element of list can be accessed using L[1] and last element accessed using L[-1]. If no element exists in list then L[n] = null.

Lists can be filtered with a boolean expression in square brackets. The expression in square brackets can reference a list element using name "item". If list entries is a context, item entries may be referenced within filter expression without item prefix. For example;

...

the year, month, day, hour, minute, second, and optional time offset.

days and time duration

Feel does not have time literals although time values can be expressed using a string literal and days and time duration built-in function. Duration format expressed in ISO 8601 duration syntax.

Days and time duration data type has also provides an context of sequence of numbers for the days, hours, minutes, and seconds of duration and normalized such that the sum of these numbers is minimized. For example; FEEL(duration("P0DT25H")) = P1DT1H

years and months duration

Feel does not have time literals although time values can be expressed using a string literal and years and months duration built-in function. Duration format expressed in ISO 8601 duration syntax.

Days and time duration data type has also provides an context of sequence of numbers for the years and months of duration and normalized such that the sum of these numbers is minimized. For example; FEEL(duration("P0Y13M")) = P1Y1M

Lists and filters

Lists are immutable and may be nested. First element of list can be accessed using L[1] and last element accessed using L[-1]. If no element exists in list then L[n] = null.

Lists can be filtered with a boolean expression in square brackets. The expression in square brackets can reference a list element using name "item". If list entries is a context, item entries may be referenced within filter expression without item prefix. For example;

    [1, 2, 3, 4][item > 2] = [3, 4]
    [{x:1, y:2}, {x:2, y:3}][x=1] = {x:1, y:2}

For convenience a selection using "." operator with a list of contexts on its left hand side returns a list of selections. For example;

    [{x:1, y:2}, {x:2, y:3}][x=1] = {x:1, y:2}

For convenience a selection using "." operator with a list of contexts on its left hand side returns a list of selections. For example;

    [{x:1, y:2}, {x:2, y:3}].y = [2,3]

Context

Context is a collection of key and expression pairs called context entries. Keys are mapped to string values. The syntax for selecting value of context entry named key1 from context1 is "context1.key1"

To retrieve a list of key,value pairs from a context m, the following built-in function may be used: get entries(m).

Range

...

.y = [2,3]

Context

Context is a collection of key and expression pairs called context entries. Keys are mapped to string values. The syntax for selecting value of context entry named key1 from context1 is "context1.key1"

To retrieve a list of key,value pairs from a context m, the following built-in function may be used: get entries(m).

Range

Feel supports the compact syntax for range of values. 

FEEL ExpressionValue
5 in ( <=5 )true
5 in ( (5..10] )false
5 in ( [5..10] )true
5 in ( 4, 5, 6 )true
5 in ( <5, >5 )false
2012-12-31 in ( (2012-12-25..2013-02-14) )true


Negation

Negation is performed with builtin not function. Semantics of negation is;

...

Name and ParametersParameterDescriptionExample

list contains(list, element)

list, any element of the semantic domain including null

does the list contain the element ?

list contains([1,2,3], 2) = true

count(list)

list

return size of list

count([1,2,3]) = 3

min(list)
min(c1,..., cN), N >1 max(list)
max(c1,..., cN), N >1

(list of) comparable items

return minimum item
return maximum item

min([1,2,3]) = 1
min(1,2,3) = 1
max([1,2,3]) = 3
max(1,2,3) = 3

sum(list)
sum(
n1,..., nN), N >1

(list of) numbers

return sum of numbers

sum([1,2,3]) = 6
sum(1,2,3) = 6

mean(list)
mean(
n1,..., nN), N >1

(list of) numbers

return arithmetic mean (average) of numbers

mean([1,2,3]) = 2
mean(1,2,3) = 2

and(list)
and(
b1,..., bN), N >1

(list of) Boolean items

return false if any item is false, else true if all items are true, else null

and([false,null,true]) = false and(false,null,true) = false
and([]) = true
and(0) = null

or(list)
or(
b1,..., bN), N >1

(list of) Boolean items

return true if any item is true, else false if all items are false, else null

or([false,null,true]) = true
or(false,null,true) = true
or([]) = false
or(0) = null

sublist(list, start position, length?)

list, number1, number2

return list of length (or all) elements of list, starting with list[start position]. 1st position is 1, last position is -1

sublist([1,2,3], 1, 2) = [2]

append(list, item...)

list, any element including null

return new list with items appended

append([1], 2, 3) = [1,2,3]

concatenate(list...)

list

return new list that is a concatenation of the arguments

concatenate([1,2],[3]) = [1,2,3]

insert before(list, position, newItem)

list, number1, any element including null

return new list with newItem inserted at position

insert before([1,3],1,2) = [1,2,3]

remove(list, position)

list, number1

list with item at position removed

remove([1,2,3], 2) = [1,3]

reverse(list)

list

reverse the list

reverse([1,2,3]) = [3,2,1]

index of(list, match)

list, any element including null

return ascending list of list positions containing match

index of([1,2,3,2],2) = [2,4]

union(list...)

list

concatenate with duplicate removal

union([1,2],[2,3]) = [1,2,3]

distinct values(list)

list

duplicate removal

distinct values([1,2,3,2,1] = [1,2,3]

flatten(list)

list

flatten nested lists

flatten([[1,2],[[3]], 4]) = [1,2,3,4]

...