Data models are a collection of conceptual tools for describing data, data relationships, data semantics and data constraints. There are three different groups :
(i) Object-Based Logical Models.
(ii) Record-Based Logical Models.
(iii) Physical Data Models.
We'll look at them in more detail now :
(i) Object-Based Logical Models : Describe data at the conceptual and view levels. Provide fairly flexible structuring capabilities. Allow one to specify data constraints explicitly. Over 30 such models, including :
a) Entity-Relationship Model
b) Object-Oriented Model
c) Binary Model
d) Semantic Data Model
e) Info Logical Model
f) Functional Data Model
*** At this point, we'll take a closer look at the Entity-Relationship (E-R) and Object-Oriented models.
a) 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 : 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. A relationship is an association among several entities. E.g. A cust_acct relationship associates a customer with each account he or she has. 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 via a relationship set.
The overall logical structure of a database can be expressed graphically by 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.
b) Object-Oriented Model :
The object-oriented model is based on a collection of objects, like the E-R model. An object contains values stored in instance variables within the object. Unlike the record-oriented models, these values are themselves objects. Thus objects contain objects to an arbitrarily deep level of nesting. An object also 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. Analogy: the programming language concept of an abstract data type.