Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 1) match all disputed transactions
match (p:person)-[b:HAS_BOUGHT_AT {status: "Disputed"}]->(m:merchant)
with
collect(p) as disputer, // list of persons with disputed transactions
collect(b) as disputed, // list disputed transactions
collect(m) as merchants // list merchants with disputed transactions
// 2) match all undisputed transactions
match (p:person)-[b:HAS_BOUGHT_AT {status: "Undisputed"}]->(m:merchant)
where p in disputer // keep only transactions where the buyer is a disputer
with // group undisputed transactions by merchant
collect(p) as mUndisputer, // all persons with undisputed transactions to merchant "m"
collect(b) as mUndisputed, // all undisputed transactions to merchant "m"
m, // merchant m
disputer, disputed, merchants // pervious lists unchanged
where all(d in disputer where d in mUndisputer) // keep only merchants "m" where all disputers belong to the list of undisputers
return disputer, disputed, mUndisputed, m, merchants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.