Cypher is a declarative query language originally developed by Neo4j for the property graph model, now standardized as openCypher. Its syntax uses ASCII-art patterns like (node)-[RELATIONSHIP]->(node) to visually represent graph traversals, making complex pathfinding queries readable and expressive without requiring explicit join logic.
Glossary
Cypher Query Language

What is Cypher Query Language?
Cypher is a declarative, pattern-matching query language for the property graph model, enabling intuitive and efficient traversal of highly connected data.
Unlike SPARQL for RDF, Cypher is optimized for the labeled property graph structure where both nodes and relationships can hold arbitrary key-value properties. The language supports clauses like MATCH, WHERE, and RETURN to filter and project results, enabling developers to efficiently query multi-hop connections, such as finding the shortest path between two entities in a knowledge graph.
Key Features of Cypher
Cypher is a declarative, pattern-matching query language for property graphs. Its ASCII-art syntax makes graph traversals intuitive and expressive.
Declarative Pattern Matching
Cypher uses an ASCII-art syntax where nodes are represented by parentheses () and relationships by arrows --> or <--. This allows developers to describe the structure of the data they want rather than the procedural steps to retrieve it.
- Node syntax:
(variable:Label {key: 'value'}) - Relationship syntax:
-[variable:TYPE]-> - Example:
MATCH (p:Patient)-[:HAS_CONDITION]->(d:Disease {code: 'E11.9'}) RETURN p.name
The query engine's cost-based optimizer determines the most efficient traversal strategy, freeing the user from manual index hinting.
Native Property Graph Model
Unlike RDF query languages that operate on triples, Cypher is purpose-built for the labeled property graph model. Every node and relationship can store an arbitrary set of key-value properties.
- Nodes carry multiple labels for polymorphic typing
- Relationships have a single type but can hold properties like
since,confidence, ordosage - This allows rich, domain-specific modeling without the need for reification or intermediate nodes
This model aligns naturally with healthcare data, where a Patient node connects to a Medication node via a :TAKES relationship that carries start_date and dose properties.
Variable-Length Path Traversals
Cypher excels at expressing recursive graph traversals of unknown depth using variable-length relationship patterns. This is critical for traversing hierarchies like medical ontologies or organizational structures.
- Syntax:
-[:TYPE*min..max]-> - Example:
MATCH path = (c:Concept {code: 'SNOMED:73211009'})-[:IS_A*1..5]->(ancestor:Concept) RETURN path - The
*quantifier finds all paths within the specified bounds - Built-in functions like
shortestPath()andallShortestPaths()optimize common traversal patterns
This capability enables efficient subsumption reasoning over taxonomies without recursive application code.
Clauses for Reading, Writing, and Aggregation
Cypher provides a comprehensive set of clauses that compose into powerful data manipulation pipelines, similar to SQL but optimized for graph-shaped data.
- MATCH: Specifies the graph pattern to search for
- WHERE: Filters results with predicates and boolean logic
- RETURN: Projects, aggregates, and aliases output columns
- CREATE / MERGE: Inserts nodes and relationships; MERGE ensures idempotency
- WITH: Chains query parts, passing results between clauses like a pipe
- UNWIND: Expands a list into individual rows
Example aggregation: MATCH (d:Disease)<-[:HAS_CONDITION]-(p:Patient) RETURN d.name, count(p) AS patient_count ORDER BY patient_count DESC
openCypher Standardization
Originally developed by Neo4j, Cypher has evolved into openCypher, an open standard with a formal grammar and specification. This enables interoperability across multiple graph database vendors.
- The openCypher project provides a reference parser, TCK (Technology Compatibility Kit), and grammar specification
- Implementations exist beyond Neo4j, including Amazon Neptune, Memgraph, RedisGraph, and Apache Spark via Cypher for Apache Spark
- A subset of Cypher has been mapped to GQL (ISO/IEC 39075), the new international standard graph query language
- This standardization protects against vendor lock-in and promotes skill portability
Graph Projections and Graph Data Science
Cypher integrates with the Graph Data Science (GDS) library to create in-memory graph projections for high-performance analytical workloads. This bridges transactional queries with advanced algorithms.
- Catalog projection:
CALL gds.graph.project('myGraph', 'Patient', {RELATED: {orientation: 'UNDIRECTED'}}) - Supports centrality algorithms (PageRank, Betweenness), community detection (Louvain, Label Propagation), and pathfinding (Dijkstra, A*)
- Enables node embedding generation and graph neural network training directly from Cypher
- Results can be written back to the graph as new node properties for downstream querying
This unification of querying and data science eliminates the need for complex ETL pipelines to external analytical tools.
Frequently Asked Questions
Clear, concise answers to the most common technical questions about Cypher, the declarative graph query language for property graph databases.
Cypher is a declarative, pattern-matching graph query language originally developed by Neo4j for the property graph model, now standardized as openCypher. It works by allowing users to describe the visual pattern of nodes and relationships they want to match in the graph, rather than specifying the exact join algorithms required. The query engine's cost-based optimizer then compiles this ASCII-art-like pattern into an efficient execution plan, performing graph traversals that are inherently index-free and relationship-centric. This declarative approach abstracts away the complexity of pointer chasing and join logic, enabling developers to express complex traversals like variable-length paths and shortest-path calculations with concise, readable syntax.
Cypher vs. SPARQL vs. SQL
A technical comparison of declarative query languages for property graphs, RDF triplestores, and relational databases.
| Feature | Cypher | SPARQL | SQL |
|---|---|---|---|
Data Model | Property Graph (nodes, relationships, properties) | RDF Triples (subject-predicate-object) | Relational Tables (rows, columns, joins) |
Standardization | openCypher (open standard) | W3C Recommendation | ISO/IEC 9075 |
Pattern Matching | ASCII-art graph patterns | Graph patterns with triple syntax | Table joins and subqueries |
Schema Flexibility | Schema-optional | Schema-optional | Schema-mandatory |
Primary Clause | MATCH | SELECT | SELECT |
Traversal Depth | Variable-length paths (*1..) | Property paths (*, +) | Recursive CTEs |
Aggregation | COUNT, COLLECT, avg, sum | COUNT, GROUP_CONCAT, AVG, SUM | COUNT, GROUP BY, AVG, SUM |
Return Format | Tabular or graph elements | Tabular or RDF graphs | Tabular only |
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
Core concepts that define how developers interact with, traverse, and optimize property graph databases using declarative pattern-matching languages.

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