Skip to main content Svelte Highlight v7.21.1

Cypher language preview

1. Pattern match

nodes, labels, and relationships
horizon-dark
MATCH (person:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.released > 2000
RETURN person.name AS actor, movie.title AS title
ORDER BY movie.released DESC
LIMIT 10
atom-one-dark
MATCH (person:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.released > 2000
RETURN person.name AS actor, movie.title AS title
ORDER BY movie.released DESC
LIMIT 10
github-dark
MATCH (person:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.released > 2000
RETURN person.name AS actor, movie.title AS title
ORDER BY movie.released DESC
LIMIT 10
dracula
MATCH (person:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.released > 2000
RETURN person.name AS actor, movie.title AS title
ORDER BY movie.released DESC
LIMIT 10
nord
MATCH (person:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.released > 2000
RETURN person.name AS actor, movie.title AS title
ORDER BY movie.released DESC
LIMIT 10
github
MATCH (person:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.released > 2000
RETURN person.name AS actor, movie.title AS title
ORDER BY movie.released DESC
LIMIT 10

2. Create and merge

parameters and property maps
horizon-dark
MERGE (u:User {id: $userId})
ON CREATE SET u.created = timestamp()
CREATE (u)-[:POSTED]->(p:Post {title: "Hello", likes: 0})
RETURN u, p
atom-one-dark
MERGE (u:User {id: $userId})
ON CREATE SET u.created = timestamp()
CREATE (u)-[:POSTED]->(p:Post {title: "Hello", likes: 0})
RETURN u, p
github-dark
MERGE (u:User {id: $userId})
ON CREATE SET u.created = timestamp()
CREATE (u)-[:POSTED]->(p:Post {title: "Hello", likes: 0})
RETURN u, p
dracula
MERGE (u:User {id: $userId})
ON CREATE SET u.created = timestamp()
CREATE (u)-[:POSTED]->(p:Post {title: "Hello", likes: 0})
RETURN u, p
nord
MERGE (u:User {id: $userId})
ON CREATE SET u.created = timestamp()
CREATE (u)-[:POSTED]->(p:Post {title: "Hello", likes: 0})
RETURN u, p
github
MERGE (u:User {id: $userId})
ON CREATE SET u.created = timestamp()
CREATE (u)-[:POSTED]->(p:Post {title: "Hello", likes: 0})
RETURN u, p

3. Map literals with identifier values

{key: value} maps, not to be confused with node labels
horizon-dark
MATCH (n:Person)
RETURN {name: n.name, age: n.age, active: true}
atom-one-dark
MATCH (n:Person)
RETURN {name: n.name, age: n.age, active: true}
github-dark
MATCH (n:Person)
RETURN {name: n.name, age: n.age, active: true}
dracula
MATCH (n:Person)
RETURN {name: n.name, age: n.age, active: true}
nord
MATCH (n:Person)
RETURN {name: n.name, age: n.age, active: true}
github
MATCH (n:Person)
RETURN {name: n.name, age: n.age, active: true}

4. Built-in functions and identifiers

id(), coalesce(), and `backtick` identifiers
horizon-dark
MATCH (n:`Weird Label`)
RETURN id(n) AS nodeId,
       coalesce(n.`display name`, "unknown") AS name,
       labels(n) AS labels
atom-one-dark
MATCH (n:`Weird Label`)
RETURN id(n) AS nodeId,
       coalesce(n.`display name`, "unknown") AS name,
       labels(n) AS labels
github-dark
MATCH (n:`Weird Label`)
RETURN id(n) AS nodeId,
       coalesce(n.`display name`, "unknown") AS name,
       labels(n) AS labels
dracula
MATCH (n:`Weird Label`)
RETURN id(n) AS nodeId,
       coalesce(n.`display name`, "unknown") AS name,
       labels(n) AS labels
nord
MATCH (n:`Weird Label`)
RETURN id(n) AS nodeId,
       coalesce(n.`display name`, "unknown") AS name,
       labels(n) AS labels
github
MATCH (n:`Weird Label`)
RETURN id(n) AS nodeId,
       coalesce(n.`display name`, "unknown") AS name,
       labels(n) AS labels