UltipaDocs
Try Playground
  • Introduction
  • GQL vs Other Languages
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Shortest Paths
    • Graph Patterns
    • Overview
    • Closed Graph
    • Open Graph
    • Graph Sharding and Storage
    • Constraints
    • Unique Identifiers
    • INSERT
    • INSERT OVERWRITE
    • UPSERT
    • SET
    • REMOVE
    • DELETE
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Scalar Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Type Conversion Functions
    • Table Functions
    • AI & Vector Functions
    • Database Functions
  • Operators
  • Predicates
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
  • Transactions
  • Triggers
  • Query Management
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Syntactic Notation
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Functions

Scalar Functions

Example Graph

The following examples run against this graph:

cardinality()

Returns the cardinality of a path, a list, or a record.

Syntaxcardinality(<expr>)
ArgumentsNameTypeDescription
<expr>PATH, LIST, RECORDThe input expression
Return TypeUINT
GQL
MATCH p = ()->{1,3}()
RETURN p, cardinality(p)

Result:

pcardinality(p)
5
3
3
GQL
LET myList = [1, 2, null, 3]
RETURN cardinality(myList)

Result:

cardinality(myList)
4
GQL
LET rec = RECORD{no: 1, value: "tennis"}
RETURN cardinality(rec)

Result:

cardinality(rec)
2

cast()

Specifies a data conversion.

Syntaxcast(<value> AS <type>)
ArgumentsNameTypeDescription
<value>/Value expression
<type>/A material value type
Return TypeAs specified by <type>
GQL
RETURN cast(1 AS String)

Result:

cast(1 AS String)
1

element_id()

Gets the unique identifier _uuid of a graph element.

Syntaxelement_id(<elemVar>)
ArgumentsNameTypeDescription
<elemVar>NODE, EDGEElement variable reference
Return TypeUINT64
GQL
MATCH (n)-[e]->()
RETURN element_id(n), element_id(e)

Result:

element_id(n)element_id(e)
87189710776125358101
87910286716504637452

labels()

Gets the label of a graph element.

Syntaxlabels(<elemVar>)
ArgumentsNameTypeDescription
<elemVar>NODE, EDGEElement variable reference
Return TypeSTRING
GQL
MATCH (n)-[e]->()
RETURN labels(n), labels(e)

Result:

labels(n)labels(e)
PaperCites
PaperCites