Skip to main content

Module 1. The Language of Connections: What Is Cypher?

Course 5. Querying Meaning: Writing Cypher for Insight
Estimated Time:
?? minutes

đź§­ Module Objectives

  • Explain what the Cypher query language is and how it works.
  • Identify and use Cypher's core components: MATCH, RETURN, nodes, and relationships.
  • Understand how Cypher expresses graph structures as readable text.
  • Run your first simple queries in Neo4j Aura to retrieve information from your graph.
  • Recognize how Cypher supports both technical and interpretive exploration of humanities data.

Why Learn Cypher?

In previous courses, you built a small graph in Neo4j representing people, songs, albums, and themes. Now it's time to talk to it.

Cypher is the language we use to communicate with a Neo4j graph database. Its name (inspired by "decipher") suggests exactly what it does: it translates between human questions and the network's underlying structure. If you think of your Neo4j graph as a map of relationships, Cypher is the set of sentences you speak to ask that map for directions.

A Language for Relationships

Cypher was designed to be human-readable. It uses simple shapes and words to describe patterns:

Symbol Represents Example
( ) Node (an entity) (p:Person)
[ ] Relationship [r:WROTE_SONG]
--> Direction of connection (p)-[:WROTE_SONG]->(s)
{ } Properties (key–value pairs) {name: "Jesse Wells"}

Together, these symbols form visual sentences that look almost like diagrams. For example, this command:

MATCH (p:Person {name:"Jesse Wells"})-[:WROTE_SONG]->(s:Song)
RETURN s.title;

reads almost like plain English:

"Find the person named Jesse Wells who wrote a song, and return the titles of those songs."

That's all there is to it.

The MATCH—WHERE—RETURN Pattern

Most Cypher queries follow a simple, elegant structure:

MATCH (pattern)
WHERE (conditions)
RETURN (results);

In this structure:

  • MATCH tells Neo4j which pattern to look for in the graph.
  • WHERE is entirely optional but refines or filters what counts as a match.
  • RETURN specifies what you want to see in the output.

You can think of MATCH as your "question," WHERE as further clarification of your question, and RETURN as your "answer."

Example 1: Find All People in the Graph

MATCH (p:Person)
RETURN p.name;

Result: A list of all person names (e.g., Jesse Wells, Dave Cobb, Charlie Kirk, Steve Irwin, etc.).

Here, (p:Person) means "any node with the label Person," and p.name tells Neo4j to show the value of the name property.

Example 2: Find Songs Written by Jesse Wells

MATCH (p:Person {name:"Jesse Wells"})-[:WROTE_SONG]->(s:Song)
RETURN s.title, s.year;

Result: A table (or graph view) listing every Song node connected to Jesse Wells through a WROTE_SONG relationship.

(You may have noticed that we've used "Jesse Wells"—rather than "Jesse Welles" here: we explained this in our last module. For our purposes, we're separating the Person "Jesse Wells"—his legal name—from the Artist "Jesse Welles.")

This kind of query is the first step in analytical thinking: using Cypher to translate a human question into a structured search.

Understanding Direction

Relationships in Neo4j are directional: they have pointed arrows. But many queries don't require direction unless it carries interpretive meaning.

Direction Example Meaning
--> (p)-[:WROTE_SONG]->(s) Person wrote the song
<-- (s)<-[:WROTE_SONG]-(p) Song was written by the person
-- (p)--(s) Connection exists, direction doesn't matter

All three of these can describe the same underlying data, depending on your question. For interpretive clarity, it's usually best to specify direction, but Cypher gives you flexibility when exploring unknown structures.

Cypher as a Humanistic Tool

At first, Cypher may look like code. But it's more like writing in a specialized grammar of relationships. Think of it as a translation layer between concepts and connections:

Conceptual Question Cypher Expression
"Who performed at
Farm Aid 2025?"
MATCH (p:Person)-[:PERFORMED_AT]->
(:Event {name:"Farm Aid 2025"})
RETURN p.name;
"Which songs evoke the
theme of forgiveness?"
MATCH (s:Song)-[:EVOKES_THEME]->(:Theme {name:"Forgiveness"})
RETURN s.title;
"What themes appear in
Jesse Welles' albums?"
MATCH (:Person {name:"Jesse Wells"})-[:WROTE_SONG]->
(s)-[:RELEASED_ON]->(a:Album)<-[:EVOKES_THEME]-(t:Theme)
RETURN DISTINCT t.name, a.title;

Each query is both technical and interpretive: a concise statement about how meaning is structured in your data.

Try It Yourself

If your Neo4j Aura instance from Course 4 is still running, open the Query Tool and run the following commands one at a time (if your instance has been paused, you'll need to restart it; be patient, as it may take a few minutes for the instance to restart):

MATCH (n)
RETURN COUNT(n) AS totalNodes;

This will count all of the nodes in your database.

MATCH (n)-[r]->(m)
RETURN COUNT(r) AS totalRelationships;

This counts all of the relationships in your database.

MATCH (p:Person {name:"Jesse Wells"})-[:WROTE_SONG]->(s)
RETURN s.title, s.year;

This finds all songs written by Jesse Wells and returns the song title and year.

Experiment with different node labels or relationship types. Try changing "Jesse Wells" to "Dave Cobb" or specifying the title of the specific song you want to know about (hint: you'll need to include the 'title' property in your MATCH statement). You may receive no results or very few, but this is because our database isn't fully populated (yet!).

Key Takeaways

  • Cypher is the language used to query Neo4j graphs.
  • It is human-readable, using simple shapes to describe patterns.
  • The basic structure of any query is MATCH → WHERE → RETURN.
  • Relationships can be directed or undirected depending on the question.
  • Writing Cypher queries is both technical and interpretive: a way of thinking about meaning through structure.

Knowledge Check & Reflection

Updated on Dec 9, 2025