Neo.ClientError.Statement.EntityNotFound
Neo.ClientError.Statement.EntityNotFound
我刚刚创建了一个新文件夹名称-Test 并启动了Neo4j 服务器。
当我 运行 以下脚本时,出现错误 - "Neo.ClientError.Statement.EntityNotFound"
和一条消息 "Node with id 0"
start root=node(0)
create
(tatham {Name:'Tatham'}),
(tom {Name:'Tom'}),
(pat {Name:'Pat'}),
(chrissy {Name:'Chrissy'}),
(sailing {Name:'Sailing'}),
(mtb {Name:'MTB'}),
(rowing {Name:'Rowing'}),
(tennis {Name:'Tennis'}),
root-[:HAS_USER]->tatham,
root-[:HAS_USER]->tom,
root-[:HAS_USER]->pat,
root-[:HAS_USER]->chrissy,
tatham-[:FRIEND]->tom,
tom-[:FRIEND]->pat,
tatham-[:FRIEND]->chrissy,
tatham-[:LIKES]->sailing,
tatham-[:LIKES]->mtb,
tom-[:LIKES]->sailing,
pat-[:LIKES]->mtb,
tom-[:LIKES]->rowing,
pat-[:LIKES]->tennis,
chrissy-[:LIKES]->mtb,
chrissy-[:LIKES]->sailing
你能帮我解决这个问题吗
问题出在您的 Cypher 查询的第一行:start root=node(0)
。该语句是说 "find a Node with id 0",但是如果您还没有插入任何数据,则没有要查找的节点,因此会出现错误。
start
已弃用,不再需要,因此您可以删除它。
@WilliamLyon 表示:
- 新建的DB没有节点,因此没有ID为0的节点
START
子句现已弃用。
您显然使用的是非常旧的 neo4j 版本。如果可能,您应该安装最新版本。
另外:
- 现在必须始终在括号内指定节点。
改为尝试以下方法,它应该适用于您的 neo4j 版本以及最新版本:
CREATE
(tatham {Name:'Tatham'}),
(tom {Name:'Tom'}),
(pat {Name:'Pat'}),
(chrissy {Name:'Chrissy'}),
(sailing {Name:'Sailing'}),
(mtb {Name:'MTB'}),
(rowing {Name:'Rowing'}),
(tennis {Name:'Tennis'}),
(root)-[:HAS_USER]->(tatham),
(root)-[:HAS_USER]->(tom),
(root)-[:HAS_USER]->(pat),
(root)-[:HAS_USER]->(chrissy),
(tatham)-[:FRIEND]->(tom),
(tom)-[:FRIEND]->(pat),
(tatham)-[:FRIEND]->(chrissy),
(tatham)-[:LIKES]->(sailing),
(tatham)-[:LIKES]->(mtb),
(tom)-[:LIKES]->(sailing),
(pat)-[:LIKES]->(mtb),
(tom)-[:LIKES]->(rowing),
(pat)-[:LIKES]->(tennis),
(chrissy)-[:LIKES]->(mtb),
(chrissy)-[:LIKES]->(sailing);
root
节点将在查询第一次遇到时自动创建,然后重新使用。
我刚刚创建了一个新文件夹名称-Test 并启动了Neo4j 服务器。 当我 运行 以下脚本时,出现错误 - "Neo.ClientError.Statement.EntityNotFound" 和一条消息 "Node with id 0"
start root=node(0)
create
(tatham {Name:'Tatham'}),
(tom {Name:'Tom'}),
(pat {Name:'Pat'}),
(chrissy {Name:'Chrissy'}),
(sailing {Name:'Sailing'}),
(mtb {Name:'MTB'}),
(rowing {Name:'Rowing'}),
(tennis {Name:'Tennis'}),
root-[:HAS_USER]->tatham,
root-[:HAS_USER]->tom,
root-[:HAS_USER]->pat,
root-[:HAS_USER]->chrissy,
tatham-[:FRIEND]->tom,
tom-[:FRIEND]->pat,
tatham-[:FRIEND]->chrissy,
tatham-[:LIKES]->sailing,
tatham-[:LIKES]->mtb,
tom-[:LIKES]->sailing,
pat-[:LIKES]->mtb,
tom-[:LIKES]->rowing,
pat-[:LIKES]->tennis,
chrissy-[:LIKES]->mtb,
chrissy-[:LIKES]->sailing
你能帮我解决这个问题吗
问题出在您的 Cypher 查询的第一行:start root=node(0)
。该语句是说 "find a Node with id 0",但是如果您还没有插入任何数据,则没有要查找的节点,因此会出现错误。
start
已弃用,不再需要,因此您可以删除它。
@WilliamLyon 表示:
- 新建的DB没有节点,因此没有ID为0的节点
START
子句现已弃用。
您显然使用的是非常旧的 neo4j 版本。如果可能,您应该安装最新版本。
另外:
- 现在必须始终在括号内指定节点。
改为尝试以下方法,它应该适用于您的 neo4j 版本以及最新版本:
CREATE
(tatham {Name:'Tatham'}),
(tom {Name:'Tom'}),
(pat {Name:'Pat'}),
(chrissy {Name:'Chrissy'}),
(sailing {Name:'Sailing'}),
(mtb {Name:'MTB'}),
(rowing {Name:'Rowing'}),
(tennis {Name:'Tennis'}),
(root)-[:HAS_USER]->(tatham),
(root)-[:HAS_USER]->(tom),
(root)-[:HAS_USER]->(pat),
(root)-[:HAS_USER]->(chrissy),
(tatham)-[:FRIEND]->(tom),
(tom)-[:FRIEND]->(pat),
(tatham)-[:FRIEND]->(chrissy),
(tatham)-[:LIKES]->(sailing),
(tatham)-[:LIKES]->(mtb),
(tom)-[:LIKES]->(sailing),
(pat)-[:LIKES]->(mtb),
(tom)-[:LIKES]->(rowing),
(pat)-[:LIKES]->(tennis),
(chrissy)-[:LIKES]->(mtb),
(chrissy)-[:LIKES]->(sailing);
root
节点将在查询第一次遇到时自动创建,然后重新使用。