Uml Class Diagram for Metro Railway

1k views Asked by At

I am trying to draw and define the classes in UML for the following problem.

An Information System of Metro Railway

Design the part of the conceptual scheme of the above system that will allow me to register the stations (by distinguishing between interchanges and terminals), the interconnection of the stations (ie the network topology) and the distances (in kilometers of the railway line) they divide.

Each train moves in a line by running consecutive routes, ie moving between prescribed extreme pairs of stations, which are not necessarily the same on each route (Eg Bronx - Manhattan, Brooklyn - Queens). Each route has a specific time of arrival and stay at each station. The actual arrival times at each station may differ from the programmed ones, as well as the speed of traffic between stations.

My first thought is that the main classes should be:

Metro Line, Metro Station, Metro Route, Metro Route Stop, Metro Train

And I am struggling how to represent the scheduled and real times.

2

There are 2 answers

2
giorgionasis On BEST ANSWER

Finally,

I come up with this design

enter image description here

Thank you very much

1
Christophe On

Lets look at the classes, which are rather obvious:

  • Metro line is a set of Metro routes
  • Metro route is associated with a sequence of Metro stations
  • Metro route is defined by two extreme Metro stations
  • Train runs on Metro routes

Each route has a specific time of arrival and stay at each station.

This implies that routes are not something general (e.g. Brooklyn - Queens), but something very specific (e.g. Brooklyn - Queens starting at 15:03).

Furthermore, as several Metro routes may use the same Metro station, and as a Metro route is composed of several Metro stations, we have a many to many association between those two classes. The time and stay neither depend solely on the route, nor solely from the station. So the best would be to see it as a property of an association class:

enter image description here

The fact that you have a planned time and stay and an actual time and stay means that there are just two different properties. The position of each train between the stations tells us about the trafic.

Finally a more elaborate way to handle the different timings would be to consider a Time table class. The association between Metro route, Metro station and Time table would then be a ternary association, and a ternary association association class could hold the timing data (either planned for the planned table, or actual for the actual table; but you could also have several versions of the plan, and a version of the actual for every day of of the year. This would be completely flexible.

Now, if you are not comfortable with an association class, you can decompose the many-to-many association into two many-to-one associations with a middle class, which you could name Route stop.