Skip to main content

Introduction

In ContexQL, functions are a powerful tool used to perform operations on objects or their relationships within the data graph. These functions can analyze or extract specific information from objects and their connections, and they play a critical role in formulating precise queries.

Function Characteristics

  1. Operations and Results:
    • A function executes a defined operation on an object, its metadata, or its relationships.
    • It produces a result that can be used within logic conditions or expressions.
  2. Parameters:
    • Functions may require parameters, which provide input values needed for the function to perform its task.
    • Parameters can be mandatory or optional, depending on the function's design.
  3. Typing:
    • Both function results and parameters are strongly typed, meaning each has a specified data type (e.g., boolean, string, number).
    • A type mismatch between parameters and expected types will result in a runtime error.

Invocation Syntax

The syntax for invoking functions is strictly defined to ensure clarity and consistency:

  • '@' symbol: Indicates the start of a function call.
  • Function name: Identifies the function being invoked.
  • Parentheses (): Enclose the parameters passed to the function.
  • Parameters: Listed within the parentheses, separated by commas if multiple. Parameters can be omitted if none are required. If a function requires no parameters, simply use empty parentheses: @function_name()