Hello everyone, I am new to TigerGraph and I am writing some test queries using gsql. One of them is to count triangles whose vertex belong to 3 community in a social network. The query is like this.
CREATE QUERY CommunityTriangle() SYNTAX v2 {
TYPEDEF TUPLE <uint a, uint b, uint c> triplet;
SetAccum<VERTEX<Person>> @p13set,@p23set;
ListAccum<triplet> @@triplet_set;
SumAccum<INT> @@triplet_count;
C = SELECT p1
FROM
Person:p1 -(knows*0..1)- Person:p3
WHERE p1.community==0 AND p3.community==2
ACCUM p1.@p13set += p3;
C = SELECT p2
FROM
Person:p2 -(knows*0..1)- Person:p3
WHERE p2.community==1 AND p3.community==2
ACCUM p2.@p23set += p3;
C = SELECT p2
FROM
Person:p1 -(knows*0..1)- Person:p2
WHERE p1.community == 0 AND p2.community == 1
ACCUM @@triplet_count += COUNT(p1.@p13set INTERSECT p2.@p23set);
PRINT @@triplet_count;
}
When I tried to load this query, gsql told me
Semantic Check Error in query CommunityTriangle (SEM-1201): line [20, 24]
Accessing the accumulator of the loop variable 'p1' is not supported.
Failed to create queries: [CommunityTriangle].
I tried to search SEM-1201 but get nothing. What happened here? How to make this query work?