Cypher is a declarative graph query language designed specifically for interacting with labeled property graphs. Its syntax relies on ASCII-art patterns—such as (node)-[RELATIONSHIP]->(node)—to visually represent graph traversals, making complex pathfinding queries intuitive to write and read. Originally proprietary to the Neo4j database, it has since been standardized as openCypher and adopted by other graph systems like Apache Age and RedisGraph.
Glossary
Cypher

What is Cypher?
Cypher is a declarative query language for property graphs, originally developed by Neo4j and now an open standard (openCypher), that uses ASCII-art pattern matching to express traversals and data manipulation.
Unlike the W3C standard SPARQL for RDF triple stores, Cypher is optimized for the property graph model where both nodes and relationships can hold arbitrary key-value attributes. It supports graph analytics, data modification (CREATE, MERGE, DELETE), and multi-hop pattern matching. The language's design prioritizes human readability for expressing entity resolution and link prediction tasks, making it a cornerstone of modern knowledge graph construction and GraphRAG pipelines.
Key Features of Cypher
Cypher is a declarative, pattern-matching query language that enables developers to express complex graph traversals using intuitive ASCII-art syntax, making it the standard for querying property graph databases.
Declarative Pattern Matching
Cypher uses ASCII-art syntax to visually represent graph patterns, making queries intuitive and readable. Instead of describing how to traverse, you declare what pattern to find.
- Nodes are represented with parentheses:
(node:Label) - Relationships use arrows and brackets:
-[rel:TYPE]-> - Patterns compose naturally:
(a:Person)-[:KNOWS]->(b:Person) - The engine optimizes traversal behind the scenes
This declarative approach separates query intent from execution strategy, allowing the query planner to choose optimal traversal algorithms.
Graph-Specific Clauses
Cypher provides specialized clauses designed for graph operations that go far beyond SQL's relational capabilities.
- MATCH: Finds patterns in the graph using index lookups and traversal
- MERGE: Creates patterns only if they don't exist, preventing duplicates
- CREATE: Adds nodes and relationships atomically
- DETACH DELETE: Removes nodes and all connected relationships safely
- CALL: Invokes procedures for graph algorithms like PageRank or community detection
Variable-length path queries like (a)-[*2..5]->(b) find paths of any length between nodes, enabling friend-of-friend queries natively.
Open Standard & Multi-Vendor
Originally developed for Neo4j, Cypher became an open standard through the openCypher project in 2015, enabling adoption across the graph ecosystem.
- GQL (Graph Query Language): ISO/IEC 39075:2024 standard heavily influenced by Cypher
- Cypher for Apache Spark: Enables graph queries on distributed data
- Cypher for Gremlin: Bridges property graph and RDF/SPARQL worlds
- Amazon Neptune, Memgraph, RedisGraph, and AgensGraph all support Cypher
This standardization ensures query portability and prevents vendor lock-in for enterprise knowledge graph deployments.
Aggregation & Path Functions
Cypher includes built-in functions for computing metrics over graph structures, essential for analytics and feature engineering.
- collect(): Gathers matched entities into lists for aggregation
- count(), avg(), sum(): Standard statistical operations on node properties
- shortestPath(): Finds the minimum-hop path between two nodes using bidirectional BFS
- allShortestPaths(): Returns all paths with the minimum length
- path length(): Computes the number of hops in a matched path
These functions enable complex analytical queries like finding central nodes or computing graph-level statistics directly in the query language.
Schema Flexibility with Optional Constraints
Cypher operates on the labeled property graph model, which provides schema flexibility while supporting optional constraints for data integrity.
- Nodes and relationships can have arbitrary key-value properties without predefined schemas
- UNIQUE constraints enforce property uniqueness on labeled nodes
- EXISTENCE constraints require specific properties on nodes or relationships
- NODE KEY constraints define composite keys for entity identity
- Relationship type constraints restrict which node labels can connect
This balance enables agile graph modeling for evolving knowledge graphs while maintaining data quality where needed.
Subqueries & Post-Union Processing
Modern Cypher supports subqueries for modular query composition and complex multi-part analysis.
- CALL subquery: Executes a nested query and unions results with the outer query
- EXISTS subquery: Tests pattern existence for conditional logic
- COUNT subquery: Evaluates pattern cardinality inline
- Post-UNION processing: Applies additional filtering and aggregation after combining results
These features enable sophisticated graph analytics like comparing subgraph densities or computing conditional traversals within a single query execution.
Cypher vs. SPARQL vs. SQL
A comparative analysis of the declarative query languages used for property graphs, RDF triple stores, and relational databases, highlighting their distinct data models and traversal mechanisms.
| Feature | Cypher | SPARQL | SQL |
|---|---|---|---|
Primary Data Model | Labeled Property Graph | RDF Triple Store | Relational Tables |
Standardization Body | ISO/GQL (openCypher) | W3C | ISO/IEC 9075 |
Core Atomic Structure | Nodes, Relationships, Properties | Subject-Predicate-Object Triples | Rows and Columns |
Pattern Matching Syntax | ASCII-art graph patterns | Graph patterns in WHERE clause | Table expressions in FROM clause |
Native Recursive Traversal | |||
Variable-Length Path Queries | |||
Schema Flexibility | Schema-optional | Schema-optional | Schema-mandatory |
Join Mechanism | Relationship traversal | Triple pattern join | Foreign key JOIN |
Index-Free Adjacency |
Frequently Asked Questions
Clear, technical answers to the most common questions about the Cypher graph query language, covering syntax, use cases, and architectural considerations.
Cypher is a declarative graph query language originally developed by Neo4j for querying property graph databases, now standardized as an open specification (openCypher) and adopted across multiple graph systems. It works by using ASCII-art pattern matching to describe graph structures visually within the query syntax. A node is represented by parentheses (), a directed relationship by -[]->, and properties by curly braces {}. The query engine parses this pattern, compiles it into an execution plan, and traverses the graph to find matching subgraphs. Unlike SQL's table joins, Cypher's pattern matching directly leverages index-free adjacency, where each node physically stores pointers to its neighbors, enabling constant-time relationship traversal regardless of dataset size. This makes Cypher exceptionally efficient for path-finding queries and multi-hop relationship analysis that would require expensive recursive joins in relational databases.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Cypher operates within a rich ecosystem of graph technologies. These related concepts are essential for understanding how declarative graph queries integrate with storage, validation, and semantic reasoning.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us