Reputation: 147
Currently i am working with graph db. I have two nodes and i need to create more than one label to the same relation. Is it possible to create more than one label to a relationship in cypher query? I tried this, but not working:
START n=node(1), n1=node(2) CREATE UNIQUE (n)-[r:HAS_TEST:HAS_ATTENDED]->(n1) return n,n1;
If it is possible, how? If it is not possible why?
Upvotes: 3
Views: 1195
Reputation: 19373
A relationship has a single type, so you cannot do what you've asked. Instead, create two relationships:
START n=node(1), n1=node(2)
CREATE UNIQUE (n)-[:HAS_TEST]->(n1)
CREATE UNIQUE (n)-[:HAS_ATTENDED]->(n1)
RETURN n,n1;
Or create a new relationship type that implies both HAS_TEST
and HAS_ATTENDED
.
Upvotes: 7