cancel
Showing results for 
Search instead for 
Did you mean: 

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.