News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

Entities and Entity Sets

Started by Kalyan, Sep 25, 2008, 12:32 AM

Previous topic - Next topic

Kalyan

Entities and Entity Sets

* An entity is an object that exists and is distinguishable from other objects. For instance, John Harris with S.I.N. 890-12-3456 is an entity, as he can be uniquely identified as one particular person in the universe.

* An entity may be concrete (a person or a book, for example) or abstract (like a holiday or a concept).

* An entity set is a set of entities of the same type (e.g., all persons having an account at a bank).

* Entity sets need not be disjoint. For example, the entity set employee (all employees of a bank) and the entity set customer (all customers of the bank) may have members in common.

* An entity is represented by a set of attributes.
o E.g. name, S.I.N., street, city for ``customer'' entity.
o The domain of the attribute is the set of permitted values (e.g. the telephone number must be seven positive integers).

* Formally, an attribute is a function which maps an entity set into a domain.
o Every entity is described by a set of (attribute, data value) pairs.
o There is one pair for each attribute of the entity set.
o E.g. a particular customer entity is described by the set {(name, Harris), (S.I.N., 890-123-456), (street, North), (city, Georgetown)}.

An analogy can be made with the programming language notion of type definition.

* The concept of an entity set corresponds to the programming language type definition.
* A variable of a given type has a particular value at a point in time.

* Thus, a programming language variable corresponds to an entity in the E-R model.

We will be dealing with five entity sets in this section:

* branch, the set of all branches of a particular bank. Each branch is described by the attributes branch-name, branch-city and assets.

* customer, the set of all people having an account at the bank. Attributes are customer-name, S.I.N., street and customer-city.

* employee, with attributes employee-name and phone-number.

* account, the set of all accounts created and maintained in the bank. Attributes are account-number and balance.

* transaction, the set of all account transactions executed in the bank. Attributes are transaction-number, date and amount.
Relationships & Relationship Sets

A relationship is an association between several entities.

A relationship set is a set of relationships of the same type.

Formally it is a mathematical relation on (possibly non-distinct) sets.

If are entity sets, then a relationship set R is a subset of

where is a relationship.

For example, consider the two entity sets customer and account. (Fig. 2.1 in the text). We define the relationship CustAcct to denote the association between customers and their accounts. This is a binary relationship set (see Figure 2.2 in the text).

Going back to our formal definition, the relationship set CustAcct is a subset of all the possible customer and account pairings.

This is a binary relationship. Occasionally there are relationships involving more than two entity sets.

The role of an entity is the function it plays in a relationship. For example, the relationship works-for could be ordered pairs of employee entities. The first employee takes the role of manager, and the second one will take the role of worker.

A relationship may also have descriptive attributes. For example, date (last date of account access) could be an attribute of the CustAcct relationship set.