public transport timetable database and editor fatima seghosime

21
i Public Transport Timetable Database And Editor Fatima Seghosime Accounting And Computing (2003/2004)

Upload: truongdung

Post on 02-Jan-2017

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Public Transport Timetable Database And Editor Fatima Seghosime

i

Public Transport Timetable Database And Editor Fatima Seghosime

Accounting And Computing (2003/2004)

Page 2: Public Transport Timetable Database And Editor Fatima Seghosime

ii

Summary Report

The aim of this project was to develop a System that would help a public transport company manage

and plan its timetable. Developing such a system involved a research into an existing system,

background research on the possible tools appropriate for the development and producing a solution.

Research to the current system was not done because there is no existing system to investigate.

The system was developed for a bus transport company. To achieve this aim a database was designed

in order to allow the bus transport company operators enter, and store all time information about trips.

A Window application was designed to help the company create and generate timetable for trips, any

changes made in the interface is updated in the database.

The proposed tools for this project was Microsoft Access and Visual Basic 6 however, these were not

the tools used because it was too tasking having to learn all three languages for the project due to the

time constraints beside visual basic 6 is not available in the school of computing machines even when I

was going to learn it. The tools used instead were Microsoft SQL Server for the database, Visual basic.

NET a later version of visual basic for the interface, and ADO.NET for the connectivity.

An evaluation of the project proved that the system fulfilled the set out aims.

Page 3: Public Transport Timetable Database And Editor Fatima Seghosime

ii

Acknowledgements I would like to acknowledge the great help and contribution of the people that have helped me to

complete this project.

First and foremost I would like to thank God Almighty for seeing me through this project.

A sincere gratitude goes to my mum, Queen Seghosime for her constant advice, prayers and support

not only for this project but she has always been there for me since the start of this programme. I wish

her God guidance.

I would also like to thank to my supervisor Dr RS Kwan and accessor Dr Sarah Fores for their support

throughout this project.

Moreover special thanks go to my fiancé, LT Suraj Abubakar for his support, advice, love and care at

the beginning the middle and the end of my course.

Thanks to Maria for being a good friend, since from the start also for her constant support.

A lot of thanks to Dr Stuart Roberts, Warren and Neil Hickman for their attempt to help me with some

of the problem encountered during this project.

Most of all thanks to the other member of my family especially Saeed and Rasheeda for keeping me

company during the lonely times in the lab doing this project.

Page 4: Public Transport Timetable Database And Editor Fatima Seghosime

iii

Public Transport Timetable Database And Editor Fatima Seghosime

TABLE OF CONTENTS

Chapter 1: Introduction...............................................................................................1

1.1 Public Transport Timetable.....................................................................1

1.2 Why A System Is Required.....................................................................1

1.3 What can be done....................................................................................1

1.4 How it can be solved…….......................................................................2

1.5 Minimum Requirements………….…………………………………….2

1.6 Revised Project Schedule……………………………………………….2

Chapter 2: Research Methodology...............................................................................3

2.1 Proposed System…….…………………………………………………….3

2.2 Database Management Software (DBMS)…………………………….......3

2.2.1 Microsoft Access………………………………………………………...4

2.2.2 Microsoft SQL Server 2000…..………………………………………….4

2.2.3 MYSQL…...……………………………………………………………...5

2.3 Front-End…………………………………………………………………..6

2.3.1 Visual Basic6…..………………………………………………………...6

2.3.2 Visual Basic.Net………………………………………………………....6

2.3.3 Visual C++……………………………………………………….............7

2.4 Connectivity………………………………………………………………..7

2.4.1 ODBC…………………………………………………………………....7

2.4.2 ADO.net………………………………………………………………….8

2.5 Conclusion…….............................................................................................8

Chapter 3: Design...........................................................................................................10

3.1 System Design…………………..................................................................10

3.2 Database design…………………………………………………………....11

3.2.1 Entity Relationship Model….....................................................................11

