How to model a domain that has a time component

Hi all,

I am looking at using Neo4j for a project. The only thing is that the domain that needs to be modeled not only has nodes and relationship, but these changes over time.

It is for a transport system. Without going into much details below is an overview of the model and example of the time dependent relationship.

So basically you have a company with a fleet of cars and buses together with drivers. These cars and buses have drivers, and these cars and buses are used to transport people or goods to specific destinations.

The above domain can be mapped into a GraphDB. The only problem now is the relationship changes. In the sense that a particular driver can be driver one car now, and in a couple of hours is driving another car. And a particular bus can be heading to one destination now, and in a couple days will head to another.

And the application has a strict requirement that mandates it needs to support snapshot of these relationship. Basically it means it should make it possible to show at a particular point in time, who are the drivers, what cars/buses are they driving, and where were day heading.

Basically it looks like there is a time-series aspect to the domain. Question is, any advice or suggestions or recommendations regarding how such can be modeled in Neo4j?

An approach I came up with, is to store all the nouns (ie cars, buses, drives, destination) in Neo4j, and use another data store (maybe some thing like redis), to store the relationship as json at a particular timestamp.

So a relationship snapshot could look something like this:

{
time_stamp:122397863424,
data: [{
  vehicle_type : bus | car,
  vehicle_id: id,
  driver: drivers_name,
  destination: amiens
}]
}

And then all I now need to do is to load these snapshot data at runtime and dynamically apply it to the graph model in Neo4j.

Which means when a user specify the timestamp, the relationship are applied to the nodes, and the user can then write whatever query they want to explore the data at that particular point in time.

Does this sounds like a valid approach to these modeling problem?

An approach can be create a node for every new timestamp and connect the mix of nodes interested from the transaction (car, driver, destination).
Atomic and simply way.

That is another interesting approach! It also has the advantage that everything can be done within Neo4j and no need to have another data store...