cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to model optional relationship

Please help me model this

Course need some qualification. course sometimes requires any of N qualification. How can I model this scenario?

I was thinking to have a node which can have property "any" or "all" so my model look like

course -----> (any) --------- of N Qualifications
Course ------> (All)---------------> of N Qualifications

3 REPLIES 3

your idea sounds good, that property could also have a number

otherwise you might model the "required" information on the relationship

(course)-->(requirement:Requirement:All)-[:NEEDS]->(qualification)
(course)-->(requirement:Requirement:Any)-[:NEEDS]->(qualification)

Thanks Michael. In your example, Is “Requirement” a node or relationship?

Hi there, in Cypher, nodes are always in parenthesis, and relationships are in square brackets.