Can't add new attribution to a vertex

Hi and thanks in dvance.

I am trying to add to the vertex the outdegree of specific type of edge:
code:


BEGIN
CREATE QUERY outDegree () SYNTAX v2 {
SumAccum @directorsCnt = 0;

Results =   SELECT
                m
            FROM DIRECTOR:d -(_:rel)- MOVIE:m
            ACCUM
                m.@directorsCnt += 1
            POST_ACCUM m.outDegree = m.@directorsCnt;
PRINT Results;

}
END


the schema is very simple vertex for director and movie that are connected and I want to add to the vertex the outDegree attribution.

I am getting an error saying:
“no type can be inferred for m.outDegree”

What can I do?

Try adjusting your declaration:

SumAccum <INT> @directorsCnt = 0;

Thanks a lot for helping. Sadly, it is still doesn’t work.

Screen:

GSQL > BEGIN
GSQL > CREATE QUERY outDegree () SYNTAX v2 {
GSQL > SumAccum ֿ<INT> @directorsCnt = 0;
GSQL >
GSQL > Results = SELECT
GSQL > m
GSQL > FROM DIRECTOR:d -(_:rel)- MOVIE:m
GSQL > ACCUM
GSQL > m.@directorsCnt += 1
GSQL > POST_ACCUM m.outDegree = m.@directorsCnt;
GSQL > PRINT Results;
GSQL > }
GSQL > END

Type Check Error in query outDegree (TYP-8017): line 9, col 27
no type can be inferred for m.outDegree
The query outDegree cannot be added!

This is the graph schema

Can you show the specific schema information for Movie please? It might help me understand. There is nothing obviously wrong with your code.

Thanks again for helping out.
I found a solution,

I think I couldn’t do it since I used the docker “free” version which doesn’t allow changing attribution on the run.

I solved this issue by reloading the graph. this time with a place holder outDegree int.
this time the “POST_ACCUM m.outDegree = m.@directorsCnt;” line worked.

Hope it will help others.