Ah my mistake! Didn't qualify my match with the property that I was
matching on! This works:
MATCH (fromCard:Card { name: {fromCardName}}),(toCard:Card{ name:
{toCardName}})
MERGE (fromCard:Card)-[r:DECK_INCIDENCE]->(toCard:Card)
SET r.deckCount = coalesce(r.deckCount, 0) +1
On Wednesday, February 12, 2014 11:56:32 AM UTC, Ben Titmarsh wrote:
>
> Hi Guys,
>
> I am aware that Neo4J doesn't have a concept of a bidirectional
> relationship and I believe that's causing me a problem when using MERGE.
> Here is my Cypher:
>
> MATCH (fromCard:Card),(toCard:Card)
> MERGE (fromCard:Card)-[r:DECK_INCIDENCE]->(toCard:Card)
> SET r.deckCount = coalesce(r.deckCount, 0) +1
>
> So say I have a collection of 4 cards: "Hearts","Diamonds","Clubs","Spades"
>
> The first time I create the relationship between Hearts and Diamonds, i.e.
> Hearts -> Diamonds. However, the next time the cards are in a different
> order and when I attempt to MERGE Diamonds -> Hearts a new relationship is
> created because no relationship exists in that direction. This is not what
> I want, I need to increment the deckCount property on the relationship
> regardless of the direction and don't want to have to manage two
> relationships per card.
>
> I cannot guarantee the order of cards and in essence I need to model a
> Bidirectional Relationship. How can I achieve what I need using MERGE?
>
> Cheers,
> Ben.
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.