我是否正确无法使用cypher加载带有标头和数据类型的csv文件? (通过“with datatype”,我的意思是标题,如下所示: 对于实体:
orderId:ID(订单)customerId:IGNORE
关系:
:START_ID(订单):END_ID(产品) )
根据这两个网站:https://neo4j.com/developer/guide-import-csv/,http://jexp.de/blog/2015/04/how-to-neo4j-data-import-minimal-example/ 似乎我可以在powershell或命令提示符下以这种方式将数据与头一起导入(我使用的是Windows计算机):
path\to\neo4j-community-3.1.1\bin\neo4j-import --into graph.db \
--nodes:Person C:\SavedNewest\people_header.csv, C:\SavedNewest\people.csv \
--relationships:KNOWS C:\SavedNewest\friendships_header.csv,C:\SavedNewest\friendships.csv
(根据这个网站重建csv:http://jexp.de/blog/2015/04/how-to-neo4j-data-import-minimal-example/)
PowerShell出错:
At line:2 char:3
+ --nodes:Person C:\SavedNewest\people_header.csv,https://gist.githubus ...
+ ~
Missing expression after unary operator '--'.
At line:2 char:3
+ --nodes:Person C:\SavedNewest\people_header.csv,https://gist.githubus ...
+ ~~~~~~~~~~~~
Unexpected token 'nodes:Person' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator
命令提示符出错:
WARNING: This command does not appear to be running with administrative rights.
Some commands may fail e.g. Start/Stop
WARNING: neo4j-import is deprecated and support for it will be removed in a future
version of Neo4j; please use neo4j-admin import instead.
Input error: Expected '--relationships' to have at least 1 valid item, but had 0 []
Caused by:Expected '--relationships' to have at least 1 valid item, but had 0 []
java.lang.IllegalArgumentException: Expected '--relationships' to have at least 1 valid item, but had 0 []
at org.neo4j.kernel.impl.util.Validators.lambda$atLeast$6(Validators.java:125)
at org.neo4j.helpers.Args.validated(Args.java:640)
at org.neo4j.helpers.Args.interpretOptionsWithMetadata(Args.java:608)
at org.neo4j.tooling.ImportTool.extractInputFiles(ImportTool.java:508)
at org.neo4j.tooling.ImportTool.main(ImportTool.java:389)
at org.neo4j.tooling.ImportTool.main(ImportTool.java:334)
错误的原因是什么?如何正确加载带有标头和数据类型的csv文件?
编辑: cmd的新输入:
C:\Users\tsutomu\Desktop\MSS\Bachelorarbeit\neo4j-community-3.1.1\bin\neo4j-import --into graph.db --nodes:Person "file:c:/SavedNewest/people_header.csv,file:c:/SavedNewest/people.csv" --relationships:KNOWS "file:c:/SavedNewest/friendships_header.csv,file:c:/SavedNewest/friendships.csv"
错误:
Input error: Directory of file:c:\SavedNewest\people_header.csv doesn't exist
引起:文件目录:c:\ SavedNewest \ people_header.csv不存在 java.lang.IllegalArgumentException:文件目录:c:\ SavedNewest \ people_header.csv不存在 在org.neo4j.kernel.impl.util.Validators.matchingFiles(Validators.java:48) 在org.neo4j.kernel.impl.util.Converters.lambda $ regexFiles $ 7(Converters.java:76) 在org.neo4j.kernel.impl.util.Converters.lambda $ toFiles $ 8(Converters.java:95) 在org.neo4j.helpers.Args.interpretOptionsWithMetadata(Args.java:608) at org.neo4j.tooling.ImportTool.extractInputFiles(ImportTool.java:508) 在org.neo4j.tooling.ImportTool.main(ImportTool.java:388) 在org.neo4j.tooling.ImportTool.main(ImportTool.java:334)
PowerShell也有同样的错误。
people_header.csv的路径:C:\ SavedNewest \ people_header.csv 有什么我应该添加到环境路径?
答案 0 :(得分:0)
您的命令行中有几个问题:
您的命令行参数中不能包含嵌入空格。例如,C:\SavedNewest\people_header.csv, C:\SavedNewest\people.csv
应该是单个参数,因此您需要删除逗号后面的空格或者引用整个参数。
必须正确格式化文件路径URL。引用developer guide:
确保使用正确的网址esp。文件URL。+在OSX和Unix上使用 file:///path/to/data.csv,在Windows上,请使用 文件:C:/path/to/data.csv