Search code examples
neo4jneo4jclient

Neo.ClientError.Statement.EntityNotFound


I just created a new folder name-Test and started Neo4j server. When i run the below script, i get the error - "Neo.ClientError.Statement.EntityNotFound" and a message "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

Can you kindly help me hot to fix this issue


Solution

  • A @WilliamLyon indicated:

    • A new DB has no nodes, and therefore has no node with the ID of 0.
    • The START clause is now deprecated.

    You are apparently using a very old version of neo4j. If possible, you should install the latest version.

    In addition:

    • Nodes now must always be specified within parentheses.

    Try the following, instead, which should work with your version of neo4j as well as the latest versions:

      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);
    

    The root node will be created automatically the first time it is encountered by the query, and then re-used.