I about me

[GraphRAG] Cypher 쿼리 언어 본문

AI

[GraphRAG] Cypher 쿼리 언어

ssungni 2026. 5. 31. 19:33

Cypher

  • Graph 데이터베이스에 접근하기 위해 사용되는 그래프 쿼리 언어
  • Visual Cypher Builder, Cypher Cheat Sheet

 

데이터셋

https://github.com/neo4j-graph-examples/recommendations

 

GitHub - neo4j-graph-examples/recommendations: Neo4j Graph Example Movies Recommendation

Neo4j Graph Example Movies Recommendation. Contribute to neo4j-graph-examples/recommendations development by creating an account on GitHub.

github.com


1. 데이터 베이스 조회

CALL db.schema.visualization()

  • Movie(영화), Actor(배우), Director(감독), Genre(장르), Person(사람), User(관람객)

 

2. 조회하기 → MATCH()

  • 노드를 중심으로 추출
    MATCH (n)
    RETURN n LIMIT 10

  • Movie, Actor, Director, Genre, Person, User 中 Movie를 중심으로 10개 추출
    MATCH (n: Movie)
    RETURN n LIMIT 10

  • title을 기준으로 추출
    MATCH (n: Movie {title: "Toy Story"})
    RETURN n

  • 이제 관계를 추출하고자 할 때, '' 사용

  • WHERE절 사용
  • WITH

3. 삭제하는 방법

MATCH (n)
DETACH DELETE n