Skip to main content

Module 2. Finding and Filtering Data: MATCH, WHERE, RETURN

copy and pasteCourse 5. Querying Meaning: Writing Cypher for Insight
Estimated Time:
?? minutes

🧭 Module Objectives

  • Retrieve specific nodes and relationships using MATCH.
  • Apply WHERE clauses to filter results by property values, labels, or relationship types.
  • Use logical operators (AND, OR, NOT) and pattern filters (CONTAINS, STARTS WITH, ENDS WITH).
  • Display and sort results with RETURN, ORDER BY, and LIMIT.
  • Understand how filtering shapes interpretation: deciding which data counts as meaningful evidence.

Asking Focused Questions

In the previous module, you learned to retrieve everything that matched a pattern. But humanities research rarely starts with "everything." We usually ask focused questions:

  • Which songs were written after 2020?
  • Which people performed at Farm Aid 2025?
  • Which themes occur more than once?

Cypher's WHERE clause gives us precision: a way to narrow the field. But before we use WHERE for specificity, we first need to give the database more general information.

The MATCH Clause: Finding Patterns

MATCH searches the graph for a pattern of nodes and relationships. This can be extremely simple or quite specific and complicated. We'll use simple examples here (you saw these in our previous module, so consider this some repetitive review).

Example 1. Find all songs:

MATCH (s:Song)
RETURN s.title, s.year;

Example 2. Find songs written by a specific person:

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

Each MATCH clause works like the preamble to a question. You describe a relationship pattern and Neo4j finds every occurrence of it.

The WHERE Clause: Filtering Results

WHERE adds conditions to your pattern: like "only if ..." or "but not when ...". You can filter by property values, string contents, numbers, or relationships.

Example 3. Filter by Property Value

MATCH (s:Song)
WHERE s.year > 2019
RETURN s.title, s.year;

β†’ Returns only songs released after 2019.

Example 4. Filter by Multiple Conditions

MATCH (s:Song)
WHERE s.year >= 2020 AND s.year <= 2024
RETURN s.title, s.year ORDER BY s.year ASC;

β†’ Uses AND to combine conditions and orders results chronologically. >= means "greater than or equal to" and <= means "less than or equal to." ORDER BY tells the system which property to sort by and ASC means "ascending." So: our results will be sorted by the year property, with the earliest listed first and most recent at the bottom.

Example 5. Filter by Text

MATCH (t:Theme)
WHERE t.name CONTAINS "war"
RETURN t.name;

β†’ Returns themes with the word "war" anywhere in the theme's name. You can also use STARTS WITH or ENDS WITH for more specific matches (e.g., t.name STARTS WITH "war" will only return themes where "war" matches the name property's first 3 characters).

Example 6. Exclude or Negate

MATCH (s:Song)
WHERE NOT s.title CONTAINS "Love"
RETURN s.title;

β†’ Lists all songs whose titles do not include the word "Love."

Example 7. Filter by Relationship Type

MATCH (p:Person)-[r:WROTE_SONG]->(s:Song)
WHERE r.year = 2024
RETURN p.name, s.title;

β†’ Finds Person–Song pairs linked by a WROTE_SONG relationship dated 2024. It is important to note that this will only return results where '2024' is recorded in a year property attached to the relationship: if the year is a property attached to the Song itself, this query will not work as expected.

RETURN, ORDER BY, and LIMIT

Everything you ask Neo4j to display must appear after RETURN. For example:

MATCH (s:Song)
WHERE s.year >= 2020
RETURN s.title, s.year
ORDER BY s.year DESC
LIMIT 5;

Keyword Purpose Example
RETURN Display selected properties RETURN s.title
ORDER BY Sort results ascending/descending ORDER BY s.year DESC
LIMIT Restrict the number of results LIMIT 10

Together, all of these keywords help you to create concise, readable output for analysis or visualization.

Example Query: A Wellespring Use Case

Let's try to pull all of this together and ask: Which of Jesse Welles' songs about forgiveness were released after 2020?

MATCH (p:Person {name:"Jesse Wells"})-[:WROTE_SONG]->
(s:Song)-[:EVOKES]->(t:Theme)
WHERE t.name = "Forgiveness" AND s.year > 2020
RETURN s.title, s.year ORDER BY s.year ASC;

This query does three things:

  1. Finds all songs written by Jesse Wells.
  2. Checks if each song evokes the theme "Forgiveness."
  3. Filters out any that predate 2021.

The result is a clear and defensible dataset for interpretation.

Filtering as Interpretation

Filtering is never neutral. Every WHERE clause reflects a choice about what matters. In the humanities, this is a form of argument: a claim about relevance and context.

  • Choosing songs after 2020 privileges recent work, themes, etc..
  • Searching for titles containing "war" may frame a political interpretation.
  • Excluding "Love" may ignore key emotional threads.

Each filter tells a story about what you're looking for and why. There are often good reasons for these filters (inclusion and exclusion) but it's important to remember that the act of filtering is an interpretation and not a purely objective act.

Database Refresh and Practice

If you've followed our previous course, your Aura instance should have a few nodes and relationships, but it's rather small, and you might have introduced some duplicates, etc. Let's clear everything out and refresh the database with a larger dataset for some practice. NOTE: the following commands will DELETE EVERYTHING from your Aura instance:

MATCH (n)
OPTIONAL MATCH p=()-[]-()
DETACH DELETE n, p

Enter this command into your Cypher Editor and click the run icon OR use a keyboard shortcut (Windows: Ctrl + Enter, MacOS: Command + Enter).

We used this in our last course. Just as a reminder, here's what the command is doing:

  1. Finds all nodes and assigns them the variable "n".
  2. Looks for all instances where two nodes are joined by a relationship and assigns the variable "p" to this pattern. This is listed as "optional," ensuring that nodes that do NOT have a relationship remain selected (because of the first line).
  3. Detaches all nodes from any relationships that they have, and deletes all nodes "n" and anything else (i.e. relationships) that were found as part of the "p" pattern matching.

