For a given vertex, I want to compute multiple aggregate features, which are indistinct from one another, which I might do as follows.
g.V(81968)
.project('P1', 'P2', 'P3')
.by(__.bothE().has('dt_int', lt(999999999999)).values('orig_amt').mean())
.by(__.bothE().has('dt_int', lt(999999999999)).values('currency').dedup().count())
.by(__.bothE().has('dt_int', lt(999999999999)).values('weight').mean())
The obvious issue with this query is that I'm computing __.bothE().has('trxn_dt', lt(999999999999)) every time I want to create a new aggregate feature (i.e. P1, P2, P3). This becomes clear when I try to compute this set of features for a vertex with a high number of edges.
Is there a way to store the filtered set of edges, and then select it for later use? Something like this pseudo query:
g.V(81968)
.hold(__.bothE().has('dt_int', lt(999999999999))).as('edges')
.project('P1', 'P2', 'P3')
.by(select('edges').values('orig_amt').mean())
.by(select('edges').values('currency').dedup().count())
.by(select('edges').values('weight').mean())
This question goes back to a previous question I asked (here), but I'm seeking a more generic approach, and I'm struggling to adapt it to a generic set of features.