Created
December 18, 2018 10:32
-
-
Save elisedeux/125b2eebc47a85a671a0fee6d4aaae56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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