These are expressions for use in projection ports - value selectors, entity filters, and data selectors.

Operators

The following basic operators are supported:


() grouping
+ addition
- subtraction
*
multiplication
/ division
&& and 
|| or
! not
== equals
!= does not equal
> greater than
< less than
>= greater than or equall to
<= less than or equal to
-N negative number
. attribute lookup
isNull() Tests if value is null, returns boolean. 


All language operations require type consistency. Values can be cast between types as described in the Casting section below.

 

Conditionals


The ?: operator can be used to specify a value dependent on a condition:

 

<condition> ? <value if true> : <value if false>


Example:

 

wheels > 4 ? "high end" : "low end"

 

Numeric Literals


Numbers without a decimal point are interpreted as being of type integer, and numbers with a decimal point are interpreted as type float. (Check out the Type System.)


Entity Literals


Entity literals can be declared with curly braces, similar to javascript.

 

{<attribute type> <attribute name>: <value>, ...}

 

The type specifier is optional. If it is omitted the type is inferred from the value provided.


The name specifier does not need to be in quotes if it is a single word containing only alphanumeric characters and underscores. Attribute names consisting of arbitrary strings can, however, be put in single or double quotation marks. Escape characters (/t, /n, /', /", etc.) are not available. 


Collection Literals


Collection literals (list, set, or multiset) can be declared using square brackets. 

 

[<type> | <value>, ...]

 

The type specifier is optional. If it is omitted the type is inferred from the value provided. The | separator should also be omitted in this case.


A small m before the opening bracket indicates that the collection is a multiset, i.e. it can contain duplicate values). A lowercase "s" indicates that it is a set, i.e. it cannot contain duplicate values. If neither is present, the collection will be interpreted as a list, i.e. it is ordered.


Casting


Values of one type can be cast to another type with the following syntax.

 

<target type>(<value>)

 

For example, a float can be cast to an integer like this:

 

<integer>(<3.1>)


 

Not all types are castable. Primitive types like integer and string cannot be cast to structured types like entity or collection, nor vice versa. Instead, use a literal or the attribute lookup syntax described above.


Input Value


The duffle selector can use the name of the projection input port to refer to the original input value. This is not available in the entity filter or value selectors. A typical use would be if the incoming data was an entity containing duffles. The desired duffle might be specified like this:

 

data.publications


 

Input Entity


Entity filters, id selectors, and value selectors can refer to the entire incoming entity that they are operating on with an asterisk in curly braces.

 

{*}
{*}.myAttribute
getAttr({*}, "my attribute with spaces in the name")