Inferensys

Glossary

Graph Query Language (GQL)

Graph Query Language (GQL) is an International Organization for Standardization (ISO) standard query language for property graphs, designed for comprehensive graph pattern matching and manipulation.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
ISO STANDARD

What is Graph Query Language (GQL)?

GQL is the International Organization for Standardization (ISO) standard query language for property graphs, designed for comprehensive graph pattern matching and manipulation.

Graph Query Language (GQL) is an International Organization for Standardization (ISO) standard, declarative query language specifically designed for creating, querying, and manipulating property graph data. It provides a unified, vendor-independent syntax for expressing complex graph patterns, enabling operations like pathfinding, subgraph matching, and graph transformation. As a successor and unifier influenced by languages like Cypher and SQL/PGQ, GQL aims to become the SQL for graph databases, offering a comprehensive suite of capabilities for CRUD operations, aggregation, and graph algorithms within a single, standardized language.

The language's core strength lies in its pattern-matching paradigm, which allows developers to intuitively describe the shape of the subgraph they wish to find or construct using a visual, ASCII-art-like syntax. GQL is engineered for both online transactional processing (OLTP) and online analytical processing (OLAP) workloads, supporting ACID transactions, recursive queries, and integration with SQL for hybrid relational-graph analytics. Its standardization ensures portability across different graph database management systems (GDBMS), reducing vendor lock-in and establishing a foundational skill for developers working with interconnected data.

ISO STANDARD

Key Features of GQL

Graph Query Language (GQL) is an International Organization for Standardization (ISO) standard query language for property graphs, designed to be a comprehensive language for graph pattern matching and manipulation. Its key features establish it as the definitive language for working with graph-structured data.

01

Declarative Pattern Matching

GQL is a declarative language, meaning users specify what data to find, not how to find it. The core operation is graph pattern matching, where you describe a subgraph structure of nodes and relationships. The query engine's optimizer determines the most efficient execution path.

  • Example Pattern: MATCH (p:Person)-[:WORKS_FOR]->(c:Company {name:'Inferensys'})
  • This syntax allows intuitive expression of complex multi-hop traversals and variable-length paths.
02

Unified Data Manipulation Language (DML)

GQL provides a complete set of Data Manipulation Language operations within a single, cohesive syntax, going beyond simple querying.

  • CREATE: Insert new nodes and relationships into the graph.
  • MATCH / SET: Find existing elements and update their properties.
  • DELETE / DETACH DELETE: Remove elements from the graph.
  • MERGE: The "upsert" operation; ensures a pattern exists, creating it if missing.

This unification simplifies application code by eliminating the need to switch between different languages or APIs for basic CRUD operations.

03

Composability with SQL/PGQ

A foundational design principle of GQL is its composability with SQL. The ISO standard formally integrates GQL with SQL through Property Graph Queries (PGQ), a sublanguage within SQL. This allows:

  • Graph Queries in SQL Context: PGQ enables graph pattern matching inside a standard SQL FROM clause.
  • GQL Calling SQL: A GQL query can invoke a tabular SQL function to process data.
  • Hybrid Workloads: Seamlessly join graph traversal results with traditional relational aggregations and reporting.

This bridges the worlds of relational and graph data, protecting existing SQL investments.

04

Comprehensive Data Definition Language (DDL)

GQL includes a full Data Definition Language for governing the structure and integrity of the property graph, moving beyond a simple query tool to a complete database language.

  • CREATE / DROP GRAPH: Define named graph databases within a catalog.
  • CREATE / ALTER / DROP TYPE: Define vertex types and edge types with mandatory labels and property schemas.
  • Constraints: Enforce uniqueness constraints on properties and cardinality constraints on relationships.
  • Index Management: Create and drop indexes on vertex/edge properties for query acceleration.

This allows administrators to fully define and evolve the graph schema.

05

Modularity & Path Queries

GQL supports advanced, modular query constructs essential for complex graph analytics.

  • Graph Functions: Package reusable traversal logic into callable units.
  • Path Queries: Explicitly return and manipulate paths (sequences of nodes and relationships) as first-class citizens in the result set.
  • Path Patterns: Specify complex constraints on paths, including variable-length hops (e.g., [:KNOWS*1..5]) and negation (finding where a path does not exist).
  • Constructed Graphs: The GRAPH clause allows queries to dynamically define a new, temporary graph view from matched patterns for further analysis.

These features enable sophisticated network analysis and recursive algorithms directly within queries.

06

Vendor-Neutral Standardization

