我正在使用 Neo4j rest api 创建具有大量节点和关系的图形结构。我使用以下密码查询格式在单个发布请求中发送一批节点及其关系。
UNWIND [[0,1], [0,6309]] AS pair
MATCH (n {name: pair[0]}), (m {name: pair[1]})
CREATE (n)-[:X]->(m)
我正在从 1GB 大小的文件中读取数据并将数据批量上传到 neo4j。我发送的所有请求都得到响应代码 200,但是当我检查{$NEO4J_HOME}/data/databases/graph.db
大小时,它只显示 244K 大小。此外du -hc *store.db*
,graph.db 中的命令显示所有 nodestore.db、relationshipstore.db 和 propertystore.db 大小均为 0。为什么通过 rest api 上传的数据没有写入图数据库中的文件?任何帮助将不胜感激。
输出自du -hc *store.db*
0 neostore.nodestore.db
4.0K neostore.nodestore.db.id
8.0K neostore.nodestore.db.labels
4.0K neostore.nodestore.db.labels.id
0 neostore.propertystore.db
8.0K neostore.propertystore.db.arrays
4.0K neostore.propertystore.db.arrays.id
4.0K neostore.propertystore.db.id
8.0K neostore.propertystore.db.index
4.0K neostore.propertystore.db.index.id
8.0K neostore.propertystore.db.index.keys
4.0K neostore.propertystore.db.index.keys.id
0 neostore.relationshipstore.db
这是使用 jersey 客户端发送到 neo4j rest api 的完整请求。
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter(user, password));
WebResource cypherResource = client.resource("http://localhost:7474/db/data/cypher");
ClientResponse cypherResponse = cypherResource.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON_TYPE).entity(query).post(ClientResponse.class);
示例查询设置为实体:
{"query":"UNWIND [[0,1], [0,6309]] AS pair
MATCH (n {name: pair[0]}), (m {name: pair[1]}) CREATE (n)-[:X]->(m)"}