我在Windows上工作.我使用记事本创建了Cypher查询的文本文件.如何使用Neo4jShell或Neo4j Web界面控制台在文件中运行查询.
kma*_*o23 15
在Debian/Ubuntu或任何*nix安装上,使用终端中的以下内容:
$ neo4j-shell -c < path-to-cypher-query-file.cql
请注意,文件中的每个cypher查询必须以分号结尾,并且必须用另一个查询中的空行分隔.此外,.cql结尾(文件格式)不是必需的.
只需在启动控制台时添加-file作为参数.
在Windows上,它看起来像这样:
Neo4jShell.bat -file path/to/cql/file
Run Code Online (Sandbox Code Playgroud)
或者您也可以将结果打印到新文件中
Neo4jShell.bat -file path/to/cql/file > path/to/output/file
Run Code Online (Sandbox Code Playgroud)
我也确定有一种方法可以在shell中进行,而不是在启动时,就像Stefan Armbruster曾经向我展示的那样,但是对于上帝的爱,我不记得他是怎么做到的.但这种方法也有效.
$ neo4j-shell -file query.cql
Run Code Online (Sandbox Code Playgroud)
或使用 cypher-shell
$ cat query.cql | cypher-shell
Run Code Online (Sandbox Code Playgroud)