As an ISO/IEC standard (ISO/IEC 39075), GQL's primary feature is its vendor neutrality and formal specification.

  • Portability: Reduces vendor lock-in by providing a common language target for graph database implementations (e.g., Neo4j, TigerGraph, Amazon Neptune).
  • Interoperability: Facilitates skills transfer and tooling development across the ecosystem.
  • Rigorous Specification: The language semantics, syntax, and error conditions are formally defined, ensuring predictable behavior.
  • Evolution: Managed by a consortium of industry and academic experts under ISO, ensuring the language evolves to meet long-term technical needs rather than being driven by a single vendor's roadmap.

This standardization is critical for enterprise adoption, providing a stable, future-proof foundation for graph technology investments.

GRAPH QUERY LANGUAGE

How GQL Works: Syntax and Execution

An overview of the ISO-standard Graph Query Language's core syntax patterns and execution model for property graph databases.

Graph Query Language (GQL) is an International Organization for Standardization (ISO) standard declarative language for querying and manipulating property graphs. Its core syntax uses graph patterns expressed in an ASCII-art style to match subgraphs, where nodes are in parentheses () and directed edges are arrows --> or --. A query's MATCH clause defines the pattern to find, while RETURN specifies the data to output, and WHERE applies filters. The language supports comprehensive CRUD operations (Create, Read, Update, Delete) and complex path queries with variable-length traversals.

GQL execution is performed by a graph query engine that parses, optimizes, and executes the declarative statement. The engine performs pattern matching by traversing the graph's native storage structure, ideally leveraging index-free adjacency. For complex queries, the optimizer creates an execution plan that may utilize graph indexes on labels or properties to locate starting points efficiently. The language is designed for composability, allowing queries to be nested and combined with set operations, and it supports ACID transactions to ensure data integrity during updates.

STANDARD COMPARISON

GQL vs. Other Graph Query Languages

A technical comparison of the ISO-standard Graph Query Language (GQL) against other prominent graph query languages, focusing on standardization, data model support, and core capabilities for property graph manipulation.

Feature / CapabilityGQL (ISO/IEC 39075)Cypher (Neo4j)SPARQL (W3C)PGQL (Oracle)

Standardization Body

International Organization for Standardization (ISO)

OpenCypher / Linked Data Benchmark Council (LDBC)

World Wide Web Consortium (W3C)

Oracle Corporation

Primary Data Model

Property Graph (ISO Standard)

Property Graph (Native)

RDF Triplestore

Property Graph

Pattern Matching Syntax

Declarative, ASCII-art (MATCH)

Declarative, ASCII-art (MATCH)

Declarative, Triple Patterns (WHERE)

Declarative, SQL-like (GRAPH_TABLE)

Schema Support

Integrated schema definition (CREATE GRAPH TYPE)

Optional via APOC or Neo4j 5.x

Implicit via RDFS/OWL ontologies

Integrated with SQL schema

Path Query Constructs

Comprehensive (REPEAT, SHORTEST, ALL)

Comprehensive (variable-length, shortest path)

Limited (property paths via SPARQL 1.1)

Limited (reachability, fixed-length)

Graph Modification (DML)

Full CRUD (CREATE, UPDATE, DELETE, MERGE)

Full CRUD (CREATE, SET, REMOVE, DELETE, MERGE)

Insert/Delete via SPARQL Update

Limited (primarily via SQL)

Transaction Support

ACID transactions (specified)

ACID transactions (native)

Typically ACID (depends on triplestore)

ACID (inherited from underlying RDBMS)

Built-in Graph Algorithms

Future extension planned

Via Graph Data Science library (GDS)

No (requires external extensions)

Via PGX in-memory analyst

Composability / Subqueries

Full support (CALL subqueries)

Limited (CALL subqueries)

Subqueries (SELECT within WHERE)

Via SQL subqueries

Integration with SQL

Designed for co-existence (SQL/PGQ)

No (separate query endpoint)

No (separate protocol)

Full integration (SQL:2023 PART 16)

GRAPH QUERY LANGUAGE (GQL)

Database Support and Implementation

GQL is an ISO-standardized query language for property graphs, designed for comprehensive graph pattern matching and data manipulation. Its adoption is shaping database architecture and tooling.

01

ISO Standardization & Core Purpose

Graph Query Language (GQL) is an International Organization for Standardization (ISO) standard (ISO/IEC 39075) for querying and manipulating property graphs. Its primary purpose is to provide a unified, vendor-independent language for graph pattern matching, data modification, and schema definition. Developed alongside SQL/PGQ (Property Graph Queries), GQL is designed to be the principal language for property graphs, analogous to SQL's role for relational data. It aims to reduce vendor lock-in and establish a common foundation for graph database interoperability and tooling.

