Neo4j import-tool succeeds but results are not showing up

不问归期 提交于 2019-12-12 19:05:35

问题


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.

My process:

$ /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) ...

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

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

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:

Before:

$ du -sh /path/to/neo4j-community-3.0.3/data
4K

After:

$ 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?


回答1:


You need to specify the dir $NEO4J_HOME/data/databases/graph.db when you call neo4j-import:

/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

or create the import somewhere else and replace the contents of $NEO4J_HOME/data/databases/graph.db with the datastore created by neo4j-import



来源:https://stackoverflow.com/questions/38385368/neo4j-import-tool-succeeds-but-results-are-not-showing-up

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!