You should see a successful result in the Results Stream. To double-check, though, let's ask the database to show us everything it has:

MATCH (n)
OPTIONAL MATCH p=()-[]-()
RETURN n, p

This is the same command, but we've now replaced DETACH DELETE with RETURN. You should see that there are now zero nodes and relationships in your database. Let's go ahead and populate with a slightly larger dataset. We'll do this using multiple sets of cypher statements. For now, don't worry about the details of these statements (but do feel free to optionally look at them and try to figure out what they're doing).

Import Data

Now that our database is completely clean, let's import some pre-preparedβ€”but not yet finalβ€”data to do some practice with for the remainder of this course. To do this, copy and paste the contents of the following toggled section into your Aura console and run it.

TOGGLE ME FOR CODE TO COPY-PASTE

// ---- BEGIN COPY-PASTE CONTENT ----
// Wellespring Sample Dataset for Course 5
// NOTE: This script clears ALL existing data.
// Run only on a fresh/teaching database.
// ---------------------------------------------

// 1. Clear database
MATCH (n)
MATCH p=()-[]-()
DETACH DELETE n, p;

// 2. Create Persons
CREATE (jesse:Person {
uid: "pers-jesse-wells",
name: "Jesse Wells",
nameFull: "Jesse Allen Breckenridge Wells",
nameAlt: ["Jeh-Sea Wells", "Breck Shipley", "Jesse Welles"],
dateBirth: "1992-11-22",
wikidataQID: "Q30599643"
})

CREATE (simon:Person {
uid: "pers-simon-martin",
name: "Simon Martin"
})

CREATE (dirk:Person {
uid: "pers-dirk-porter",
name: "Dirk Porter"
})

CREATE (blake:Person {
uid: "pers-blake-foster",
name: "Blake Foster"
})

CREATE (skyler:Person {
uid: "pers-skyler-greene",
name: "Skyler Greene"
})

CREATE (kenny:Person {
uid: "pers-kenny-loggins",
name: "Kenny Loggins",
nameFull: "Kenneth Clark Loggins",
dateBirth: "1948-01-07",
wikidataQID: "Q435965"
})

CREATE (lincoln:Person {
uid: "pers-lincoln-parish",
name: "Lincoln Parish",
nameFull: "Lincoln Tyler Parish"
})

CREATE (johny:Person {
uid: "pers-johny-fisher",
name: "Johny Fisher",
nameFull: "Johny David Fisher",
nameAlt: ["Local Opener"]
})

CREATE (aaron:Person {
uid: "pers-aaron-martin",
name: "Aaron Martin",
nameFull: "Aaron Mitchell Martin"
})

CREATE (matt:Person {
uid: "pers-matt-quinn",
name: "Matt Quinn"
})

CREATE (margo:Person {
uid: "pers-margo-price",
name: "Margo Price",
nameFull: "Margo Rae Price",
dateBirth: "1983-04-15",
wikidataQID: "Q22073688"
})

CREATE (ivey:Person {
uid: "pers-jeremy-ivey",
name: "Jeremy Ivey",
nameFull: "Jeremy Blain Ivey"
})

CREATE (marcus:Person {
uid: "pers-marcus-king",
name: "Marcus King",
dateBirth: "1996",
wikidataQID: "Q90797800"
})

CREATE (sierra:Person {
uid: "pers-sierra-ferrell",
name: "Sierra Ferrell",
nameFull: "Sierra Elizabeth Ferrell",
dateBirth: "1988-08-03",
wikidataQID: "Q110877092"
})

CREATE (billy:Person {
uid: "pers-billy-strings",
name: "William Apostol",
nameFull: "William Lee Apostol",
nameAlt: ["Billy Strings"],
dateBirth: "1992-10-03",
wikidataQID: "Q52004084"
})

CREATE (dave:Person {
name: "Dave Cobb",
dateBirth: "1974-07-09",
wikidataQID: "Q19957048"
})

// 3. Create Artists (stage/band names)
CREATE (artJehSea:Artist {
uid: "art-jeh-sea-wells",
name: "Jeh-Sea Wells",
type: "solo",
dateFormation: "2012",
dateDissolution: "2020"
})

CREATE (artDead:Artist {
uid: "art-dead-indian",
name: "Dead Indian",
type: "band",
sni: "000000047051711X",
dateFormation: "2012",
dateDissolution: "2015"
})

CREATE (artCosmic:Artist {
uid: "art-cosmic-american",
name: "Cosmic American",
type: "band",
dateFormation: "2015",
dateDissolution: "2016"
})

CREATE (artWelles:Artist {
uid: "art-welles",
name: "Welles",
type: "band",
isni: "0000000475627633",
dateFormation: "2017",
dateDissolution: "2023"
})

CREATE (artJesse:Artist {
uid: "art-jesse-welles",
name: "Jesse Welles",
type: "solo",
isni: "0000000528650010",
dateFormation: "2024"
})

CREATE (artLocal:Artist {
uid: "art-local-opener",
name: "Local Opener",
type: "solo",
isni: "0000000493760526",
dateFormation: "2020"
})

CREATE (artOkey:Artist {
uid: "art-okey-dokey",
name: "Okey Dokey",
type: "band",
isni: "0000000470471959",
dateFormation: "2016"
})

CREATE (artMt:Artist {
uid: "art-mt-joy",
name: "Mt. Joy",
type: "band",
isni: "0000000469141055",
dateFormation: "2018",
wikidataQID: "Q60744472"
})

CREATE (artMargo:Artist {
uid: "art-margo-price",
name: "Margo Price",
type: "solo",
isni: "0000000462985415",
wikidataQID: "Q22073688"
})

CREATE (artMarcus:Artist {
uid: "art-marcus-king",
name: "Marcus King",
type: "solo",
isni: "0000000475545515",
wikidataQID: "Q90797800"
})

CREATE (artMKB:Artist {
uid: "art-marcus-king-band",
name: "The Marcus King Band",
type: "band",
isni: "0000000495413413",
wikidataQID: "Q28403222"
})

CREATE (artSierra:Artist {
uid: "art-sierra-ferrell",
name: "Sierra Ferrell",
type: "solo",
isni: "0000000483782123",
wikidataQID: "Q110877092"
})

CREATE (artBilly:Artist {
uid: "art-billy-strings",
name: "Billy Strings",
type: "solo",
isni: "0000000512062345",
wikidataQID: "Q52004084"
})

// 4. Link Person -> Artist
CREATE
(jesse)-[:PERFORMS_AS]->(artJehSea),
(jesse)-[:MEMBER_OF {role: ["vocals","guitar"]}]->(artDead),
(jesse)-[:MEMBER_OF {role: ["vocals","guitar"]}]->(artCosmic),
(jesse)-[:MEMBER_OF {role: ["vocals","guitar"]}]->(artWelles),
(jesse)-[:PERFORMS_AS]->(artJesse),
(simon)-[:MEMBER_OF {role: ["drums"]}]->(artDead),
(simon)-[:MEMBER_OF {role: ["drums"]}]->(artCosmic),
(dirk)-[:MEMBER_OF {role: ["bass"]}]->(artDead),
(blake)-[:MEMBER_OF {role: ["bass"]}]->(artCosmic),
(skyler)-[:MEMBER_OF {role: ["guitar"]}]->(artCosmic),
(johny)-[:PERFORMS_AS]->(artLocal),
(johny)-[:MEMBER_OF {role: ["guitar"]}]->(artOkey),
(aaron)-[:MEMBER_OF {role: ["vocals","bass"]}]->(artOkey),
(matt)-[:MEMBER_OF {role: ["vocals","guitar"]}]->(artMt),
(margo)-[:PERFORMS_AS]->(artMargo),
(marcus)-[:PERFORMS_AS]->(artMarcus),
(marcus)-[:MEMBER_OF {role: ["vocals","guitar"]}]->(artMKB),
(sierra)-[:PERFORMS_AS]->(artSierra),
(billy)-[:PERFORMS_AS]->(artBilly)

// 5. Create Albums
CREATE (albLeadMe:Album {
uid: "alb-lead-me-to-the-sky",
title: "Lead Me to the Sky",
upc: "885007405412",
type: "lp",
releaseDate: "2013-04-09",
spotifyURI: "https://open.spotify.com/album/1SqZrOA3M2Kxbwsp4FWTX9"
})

CREATE (albGrey:Album {
uid: "alb-grey",
title: "Grey",
upc: "888174113371",
type: "single",
releaseDate: "2013-07-09",
spotifyURI: "https://open.spotify.com/album/7KFj4h1XllMhSBqpsc4U0P"
})

CREATE (albWhenWe:Album {
uid: "alb-when-we-live",
title: "When We Live",
upc: "889211134649",
type: "lp",
releaseDate: "2014-11-11",
spotifyURI: "https://open.spotify.com/album/49zXml1yKgt8TBQDLZgIMH"
})

CREATE (albRedTrees:Album {
uid: "alb-red-trees-white-trashes",
title: "Red Trees and White Trashes",
upc: "814908025702",
type: "lp",
releaseDate: "2018-06-15",
spotifyURI: "https://open.spotify.com/album/7ADJVb0A5UfpnijQ67tqYI"
})

CREATE (albLocalFriends:Album {
uid: "alb-friends-local-opener",
title: "Friends",
upc: "5056495328056",
type: "lp",
releaseDate: "2021-05-07",
spotifyURI: "https://open.spotify.com/album/0VGGBBWaKsciegOZoDXD3x"
})

CREATE (albCurio:Album {
uid: "alb-curio-cabinet-i",
title: "Curio Cabinet I",
upc: "5054526909922",
type: "lp",
releaseDate: "2019-12-20",
spotifyURI: "https://open.spotify.com/album/2x7ehC4u9qKsysxt3JJw4R"
})

CREATE (albHells:Album {
uid: "alb-hells-welles",
title: "Hells Welles",
upc: "193436388542",
type: "lp",
releaseDate: "2024-07-04",
spotifyURI: "https://open.spotify.com/album/3Q48reORc8Ex4xTsFuYQGf"
})

CREATE (albPatchwork:Album {
uid: "alb-patchwork",
title: "Patchwork",
upc: "193436398749",
type: "lp",
releaseDate: "2024-09-20",
spotifyURI: "https://open.spotify.com/album/48Hs14SqGLxaaD8z22QDrE"
})

CREATE (albHaveYouEver:Album {
uid: "alb-have-you-ever-seen-the-rain",
title: "Have You Ever Seen the Rain",
upc: "193436403146",
type: "single",
releaseDate: "2024-10-29",
spotifyURI: "https://open.spotify.com/album/71mceHjIhQDigBVree5KXM"
})

CREATE (albAllCreatures:Album {
uid: "alb-all-creatures-great-and-small",
title: "All Creatures Great and Small",
upc: "193436408301",
type: "ep",
releaseDate: "2024-12-13",
spotifyURI: "https://open.spotify.com/album/2E3nRMi6CfyHMQjYA2tgM3"
})

CREATE (albMiddle:Album {
uid: "alb-Middle",
title: "Middle",
upc: "193436415354",
type: "lp",
releaseDate: "2025-02-21",
spotifyURI: "https://open.spotify.com/album/66esRfCq1pX9ofsg4wwp3Q"
})

CREATE (albPowerlines:Album {
uid: "alb-under-the-powerlines",
title: "Under The Powerlines (April 24β€”September 24)",
upc: "193436419239",
type: "lp",
releaseDate: "2025-03-21",
spotifyURI: "https://open.spotify.com/album/6Z499VaeaPbRHYM8RwbaH8"
})

CREATE (albPilgrim:Album {
uid: "alb-pilgrim",
title: "Pilgrim",
upc: "193436431750",
type: "lp",
releaseDate: "2025-07-04",
spotifyURI: "https://open.spotify.com/album/3e5ebpECrk8VZYxkTL2FA8"
})

CREATE (albDevilsDen:Album {
uid: "alb-devils-den",
title: "Devil's Den",
upc: "193436438544",
type: "lp",
releaseDate: "2025-08-22",
spotifyURI: "https://open.spotify.com/album/3ylSrdUwRK2SMt4YIdAJ5q"
})

CREATE (albWithTheDevil:Album {
uid: "alb-with-the-devil",
title: "With the Devil",
upc: "193436439688",
type: "lp",
releaseDate: "2025-08-22",
spotifyURI: "https://open.spotify.com/album/19ko9cDZ7C6HEgj7CbFt1E"
})

CREATE (albPowerlines2:Album {
uid: "alb-under-the-powerlines-ii",
title: "Under The Powerlines II (October 24β€”December 24)",
upc: "193436442923",
type: "lp",
releaseDate: "2025-09-26",
spotifyURI: "https://open.spotify.com/album/4PXryJrIsUgus5XIBFK207"
})

CREATE (albHardHeaded:Album {
uid: "alb-hard-headed-woman",
title: "Hard Headed Woman",
upc: "00888072714748",
type: "lp",
releaseDate: "2025-08-29",
spotifyURI: "https://open.spotify.com/album/1q03d1hYDfMWALV5t8Rbaw"
})

CREATE (albDarling:Album {
uid: "alb-darling-blue",
title: "Darling Blue",
upc: "00602478750687",
type: "lp",
releaseDate: "2025-09-26",
spotifyURI: "https://open.spotify.com/album/14gWu1NRr0J0M1evRdF83C"
})

// 6. Link Artists -> Albums
CREATE
(artDead)-[:RELEASED]->(albLeadMe),
(artDead)-[:RELEASED]->(albGrey),
(artDead)-[:RELEASED]->(albWhenWe),
(artWelles)-[:RELEASED]->(albRedTrees),
(artLocal)-[:RELEASED]->(albLocalFriends),
(artOkey)-[:RELEASED]->(albCurio),
(artJesse)-[:RELEASED]->(albHells),
(artJesse)-[:RELEASED]->(albPatchwork),
(artJesse)-[:RELEASED]->(albHaveYouEver),
(artJesse)-[:RELEASED]->(albAllCreatures),
(artJesse)-[:RELEASED]->(albMiddle),
(artJesse)-[:RELEASED]->(albPowerlines),
(artJesse)-[:RELEASED]->(albPilgrim),
(artJesse)-[:RELEASED]->(albDevilsDen),
(artJesse)-[:RELEASED]->(albWithTheDevil),
(artJesse)-[:RELEASED]->(albPowerlines2),
(artMargo)-[:RELEASED]->(albHardHeaded),
(artMarcus)-[:RELEASED]->(albDarling),
(artMKB)-[:RELEASED]->(albDarling)

// 7. Create Songs
CREATE (sNotMySong:Song {
uid: "song-this-is-not-my-song",
title: "This is Not My Song",
bmiID: 70345423,
iswc: "T3288295585",
songdexID: "SDX4C2DCDB3"
})

CREATE (sSummer:Song {
uid: "song-summer",
title: "Summer",
bmiID: 23582754,
iswc: "T9242026988",
songdexID: "SDX2EDF0E68"
})

CREATE (sWag:Song {
uid: "song-wag-your-tail",
title: "Wag Your Tail",
bmiID: 30771468,
iswc: "T9287888215"
})

CREATE (sDannys:Song {
uid: "song-dannys-song",
title: "Danny's Song",
ascapID: "340133840",
iswc: "T0700413019",
songdexID: "SDX499182DF"
})

CREATE (sWarMurder:Song {
uid: "song-war-isnt-murder",
title: "War Isn't Murder",
bmiID: 70344875,
iswc: "T3288295290",
songdexID: "SDX24FF371D"
})

CREATE (sHorses:Song {
uid: "song-horses",
title: "Horses",
bmiID: 72237059,
iswc: "T3312047835"
})

CREATE (sCertain:Song {
uid: "song-certain",
title: "Certain",
bmiID: 72235409,
iswc: "T3312047857"
})

CREATE (sSorry:Song {
uid: "song-im-sorry",
title: "I'm Sorry",
bmiID: 72231003,
iswc: "T3312047880"
})

CREATE (sFear:Song {
uid: "song-fear-is-the-mind-killer",
title: "Fear is the Mind Killer",
bmiID: 70345260,
iswc: "T3288295541",
songdexID: "SDXE479D39A"
})

CREATE (sWheel:Song {
uid: "song-wheel",
title: "Wheel",
bmiID: 72229524,
iswc: "T3312047915"
})

CREATE (sAnything:Song {
uid: "song-anything-but-me",
title: "Anything But Me",
bmiID: 72229476,
iswc: "T3312047959"
})

CREATE (sEveryGrain:Song {
uid: "song-every-grain-of-sand",
title: "Every Grain of Sand",
bmiID: 72230094,
iswc: "T3312047993"
})

CREATE (sSimpleGifts:Song {
uid: "song-simple-gifts",
title: "Simple Gifts",
bmiID: 72237347,
iswc: "T3312048054"
})

CREATE (sWhyDont:Song {
uid: "song-why-dont-you-love-me",
title: "Why Don't You Love Me",
bmiID: 72234064,
iswc: "T3312048076"
})

CREATE (sRocket:Song {
uid: "song-rocket-man",
title: "Rocket Man",
bmiID: 72234551,
iswc: "T3312048112"
})

CREATE (sWarGod:Song {
uid: "song-war-is-a-god",
title: "War is a God",
bmiID: 72233016,
iswc: "T3312048167"
})

CREATE (sMiddle:Song {
uid: "song-middle",
title: "Middle",
bmiID: 72229357,
iswc: "T3312048203"
})

CREATE (sFarFrom:Song {
uid: "song-far-from-home",
title: "Far From Home",
bmiID: 75180538,
iswc: "T3351396373",
songdexID: "SDX8D53CF67"
})

CREATE (sPhilanthropist:Song {
uid: "song-philanthropist",
title: "Philanthropist",
bmiID: 75180957,
iswc: "T3351396384",
songdexID: "SDX7F5B3C0A"
})

CREATE (sDontWake:Song {
uid: "song-dont-wake-me-up",
title: "Don't Wake Me Up",
sesacID: 737275041,
iswc: "T3281403478",
songdexID: "SDX9AF093D0"
})

CREATE (sSomebodyElse:Song {
uid: "song-somebody-else",
title: "Somebody Else",
bmiID: 75211717,
songdexID: "SDXE382B3F0"
})

// 8. Connect Songs to their Song Writers
CREATE
(jesse)-[:WROTE_SONG]->(sNotMySong),
(jesse)-[:WROTE_SONG]->(sSummer),
(jesse)-[:WROTE_SONG]->(sWag),
(jesse)-[:WROTE_SONG]->(sWarMurder),
(jesse)-[:WROTE_SONG]->(sHorses),
(jesse)-[:WROTE_SONG]->(sCertain),
(jesse)-[:WROTE_SONG]->(sSorry),
(jesse)-[:WROTE_SONG]->(sFear),
(jesse)-[:WROTE_SONG]->(sWheel),
(jesse)-[:WROTE_SONG]->(sAnything),
(jesse)-[:WROTE_SONG]->(sEveryGrain),
(jesse)-[:WROTE_SONG]->(sSimpleGifts),
(jesse)-[:WROTE_SONG]->(sWhyDont),
(jesse)-[:WROTE_SONG]->(sRocket),
(jesse)-[:WROTE_SONG]->(sWarGod),
(jesse)-[:WROTE_SONG]->(sMiddle),
(jesse)-[:WROTE_SONG]->(sFarFrom),
(jesse)-[:WROTE_SONG]->(sPhilanthropist),
(jesse)-[:WROTE_SONG]->(sSomebodyElse),
(kenny)-[:WROTE_SONG]->(sDannys),
(lincoln)-[:WROTE_SONG]->(sSummer),
(margo)-[:WROTE_SONG]->(sDontWake),
(ivey)-[:WROTE_SONG]->(sDontWake),
(marcus)-[:WROTE_SONG]->(sSomebodyElse)

// 9. Create Recordings
CREATE (recNotMySongGrey:Recording {
uid: "rec-this-is-not-my-song-grey",
title: "This is Not My Song (Grey)",
isrc: "ushm21376892",
durationSeconds: 229,
isLive: false,
spotifyURI: "https://open.spotify.com/track/1woC7D1UN4zquHncGB0CfA"
})

CREATE (recNotMySongPatchwork:Recording {
uid: "rec-this-is-not-my-song-patchwork",
title: "This is Not My Song (Patchwork)",
durationSeconds: 209
})

CREATE (recSummerRedTrees:Recording {
uid: "rec-summer-red-trees-white-trashes",
title: "Summer (Red Trees and White Trashes)"
})

CREATE (recWag:Recording {
uid: "rec-wag-your-tail-curio-cabinet",
title: "Wag Your Tail (Curio Cabinet)"
})

CREATE (recDannys:Recording {
uid: "rec-dannys-song-local-opener",
title: "Danny's Song (Friends)"
})

CREATE (recWarMurderHells:Recording {
uid: "rec-war-isnt-murder-hells-welles",
title: "War Isn't Murder (Hells Welles)"
})

CREATE (recHorsesMiddle:Recording {
uid: "rec-horses-middle" ,
title: "Horses (Middle)",
durationSeconds: 215,
isLive: false
})

CREATE (recCertainMiddle:Recording {
uid: "rec-certain-middle",
title: "Certain (Middle)",
isrc: "QM24S2500590",
durationSeconds: 217,
isLive: false,
spotifyURI: "https://open.spotify.com/track/6Rouoeb8kDM7tEmMIKaCuG"
})

CREATE (recSorryMiddle:Recording {
uid: "rec-im-sorry-middle",
title: "I'm Sorry (Middle)",
durationSeconds: 197,
isLive: false
})

CREATE (recFearMiddle:Recording {
uid: "rec-fear-is-the-mind-killer-middle",
title: "Fear is the Mind Killer (Middle)",
durationSeconds: 249,
isLive: false
})

CREATE (recFearPatchwork:Recording {
uid: "rec-fear-is-the-mind-killer-patchwork",
title: "Fear is the Mind Killer (Patchwork)",
durationSeconds: 307,
isLive: false
})

CREATE (recWheelMiddle:Recording {
uid: "rec-wheel-middle",
title: "Wheel (Middle)",
durationSeconds: 224
})

CREATE (recAnythingMiddle:Recording {
uid: "rec-anything-but-me-middle",
title: "Anything But Me (Middle)",
isrc: "QM24S2500586",
durationSeconds: 232,
isLive: false,
spotifyURI: "https://open.spotify.com/track/3tIxJq4LScLyay7wk69x8s"
})

CREATE (recEveryGrainMiddle:Recording {
uid: "rec-every-grain-of-sand-middle",
title: "Every Grain of Sand (Middle)",
durationSeconds: 179,
isLive: false
})

CREATE (recSimpleGiftsMiddle:Recording {
uid: "rec-simple-gifts-middle",
title: "Simple Gifts (Middle)",
durationSeconds: 194
})

CREATE (recWhyDontMiddle:Recording {
uid: "rec-why-dont-you-love-me-middle",
title: "Why Don't You Love Me (Middle)",
durationSeconds: 218
})

CREATE (recRocketMiddle:Recording {
uid: "rec-rocket-man-middle",
title: "Rocket Man (Middle)",
durationSeconds: 265
})

CREATE (recWarGodMiddle:Recording {
uid: "rec-war-is-a-god-middle",
title: "War is a God (Middle)",
durationSeconds: 197
})

CREATE (recMiddleMiddle:Recording {
uid: "rec-middle-middle",
title: "Middle (Middle)",
durationSeconds: 246
})

CREATE (recFarFromPilgrim:Recording {
uid: "rec-far-from-home-pilgrim",
title: "Far From Home (Pilgrim)"
})

CREATE (recPhilanthropistPilgrim:Recording {
uid: "rec-philanthropist-pilgrim",
title: "Philanthropist (Pilgrim)"
})

CREATE (recDontWakeHardHeaded:Recording {
uid: "rec-dont-wake-me-up-hard-headed-woman",
title: "Don't Wake Me Up (Hard Headed Woman)"
})

CREATE (recSomebodyElseDarlingBlue:Recording {
uid: "rec-somebody-else-darling-blue",
title: "Somebody Else (Darling Blue)"
})

// 10. Link Songs <-- Recordings --> Albums
CREATE
(sNotMySong)<-[:PERFORMANCE_OF]-(recNotMySongGrey)-[:RELEASED_ON {trackNo: 3}]->(albGrey),
(sNotMySong)<-[:PERFORMANCE_OF]-(recNotMySongPatchwork)-[:RELEASED_ON {trackNo: 7}]->(albPatchwork),
(sSummer)<-[:PERFORMANCE_OF]-(recSummerRedTrees)-[:RELEASED_ON {trackNo: 12}]->(albRedTrees),
(sWag)<-[:PERFORMANCE_OF]-(recWag)-[:RELEASED_ON {trackNo: 6}]->(albCurio),
(sDannys)<-[:PERFORMANCE_OF]-(recDannys)-[:RELEASED_ON {trackNo: 4}]->(albLocalFriends),
(sWarMurder)<-[:PERFORMANCE_OF]-(recWarMurderHells)-[:RELEASED_ON {trackNo: 1}]->(albHells),
(sFear)<-[:PERFORMANCE_OF]-(recFearPatchwork)-[:RELEASED_ON {trackNo: 3}]->(albPatchwork),
(sHorses)<-[:PERFORMANCE_OF]-(recHorsesMiddle)-[:RELEASED_ON {trackNo: 1}]->(albMiddle),
(sCertain)<-[:PERFORMANCE_OF]-(recCertainMiddle)-[:RELEASED_ON {trackNo: 2}]->(albMiddle),
(sSorry)<-[:PERFORMANCE_OF]-(recSorryMiddle)-[:RELEASED_ON {trackNo: 3}]->(albMiddle),
(sFear)<-[:PERFORMANCE_OF]-(recFearMiddle)-[:RELEASED_ON {trackNo: 4}]->(albMiddle),
(sWheel)<-[:PERFORMANCE_OF]-(recWheelMiddle)-[:RELEASED_ON {trackNo: 5}]->(albMiddle),
(sAnything)<-[:PERFORMANCE_OF]-(recAnythingMiddle)-[:RELEASED_ON {trackNo: 6}]->(albMiddle),
(sEveryGrain)<-[:PERFORMANCE_OF]-(recEveryGrainMiddle)-[:RELEASED_ON {trackNo: 7}]->(albMiddle),
(sSimpleGifts)<-[:PERFORMANCE_OF]-(recSimpleGiftsMiddle)-[:RELEASED_ON {trackNo: 8}]->(albMiddle),
(sWhyDont)<-[:PERFORMANCE_OF]-(recWhyDontMiddle)-[:RELEASED_ON {trackNo: 9}]->(albMiddle),
(sRocket)<-[:PERFORMANCE_OF]-(recRocketMiddle)-[:RELEASED_ON {trackNo: 10}]->(albMiddle),
(sWarGod)<-[:PERFORMANCE_OF]-(recWarGodMiddle)-[:RELEASED_ON {trackNo: 11}]->(albMiddle),
(sMiddle)<-[:PERFORMANCE_OF]-(recMiddleMiddle)-[:RELEASED_ON {trackNo: 12}]->(albMiddle),
(sFarFrom)<-[:PERFORMANCE_OF]-(recFarFromPilgrim)-[:RELEASED_ON {trackNo: 6}]->(albPilgrim),
(sPhilanthropist)<-[:PERFORMANCE_OF]-(recPhilanthropistPilgrim)-[:RELEASED_ON {trackNo: 7}]->(albPilgrim),
(sDontWake)<-[:PERFORMANCE_OF]-(recDontWakeHardHeaded)-[:RELEASED_ON {trackNo: 4}]->(albHardHeaded),
(sSomebodyElse)<-[:PERFORMANCE_OF]-(recSomebodyElseDarlingBlue)-[:RELEASED_ON {trackNo: 6}]->(albDarling)

// 11. Link Person --> Recording <-- Artist
CREATE
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recNotMySongGrey)<-[:CREDITED_ON {role: ["primary artist"]}]-(artDead),
(simon)-[:PERFORMED_ON {role: ["drums"]}]->(recNotMySongGrey),
(dirk)-[:PERFORMED_ON {role: ["bass"]}]->(recNotMySongGrey),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recSummerRedTrees)<-[:CREDITED_ON {role: ["primary artist"]}]-(artWelles),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recWag)<-[:CREDITED_ON {role: ["primary artist"]}]-(artOkey),
(johny)-[:PERFORMED_ON {role: ["guitar"]}]->(recWag)<-[:CREDITED_ON {role: ["featured"]}]-(artWelles),
(aaron)-[:PERFORMED_ON {role: ["vocals","bass"]}]->(recWag),
(johny)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recDannys)<-[:CREDITED_ON {role: ["primary artist"]}]-(artLocal),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recDannys)<-[:CREDITED_ON {role: ["featured"]}]-(artWelles),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recWarMurderHells)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recFearPatchwork)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recNotMySongPatchwork)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recHorsesMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recCertainMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recSorryMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recFearMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recWheelMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recAnythingMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recEveryGrainMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recSimpleGiftsMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recWhyDontMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recRocketMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recWarGodMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recMiddleMiddle)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recFarFromPilgrim)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recPhilanthropistPilgrim)<-[:CREDITED_ON {role: ["primary artist"]}]-(artJesse),
(sierra)-[:PERFORMED_ON {role:["vocals"]}]->(recFarFromPilgrim)<-[:CREDITED_ON {role:["featured"]}]-(artSierra),
(billy)-[:PERFORMED_ON {role: ["guitar"]}]->(recPhilanthropistPilgrim)<-[:CREDITED_ON {role: ["featured"]}]-(artBilly),
(margo)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recDontWakeHardHeaded)<-[:CREDITED_ON {role: ["primary artist"]}]-(artMargo),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recDontWakeHardHeaded)<-[:CREDITED_ON {role: ["featured"]}]-(artJesse),
(marcus)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recSomebodyElseDarlingBlue)<-[:CREDITED_ON {role: ["primary artist"]}]-(artMarcus),
(jesse)-[:PERFORMED_ON {role: ["vocals","guitar"]}]->(recSomebodyElseDarlingBlue)<-[:CREDITED_ON {role: ["featured"]}]-(artJesse)

