UltipaDocs
Products
Solutions
Resources
Company
Start Free Trial
UltipaDocs
Start Free Trial
  • Introduction
  • GQL vs Other Languages
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Questioned Paths
    • Shortest Paths
    • Cheapest Paths
    • K-Hop Traversal
    • Graph Patterns
    • Overview
    • Open Graphs
    • Closed Graphs
    • Graph Types
    • Constraints
    • Projections
    • Storage Maintenance
    • Node and Edge IDs
    • INSERT
    • INSERT OVERWRITE
    • UPSERT
    • MERGE
    • SET
    • REMOVE
    • DELETE
    • FOREACH
    • LOAD CSV
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Element Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Null Functions
    • Utility Functions
    • Type Conversion Functions
    • Table Functions
  • Operators
  • Predicates
    • Overview
    • CASE
    • LET Value Expression
    • Value Query Expression
    • List Expressions
    • Current Values
    • Index
    • Full-text Index
    • Vector Index
  • Transactions
  • Triggers
  • Query Management
  • Execution Plan
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Naming Conventions
    • Syntactic Notation
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Functions

Type Conversion Functions

cast()

Converts a value to the specified type.

Syntaxcast(<value> AS <type>)
ArgumentsNameTypeDescription
<value>AnyThe value to convert
<type>/Target type (see supported types below)
Return TypeAs specified by <type>

Supported target types:

CategoryTypes
IntegerINT, INTEGER, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, UINT64
FloatFLOAT, FLOAT32, FLOAT64, DOUBLE, DECIMAL, REAL
StringSTRING, TEXT, VARCHAR
BooleanBOOL, BOOLEAN
TemporalDATE, LOCAL TIME, LOCAL DATETIME, TIMESTAMP, ZONED DATETIME, DURATION
CollectionLIST, RECORD
BinaryBYTES, BINARY
GQL
RETURN cast(1 AS STRING), cast("42" AS INT), cast("true" AS BOOL)

to_integer()

Converts a value to an integer. Returns null if conversion is not possible.

Syntaxto_integer(<value>)
ArgumentsNameTypeDescription
<value>INT, FLOAT, BOOL, or STRINGThe value to convert
Return TypeINT
GQL
RETURN to_integer("42"), to_integer(3.7), to_integer(true)

Result: 42, 3, 1

to_float()

Converts a value to a float. Returns null if conversion is not possible.

Syntaxto_float(<value>)
ArgumentsNameTypeDescription
<value>FLOAT, INT, BOOL, or STRINGThe value to convert
Return TypeFLOAT
GQL
RETURN to_float("3.14"), to_float(42), to_float(true)

Result: 3.14, 42, 1

to_string()

Converts a value to a string. Returns null if conversion is not possible.

Syntaxto_string(<value>)
ArgumentsNameTypeDescription
<value>AnyThe value to convert
Return TypeSTRING
GQL
RETURN to_string(42), to_string(3.14), to_string(true)

Result: "42", "3.14", "true"

to_boolean()

Converts a value to a boolean. Returns null if conversion is not possible. Accepted string values: "true", "t", "yes", "y", "1" for true; "false", "f", "no", "n", "0" for false (case-insensitive).

Syntaxto_boolean(<value>)
ArgumentsNameTypeDescription
<value>BOOL, INT, FLOAT, or STRINGThe value to convert
Return TypeBOOL
GQL
RETURN to_boolean("true"), to_boolean(1), to_boolean("yes")

Result: true, true, true

to_list()

Converts a value to a list. Strings are split into a list of characters. Paths are converted to a list of alternating nodes and edges. Other values are wrapped in a single-element list.

Syntaxto_list(<value>)
ArgumentsNameTypeDescription
<value>AnyThe value to convert
Return TypeLIST
GQL
RETURN to_list("hello")

Result: ["h", "e", "l", "l", "o"]

to_map()

Creates a record (map) from key-value pairs.

Syntaxto_map(<key1>, <value1> [, <key2>, <value2>, ...])
ArgumentsNameTypeDescription
<key>STRINGA key name
<value>AnyThe value for the preceding key
Return TypeRECORD
GQL
RETURN to_map("name", "Alice", "age", 30)

Result: {"name": "Alice", "age": 30}