Reputation: 12299
I am modeling an event system. Say I have an event called EVENT_A. When I create an event, I capture some information - who caused the event (person A), who was affected by the event (person B), and how person B was affected (B's property (a car, house, etc) is identified.)
(EVENT_A)->[:AFFECTS]->(PERSON {is:b})
Now the crux - Do I:
Either will work.
pros/cons for #1:
pros/cons for #2:
So what's a guideline for what goes into the relationships and which things get piled into nodes?
Upvotes: 1
Views: 42
Reputation: 45023
Is better to have different relationship types instead of one property on the relationship.
(PERSON {name: 'Rebeca'})-[:CAUSED]->(EVENT_A {id: 1})->[:AFFECTS_CAR]->(PERSON {name: 'John'})
(PERSON {name: 'Joe'})-[:CAUSED]->(EVENT_A {id: 2})->[:AFFECTS_HOUSE]->(PERSON {name: 'Rebeca'})
(PERSON {name: 'Simon'})-[:CAUSED]->(EVENT_A {id: 3})->[:AFFECTS_ETC]->(PERSON {name: 'William'})
Also for sharing information between nodes you can have node for that.
(EVENT_A {id: 1})-[:HAS]->(DESCRIPTION {id: 1})
(EVENT_A {id: 2})-[:HAS]->(DESCRIPTION {id: 1})
(EVENT_A {id: 3})-[:HAS]->(DESCRIPTION {id: 1})
Upvotes: 1