3.2.2 Basic constructs of ER modelling.............................................................11

3.2.3 Explanation of the entities………………………………………….........13

3.2.4 Resolving Many-Many Relationship.........................................................14

3.2.5 Relational schema………………………………………………………..15

Page 5: Public Transport Timetable Database And Editor Fatima Seghosime

iv

3.2.5 Referential integrity constraint… … … … … … … … … … … … … … … … ..16

3.2.6 Normalisation… … … … … … … … … … … … … … … … … … … … … … … .16

3.2 Prototype application design.........................................................................17

Chapter 4: Project Implementation and Testing..............................................................19

4.1 Coding… … … … ..........................................................................................19

4.2 System Testing… … … … … … … … … … … … … … … … … … … … … … .....21

Chapter 5: Conclusion and Evaluation............................................................................23

5.1 System Evaluation........................................................................................23

5.2 Usability… … … … … ...................................................................................25

5.3 Future Enhancement.… … … … … … … … … … … … … … … … … … … … ...26

Chapter 6: Bibliography and References........................................................................27

Appendix A: Reflection on the project............................................................................i

Appendix B: Project Schedule...........................… … … … … … … … … … … … … … … .ii

Appendix C: User Manual… … … … … … … … … … … … … … … … … … … … … … … ...iv

Appendix D: Database tables Relationship… ..… … … … … … … … … … … … … … … ...vi

Appendix E: Relational Schema..............… … … … … … … … … … … … … … ....vii

Appendix F: Screen Shots....................................................................................ix

Page 6: Public Transport Timetable Database And Editor Fatima Seghosime

v

Public Transport Timetable Database And Editor Fatima Seghosime

Table of Figures Figure 3.1: Architecture of the Bus transport timetabling system.................................10 Figure 3.2: ER Diagram of the System...........................................................................12 Figure 3.3: Refined ER Diagram....................................................................................14 Figure 3.4: Foreign Key Constraint.................................................................................16 Figure 3.5:User Graphical Interface of The System........................................................18 Figure 4.1: Steps in ADO.NET connection.....................................................................19 Figure 4.2: The System Main Interface...........................................................................21 Figure 4.3: Timebase Screen...........................................................................................22

Page 7: Public Transport Timetable Database And Editor Fatima Seghosime

1

Public Transport Timetable Database And Editor Fatima Seghosime

Chapter 1: Introduction

1.1 Public transport timetable

A timetable describes the temporal characteristics of public transport journeys or trip time.

Otherwise, timetable is mostly concerned about the time variations in a trip.

The timetable is not just the physical leaflets we see but is there is more to it; the various stages on how

the timetable is generated will be analysed in later chapters of this report. The project aimed to use

some basic tools to develop a public transport system that will enable the users or operators of public

transport company plan and manage their timetables efficiently.

1.2 Why A System Is Required

Creating a timetabling System will make it very easy for a bus transport company’s scheduler to

enter or generate trips information. However, there is no current system to research on and this will

make it difficult to know certainly what the users needs would be and compare how satisfactory the

system has met the users needs.

Every software engineer knows that apart from understanding the users’ needs, it is

necessary to review the specification with the users during the design process, in this case, the

supervisor is assumed to be the stakeholder. This make the stage the most difficult part of software

development. What the system required to meet those needs are specified and can be revised if

necessary before the actual implementations.

In making the specifications clearer, detailed ER-diagram and a prototype application design will be

used to define the system behaviour. Other methods can also be use to describe how the system works;

these will be mentioned in later chapters.

1.3 What can be done

In order to develop the System, the following objectives are set out.

• Design and build a database that will hold the timetable information.

• Create an application that will enable the bus operators to create and generate trips

timetable.

Page 8: Public Transport Timetable Database And Editor Fatima Seghosime

2

Public Transport Timetable Database And Editor Fatima Seghosime

1.4 How it will be Solved

The project aimed to develop a system that will enable a public transport company to plan and manage

