Neo4j导入工具成功,但未显示结果 [英] Neo4j import-tool succeeds but results are not showing up
问题描述
我最近开始使用导入工具来加快加载时间,到目前为止,结果是有希望的,只是以后它们不会通过cypher反映在我的数据库中.
I recently started using the import tool for faster load times, and so far the results were promising, except that they are not reflected in my database afterwards through cypher.
我的过程:
$ /path/to/neo4j-community-3.0.3/bin/neo4j stop
$ rm -rf /path/to/neo4j-community-3.0.3/data/
$ mkdir /path/to/neo4j-community-3.0.3/data
$ /path/to/neo4j-community-3.0.3/bin/neo4j-import --nodes:record /path/to/records.csv --into /path/to/neo4j-community-3.0.3/data
tmp.csv:
meta:ID,time:long,lat:float,lon:float
KAQP_20140420v20001_0000,1397970000,26.9387950897,-91.2847290039
KAQP_20140420v20001_0001,1397970060,26.9387989044,-91.2847595215
.... (1440 lines of the same record format) ...
对neo4j-import工具的调用结果:
Results of the call to neo4j-import tool:
Neo4j version: 3.0.3
Importing the contents of these files into neo4j-community-3.0.3/data:
Nodes:
:record
/neo4j/tmp.csv
Available memory:
Free machine memory: 23.65 GB
Max heap memory : 6.87 GB
Nodes
Done in 384ms
Prepare node index
[*:7.63 MB------------------------------------------------------------------------------------] 0
Done in 34ms
Calculate dense nodes
Done in 10ms
Node --> Relationship Sparse
Done in 10ms
Relationship --> Relationship Sparse
Done in 10ms
Node counts
Done in 51ms
Relationship counts
Done in 10ms
IMPORT DONE in 2s 360ms. Imported:
1440 nodes
0 relationships
5760 properties
非常好,到目前为止,一切看起来都很不错.所以现在我启动neo4j:
Excellent, everything looks great so far. So now I start up neo4j:
$ /path/to/neo4j-community-3.0.3/bin/neo4j start
然后我尝试获取记录数:
Then I attempt to get the count of records:
$ /path/to/neo4j-community-3.0.3/bin/neo4j-shell -c 'MATCH (r:record) RETURN count(r) as count;'
+----------+
| count(r) |
+----------+
| 0 |
+----------+
1 row
42 ms
那很奇怪,所以我想也许这个标签没有注册或什么?因此,我尝试了以下方法:
That was strange, so I thought maybe the label wasn't registered or something? So instead I tried this:
$ /path/to/neo4j-community-3.0.3/bin/neo4j-shell -c 'MATCH (r) RETURN count(r) as count;'
+----------+
| count(r) |
+----------+
| 0 |
+----------+
1 row
28 ms
这真的很奇怪.我的下一个想法也许是目录很奇怪?所以我测试了/path/to/neo4j-community-3.0.3/data
的大小:
This is really weird. My next thought was maybe the directory is being weird? So I tested the size of /path/to/neo4j-community-3.0.3/data
:
之前:
$ du -sh /path/to/neo4j-community-3.0.3/data
4K
之后:
$ du -sh /path/to/neo4j-community-3.0.3/data
53M
它肯定在那里!我不知道是否错过了关键的一步.知道发生了什么事吗?
Its definitely in there! I have no clue if I just missed a crucial step. Anyw idea whats going on?
推荐答案
调用neo4j-import
时需要指定目录$NEO4J_HOME/data/databases/graph.db
:
/path/to/neo4j-community-3.0.3/bin/neo4j-import --nodes:record /path/to/records.csv --into /path/to/neo4j-community-3.0.3/data/databases/graph.db
或在其他位置创建导入,并将$NEO4J_HOME/data/databases/graph.db
的内容替换为neo4j-import
or create the import somewhere else and replace the contents of $NEO4J_HOME/data/databases/graph.db
with the datastore created by neo4j-import
这篇关于Neo4j导入工具成功,但未显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!