2

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?

Joe Maffei
  • 1,855
  • 1
  • 15
  • 18
  • possible duplicate of [Relating an entity to a relationship proper in Neo4j?](http://stackoverflow.com/questions/27972121/relating-an-entity-to-a-relationship-proper-in-neo4j) – FrobberOfBits Mar 06 '15 at 19:02
  • In Neo4j, you'd want to have an additional "intermediate" node to represent something that you can relate to. – Eve Freeman Mar 06 '15 at 19:19

1 Answers1

2

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)
Brian Underwood
  • 10,746
  • 1
  • 22
  • 34