You are here

Representing composite entities

8 September, 2015 - 16:47

Certain types of entities are better understood – and, thus, modeled – as being comprised of not just a set of attributes, but of other whole entities. These are called composite entities or composite objects. The entities which comprise another entity are referred to here as constituent entities. Sometimes they are referred to as components or child objects of an encompassing parent entity or parent object. It is important to note that many types of entities cannot exist in their own right without the existence of their constituent entities.

EX. TR-4:

One trip on one train route in our example can be modeled as a number of composite entities. The equipment that is to be used is itself is a composite. There may be several engines and any number of cars. A train company would certainly use a data management system to keep track of each of these pieces of equipment individually. For a given trip, the company would also need to know which of these individual pieces of equipment are used together. Which engine did we send to Ottawa today with train 39? Thus, we might look at a composite model of the equipment used for a trip as follows:

train_equipment(trip_id=2007-08-17 18:00, ... )
    engines
        {engine(id=E105, model=General Electric P27,... ),
        engine(id=E2711, mode=Budd Diesel #2, ... )}

    passenger_cars
        {passenger_car(id=P143,model=Bombardier 101,
        capacity=100,...),
        passenger_car(id=P2008,model=Bombardier 101,
        capacity=100,...),
        ... ...
        passenger_car(id=P2009,model=Bombardier 101,
        capacity=90,...) }

    dining_cars
        {dining_car(id=D013, model=Bombardier D101,...)}

    caboose(id=C007, model=Bombardier C101,...)

Thus, the train_equipment entity can be seen as having many components: collections of engines, passenger_cars, a dining car, and a caboose. Each of the constituent entities exist by themselves in their own right, but in order to understand the concept of train equipment for a particular trip, they are aggregatedtogether as a single composite entity.

Question for the reader:

  1. Can you create models of passenger reservations looking at them from a composite context.