Skip to content

Commit

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

CREATE OR REPLACE QUERY q7 () SYNTAX V3 {

SumAccum<INT> @cnt = 0; //local accumulator
SumAccum<INT> @@testCnt1 = 0; //global accumulator
SumAccum<INT> @@testCnt2 = 0; //global accumulator

S = SELECT a
FROM (a:Account) ~ [e:hasPhone] ~ (p:Phone)
WHERE a.isBlocked == TRUE
//a.@cnt snapshot value is 0
ACCUM a.@cnt +=1, //add 1 to a.@cnt
@@testCnt1+= a.@cnt //access a.@cnt snapshot value 0
POST-ACCUM (a) //loop vertex “a” set.
@@testCnt2 += a.@cnt; //access a.@cnt new snapshot value 1


PRINT @@testCnt1;
PRINT @@testCnt2;
PRINT S;

}

INTERPRET QUERY q7()

0 comments on commit 4279924

Please sign in to comment.