I'd bluffed myself into thinking that I'd solved this but actually I hadn't. This is my cypher:
MATCH (fromCard:Card { name: {fromCardName}}),(toCard:Card{ name: {toCardName}})
MERGE (fromCard:Card)-[r:DECK_INCIDENCE]->(toCard:Card)
SET r.passCount = coalesce(r.passCount, 0) +1
For each pair of cards I end up creating a relationship in both directions, for example the first time fromCard='HEARTS' and toCard='SPADES', HEARTS->SPADES is created with passCount 1, then when fromCard='SPADES' and toCard='HEARTS' SPADES->HEARTS is created with passCount 1. The desired behaviour is that there is only one "bidirectional" relationship. The direction is really not important, all I'm modelling is the strength of the relationship i.e. the number of times that this combination of cards is "passed" (note that I've used Hearts and Spades here purely for explanation, I in fact have ~20k domain-specific cards)
I tried without the arrow
MATCH (fromCard:Card { name: {fromCardName}}),(toCard:Card{ name: {toCardName}})
MERGE (fromCard:Card)-[r:DECK_INCIDENCE]-(toCard:Card)
SET r.passCount = coalesce(r.passCount, 0) +1
but that gives me: Only directed relationships are supported in CREATE, while MATCH allows to ignore direction.
So I'm stuck here. It's important that relationships are created lazily, i.e. the first time a 'pass' is registered, as for may pairs of cards they will never be related at all. So how can I use the semantics of a merge to create a relationship where the property passCount can be incremented (or coalesced if null) regardless of the direction?