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

GQL vs Other Languages

This page compares GQL with other popular graph query languages to help you understand the differences and similarities.

GQL vs Cypher

Cypher is a query language created by Neo4j. GQL (ISO/IEC 39075) is the international standard that drew inspiration from Cypher but is vendor-neutral and designed for interoperability.

Syntax Comparison

FeatureGQLCypher
Create nodesINSERTCREATE
Directed edge()->()()-->()
Undirected edge()-()()-()
Variable-length path-{1,5}*1..5
Multi-label (AND)(:A&B)(:A:B)
Label OR(:A|B)Not supported
Any label(:%)Not supported
Variable assignmentLET x = ...WITH ... AS x
List iterationFOR x IN listUNWIND list AS x
Inline filterMATCH (n WHERE ...)Not supported
Standalone filterFILTERNot available
Query chainingNEXTWITH
GroupingExplicit GROUP BYImplicit

Example Comparison

GQL:

GQL
MATCH (c:Customer)-[:BUYS]->(p:Product)
RETURN c.firstName AS customer,
       sum(p.price) AS totalSpent,
       collect(p.name) AS productsBought
       GROUP BY customer
ORDER BY totalSpent DESC

Cypher:

Cypher
MATCH (c:Customer)-[:BUYS]->(p:Product)
WITH c.firstName AS customer,
     sum(p.price) AS totalSpent,
     collect(p.name) AS productsBought
RETURN customer,
       totalSpent,
       productsBought
ORDER BY totalSpent DESC

GQL variable-length paths:

GQL
MATCH (:Person {name: 'Alice'})-[:KNOWS]-{1,3}(b:Person)
RETURN b.name

Cypher equivalent:

Cypher
MATCH (:Person {name: 'Alice'})-[:KNOWS*1..3]->(b:Person)
RETURN b.name

GQL vs GraphQL

Despite the similar names, GQL and GraphQL are fundamentally different:

AspectGQLGraphQL
PurposeQuery language for graph databasesAPI query language
Data modelProperty graph (nodes and edges)Hierarchical/tree structure
SchemaOptional (open graphs) or required (closed graphs)Always required
OperationsPattern matching, traversal, mutationsRequest specific fields from API
ExecutionRuns directly on databaseRuns on API server
RelationshipsFirst-class citizens (edges)Nested fields
TraversalNative path patternsMust be implemented in resolvers

Conceptual Difference

GQL is designed for querying graph databases where relationships (edges) are first-class citizens:

GQL
// Find friends of friends in GQL
MATCH (:Person {name: 'Alice'})-[:KNOWS]-{2}(fof:Person)
RETURN fof.name

GraphQL is designed for APIs where you request specific fields:

Graphql
# Request data from an API in GraphQL
query {
  person(name: "Alice") {
    friends {
      friends {
        name
      }
    }
  }
}