mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-09 15:03:21 +00:00
Templates (#12294)
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: Lance Martin <lance@langchain.dev> Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
This commit is contained in:
21
templates/neo4j-cypher-ft/ingest.py
Normal file
21
templates/neo4j-cypher-ft/ingest.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from langchain.graphs import Neo4jGraph
|
||||
|
||||
graph = Neo4jGraph()
|
||||
|
||||
# Import sample data
|
||||
graph.query(
|
||||
"""
|
||||
MERGE (m:Movie {name:"Top Gun"})
|
||||
WITH m
|
||||
UNWIND ["Tom Cruise", "Val Kilmer", "Anthony Edwards", "Meg Ryan"] AS actor
|
||||
MERGE (a:Person {name:actor})
|
||||
MERGE (a)-[:ACTED_IN]->(m)
|
||||
"""
|
||||
)
|
||||
|
||||
# Create full text index for entity matching
|
||||
# on Person and Movie nodes
|
||||
graph.query(
|
||||
"CREATE FULLTEXT INDEX entity IF NOT EXISTS"
|
||||
" FOR (m:Movie|Person) ON EACH [m.title, m.name]"
|
||||
)
|
Reference in New Issue
Block a user