'Returns a dict of {flow: {time_in_day: count}}
WARNING/FIXME: this mutates the query'

def flow_daily(self, query):

    query.add_clause('WITH    src.elt    as    src,    link.elt    as    link,    dst.elt    as    dst\nMATCH    (link)-[:SEEN]->(t:Time)\nWITH    src,    link,    dst,    t,    (t.time    %    86400)    as    time_in_day\nWITH    [link.proto,    COALESCE(link.dport,    link.type)]    AS    flow,\n                    time_in_day,    COUNT(*)    AS    count\n')
    query.ret = 'RETURN    flow,    time_in_day,    count'
    query.orderby = 'ORDER    BY    flow[0],    flow[1],    time_in_day'
    counts = self._cursor2flow_daily(self.run(query))
    return counts