// 12. Create Themes

CREATE (thCosmic:Theme {name: "Cosmic Imagery"})
CREATE (thNatural:Theme {name: "Natural (Earth) Imagery"})
CREATE (thDepress:Theme {name: "Anxiety and Depression"})
CREATE (thFearUncertain:Theme {name: "Fear and Uncertainty"})
CREATE (thInternal:Theme {name: "Internal Struggles"})
CREATE (thSocial:Theme {name: "Social Critique"})
CREATE (thWar:Theme {name: "Critique of War"})
CREATE (thLoveHate:Theme {name: "Love vs Hate"})
CREATE (thFaith:Theme {name: "God, Faith, Religion"})
CREATE (thDeath:Theme {name: "Mortality and Death"})
CREATE (thTime:Theme {name: "Finite Nature of Time"})
CREATE (thExist:Theme {name: "Existentialism"})
CREATE (thScifi:Theme {name: "Science Fiction and Fantasy"})

CREATE (thMeaning:Theme {name: "Search for Meaning"})
CREATE (thTruth:Theme {name: "Search for Truth"})
CREATE (thKnowledge:Theme {name: "Search for Knowledge"})
CREATE (thRomantic:Theme {name: "Romantic Relationships"})

// 13. Link Songs -> Themes (EVOKES_THEME)
CREATE
(sAnything)-[:EVOKES_THEME]->(thCosmic),
(sEveryGrain)-[:EVOKES_THEME]->(thCosmic),
(sFarFrom)-[:EVOKES_THEME]->(thCosmic),
(sWheel)-[:EVOKES_THEME]->(thCosmic),
(sRocketMan)-[:EVOKES_THEME]->(thCosmic),
(sMiddle)-[:EVOKES_THEME]->(thCosmic),
(sAnything)-[:EVOKES_THEME]->(thNatural),
(sCertain)-[:EVOKES_THEME]->(thNatural),
(sDontWake)-[:EVOKES_THEME]->(thNatural),
(sEveryGrain)-[:EVOKES_THEME]->(thNatural),
(sFear)-[:EVOKES_THEME]->(thNatural),
(sHorses)-[:EVOKES_THEME]->(thNatural),
(sMiddle)-[:EVOKES_THEME]->(thNatural),
(sSimpleGifts)-[:EVOKES_THEME]->(thNatural),
(sNotMySong)-[:EVOKES_THEME]->(thNatural),
(sWhyDont)-[:EVOKES_THEME]->(thNatural),
(sAnything)-[:EVOKES_THEME]->(thDepress),
(sDontWake)-[:EVOKES_THEME]->(thDepress),
(sFarFrom)-[:EVOKES_THEME]->(thDepress),
(sSorry)-[:EVOKES_THEME]->(thDepress),
(sSomebodyElse)-[:EVOKES_THEME]->(thDepress),
(sCertain)-[:EVOKES_THEME]->(thFearUncertain),
(sFarFrom)-[:EVOKES_THEME]->(thFearUncertain),
(sFear)-[:EVOKES_THEME]->(thFearUncertain),
(sWhyDont)-[:EVOKES_THEME]->(thFearUncertain),
(sAnything)-[:EVOKES_THEME]->(thInternal),
(sFarFrom)-[:EVOKES_THEME]->(thInternal),
(sFear)-[:EVOKES_THEME]->(thInternal),
(sHorses)-[:EVOKES_THEME]->(thInternal),
(sSorry)-[:EVOKES_THEME]->(thInternal),
(sSimpleGifts)-[:EVOKES_THEME]->(thInternal),
(sSomebodyElse)-[:EVOKES_THEME]->(thInternal),
(sCertain)-[:EVOKES_THEME]->(thSocial),
(sDontWake)-[:EVOKES_THEME]->(thSocial),
(sHorses)-[:EVOKES_THEME]->(thSocial),
(sPhilanthropist)-[:EVOKES_THEME]->(thSocial),
(sWarMurder)-[:EVOKES_THEME]->(thSocial),
(sWag)-[:EVOKES_THEME]->(thSocial),
(sHorses)-[:EVOKES_THEME]->(thWar),
(sPhilanthropist)-[:EVOKES_THEME]->(thWar),
(sWarMurder)-[:EVOKES_THEME]->(thWar),
(sWarGod)-[:EVOKES_THEME]->(thWar),
(sCertain)-[:EVOKES_THEME]->(thLoveHate),
(sFear)-[:EVOKES_THEME]->(thLoveHate),
(sHorses)-[:EVOKES_THEME]->(thLoveHate),
(sWarGod)-[:EVOKES_THEME]->(thLoveHate),
(sCertain)-[:EVOKES_THEME]->(thFaith),
(sEveryGrain)-[:EVOKES_THEME]->(thFaith),
(sHorses)-[:EVOKES_THEME]->(thFaith),
(sSorry)-[:EVOKES_THEME]->(thFaith),
(sMiddle)-[:EVOKES_THEME]->(thFaith),
(sRocket)-[:EVOKES_THEME]->(thFaith),
(sWarGod)-[:EVOKES_THEME]->(thFaith),
(sWarMurder)-[:EVOKES_THEME]->(thFaith),
(sWhyDont)-[:EVOKES_THEME]->(thFaith),
(sDontWake)-[:EVOKES_THEME]->(thDeath),
(sEveryGrain)-[:EVOKES_THEME]->(thDeath),
(sHorses)-[:EVOKES_THEME]->(thDeath),
(sRocket)-[:EVOKES_THEME]->(thDeath),
(sSomebodyElse)-[:EVOKES_THEME]->(thDeath),
(sWarMurder)-[:EVOKES_THEME]->(thDeath),
(sEveryGrain)-[:EVOKES_THEME]->(thTime),
(sHorses)-[:EVOKES_THEME]->(thTime),
(sRocket)-[:EVOKES_THEME]->(thTime),
(sWheel)-[:EVOKES_THEME]->(thTime),
(sMiddle)-[:EVOKES_THEME]->(thExist),
(sSimpleGifts)-[:EVOKES_THEME]->(thExist),
(sWhyDont)-[:EVOKES_THEME]->(thExist),
(sWheel)-[:EVOKES_THEME]->(thExist),
(sDontWake)-[:EVOKES_THEME]->(thExist),
(sFarFrom)-[:EVOKES_THEME]->(thExist),
(sFarFrom)-[:EVOKES_THEME]->(thScifi),
(sMiddle)-[:EVOKES_THEME]->(thScifi),
(sRocket)-[:EVOKES_THEME]->(thScifi),
(sSimpleGifts)-[:EVOKES_THEME]->(thScifi),
(sWhyDont)-[:EVOKES_THEME]->(thScifi),
(sAnything)-[:EVOKES_THEME]->(thMeaning),
(sCertain)-[:EVOKES_THEME]->(thMeaning),
(sFarFrom)-[:EVOKES_THEME]->(thMeaning),
(sHorses)-[:EVOKES_THEME]->(thMeaning),
(sSimpleGifts)-[:EVOKES_THEME]->(thMeaning),
(sWhyDont)-[:EVOKES_THEME]->(thMeaning),
(sCertain)-[:EVOKES_THEME]->(thTruth),
(sWarGod)-[:EVOKES_THEME]->(thTruth),
(sWhyDont)-[:EVOKES_THEME]->(thTruth),
(sAnything)-[:EVOKES_THEME]->(thKnowledge),
(sHorses)-[:EVOKES_THEME]->(thKnowledge),
(sSorry)-[:EVOKES_THEME]->(thKnowledge),
(sSimpleGifts)-[:EVOKES_THEME]->(thKnowledge),
(sWheel)-[:EVOKES_THEME]->(thKnowledge),
(sAnything)-[:EVOKES_THEME]->(thRomantic),
(sSorry)-[:EVOKES_THEME]->(thRomantic),
(sSomebodyElse)-[:EVOKES_THEME]->(thRomantic),
(sNotMySong)-[:EVOKES_THEME]->(thRomantic),
(sWhyDont)-[:EVOKES_THEME]->(thRomantic)