their timetables. In order to achieve these objectives, a database and a Window application will be

design using appropriate software tools.

The database will store the timetable information of each bus trips within Leeds city routes; this

includes the valid days for the trip, operating time, trip pattern, and route pattern est.

The application will allow the schedulers to access, create and generate timetable for trips. These

include inserting, copying, deleting, and editing and these changes are updated automatically in the

database.

1.5 Minimum Requirements

In order to meet the stated objectives, the following minimum requirements were identified.

• A database to store bus transport timetable information and to enter trip times

• A prototype application that will allow the users (operators) to create and generate timetable

for trips.

1.6 Revised Project Schedule

It is always very important to have a focus at the beginning of a project and consider any other

constraints that might prevent the time set for a project completion. When the initial schedule was

made most of these constraint were consider properly but the time allocated to each stages was not

idea. When planning the project schedule, lot of assumptions were made. I anticipated that any problem

encounter would be easily solved. Therefore, initial schedule lacked an insight into the concurrency of

tasks and a greater understanding of the length of time it would take to perform certain tasks. (See

Project schedule: Appendix B). The revised schedule table can be found in appendix B 2.

Page 9: Public Transport Timetable Database And Editor Fatima Seghosime

3

Public Transport Timetable Database And Editor Fatima Seghosime

Chapter 2: Research Methodology

2.1 Proposed System

Developing a system requires the use of appropriate tools. Getting the tools most appropriate was very

costly. This was because there is no current public transport timetable system to analyse; everything

has to be built from scratch.

In order to have the tools that was most appropriate to develop a robust system that would help a bus

transport company plan and manage their timetable, lot of books and Internet search consultation was

done.

Some past final year project, textbooks on software engineering and books on transportation were

consulted to gain a basic knowledge of developing system. This research gave a general understanding

on the possible tools that can be used in developing a system. Internet search and bus timetable leaflet

gave a better understanding on the basic entities to consider in designing the database of this system.

The objective and requirements that are met will be explained in later chapter when evaluating the

system functionality. The software will be given to anonymous testers to give feedback on their about

the system usability and robustness.

Security is a big concern when developing a system as there is a lot of information that is confidential

and not all users can have access. Talking about security, some of the safeguards that can be used to

access information or retrieve information from a system are username with a password. Passwords are

normally an important part of any secured system. Although for the purpose of this project, security

will not be implemented, as the user will not have a need for it. The supervisor who was also use as the

stakeholder felt it would not be necessary.

In order to meet the requirement of the users, a database and a window application will be

implemented. The database will store the timetable time information and an application, which will

allow users to manually create new trip by adding trip for certain duration, copying trip, and deleting

trips.

2.2 Database Management Software (DBMS)

A Database Management System (DBMS) is a software package designed to store and manage

databases [Userpages]. There are so many DBMS software available in the market today and they are

all having one thing in common; which is Relational model. In order to choose a concrete DBMS, few

of the many different database paradigms was analysed and compared.

The most important factor in choosing a DBMS is the model employed to store, manage and retrieve

information from the database.

Page 10: Public Transport Timetable Database And Editor Fatima Seghosime

4

Public Transport Timetable Database And Editor Fatima Seghosime

In addition, considering a tool to be used, a developer need toa sharp focus on the relevant project

requirements with a thorough understanding about strengths and weaknesses of the various DBMSes

available (Open or closed sources).

2.2.1 Microsoft Access

Microsoft Access is one of the well-known implementation of the relational data model on the PC

platform [Elmasri]. It is the most widespread DBMS (database Management System) for the Microsoft

Windows platform. “Microsoft Access is a workgroup database designed for small and medium-size

applications with a few megabytes of data at most and a small user base” [Martin]. This mean it can be

used only when a developer want to store small amount of data or work with a very low resources such

as memory. As this project is for single set of users, (only the schedulers or operators) in the bus

company, Access is worth considering but other factors needs to be considered that is scalability and