02

Core Language Constructs and Syntax

GQL's syntax is designed for intuitive expression of graph patterns. Key constructs include:

  • MATCH Clauses: Specify patterns of nodes and relationships to find in the graph, using ASCII-art-like syntax (e.g., (a:Person)-[:WORKS_AT]->(b:Company)).
  • Path Patterns: Allow querying for variable-length connections and specific traversal depths.
  • Graph Modification: Supports CREATE, DELETE, SET, and REMOVE for updating graph structure and properties.
  • Projection & Aggregation: Uses RETURN and GROUP BY clauses to shape and aggregate result sets.
  • Subqueries & Composability: Enables complex, nested queries and result composition. Its design emphasizes declarative querying, letting users specify what data they want, not how to retrieve it.
03

Comparison with Cypher and SQL/PGQ

GQL's development was heavily influenced by existing languages, leading to important distinctions:

  • GQL vs. Cypher: Cypher is the pioneering query language for Neo4j. GQL standardizes and extends many of Cypher's core concepts (like its MATCH syntax) but introduces a more formalized type system and comprehensive schema definition capabilities. GQL is intended as a formal standard, whereas Cypher is an implementation.
  • GQL vs. SQL/PGQ: SQL/PGQ (Part 16) is an extension to the SQL standard that allows graph queries (the MATCH clause) to be embedded within SQL statements on relational tables. GQL is a standalone language for dedicated graph databases. A system can support both: SQL/PGQ for querying graphs in SQL databases, and GQL for native graph databases.
04

Database Vendor Support and Adoption

As a new standard, GQL implementation is actively progressing. Major database vendors are building support:

  • Neo4j: The primary driver behind GQL's development. Neo4j is implementing GQL as a successor/enhancement to its Cypher language, with ongoing development in its core engine.
  • TigerGraph: Has announced support for GQL, aligning its GSQL language with the standard.
  • Amazon Neptune: Supports openCypher and SPARQL; GQL support is a logical future direction given its property graph capabilities.
  • Microsoft Azure Cosmos DB: Its Gremlin API is a different paradigm (imperative traversal); GQL adoption would require significant engine work but is a potential long-term consideration for the industry. Adoption is a multi-year process, as it requires fundamental changes to query parsers, planners, and executors.
05

Schema Definition and Constraints

A significant advancement in GQL over many predecessor languages is its integrated schema definition language (SDL). This allows database administrators to formally define the graph's structure:

  • Type Definitions: Create NODE TYPE and EDGE TYPE definitions with specified property types.
  • Constraints: Apply uniqueness constraints on node properties and cardinality constraints on relationships (e.g., :OWNS edge from Company to Product must be exactly one).
  • Inheritance: Support for type hierarchies using EXTENDS. This moves property graphs from a largely schema-less or schema-late (schema-on-read) model towards a more rigorous, integrity-enforcing schema-on-write approach, crucial for enterprise data governance.
06

Implementation Challenges and Query Optimization

Implementing a GQL engine involves several deep technical challenges:

  • Query Planning & Cost Estimation: The planner must translate declarative graph patterns into an efficient sequence of low-level operations (seeks, traversals, joins). Estimating the cost of variable-length path traversals is particularly complex.
  • Index Utilization: Efficiently leveraging graph indexes on labels and properties to avoid full graph scans. GQL's rich predicates require sophisticated index matching logic.
  • Parallel Execution: Distributing query execution across a cluster for large graphs requires intelligent graph partitioning strategies to minimize cross-machine communication during traversals.
  • Concurrency Control: Supporting ACID transactions with Multi-Version Concurrency Control (MVCC) for GQL's read and write operations, ensuring isolation and consistency for concurrent users.
GRAPH QUERY LANGUAGE (GQL)

Frequently Asked Questions

Graph Query Language (GQL) is the International Organization for Standardization (ISO) standard query language for property graphs, designed for comprehensive graph pattern matching and manipulation. These FAQs address its core purpose, mechanics, and relationship to other technologies.

Graph Query Language (GQL) is an International Organization for Standardization (ISO) standard, declarative query language specifically designed for creating, querying, updating, and managing data stored in property graph databases. It is the first dedicated, vendor-neutral standard for property graphs, analogous to SQL for relational databases, providing a comprehensive syntax for expressing complex graph pattern matching, filtering, and data manipulation operations. GQL unifies and extends concepts from existing languages like Cypher (from Neo4j) and PGQL, aiming to ensure portability and interoperability across different graph database systems that implement the standard.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.