2
votes

Let's assume a database of workers and skill sets. Ron is a manager and plays saxophone.

Person:Ron <-[:SKILLED_IN]- Skill:Management
Person:Ron <-[:SKILLED_IN]- Skill:Saxophone

Andy endorses Ron as a saxophone player, but not as a manager. Is there a way to create an [:ENDORSES] relationship that links Andy and Ron's [:SKILLED_IN] relationship?

In other words, can you create a relationship between nodes and relationships?

1
In Neo4j, you'd want to have an additional "intermediate" node to represent something that you can relate to. - Eve Freeman

1 Answers

2
votes

Wes' answer about having intermediate node is spot on, I think. In graph theory it's called a hypernode (an edge that connects more than two nodes), but Neo4j doesn't support hypernodes natively so you'd want something like:

(:Person)-[:PERSON_SKILL]->(:PersonSkill)<-[:PERSON_SKILL]-(:Skill)
(:Person)-[:ENDORSES]->(:PersonSkill)