Cypher Query Language
Properties
tags
cscs/databases
created
22.11.2024, 15:08
modified
09.08.2025, 11:29
published
Empty
sources
Empty
topics
Cypher, Graph Query Languages, Neo4j, Graph Databases
authors
Empty
ai-assisted
No
Footnote sources: ChatGPT1
Cypher is the query language used in Neo4j. It is designed for working with graph databases, providing a simple syntax for querying and manipulating data.
# Example: Neo4j Data and Query
# Sample Data
Imagine a social network with the following:
- Nodes:
Usernodes:Alice,Bob,Charlie
- Relationships:
Alice FRIENDS_WITH BobBob FRIENDS_WITH Charlie
# Query Example
| |
# Explanation of the Query
MATCH: Identifies patterns in the graph.(a:User {name: "Alice"}): Matches a node labeledUserwith the propertyname: "Alice".-[:FRIENDS_WITH]->: Traverses an outgoingFRIENDS_WITHrelationship.(b:User): Matches the connected node labeledUser.
RETURN: Specifies what to retrieve.b.name: Returns thenameproperty of the connected user.
# Output
This query would return:
| |
Prompt: Provide an example of querying this database. And explain the cypher query. ↩︎