26 lines
1021 B
Plaintext
26 lines
1021 B
Plaintext
// Query to Create a New Scenario and its Delta (MODIFIES relationship)
|
|
// This allows defining a new 'what-if' scenario by specifying changes to a job's properties.
|
|
|
|
// Parameters:
|
|
// :new_scenario_id => 'what-if-2'
|
|
// :description => 'Job 5 기간 단축 시나리오'
|
|
// :target_job_id => 5
|
|
// :new_duration_value => 3
|
|
// :new_cost_value => 50
|
|
|
|
// 1. Create the new Scenario node if it doesn't already exist
|
|
MERGE (s:Scenario {id: $new_scenario_id})
|
|
ON CREATE SET s.description = $description
|
|
|
|
// 2. Find the target Job to modify
|
|
MATCH (j:Job {id: $target_job_id})
|
|
|
|
// 3. Create or update the MODIFIES relationship between the Scenario and the Job
|
|
// This relationship holds the delta (the new property values for this scenario)
|
|
MERGE (s)-[m:MODIFIES]->(j)
|
|
ON CREATE SET m.new_duration = $new_duration_value, m.new_cost = $new_cost_value
|
|
ON MATCH SET m.new_duration = $new_duration_value, m.new_cost = $new_cost_value
|
|
|
|
// 4. Return the created/updated Scenario and the modified Job for confirmation
|
|
RETURN s, m, j;
|