Self-relationships are possible in neo4j.
Syntax
CREATE (node)-[:Relationship]->(node)
Follow below steps to confirm the same.
Step 1: Open neo4j browser by hitting following url in browser.
http://localhost:7474/browser/
Step 2: Execute below query to create a node elephant and add self-relationship.
CREATE (elephant:Animal{name: "Ganesha"})-[:BIG_ANIMAL]->(elephant)
Step 3: Get all the nodes by executing below command.
MATCH (n) RETURN n
Previous Next Home
No comments:
Post a Comment