robustness. For example Microsoft Access databases cannot be restored to the point of failure, this

makes more expensive when administering the database [Alex].

Microsoft Access is very good at designing database tables and it has many important features that

concern the database as a whole. It has the ability of manipulating security and allows interactive

definition of relationships between the tables – which can specify referential integrity constraints

through the relationships windows to avoid duplication of information [Elmasri]. This worthwhile

designing the database of this system because one of most important when designing a system is to

have a database that maintains data consistency.

Access provides a database engine and a graphical user interface (GUI) for data definition and

manipulation, with the power of Structural Query Language (SQL) [Elmasri]. Access provides a

programming language – Visual Basic this gives users the ability to create ranges of applications. Users

can also use the Wizards in access to develop personal report and applications as well. Access can also

be used as front-end to other database. For the purpose of this project, it is been considered as a DBMS.

The connectivity between Microsoft Visual Basic and Access is very easy but connection from other

programming language is quite difficult and the connection must be done through open Database

Connectivity (ODBM).

2.2.2 Microsoft SQL Server 2000

Microsoft Structural Query Language (SQL) is a Relational Database Management System (RDBMS)

and SQL Server 2000 extends the performance, reliability, quality, and ease-of-use of Microsoft SQL

Server version 7.0. Microsoft SQL Server includes several features that make it an excellent database

platform for large-scale online transactional processing (OLTP), data warehousing, and e-commence

application [Discount].

Page 11: Public Transport Timetable Database And Editor Fatima Seghosime

5

Public Transport Timetable Database And Editor Fatima Seghosime

Microsoft SQL server is designed to be the database for the enterprise that can handle large volumes of

data and a large number of users [Martin]. handling large number of users might be necessary for this

project because few users would use the system.

SQL Server 2000 contains a feature called “recovery models” that can help classify back up needs and

simplify back up plan as well. SQL Server uses the transaction log, among other things, to ensure that

committed transactions are not lost due to a power failure.

SQL server databases can be processed from application programmes coded in standard programming

languages such as Visual basic or C#, or application logic can be place in stored procedures and

triggers [Michael].

SQL server 2000 only works s on windows-based platforms including Windows 9x, Windows NT,

Windows 2000 and Windows CE unlike Microsoft Access, which can work on more platforms [Alex].

2.2.3 MySQL

MySQL is the world’ s most popular open source database with a large user base and good

documentation [Mysql]. It is a Database Management System (DBMS) product that runs on UNIX,

Linux and Windows. Unlike Microsoft Access, MySQL is solely a database server and it misses many

of the capability of commercial DBMS products such as Oracle and SQL server [David]. The most

prominent feature of mySQL is its speed when running SQL select statements. “MySQL was built for

speed” [Alex].

MySQL is a good choice when working with a low budget or participating in open source movement

[David]. MySQL is cheaper than Oracle and other commercial product in Linux/UNIX environment

and it is cheaper to install as well. MySQL is relatively easy to learn even if the user is new to

relational database; sophisticated web application can be created in a relatively short period of time.

MySQL is extremely fast for pure query application when compared with other DBMS, this is due to

its limited transaction management and logging capabilities. MySQL does not support views, stored

procedures, or triggers. This does not matter much in this project since views, store procedures will not

be used.

MySQL does nothing with foreign key referential integrity because it does not support it; - it is treated

as add-on rather than the absolute critical central feature it should be. As one of the database design

requirements for this project, it is not too idea to use MySQL because it will makes the design more

difficult and time consuming. Although the use of foreign key can be implemented at the programming

level, it is entirely up to the programmer to make sure that data consistency is maintained. MySQL

does not support all the ANSI-standard ON DELETE options, nor does it support match partial

[David].

Page 12: Public Transport Timetable Database And Editor Fatima Seghosime

6

Public Transport Timetable Database And Editor Fatima Seghosime

2.3 TECHNIQUES FOR THE FRONT-END

