Expressions

A TypeQL expression uses operators and functions to compute a value from other values. It uses the following syntax:

let <var> = <expression>;

Examples:

#!test[read]
match
let $x = 5;

let $y = $x * 3.1;

let $z = ceil($y + 1);

Validation

The following rules apply to variables involved in expressions:

  • The variables used on the right-hand side of an expression must be bound to either attributes or values.

  • The attribute may be of various attribute types as long as they all have the same value type.

  • A value variable must be assigned to exactly once.

During compilation, the types of every subexpression are resolved, and the expression tree is constructed. If any function which is passed an argument which does not match the expected type, or any operator which is not defined for the given combination of types, will fail compilation with an error.

Explore expressions

Syntax for literal values in TypeQL.

Arithmetic and other operators in TypeQL expressions.

Calling functions in TypeQL expressions.