Querying graph structure at a certain point in time

Thought I’d write an update as I think I’ve come up with a solution for my problem after a bit of research.

Each edge to a parent now has 2 facets date and expired. I’m using UNIX timestamps to represent the date the edge was created and expired for the date the movement occurred. On the newest edge, the expired is set to the maximum in64 value.

When a child moves, the previous edge’s expired facet is set to the same date facet of the new edge. I can then perform a query like this:

query Structure($id: string)
{
  q(func: eq(name, $id)) @recurse {
      uid
      name
      sponsoring: ~sponsor @facets(orderdesc: date, date, expired) @facets(lt(date, 10000000000) AND gt(expired, 10000000000))
  }
}

This appears to give me a top down view of the graph structure at a specific point in time. I actually got the idea from a blog post about doing the same thing in arangodb

This appears to work exactly as I want. Thanks for all the assistance @chewxy and @MichelDiz

1 Like