2.3.1 Visual Basic6

Visual Basic 6 (VB6) is a Microsoft Windows programming language. Visual Basic programs are

created in an Integrated Development Environment (IDE). IDE allows user to create and, run and

debug Visual Basic conveniently [Deitel].

Visual Basic 6 “ is the most productive tool for creating high-performance enterprise and web-base

applications” [Discount]. Integrated Visual Database tools and a RAD environment promote

productivity while native code compilation provides fast applications. Is one of the most widely used

Rapid Application Development (RAD) languages.

Visual Basic 6 comes with a complete set of graphical tools and a high-level language construct that

makes it easy and quick to develop a running application. It has other features like event handling,

access to the Win32 API (Application Programming Language), object-oriented features, error

handling, and structured programming.

Visual Basic 6 feedback and on-line debugging tools save a lot of time in correcting mistakes when

developing a new application. It interprets each statement as it being written, translating code

immediately to runnable form. It is compatible with Microsoft Access, which makes the connectivity

very easy. Visual Basic Data manager can perform all operations like compact, repair, encrypt on

database created in Microsoft Access.

Visual Basic 6 introduces ADO as the powerful new standard for data access. Included OLBE DB

drivers include SQL Server 6.5+, Oracle 7.3.3, Microsoft Access, ODBS, and SNA Server [Discount].

2.3.2 Visual Basic.Net

Visual Basic.net (VB.NET) is Microsoft’ s reengineering of Visual Basic for the .NET platform and it is

a language written specifically for the .NET. VB.NET departs in some significant ways from earlier

versions of Visual Basic. VB.NET has evolved into a full-integrated object-oriented commercial

software development package but retains some of the inherent simplicity of its predecessor [O’ Reilly].

VB.NET has quite a number of features that helps it maintain backwards compatibility with Visual

Basic6 (VB6). VB.NET has two new forms packages (Windows forms and web forms); streamlined

language, can remove legacy keywords, improves type safety, and developers are now exposed to low-

level construct. With web forms and ADO.NET developers can now develop a rapid scalable web sites

with inheritance. Windows forms natively support accessibility and visual inheritance and it is now

very simple in deploying applications. This project is a Windows form application and ADO.NET

works perfectly with it as well.

Page 13: Public Transport Timetable Database And Editor Fatima Seghosime

7

Public Transport Timetable Database And Editor Fatima Seghosime

VB.NET is a significant step forward for Visual Basic programmers. According to O’ Reilly VB has

been cast as a second-class “ toy” language that was not up to the challenge of enterprise-level software

development in the past. Thanks to VB.NET.

VB.NET provides support in the language to find bugs in the early stage of development. This makes it

easy to maintain codes and makes the program more reliable [O’ Reilly]. VB.NET does not support

some features available in other languages and this makes it unsafe for code.

2.3.3 Visual C++ 6.0

Visual C++ 6.0 is a C++ development environment for Windows and Web, including scripting,

compiling and debugging tools and component libraries. It can be used to develop applications that

make use of OLE (Object Linking and Embedding), ODBC (Open Database Connectivity) and

Microsoft Foundation class (MFC) library. Visual C++ can be used to build Activex controls, and

create multimedia based, interactive, Dynamic HTML (DHTML) pages [Discount Software]. Visual

C++ 6.0 is the most productive C++ tool for the highest-performance development for Windows and

Web [Discount].

Visual C++ 6.0 brings a new level of productivity to C++, without sacrificing flexibility, performance,

and control.

Visual C++ development system can perform almost all general code optimizations. With compiler

switches and pragmatic statements, the type of optimizations applied to the code can be controlled

[Martin].

Visual C++ has a number of features that aid in producing fast programs and this includes profiling,

and delay loading.

Microsoft says, “ Developer spends less time building applications and less time coding, compiling and

debugging when Visual C++ is used” . In Visual C++ component can be reused and the ubiquity of

