Reputation: 1
So I have a graph with 'people' nodes and 'meeting' nodes. The edge can be of either "Call In" or Call"Out"
I trying to get all the names of the persons that have more than 2 edges of type "Called In" from meetings that occurred in the last 30 days?
I've got this, but how do I work in the dates?
g.V().has("label", "person").where(out('Called In').count().is(gt(5))).values('name')
thanks
Upvotes: 0
Views: 226
Reputation: 10904
If MeetingDate
is stored as a Long
(days since epoch), it would be:
g.V().hasLabel("person").
filter(out("Called In").
has("MeetingDate", gte(LocalDate.now().minusDays(30).toEpochDay())).
count().is(gt(2))).
values("name")
If MeetingDate
is stored is a String
, it has to be in the US format (yyyy-MM-dd
), otherwise, gte
(and all other range predicates) won't work.
Next, if the date is indexed, you would rather do the following in order to get the best traversal performance:
g.V().has("Meeting","MeetingDate",gte(LocalDate.now().minusDays(30).toEpochDay())).
in("Called In").dedup().
values("name")
Upvotes: 3