Skip to content

Commit

Permalink
Create q11.gsql
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxiw authored Jan 21, 2025
1 parent ccf633b commit 2356851
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions demos/guru_scripts/docker/tutorial/4.x/script/q11.gsql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
USE GRAPH financialGraph

CREATE OR REPLACE DISTRIBUTED QUERY q11() SYNTAX V3 {

SumAccum<int> @cnt = 0;
SumAccum<int> @@cnt = 0;

//for each blocked account, find its 1-hop-neighbor who has not been blocked.
tgtAccnts = SELECT y
FROM (x:Account)- [e:transfer] -> (y:Account)
WHERE x.isBlocked == TRUE AND y.isBlocked == FALSE
ACCUM y.@cnt +=1, @@cnt +=1;

// tgtAccnts vertex set drive the query block below
tgtPhones = SELECT z
FROM (x:tgtAccnts)- [e:hasPhone] - (z:Phone)
WHERE z.isBlocked AND x.@cnt >1 AND @@cnt>0
ACCUM z.@cnt +=1;

PRINT tgtPhones;
}


INSTALL QUERY q11


RUN QUERY q11()

0 comments on commit 2356851

Please sign in to comment.