Microsoft technologies makes Visual C++ a good, safe, bread-and-butter skill. [Discount]

2.4 Connectivity

2.4.1 ODBC-Open Database Connectivity

Open Database Connectivity (OBDC) is an open standard application-programming interface (API) for

accessing a database. By using ODBC statements in the program, access can be gain to many different

numbers of files in the databases; this includes Access, dBase, Oracle, Excel and text. In addition to the

ODBC software, a separate module or driver is needed for each database to be accessed. [John]

ODBC is based on and closely aligned with the open group standard Structural Query Language

(SQL). It allows programs to use SQL requests that will access database without having to know the

Page 14: Public Transport Timetable Database And Editor Fatima Seghosime

8

Public Transport Timetable Database And Editor Fatima Seghosime

proprietary interfaces to the databases. ODBC handles the SQL request and converts into a request the

individual database understands.

For client/server database system such as Oracle, the ODBC driver provides links to their database

engines to access the database. OBDC support SQL and non-SQL databases. Although the application

always uses SQL to communicate with ODBC, it will communicate with non-SQL databases in native

language.

2.4.2 ADO.NET

ADO.NET is a new version of ADO for accessing disconnected data sources. [Msdn] Its components

have been designed to function properly on n-tier architecture. ADO.NET is provides consistent access

to these data sources; these includes Microsoft SQL Server, as well as data sources exposed via OLB

DB and XML. Data sharing consumer applications can use ADO.NET to connect to these data sources

and retrieve, manipulate, and update data.

ADO.NET provides complete support for XML and allows the manipulation of persistent data.

ADO.NET includes .NET data providers for connecting to a database, executing commands, and

retrieving results. The retrieved results are placed in a DataSet object in order to be exposed to the user

when needed, combined with data from multiple sources. The DataSet represents a subset of the entire

database, cached on the machine without having to connect to the database all the time. DataSet can be

reconnected to it parent database once in a while, the database is updated with the changes made to the

DataSet, and the DataSet can be updated as well with the changes in the database made by other

process.

In ADO.NET, there are four classes that can read and write data from data sources. This includes

Connection, Command, DataAdapter and DataReader. [Siue]

2.5 Conclusion

After series of research on the possible tools to use in the development of the new system, a few

technologies discussed above were considered as appropriate for the design but only three out of the

tools will be consider for the purpose of this project, because not only are they more advantageous but

for some other reasons.

For the database design, the DBMS are all available in the school of computing, which is one of the

factors considered. Microsoft SQL Server was chosen as DBMS software used for this project not only

because I am already competent at using it but because the system need to be secured, scalable robust,

these are the beautiful thing about what SQL Server can provide for a system. Also, Microsoft SQL

Server is integrated with Window NT security, while Access in not [Alex]. Access database cannot be

restored to the point of failure which make administering Access more costly than SQL Server.

Page 15: Public Transport Timetable Database And Editor Fatima Seghosime

9

Public Transport Timetable Database And Editor Fatima Seghosime

Being that the application is Windows based, MySQL was out of the question since it is mostly used

as a backend for web site and it runs on Linux/Unix machine.

For the front-end and connectivity tool, there was no much choice than to use Visual Basic.Net and

ADO.NET because they are more compatible. Availability of the tools in the school of computing was

another reason that was considered both Visual Basic 6 and Visual C++ 6.0 are no longer available in

the school machine.

Page 16: Public Transport Timetable Database And Editor Fatima Seghosime

10

Public Transport Timetable Database And Editor Fatima Seghosime

CHAPTER 3: Design

3.1 System Design

This chapter will provide a detailed design specification for the proposed bus transport timetabling

system. This system should help the bus transport to plan and produce their timetable without wasting

precious time. The stages of development include the components of the system, this represent how the

whole System will look at the time of completion, a database design, and a prototype application

design. An entity relationship (ER) diagram was used to model the database; this provide a structural

understanding of how the timetable is stored in the database and data consistency checking

