Contact Us


Understanding GQL: A Comprehensive Overview of the Standard Graph Query Language

The International Organization for Standardization (ISO) has recently published a new standard for a property graph database language called GQL (ISO/IEC 39075). Developed by the same committee responsible for SQL, GQL is designed to parallel SQL and is the first new database query language released by ISO in over 35 years. GQL is significant for its ability to handle property graph databases, which are gaining prominence in big data and NoSQL technologies.

This article draws on insights from the highlights of the full GQL documents (39075 Database Language GQL) and presents the fundamental GQL definitions with examples.

Use Cases of Property Graph Databases

The applications of Property Graph Databases span across various industries and scenarios. They have played a crucial role in fraud detection in the financial sector, driven the creation of real-time recommendation engines in customer-centric systems, and have been a cornerstone in the development of knowledge graphs within large-scale organizations. The strength of property graphs lies in their ability to efficiently handle immense volumes of data and the intricate relationships that exist within this data. This unique capability has redefined the way people understand and interact with data, opening up new opportunities and solutions across different fields.

Focusing on the realm of real-time recommendations, the unique architecture of property graph databases allows for the representation of complex relationships between users and items, such as products on an e-commerce platform or movies on a streaming service. The support for highly connected data structures and relationships within graph databases facilitates quick and accurate predictions, empowering businesses with immediate, actionable insights. The ability to instantly assess the current business context, match user profiles, capture new behaviors, evaluate alternatives, and generate recommendations is a testament to the power and potential of graph databases.

GQL Definition with examples

GQL defines a comprehensive set of operations for querying, updating, and managing schema of graph databases. It supports complex pattern matching, data manipulation, and a variety of graph models. Key concepts include nodes (or vertices), relationships (or edges), properties, and labels. Understanding these core elements is crucial to mastering GQL.The following examples offer a concise overview of GQL capabilities through illustrations.

Graph Pattern Matching (GPM)

GQL uses a powerful GPM language to simplify complex data analysis. For instance, to find all nodes with a one-hop relationship to a node named 'Avery', the query would be:

MATCH (a {firstname: 'Avery'})-[b]->(c) RETURN a, b, c

This query allows the user to retrieve relationships without needing to specify them.

Quantified Path Patterns (QPP)

GQL supports complex queries like QPP, which can find paths of varying lengths. An example query to find paths up to five hops long is:

MATCH ((a)-[r]->(b)){1,5} RETURN a, r, b

Data Manipulation

Nodes and edges can be added using the INSERT statement. For example, to insert a node labeled as 'Pet' with properties:

INSERT (:Pet {name: 'Unique', pettype: 'Dog'})

To insert two nodes and an edge between them, the query could be:

INSERT (:Person {firstname: 'Avery', lastname: 'Stare', joined: date("2022-08-23")})
-[:LivesIn {since: date("2022-07-15")}]->
(:City {name: 'Granville', state: 'OH', country: 'USA'})

Modifying and Deleting Data

GQL allows modification of data by setting or removing properties. For example:

MATCH (d:Pet) WHERE d.name="Unique" SET d.weight_kg=26
MATCH (e {lastname: 'Stare'}) REMOVE e.joined

Deletion is done by detaching and then removing nodes and relationships:

MATCH (a {firstname: 'Avery'})-[b]->(c) DETACH DELETE a, c


GQL supports serializable transactions with explicit or implicit START TRANSACTION statements, and can be terminated with COMMIT or ROLLBACK.

Schema-free and Fixed-schema Graphs

GQL supports both schema-free graphs, which accept any data, and fixed-schema graphs, which are constrained by a predefined graph type. An example of creating a graph type and then a graph using that type is:

CREATE GRAPH TYPE /MyFolder/control/fraud_TYPE
// ... (graph type definition)
CREATE GRAPH /MyFolder/control/fraud TYPED /MyFolder/control/fraud_TYPE

Comparing Nodes and Edges to Tables

In GQL, nodes with specific labels are akin to tables, and edges describe relationships between nodes without the need for the query writer to understand the relationships beforehand.

How to Start GQL Journey

There are several resources available to start learning GQL. The official ISO website provides extensive documentation and tutorials. Additionally, practicing with a graph database that supports GQL, like the upcoming NebulaGraph Enterprise v5.0, can offer hands-on experience.


GQL is a powerful new standard for property graph databases, offering a rich set of features for data manipulation and analysis. Its power and potential are evident in its ability to redefine data interaction, providing immediate, actionable insights, and opening new avenues across different fields. As this language continues to evolve, it is expected to play a crucial role in our understanding and interaction with data.

With the upcoming NebulaGraph Enterprise v5.0, we're thrilled to bring native GQL support to our users. We believe that the adoption of GQL is a significant step forward in simplifying graph database usage and spurring innovation in the field. Stay tuned for more updates as we continue to explore the exciting possibilities GQL offers. If you're interested in NebulaGraph Enterprise v5.0, feel free to reach out to us.