I am not totally new to graph databases (Neo4J about a decade ago) nor graph problems, but it's been a while, so forgive my ArangoDB noobie perspective.
I am trying to figure out how to determine what a place would have been called in the past. Save I have a place called "G" in the following graph:
In this graph, places are linked by edges that tell you when the place was founded from another place (so, G was founded in 600 from F). I want to query what G was called in a given year: if I ask for the name of the place currently called 'G' in the year 450, the answer ought to be 'D' (because not only was G founded from F in 600, but F was founded from D in 500, while D was founded in 300). I think I need to include a "root" node for path traversals to come back in a consistent form (ie always include place 'A' if the date is before 100).
I have been trying out AQL to answer the question, with some success, but am not sure this is the Right Way (tm) to go about it, so any pointers would be helpful.
FOR p IN places
FILTER p.display_name == @name
LET path = (
FOR v, e IN 0..10 OUTBOUND p places_established_from
PRUNE e != null AND e.established < @date
RETURN v
)
RETURN path[-2]
It seems to do the trick but does not feel so natural nor efficient?
jeff