mechanisms such as integrity constraint and table normalisation.

The prototype design is created in a window application; this helps to maintain a feel of consistency for

the system functionality. These allow the users to insert, delete and update a timetable, by inserting a

trip onto another route or changing service routes. They are able to change departure times, and

increase or decrease services to a particular destination or location. All the editing operations are

performed in a graphical user interface (GUI). The users of this System are the bus scheduler or

operator and for the rest of the chapter the scheduler or operator will sometimes be used in conjunction

with user.

Figure 3.1: Architecture of the Bus transport timetabling system

This diagram represents how the system will look when the bus company is scheduling trips when it

goes live.

Page 17: Public Transport Timetable Database And Editor Fatima Seghosime

11

Public Transport Timetable Database And Editor Fatima Seghosime

3.2 Database Design

The entity-relationship model was used for the design of the bus timetabling system.

3.2.1 The Entity-Relationship (ER) Model.

The entity-relationship (ER) model was originally proposed by Peter in 1976 as a way to unify the

network and relational database view [Utexas]. ER model is use for the design of the timetable

database. The entity-relationship (ER) model is a conceptual data model that views the real world as

entities and relationships. A basic component of the model is the Entity-Relationship diagram; this is

used to visually represent data objects that are going to be in the database [Utexas].

The reasons for using this model for this project are that:

• It maps well to the relational model.

• The constructs used in the ER model can easily be transformed into relational tables.

• It is simple and easy to understand. Therefore, the model can be used to communicate

the design to the users.

3.2.2 Basic constructs of E-R modelling

The ER model views the real word as a construct of entities and association between entities.

The entity-relationship diagrams was used in order to:

• Identify the data that must be captured, stored and retrieved in order to support the business

activities performed by an organization; and

• Identify the data required to derive and report on the performance measures that an

organisation should be monitoring.

The component of an ER diagram includes the following:

Entities

Entities are the principal data object about which information is to be collected. Entities are

usually recognized by classes that are relevant to the database. They are represented by label

rectangles. For example, in the figure 3.2, the entities are RoutePattern, Trip, BusService,

TimingPattern, Timetable, Stop and trip timing.

Page 18: Public Transport Timetable Database And Editor Fatima Seghosime

12

Public Transport Timetable Database And Editor Fatima Seghosime

Attributes

Attributes describe the entity of which they are associated. It can be classified as an identifier

or descriptors. Identifiers, more commonly called keys, uniquely identify an instance of an

entity. A descriptor describes a non-unique characteristic of an entity instance. For example in

the timetable ER, trip_id is a unique identify of that trip and start time describes the time at which the

trip will start it runs for that particular day.

Relationship

A relationship is a logical link between two entities. “ A relationship represents a business rule and can

be expresses as a verb phrase” . [jthom] Most relationships between entities are of the “ one-to-many”

type in which one instance of the parent entity relates to many instances of the child entity. For

example in figure 3.2, Bus Service has one-to-many relationship with the Trip entity. This is because

BusService can run many trips but a trip can only be assigned to one bus service at a time.

“ Many-to-many” relationship is another type of relationship. In this relationship, many instances of one

entity relates to many instances of the other entity. For example, in figure 3.2, the Route_pattern entity

has many-to-many relationship with the stop entity because every Route-pattern is associated with two

or more stops and every stop covers different bus route.

.

Figure 3.2 ER Diagram of the bus transport timetabling system database.

Page 19: Public Transport Timetable Database And Editor Fatima Seghosime

13

Public Transport Timetable Database And Editor Fatima Seghosime

3.2.3 Explanation of the entities in the diagram.

BusService

There are many buses with different service numbers; with this numbers, the operators are able to

allocate them to various routes to give a set of trips. Services are identified within the

timetable as more frequent during the busy (peak) time and less frequent for both less busy times (off-

peak) and Sundays respectively.

Trip

A trip describes the service run time in a particular day in a calendar date. Trip time varies

