mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
17 lines
357 B
Python
17 lines
357 B
Python
|
from langchain.graphs import Neo4jGraph
|
||
|
|
||
|
graph = Neo4jGraph()
|
||
|
|
||
|
graph.query(
|
||
|
"""
|
||
|
MERGE (m:Movie {name:"Top Gun"})
|
||
|
WITH m
|
||
|
UNWIND ["Tom Cruise", "Val Kilmer", "Anthony Edwards", "Meg Ryan"] AS actor
|
||
|
MERGE (a:Actor {name:actor})
|
||
|
MERGE (a)-[:ACTED_IN]->(m)
|
||
|
WITH a
|
||
|
WHERE a.name = "Tom Cruise"
|
||
|
MERGE (a)-[:ACTED_IN]->(:Movie {name:"Mission Impossible"})
|
||
|
"""
|
||
|
)
|