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
  • Backup and Restore
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Syntactic Notation
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Syntax

Comments

Single-Line Comments

In GQL, single-line comments are written using either two forward slashes // or two minus signs --. Everything following // or -- on the same line is treated as a comment and ignored during query execution.

GQL
MATCH (:User {name: "rowlock"})-[:Follows]->(n:User) // Retrieves users followed by rowlock
RETURN n.name

A path expression should not juxtapose a token that exposes a minus sign on the right (]-, <-, -) followed by a token that exposes a minus sign on the left (-[, ->, -), as this combination introduces the comment symbol --.

This query throws syntax error since it concatenates <- and - without any separators:

GQL - Syntax Error
MATCH (:User {name: "rowlock"})<--(n:User)
RETURN n

Instead, you can use a space between the two abbreviated edge patterns:

GQL
MATCH (:User {name: "rowlock"})<- -(n:User)
RETURN n

Multi-Line Comments

Multi-line comments begin with a forward slash and asterisk (/*) and end with an asterisk and forward slash (*/), allowing for comments that span multiple lines.

GQL
/* This query retrieves users followed by rowlock,
and returns all their names */
MATCH (:User {name: "rowlock"})-[:Follows]->(n:User)
RETURN n.name