// 14. Events and Performances
CREATE (evFA2024:Event {
uid: "event-farm-aid-2024",
name: "Farm Aid 2024",
dateStart: "2024-09-21",
dateEnd: "2024-09-21"
})

CREATE (evFA2025:Event {
uid: "event-farm-aid-2025",
name: "Farm Aid 2025",
dateStart: "2024-09-20",
dateEnd: "2024-09-20"
})

// Link Artist -> Events
CREATE
(artJesse)-[:PERFORMED_AT]->(evFA2024),
(artMargo)-[:PERFORMED_AT]->(evFA2024),
(artJesse)-[:PERFORMED_AT]->(evFA2025),
(artMargo)-[:PERFORMED_AT]->(evFA2025),
(artBilly)-[:PERFORMED_AT]->(evFA2025)
// ---- END COPY-PASTE CONTENT ----

NOTE: You must paste and run this as ONE COMPLETE block. If you receive an error, then check to be sure that you have ONLY included the items from:

// -β€” BEGIN COPY-PASTE CONTENT ----
to
// -β€” END COPY-PASTE CONTENT -β€”

This code block has been tested dozens of times using multiple web browsers, so any error that you receive are almost certainly an error in what you have copied and pasted, so double-check the beginning and end of your command. It must match exactly as provided in the toggled section.

Test The New Data

Run a few basic Cypher queries. Do you know have a collection of albums, songs, people, etc.? If so, try running the commands and queries from earlier in this module. When you feel comfortable, move on to module 3.

Key Takeaways

  • MATCH finds patterns; WHERE filters them; RETURN displays results.
  • Logical operators ( AND, OR, NOT ) combine and refine conditions.
  • Text filters (CONTAINS, STARTS WITH, ENDS WITH) let you search language-based data.
  • ORDER BY and LIMIT help structure readable outputs.
  • Every filter is an interpretive decision about what counts as evidence.

Knowledge Check & Reflection

There is no knowledge Check & Reflection Section for this page. If you've succeeded so far, move on. If not, please try again.

Updated on Dec 9, 2025