answers please?

On Monday, April 28, 2014 12:41:50 PM UTC+5:30, Atul Agrawal wrote:
>
> Hello everyone,
> I asked this question in stackoverfow but didn't get a reply unfortunately
> Here is the link:
> http://stackoverflow.com/questions/23328318/cypher-query-to-reach-a-terminal-node
>
> Question:
>
> I have the following data structure for a bus service. A city node has 
> many buses to other city node which again has many buses to other city node.
>
> Bus and city are uniquely identified by their id.
>
> *(a:city)-[r:To]->(b:City)->[r:To]->(c:City)-[r:To]->(d:City)*
>
> Node City has properties:cityId(int) relationship To has 
> prop:busId(int),arrivalTime(int).
>
> *Question:*
>
> Given a cityId and a busId how to write a cypher query to get the route of 
> the bus i.e all city from start to destination sorted by the arrivalTime.
>
> The cityId provided above ensures that the bus starts from that city.
>
> My Guess
>
> *Match (a:City)-[r:To*]->(b:City) where a.cityId=cityid and r.busId=busId 
> return r,b. order by r.arrivalTime*
>
> But it doesnot ensure b is the last station and there is no way to get 
> cityId
>
>
> -- 
> Atul Agrawal
> mob:+91-99211-40647
> [image: View my profile on 
> LinkedIn]<http://in.linkedin.com/pub/atul-agrawal/60/775/6b8>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to