Due to a unforeseen shutdown (and /or and error in my code) I have relationships in the database without nodes attached to it.
I think what happened was that used a MATCH statement to look up a node and subsequently a MERGE to create a relationship. For some reasons however the Match did not return a results, but the MERGE did create a relationship (apparently with a non existing node). See example below:
MATCH (image:Image {id:{param}.id})
FOREACH (tagName in {param}.tags | MERGE (tag:Tag {tag:tagName}) MERGE (image)-[:IS_TAGGED_AS]->(tag) // Here it creates a relationship even if no matching image is found.
)
When I run a simple query I receive the following message:
While loading relationships for Node[xx] a Relationship[xx] was encountered that had startNode: 0 and endNode: 0, i.e. which had neither start nor end node as the node we're loading relationships for
I can reference the node and the relationship by Id (although the relationship does not return results) but can't Delete them.
Is there anything I can do to fix this?
Ideally I create a query to select all 'bad' relationships and delete them.
I am working on Neo4j 2.3.0.