簡體   English   中英

如何在neo4j中加載帶頭和數據類型的csv文件?

[英]How to load a csv file with header and data type in neo4j?

我是否正確無法使用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中不存在。 org.neo4j.kernel.impl.util.Converters.lambda上的org.neo4j.kernel.impl.util.Converters.lambda $ regexFiles $ 7(Converters.java:76)上的util.Validators.matchingFiles(Validators.java:48)在org.neo4j.tooling的org.neo4j.tooling.ImportTool.extractInputFiles(ImportTool.java:508)的org.neo4j.helpers.Args.interpretOptionsWithMetadata(Args.java:608)上$ $Files $ 8(Converters.java:95) .ImportTool.main(ImportTool.java:388)at org.neo4j.tooling.ImportTool.main(ImportTool.java:334)

PowerShell的錯誤相同。

people_header.csv的路徑:C:\\ SavedNewest \\ people_header.csv我應該添加到環境路徑中嗎?

您的命令行中有幾個問題:

  1. 您的命令行參數中不能包含嵌入空格。 例如, C:\\SavedNewest\\people_header.csv, C:\\SavedNewest\\people.csv應該是單個參數,因此您需要刪除逗號后的空格或雙引號整個參數。

  2. 必須正確格式化文件路徑URL。 引用開發者指南

    確保使用正確的URL esp。 文件URL。+在OSX和Unix上使用file:///path/to/data.csv,在Windows上,請使用file:c:/path/to/data.csv

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM