Bestpractice How to Model DateTime Relations when doing pathfinding

13 views
Skip to first unread message

Boas Enkler

unread,
Apr 27, 2016, 12:59:57 PM4/27/16
to Neo4j
Hi

I'm quite new to neo4j .I want to build up a graph to combine travels/rides . 

There are several concerns i'm thinking about. 

First some examples to describe my problem

I've a two rides. 
Stop A ->Ride with Company 1 -> Stop B 
Stop B -> Ride with Company 2-> Stop C  


Now When I Search A-> C I want to find both of those rides. 

Now first of all I would Have , Stops,Companies, and Rides. In this case the linking now seems quite obvious. 

But now there are further scenarios


1. Date Relation
Each Ride as a Departure Date and Time.
The Second ride must occur After the first ride. 

I thought about adding date Nodes  for example

Stop A -> 01/01/2016 -> RideWithCompany1  -> Stop B
Stop B -> 01/01/2016 -> RideWithCompany2 -> Stop C

Now I could query between A and C on 01/01/2016

Would this be a good practice ? 

2. ) Order in Time
The ride with Company 2 could be on the next day and may be valid.
I currently can't imagine how I could do this with a CIPHER query.

3.) Limitations
3.1) I only wnat to combine to a maximum of 3 Rides
3.2) Each Ride has price and I don't wont to combine rides with prices over a specific value

Curretnly I would handle them in code when iterating thorugh the result items, but is there a better? Can this be done by a query?

Are there any hints in what strategy the graph should be designed? Or any links to ressources which may help?
Reply all
Reply to author
Forward
0 new messages