I have a simple graph structure as follows:
Event-----HappenedAt------>Location
Event and Location vertices both have a name and id property. HappenedAt edge has a date property (in ticks) called 'on'.
I am having trouble writing a query that for a given location (so starting with a known location) return a list of all distinct events that happened at that location, a count of the number of times each event happened (so groupcount of the happenedAt edges) and the max/most recent date each event occurred.
Ideally the output would look as follows for a given location: Event Id, count, most recent/max date
Event A, 2, 5/27/2018
Event B, 2, 7/1/2018
I can get the group count and the max date just fine by themselves but can't seem to get the query right where those are combined into a single query to produce that output.
Probably simple, but I am new to Gremlin and Graph databases in general. Any help would be greatly appreciated.
g.addV('event').property('id','e1').property('name','Event A').as('e1').
addV('event').property('id','e2').property('name','Event B').as('e2').
addV('location').property('id','l1').property('name','Location 1').as('l1').
addV('location').property('id','l2').property('name','Location 2').as('l2').
addE('happenedAt').from('e1').to('l1').property('on','5/27/2018').
addE('happenedAt').from('e1').to('l1').property('on','4/1/2018').
addE('happenedAt').from('e2').to('l1').property('on','6/5/2018').
addE('happenedAt').from('e2').to('l1').property('on', '7/1/2018').iterate()