In software engineering, a logical data model or logical schema is a data model of a specific problem domain expressed independently of any physical data model. It is often used to design relational databases.
A logical schema represents all the concepts in a problem domain and their relationships. It does not indicate how these concepts will be mapped to physical constructs, or what operations can be performed on the data.
What is a Logical Model?
A logical model is a model of the system that is independent of any particular implementation. In other words, it captures what the system does, independent of how it does it. A logical model can be thought of as a blueprint for the system.
Elements of a Logical Model
There are three basic elements to a logical model: entities, attributes, and relationships.
Entities are the “things” in your system that you want to track or store information about. They could be people, places, things, or events. Attributes are the characteristics of entities. For example, if you were tracking information about a person, their attributes might include their name, age, height, weight, etc. Relationships are the connections between entities. For example, a person might have a relationship with a spouse or a child.
Benefits of a Logical Model
A logical model is a tool that can be used to help understand, design, and document a system. A logical model can be used to:
Understand the system: By understanding the system, you can identify the components that need to be included in the model and how they relate to each other.
Design the system: By designing the system, you can ensure that all of the components fit together and work together to accomplish the objectives of the system.
Document the system: By documenting the system, you can create a record of the system that can be used by others to understand and use the system.
What is a Physical Model?
Elements of a Physical Model
There are three basic elements to a physical model:
-Namespace: A namespace defines a logical grouping of objects. It is similar to a package in Java or a namespace in XML.
-Objects: Objects are the basic building blocks of a physical model. They can represent entities, attributes, operations, or relationships.
- Types: Types define the structure of an object. They can be simple (e.g., Integer, String, Boolean) or complex (e.g., Employee, Department).
Benefits of a Physical Model
A physical model is a three-dimensional representation of a objects or systems, usually at a smaller scale than the actual object or system. They are often used in conjunction with drawings or other two-dimensional representations.
Physical models have many benefits, including:
-The ability to see the object or system from all sides and in different lighting conditions
-The ability to manipulate the model to see how it works
-The ability to test the limits of the model without damaging the actual object or system
-The ability to create a scaled version of the object or system
mapping between logical and physical models
A one-to-one mapping is a relationship between two entities where each entity is related to only one instance of the other entity. In contrast, a one-to-many mapping is a relationship between two entities where each entity is related to many instances of the other entity.
For example, a person can have only one passport, but a passport can be related to many people. In this case, the relationship between people and passports is a one-to-many mapping.
One-to-one mapping is usually represented by a line connecting the two entities. The following figure shows an example of a one-to-one mapping between people and passports.
In a one-to-many mapping, one object in the logical model is associated with multiple objects in the physical model. For example, a customer in the logical model might be associated with multiple addresses in the physical model. A one-to-many mapping is typically represented using a crow’s foot notation, as shown in Figure 1.
Figure 1. One-to-many mapping
In the above example, the customer object in the logical model is associated with multiple address objects in the physical model. This type of mapping is often used when there is a need to store additional information about an object that is not essential to its identifier. For example, a customer might have multiple addresses (home, work, etc.), and each address might have different attributes (street, city, state, etc.).
In a many-to-one mapping, one logical model element is mapped to multiple physical model elements. This type of mapping is useful when you want to map an inheritance hierarchy in the logical model to a single table in the physical model, or when you want to map multiple columns in the logical model to a single column in the physical model.
In a many-to-many mapping, a single logical association is represented by multiple physical associations. For example, a single customer might be associated with multiple orders, and each order might be associated with multiple customers.
In this article, we have looked at the mapping between logical and physical models in UML. We have seen that the mapping is a many-to-many relationship, and that there is a one-to-one mapping between attributes and physical objects. We have also seen that there is a one-to-one mapping between associations and physical relationships.