1. Learn
  2. /
  3. Courses
  4. /
  5. Graph RAG with LangChain and Neo4j

Connected

Exercise

Writing Cypher statements

To retrieve information from Neo4j knowledge graphs for use in a Graph RAG workflow, you'll need to understand Neo4j's query language, Cypher. Eventually, this Cypher will be written by LLMs, but it's good to get a feel for it so you can validate it if needed.

Over the next few exercises, you'll build up a Cypher statement to find people who work at a company.

Instructions 1/4

undefined XP
  • 1
    • Complete the Cypher query to retrieve all Person nodes from the graph and return them.
  • 2
    • Retrieve all Person nodes (as the variable n) that have a WORKS_FOR relationship to a Company node (as the variable c).
  • 3
    • Update the statement to filter the pattern to where the name property on the n node matches the $name parameter
  • 4
    • Update the RETURN clause to return the name properties on the n and c nodes, aliased as person and company.