
There may be many reasons to use DBMS, but the primary reason might be for efficiently storing and retrieving data. To achieve ease of data retrieval and manipulation, existing RDBMSs support SQL. You can create, read, update, and delete data in RDBMSs through standardized way.
What about graph databases?
There are several graph databases out there and they offer their own query language to achieve the same goal. There is no standardized way in the graph world. In this posting, we will briefly introduce query languages that are supported by existing graph databases. The list of graph databases that are introduced in this posting is as follows.
- Neo4j
- OrientDB
- Titan
- ArangoDB
Let’s learn each query language briefly through a simple example user query “Find persons who are friend-of-friend of J.”
1. Neo4j
Neo4j offers Cypher, a declarative query language. It is optimized for reading because it nearly draws graph patterns with some keywords to create and read graphs. Here is the Cypher query to run the above example user query.
MATCH (:Person {name: ‘J’})-[:FRIEND*2]->(f:Person)
RETURN f.name
You can easily find out what the relathioship the query uses, how many relationships it follows, and more.
See also Cypher Query Language for more details.
2. OrientDB
OrientDB offers OrientDB SQL which is based on SQL but few are different. Some extensions are added to the query language to enable graph functionality. So, graph pattern matching queries can be written in a declarative fashion. Below is the OrientDB SQL query to run the above example user query.
SELECT f.name FROM (
MATCH
{class: Person, where: (name = ‘J’)}
.out(‘FRIEND’)
{class: Person, as: f, while: ($depth 1)}
RETURN f)
The above query is not as intuitive as the same query written in Cypher, but it is pretty readable.
See also Match for more details.
3. Titan
Titan offers Gremlin which is developed by Apache TinkerPop. In Gremlin, a graph traversal is composed of an ordered list of steps. And it supports declarative graph pattern matching through match()-step. Here is the Gremlin query to run the above example user query.
g.V().match(
__.hasLabel(‘Person’).has(‘name’, ‘J’).
repeat(out(‘FRIEND’)).times(2).
hasLabel(‘Person’).as(‘f’)
).select(‘f’).values(‘name’)
The above query looks like codes written in functional languages and also is somewhat similar to Cypher.
See also Match Step for more details.
4. ArangoDB
ArangoDB offers AQL. It is also a declarative language like others and is similar to SQL but the syntax is different. Below is the AQL query to run the above example user query.
FOR n IN person
FILTER n.name == ‘J’
LET name = (FOR f, e IN 2..2 OUTBOUND n._id friend
FILTER IS_SAME_COLLECTION(‘person’, f._id)
RETURN f.name)
RETURN {name: name}
See also Graph Traversals in AQL for more details.
Conclusion
We’ve looked simple use of four graph query languages. Although it is not enough to grasp the power of each language, this posting might be a good start point. Because each language has different pros and cons from each other, see the documentations linked above for more detailed information.
Common questions
What is the most widely used graph query language today?
Cypher, including engines that follow the openCypher specification, is the most widely implemented language for property graph databases, and its syntax is the closest match to GQL (ISO/IEC 39075:2024), the ISO standard for graph queries. Gremlin is widely used as a vendor-neutral traversal API across different engines, and SPARQL remains the standard for RDF triple stores.
Can I just query graph data with regular SQL?
Recursive common table expressions let SQL express some multi-hop queries, but each additional hop generally needs another join, so performance and readability both degrade as the pattern gets deeper. Graph query languages were designed to avoid that per-hop join cost.
Does the GQL standard replace Cypher?
GQL, standardized as ISO/IEC 39075:2024, defines a common core syntax drawn largely from Cypher, intended to do for graph databases what SQL did for relational ones. It does not remove vendor-specific extensions: individual engines still add their own syntax beyond the shared core.
Why do fraud detection systems favor graph queries over SQL joins?
Fraud rings typically show up as short chains of shared attributes or payments connecting accounts that look unrelated individually. A graph query can express "find any path up to N hops matching this pattern" directly, while the equivalent in SQL needs a new join for every additional hop.
Is SPARQL the same kind of language as Cypher?
No. SPARQL queries triples in the subject-predicate-object form used by RDF stores and supports querying across federated stores. Cypher and GQL query property graphs, where nodes and edges carry their own named properties, which changes how you model and write a query even though both are pattern-matching languages.
Sources
About this page
Last reviewed October 30, 2026 by the Nine Bits editors. Read our editorial policy or report an error.