From 23568517fd062eb8e622bb35316628f8d2b156f3 Mon Sep 17 00:00:00 2001 From: Mingxi Wu Date: Tue, 21 Jan 2025 12:33:45 -0800 Subject: [PATCH] Create q11.gsql --- .../docker/tutorial/4.x/script/q11.gsql | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 demos/guru_scripts/docker/tutorial/4.x/script/q11.gsql diff --git a/demos/guru_scripts/docker/tutorial/4.x/script/q11.gsql b/demos/guru_scripts/docker/tutorial/4.x/script/q11.gsql new file mode 100644 index 00000000..d6c41e37 --- /dev/null +++ b/demos/guru_scripts/docker/tutorial/4.x/script/q11.gsql @@ -0,0 +1,27 @@ +USE GRAPH financialGraph + +CREATE OR REPLACE DISTRIBUTED QUERY q11() SYNTAX V3 { + + SumAccum @cnt = 0; + SumAccum @@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()