g.addV('l1').
property(id, 12347).
property('submit_time', new Date('Wed May14 10:00:00 PDT 2019')).
addV('l1').
property(id, 4522323).
property('submit_time', new Date('Wed May15 11:00:00 PDT 2019')).
addV('l1').
property(id, 2355208312).
property('submit_time', new Date('Wed May15 11:00:00 PDT 2019')).
addV('l3').
property(id, 45678).
property('start_time', new Date('Fri Apr 24 07:01:36 PDT 2019')).
addV('l3').
property(id, 67892).
property('start_time', new Date('Fri Apr 24 07:01:36 PDT 2019')).
addV('l3').
property(id, 678954).
property('start_time', new Date('Fri Apr 26 23:01:36 PDT 2019')).
property('condition', "somevalue").
addE('e1').
from(V(12347)).
to(V(45678)).
addE('e1').
from(V(12347)).
to(V(67892)).
addE('e1').
from(V(4522323)).
to(V(678954)).
addE('e1').
from(V(2355208312)).
to(V(45678)).
iterate()
One l1
vertex can be associated with an edge (e1
) to multiple different l3
vertices. I am trying to aggregate the above scenario based on submit_time
property from l1
. I have tried the below query.
g.V().hasLabel("l1").
group().
by(map {(it.get().value("submit_time").getYear() + 1900) + "/" +
(it.get().value("submit_time").getMonth() + 1) + "/" +
it.get().value("submit_time").getDate()}).
unfold().
project('submitdate','job','jobdesc').
by(keys).
by(values).
by(select(values).unfold().out('e1').has("condition","somevalue").fold()).
order(local).
by(keys, incr)
It fetches me the below result.
==>[job:[v[12347]],jobdesc:[],submitdate:2019/5/14]
==>[job:[v[2355208312],v[4522323]],jobdesc:[v[678954]],submitdate:2019/5/15]
In the above result it's aggregating based on submitdate
and getting me its corresponding l1
vertex as job
after aggregation, however my jobdesc
is empty because it does not satisfy the "has" condition .has("condition","somevalue")
.
In the 1st result, even though vertex v[12347]
is considered in aggregation, and have an edge to v[45678]
and v[67892]
they do not satisfy the "has condition", so my jobdesc
is empty. Similarly in the 2nd result, one of my vertex (v[678954]
) is satisfying the above condition.
Can anyone please help me to get some default value, eg. an empty array for jobdesc
for each of the job vertex if it does not satisfy the condition and is considered in aggregation?
Expected output
==>[job:[v[12347]],jobdesc:[[]],submitdate:2019/5/14]
==>[job:[v[2355208312],v[4522323]],jobdesc:[[],v[678954]],submitdate:2019/5/15]
Eg: v[2355208312]
is considered in aggregation for submitdate
2019/5/14
but there is no jobdesc
for it so I am not able to map the index for each job and its corresponding jobdesc
.