在我的 AWS 托管 Neo4j 服务器上,我摄取了一个大型数据集。使用的版本是neo4j:3.5.5-enterprise和apoc-3.5.0.4。我想在我的笔记本电脑上检查数据集的一个子集,所以我想导出该子集并创建我的 data.cypher 文件,如下所示:
call apoc.export.cypher.query(
"
MATCH (a:Author {name: '$NAME'})
WITH a
OPTIONAL MATCH (u:UnknownAuthor)-[:MAYBE]-(a)
WITH collect(u)+collect(a) AS authors
UNWIND authors as a
MATCH (a)-[:WROTE]-(p:Paper)
WITH a, p
OPTIONAL MATCH (p)-[]-(n)
return *
",
'/data.cypher',{format:'cypher-shell'});
AWS 和我的本地 Neo4j 都在 Docker 容器中运行。所以我从 Docker 容器中检索它
docker cp neo4j:/var/lib/neo4j/import/data.cypher data.cypher
然后我将 data.cypher 文件下载到我的笔记本电脑并尝试将其摄取到我本地的空 Neo4j 容器中:
docker cp data.cypher neo4j:/var/lib/neo4j/import/data.cypher
echo "starting cypher shell"
docker exec -it neo4j \
sh -c 'cat /var/lib/neo4j/import/data.cypher | /var/lib/neo4j/bin/cypher-shell --format plain'
不幸的是,这不起作用,我收到此错误消息:
Invalid input '}': expected whitespace, comment or a property key name (line 2, column 61 (offset: 61))
"UNWIND [{id:"3647617", properties:{name:"Allen Macpherson", }}, {id:"47022847", properties:{name:"Julia E. Anderson", }}, --- REST OMITTED ---] as row"
^
如何导入此文件?