Quantcast
Channel: Joab Jackson, Author at The New Stack
Viewing all articles
Browse latest Browse all 697

GQL: A New ISO Standard for Querying Graph Databases

$
0
0

Graph databases are now officially a first-class entity in the world of computer science.

The International Standard for Organization (ISO) has published an international standard for querying graphs, called the Graph Query Language (ISO/IEC 39075:2024).

It is the first database query language that ISO had published since 1987 when it ratified SQL in that year. The standards body spent over five years sorting the details.

“There’s nothing like international formal standard, a sibling to SQL that comes out from the same organization as SQL, to speak volumes for the mainstream value” of GQL, said Philip Rathle, chief technology officer at Neo4j, in an interview with TNS.

The release “marks a new chapter in the history of query languages, revolutionizing the way we interact with and harness the power of interconnected data,” said Tony Holland, communications lead, ISO/ IEC Joint Technical Committee 1/AG 1, in a statement. “GQL represents a significant step forward in data querying and manipulation, offering a unified and expressive language for navigating complex graph structures.”

In addition to expertise from Neo4J, engineers from HypergraphDB, Redis Labs, TigerGraph, Oracle and Germany’s University of Bonn also participated in the project.

A visualization of a graph database (courtesy: Neo4J)

Advantages of Standardization

Ratification of the language by a global standards body, much like it did for SQL itself, brings assurance of its stability, encouraging users and tool vendors to further invest in the technology.

The basis for graph computing is the property graph, which is superior in describing dynamically changing data.

Graph databases have been widely used for decades, and only recently, the form has generated new interest in being a pivotal component in Large Language Model-based Generative AI apps. A graph model can visualize complex, interconnected systems.

The downside of LLMs is that they are black boxes of a sort, Rathle explained. “There’s no way to understand the reasoning behind the language model. It is just following a neural network and doing it’s doing its thing,” he said. A knowledge graph can serve as external memory, a way to visualize how the LLM constructed its worldview.

“So I can trace through the graph and see why it arrived with that answer,” Rathle said.

Graph databases are also widely used in the health care companies for drug discovery and by aircraft and other manufacturers as a way to visualize complex system design, Rathle said. “You have all these cascading dependencies and that calculation works really well in the graph,” Rathle said.

What’s in GQL?

The GQL standard is over 600 pages long and references more than 400 papers.

Components include:

  • Graph-only data types (Vertex, Edge, Path)
  • Scalar data types
  • Operations, functions, and predicates for the scalar types
  • a transaction model
  • A security model
  • Graph Pattern Matching
  • Graph Types, to constrain the contents of a graph

GQL is based on Cypher — and its open source variant OpenCypher — the query language for one of the most popular graph database systems, Neo4j.

The Core Syntax for GQL is largely identical to Cypher, with the MATCH … RETURN statements working the same. The query:

MATCH (movie:Movie)
RETURN movie.title


will return all the nodes with the “Movie” label in the database.

Table 2. Result
movie.title
"Wall Street"

"The American President"

Rows: 2


GQL also uses the same basic expressions, linear composition, and other aspects of Cypher.

The best part of GQL, naturally, is the ability to traverse a graph. For instance, this example query from Neo4J shows the next stop for a transport service that stops at Denmark Hill at 22:37:

MATCH (n:Station {name: 'Denmark Hill'})<-[:CALLS_AT]-
(s:Stop WHERE s.departs = time('22:37'))-[:NEXT]->
(:Stop)-[:CALLS_AT]->(d:Station)
RETURN d.name AS nextCallingPoint


With the result of…

Table 4. Result
nextCallingPoint
"Clapham High Street"


There are some basic differences between Cypher and GQL, however.

GQL will use the keyword INSERT to add a node or relationship to a graph, whereas Cypher uses CREATE. The FOR statement takes the place of Cypher’s UNWIND.

Other graph query languages include NebulaGraph‘s NQL, Apache Tinkerpop’s Gremlin, SPARQL for RDF, and ArangoDB‘s AQL. There’s also the GraphQL language, a graph-oriented query language for building APIs.

The upgrade path from existing graph query languages should be fairly easy, at least if those implementations were based on Cypher. According to Rathlee, at least a dozen different graph database systems are built on OpenCypher, including the popular Neptune from Amazon Web Services.

The post GQL: A New ISO Standard for Querying Graph Databases appeared first on The New Stack.

The International Standard for Organization (ISO) has a published an international standard for querying graphs, called the Graph Query Language (ISO/IEC 39075:2024).

Viewing all articles
Browse latest Browse all 697

Trending Articles