Skip to content
Developer Edition runs on one host and does not require a product license file. Need multi-host deployment or performance testing at scale? Explore Enterprise Edition

Expressions overview

An expression is, in general, a declaration of constants, variables, operators, function calls and many others that evaluate to a specific value. In GQL, there are many forms of expressions, such as function call expressions that invoke functions, label expressions that match one or more labels of a graph element, value expressions that evaluate to values or constants, and so on. The sections below show how to use these expressions in GQL queries.

Functions

A function is a command that maps input arguments to return values according to pre-defined algorithms. In this documentation, we uniquely introduce and identify a function using a function signature for explanatory purposes.

GQL provides a set of built-in functions that you can use in your queries. You can run the command SHOW FUNCTIONS to view all the functions.

The following are the types of functions supported by GQL:

Function signatures

The function signature defines the function name, the names and data types of arguments, and the data type of the return value.

The following example shows the function signature of the element_id() function:

element_id(n: NODE) -> INT64
Where:

  • element_id is the function name.
  • n is the name of the argument, which can be the return value of a value expression.
  • NODE is the data type of the argument. You can find the supported data types for each function's argument by using the command SHOW FUNCTION <function_name>.
  • UINT64 is the data type of the return value. You can find the data type of the return value by using the command SHOW FUNCTION <function_name>.
  • If the function is variadic, the last input parameter is followed by the ellipsis (...) symbol.

Null behavior

The null behavior defines how a function behaves when any of its arguments are NULL. In GQL, the following null behaviors are defined:

  • default: The function returns a NULL value result if any of its arguments are NULL.
  • ignore: The function ignores NULL in its arguments.
  • error: The function returns an error if any of its arguments are NULL.
  • general: The function returns a function-specific result if any of its arguments are NULL.

For the null behavior of each function, see the corresponding topic.

Operators

An operator is a symbol or keyword that performs operations on one or more operands. For more information about the operators supported by GQL, see Operators.

Predicates

A predicate specifies a condition that evaluates to a boolean value. GQL supports the following types of predicates:

Value expressions

A value expression specifies a value or a constant. GQL supports the following types of value expressions:

Label expressions

A label expression specifies one or more labels that are used to identify a graph element. For more information, see Label expressions.