Build Graph Patterns - how to include aggregation in results

GraphStudio has this cool feature called “Build Graph Patterns” (beta, ATTOW).

You can easily build queries with this, even including aggregations.

For the last one, I don’t see any option to tell GraphStudio to include the aggregated value into results.
You can do it by checking a box for verticles (next to optional verticle name in “Basic info” section of configuration panel).

Is similar functionality available for aggregations? If not, please consider adding it.

Thanks for sharing your experience with Visual Query Builder! For now we support aggregate values onto vertices. Once the vertices are included in the results, all their attributes and aggregated values are in output. In the future we plan to have a finer granular control which attributes/aggregated values to be included. For now everything will be output.

Let’s assume we have the folowing schema


How would a graph pattern (created in Build Graph Pattern) where you want to count all the Level2 nodes for Level1 nodes.

Manually, it would probably translate to:

CREATE QUERY aa() FOR GRAPH LoadingTest API("v2") SYNTAX v2 {

  SumAccum<int> @l2_cnt;

  counts = 
        SELECT l1
        FROM Level2:l2 -(PART_OF>:alias_schema_3)- Level1:l1
        ACCUM l1.@l2_cnt += 1;

  PRINT counts [counts .name, counts .@l2_cnt];

This gives Level1 vertex name and count of related Level2 nodes.

Maybe it is easy to do in the UI and I am simply “blindfolded”.

You know what, I was albe to do this.


So, there is a way to to that.

On the other hand, it feels a bit counterintuitive.
I want to count Level2 nodes, but I need to add aggregation on Level1 node.
I felt I need to add aggregation on the entity I want to count/average/max/min on.

But it may be just me. I am quite new to the platform…

Thanks for the feedback! The attachment happens on a vertex and for aggregation functions, it aggregate from that vertex’s point of view. In the above pattern, from one Level1 vertex’s point of view, for all the Level1<-PART_OF-Level2 matches, how many different matches itself get involved? That will be attached as cnt on that Level1 vertex. So it happen to be same as how many Level2 vertices connected to that Level1 vertex in the pattern.
There is a more explicit way of expressing the above pattern, which can be explained as for each Level1 vertex, count how many different Level2 vertices are connected to it through the match: