CREATE QUERY vertex_query(vertex<User> u) FOR GRAPH device {
SumAccum<int> @@degree = 0;
Start = {u};
Result = SELECT v
FROM Start:v -(owns:o)-> :fp
SAMPLE 1 EDGE WHEN v.outdegree() > 1
ACCUM @@degree += 1;
PRINT @@degree;
}
results in
[
{
"@@degree": 1
}
]
While with v2 syntax
CREATE QUERY vertex_query(vertex<User> u) FOR GRAPH device SYNTAX v2 {
SumAccum<int> @@degree = 0;
Start = {u};
Result = SELECT v
FROM Start:v -(owns>:o)- :fp
SAMPLE 1 EDGE WHEN v.outdegree() > 1
ACCUM @@degree += 1;
PRINT @@degree;
}
gives
[
{
"@@degree": 22206
}
]