-
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
25 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,25 @@ | ||
USE GRAPH financialGraph | ||
|
||
// create a query | ||
CREATE OR REPLACE QUERY q3 (datetime low, datetime high, string accntName) SYNTAX v3 { | ||
|
||
// a path pattern in ascii art () -[]->()-[]->() | ||
R = SELECT b | ||
FROM (a:Account {name: accntName})-[e:transfer]->()-[e2:transfer]->(b:Account) | ||
WHERE e.date >= low AND e.date <= high and e.amount >500 and e2.amount>500; | ||
|
||
PRINT R; | ||
|
||
// below we use variable length path. | ||
// *1.. means 1 to more steps of the edge type "transfer" | ||
// select the reachable end point and bind it to vertex alias "b" | ||
R = SELECT b | ||
FROM (a:Account {name: accntName})-[:transfer*1..]->(b:Account); | ||
|
||
PRINT R; | ||
|
||
} | ||
|
||
install query q3 | ||
|
||
run query q3("2024-01-01", "2024-12-31", "Scott") |