Reputation: 2117
I am working with email data in neo4j. I have the same sender
for all 5 emails and 5 different recipients
. The sender has a property the link
in the email that was sent. In most databases I can do a groupby
to have one node the name
'tv.test.com', to many recipients "One-to-many"
//CREATE SAMPLE NODES
CREATE (sender1:Sender{name:'tv.test.com', url:'https://www.tv.test.com/5219922-h1=Ez1bLCN'})
CREATE (sender2:Sender{name:'tv.test.com', url:'https://www.tv.test.com/5218922-h1=Ez1bLCN'})
CREATE (sender3:Sender{name:'tv.test.com', url:'https://www.tv.test.com/5259922-h1=Ez1bLCN'})
CREATE (sender4:Sender{name:'tv.test.com', url:'https://www.tv.test.com/5213822-h1=Ez1bLCN'})
CREATE (sender5:Sender{name:'tv.test.com', url:'https://www.tv.test.com/5215922-h1=Ez1bLCN'})
CREATE (recipient1:Recipient{name:'[email protected]'})
CREATE (recipient2:Recipient{name:'[email protected]'})
CREATE (recipient3:Recipient{name:'[email protected]'})
CREATE (recipient4:Recipient{name:'[email protected]'})
CREATE (recipient5:Recipient{name:'[email protected]'})
CREATE (sender1)-[:TO]->(recipient1)
CREATE (sender2)-[:TO]->(recipient2)
CREATE (sender3)-[:TO]->(recipient3)
CREATE (sender4)-[:TO]->(recipient4)
CREATE (sender5)-[:TO]->(recipient5)
What it currently looks like:
This is what I want it to look like where I can keep the property and group by name:
Upvotes: 0
Views: 30
Reputation: 4052
Are these one-to-many or many-to-many relationships? If yes then you can move the URL from sender to the recipient node, that would solve your problem. If not then you can move the URL to relationship property.
The recommended way is to create a new type of node Email
and connect the Sender
and the Recipient
to it.
Upvotes: 1