|
|
|
@ -134,6 +134,10 @@ CREATE (e)-[:AUTHORED_BY]->(a) |
|
|
|
eTagIndex := 0 |
|
|
|
eTagIndex := 0 |
|
|
|
pTagIndex := 0 |
|
|
|
pTagIndex := 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Track if we need to add WITH clause before OPTIONAL MATCH
|
|
|
|
|
|
|
|
// This is required because Cypher doesn't allow MATCH after CREATE without WITH
|
|
|
|
|
|
|
|
needsWithClause := true |
|
|
|
|
|
|
|
|
|
|
|
// Only process tags if they exist
|
|
|
|
// Only process tags if they exist
|
|
|
|
if ev.Tags != nil { |
|
|
|
if ev.Tags != nil { |
|
|
|
for _, tagItem := range *ev.Tags { |
|
|
|
for _, tagItem := range *ev.Tags { |
|
|
|
@ -150,6 +154,15 @@ CREATE (e)-[:AUTHORED_BY]->(a) |
|
|
|
paramName := fmt.Sprintf("eTag_%d", eTagIndex) |
|
|
|
paramName := fmt.Sprintf("eTag_%d", eTagIndex) |
|
|
|
params[paramName] = tagValue |
|
|
|
params[paramName] = tagValue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add WITH clause before first OPTIONAL MATCH to transition from CREATE to MATCH
|
|
|
|
|
|
|
|
if needsWithClause { |
|
|
|
|
|
|
|
cypher += ` |
|
|
|
|
|
|
|
// Carry forward event and author nodes for tag processing
|
|
|
|
|
|
|
|
WITH e, a |
|
|
|
|
|
|
|
` |
|
|
|
|
|
|
|
needsWithClause = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cypher += fmt.Sprintf(` |
|
|
|
cypher += fmt.Sprintf(` |
|
|
|
// Reference to event (e-tag)
|
|
|
|
// Reference to event (e-tag)
|
|
|
|
OPTIONAL MATCH (ref%d:Event {id: $%s}) |
|
|
|
OPTIONAL MATCH (ref%d:Event {id: $%s}) |
|
|
|
|