alex
alex

Reputation: 15

In Neo4j, is it possible to have the same relationship name for different entities

Let`s use the movie DB as an example. If I would insert all people that worked on a movie in the DB, it would be difficult to find relationship names for everyone. Would it be a problem to have entities like: sound_designer, sound_engineer, set_designer, set_assistance, cable_guy, etc with the same relationship "WORKS_IN" to a Movie entity. Is it possible? Is it a good solution? Would I have problems? Are there alternatives?

Upvotes: 0

Views: 410

Answers (1)

InverseFalcon
InverseFalcon

Reputation: 30397

Gabor's answer in the comments is a good one, there are no problems with nodes of differing labels having relationships of the same type to the same node.

Multi-labeling nodes with their role isn't a bad idea, however that assumes that a person's role is constant throughout the years captured by the graph, which may not hold true. Or rather, the labels would capture what roles they have been in their entire history, but what specific role they played within a particular movie is likely something you want as a property of the relationship itself, like a role property. Which might even be a list, if a person might have multiple roles for the same movie, similar to actors playing a part (where there is a roles list property on :ACTED_IN relationships).

Upvotes: 1

Related Questions