Neo4j:有没有办法优化CSV LOAD的输入,比如正则表达式?

时间:2014-05-27 14:10:03

标签: regex csv neo4j

我有一个csv文件(现在我只处理它的一行),有很多类似的标题:

neo4j-sh (?)$ load csv from "file:///...libreof.csv" as csvLine return csvLine[7],csvLine[8], csvLine[9], csvLine[11],csvLine[12], csvLine[13];  
+-----------------------------------------------------------------------------------------------------+
| csvLine[7]     | csvLine[8]     | csvLine[9]     | csvLine[11]    | csvLine[12]    | csvLine[13]    |
+-----------------------------------------------------------------------------------------------------+
| "names_0_lang" | "names_0_text" | "names_0_type" | "names_1_lang" | "names_1_text" | "names_1_type" |
| "la"           | "Fabariense"   | "orig"         | "de"           | "Peffers"      | "orig"         |
+-----------------------------------------------------------------------------------------------------+

到目前为止,为了创建具有属性的节点,我必须为每个列输入命令,当大约有50个列时,这非常耗时:

using periodic commit load csv with headers from "file:///...csv" as csvLine                                
> create (pl_name:placeName { name:csvLine.names_0_text, lang:csvLine.names_0_lang, type:csvLine.names_0_type})  
> create (pl_name:placeName { name:csvLine.names_1_text, lang:csvLine.names_1_lang, type:csvLine.names_1_type})  

导致:

neo4j-sh (Fabariense,1)$ ls
==> :placeName
==> *lang =[la]      
==> *name =[Fabariense] 
==> *type =[orig]   

neo4j-sh (Peffers,2)$ ls
==> :placeName
==> *lang =[de]      
==> *name =[Peffers] 
==> *type =[orig]   

有没有办法优化来自csv的数据加载? 要使用正则表达式'r'names_\d+_text''r'names_\d+_type''r'names_\d+_lang'之类的内容,并一次性加载行中匹配的所有内容,而不是逐个加载?

0 个答案:

没有答案