during the day (i.e. between peak and off-peak time) and between different types of days. A

service number can be allocated to a certain number of trips in a day; the start time and end time of the

trip has to be known before the actual number of trips for that day can be calculated or known. This trip

time types define the exact route of a trip.

A trip is valid within certain date time (that is the validfrom and validuntil date). This is used

to represent the duration or length of the trip for that period).

Timetable

Timetables are based on trip time. The timetable describes the route that trips take and the time they

take place. In this respect, not only the time of the day is important, but also the day on which the trip

is undertaken must be known.

This is only possible when all the trips are shown on a calendar and it is indicated in the calendar

whether there is a service running or not running. The timetable has a validity period, which determines

how long the timetable will be used. For example once a timetable is created a time period is specified,

this usually between three months to six months.

Bus Stop

The Stop gives the list of bus stops in a route or describes the sequence of stops in a route.

Stop stores the name of stops and the time that the services will get to that stop from the

beginning of the trip.

Page 20: Public Transport Timetable Database And Editor Fatima Seghosime

14

Public Transport Timetable Database And Editor Fatima Seghosime

RoutePattern

Route is where the trip takes place and it consists of a sequence of points of stops. Route number

allows the operators to specify which route trips take place. For Example, there are number of bus

routes through the city centre area linking to it the surrounding areas in Leeds.

Timing_Pattern

This is the time allocated for each trip. Time varies depending on the time of day and day

type. Mornings between 0535 and 0930 are regarded as peak time, so services are frequent in this

period and during late afternoon as well. During the off-peak time, services tend to run fewer trips

time.

Timing pattern is the time variation involved in a trip and every route has its own timing pattern.

Trip_Timing

This defines the exact route of a trip. This is done by specifying the intermediate time between two

stops i.e. the time it takes a bus service to get from one stop to the next.

3.2.4 Resolving many-to-many relationship in the ER diagram

There is a problem in figure 3.2 that needs resolving; that is the issue of many-to-many relationships

between RoutePattern and Stop entities. In this model, many-to-many relationships cannot be use

because it cannot by represented by the relational model [Utexas]. Therefore, many-to-many

relationships must be resolved at this early stage of the modelling process in order to avoid data

redundancy. In order to resolve these relationships an association entity was used to replace the

relationship and then relate the original entities to the association entities.

Figure 3.3: Refined ER diagram of the bus transport timetabling system database

Page 21: Public Transport Timetable Database And Editor Fatima Seghosime

15

Public Transport Timetable Database And Editor Fatima Seghosime

In the new ER diagram, identifying and adding the entity Point eliminated many-to-many relationship

in the model. This new entity (Point) relates to the original RoutePattern and Stop entities by a pair of

one-to-many relationships.

Point is a stop in a route that a given bus services can regulate or a point is where buses regulate their

service.

3.2.5 Relational Database Schema

Relational database schema S is a set of relation schemas S= {R1, R2… ..Rn} and a set of integrity

constraints [Elmasri]. For example Bus_service has attributes Service Number and TB_id and the

primary key is the underline attribute.

The table below is the output of the implementation of the bus timetabling system database.

Route_Pattern

(Route_no int not null,

Route_Descritption nvarchar (50) null,

Service_no int null,

Primary key (Route_no)

Foreign key (Service_no) references Bus_Service))

The above relational schema defines the design level of the Route-Pattern table in Bus transport

database. It shows all the attributes, data types, and integrity constraint. (See complete Schema in

Appendix E)

3.2.6 Referential Integrity constraint

Referential integrity is enforced to validate the inputs in the relational database in order to be able to

navigate between related tables. Referential integrity rule states that every foreign key value must

match a primary key value in the associated table [Utexas].

Below is an example of a foreign key constraint enforced on route_no in the Trip and Route_Pattern

table in the bus timetabling system database. Constraints such as this protect the database from storing

inconsistent data. What this means is that the constraint will prevent any actions that would destroy