I am trying to learn Neo4j. I will like to model the subway network. The schema of a subway station look like this:
{
"identity": 0,
"labels": [
"Station"
],
"properties": {
"name": "station-ew-01",
"line": [
"ew"
]
}
}
"ew" in the "line" property represents the the line the station is on. Some stations will have multiple lines running through the station.
I did a cypher query to find the shortest path between 2 nodes:
match path = shortestpath((start:Station {name:"source"})-["TRAVEL_TO*1..30]->(end:Station {name:"destination"}))
return path
How do I construct a cypher query such that the nodes/"stations" from "source" to "destination", are on the same line ? How do I specify node.lines = "ew" for each of the node return by the shortest path ?
Thanks.