-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
USE GRAPH financialGraph | ||
|
||
// create a query | ||
CREATE OR REPLACE OPENCYPHER QUERY c7 (datetime low, datetime high, string accntName) { | ||
// a path pattern in ascii art () -[]->()-[]->() | ||
// think the MATCH clause is a matched table with columns (a, e, b, e2, c) | ||
// you can use SQL syntax to group by on the matched table | ||
// Below query find 2-hop reachable account c from a, and group by the path a, b, c | ||
// find out how much each hop's total transfer amount. | ||
MATCH (a:Account)-[e:transfer]->(b)-[e2:transfer]->(c:Account) | ||
WHERE e.date >= $low AND e.date <= $high | ||
RETURN a, b, c, sum(DISTINCT e.amount) AS hop_1_sum, sum(DISTINCT e2.amount) AS hop_2_sum | ||
} | ||
|
||
install query c7 | ||
|
||
run query c7("2024-01-01", "2024-12-31", "Scott") |