1. Object-Based Logical Models

Object-based logical models describe data at the conceptual and view levels. They provide fairly flexible structuring capabilities and facilitate the explicit specification of data constraints.

 There are several categories of object-based logical models. They are:

 

• Entity-relationship model, Object-oriented model, Binary model, Semantic data model, Infological model, Functional data model, etc. However, for the purpose of this course we shall be considering the Entity-relationship and Object-oriented models.

 

1. The E-R Model

 The entity-relationship model is based on a perception of the world as consisting of a collection of basic objects (entities) and relationships among these objects.

 In order to grasp the full notion of this model, we would describe some of the key terms highlighted above. An entity is a distinguishable object that exists. Each entity has associated with it a set of attributes describing it. E.g. number and balance for an account entity. On the other hand a relationship is an association among several entities. For example, a cust_acct relationship associates a customer with each account he or she has. Thus, the set of all entities or relationships of the same type is called the entity set or relationship set.

 Another essential element of the E-R diagram is the mapping cardinalities, which express the number of entities to which another entity can be associated with via a relationship set. We will see later how well this model works to describe real world situations.

 The overall logical structure of a database can be expressed graphically by an E-R diagram as depicted in Figure 1.2 below:

 

 

Fig. 1.2:   An E-R Diagram

 •              rectangles: represent entity sets.

•              ellipses: represent attributes.

•              diamonds: represent relationships among entity sets.

•              lines: link attributes to entity sets and entity sets to relationships.

 

2. The Object-Oriented Model

The object-oriented model is based on a collection of objects, like the E- R model. Classically, an object contains values stored in instance variables within the object. Unlike the record-oriented models, these values are themselves objects.

 An object contains bodies of code that operate on the object. These bodies of code are called methods. Objects that contain the same types of values and the same methods are grouped into classes. A class may be viewed as a type definition for objects. The only way in which one object can access the data of another object is by invoking the method of that other object. This is called sending a message to the object. Internal parts of the object, the instance variables and method code, are not visible externally.

 We can apply the aforementioned theory representing a bank account by means of an object. The object contains instance variables number and balance. The object contains a method pay-interest which adds interest to the balance. Under most data models, changing the interest rate entails changing code in application programs.

 In the object-oriented model, this only entails a change within the pay- interest method. On the other hand, for entities in the E-R model, each object has its own unique identity, independent of the values it contains. Thus, two objects containing the same values are distinct. Furthermore, distinction is created and maintained in physical level by assigning distinct object identifiers.