WHAT

Database Objects and Inheritance | Spanglers – General Blog News

17
Database Objects and Inheritance | Spanglers – General Blog News
Database Objects and Inheritance | Spanglers – General Blog News

Database Objects and Inheritance Database Objects and Inheritance

Oracle Database Tips by Donald Burleson

You are watching: what is isa relationship

Inheritance is defined as the ability of a lower-level object to inherit, or access, the data items and behaviors associated with all classes which are above it in the class hierarchy. For example, consider a scenario where a many-to-many relationship exists between ORDER and ITEM classes. Because an order may be for many items, and an item participates in many orders, these entities for the classic many-to-many relationship. It is necessary to establish some kind to linkage between these entities to allow for an order to have many items and an item to participate in many orders. For example, when an order is placed, a junction class, called ORDER_LINE is invoked, and an object is created to link the item with the order. The behaviors of this ORDER_LINE object will be different depending upon the data items and behaviors which are inherited from its ORDER and ITEM superclasses.

Data inheritance can affect behavior. For example, if the ITEM record has an existing inventory level equal to zero, the order will be rejected. For inherited behavior, the PLACE_ORDER behavior (associated with the ORDER class) may be either RUSH or REGULAR, and the presence of the attributes RUSH or REGULAR, effect the PLACE_ORDER behavior.

Figure 1-3

Readmore: what is the opposite of natural | Spanglers – General Blog News

Multiple inheritance refers to the ability of an object to inherit attributes and behaviors from more than one superclass. This ability is especially useful for “junction” objects which establish a many-to-many relationship between two classes. For example, a line-item object will inherit from two classes: an ORDER class which may be RUSH or COD, and the ITEM class, which may be perishable, or non-perishable.

For example, the many-to-many relationship between an ORDER class and the ITEM class is established with a LINE_ITEM class, which serves to link the orders with the items that participate in the order. The LINE_ITEM class would “inherit” the data item and behaviors of the ORDER class and the ITEM class. When a LINE_ITEM record is added to the database, the behaviors from the order and the item objects are invoked.

Figure 1-4

THE “ISA” RELATIONSHIP

After establishing a class hierarchy with the Entity/Relation model, the principle of generalization is used to identity the class hierarchy and the level of abstraction associated with each class. Generalization implies a successive refinement of the class, allowing the superclasses of objects to inherit the data attributes and behaviors which apply to the lower levels of the class. Generalization establishes “taxonomy hierarchies”, which organize the classes according to their characteristics, usually in increasing levels of detail. Generalization begins at a very general level, and proceeds to a specific level, with each sub-level having its own unique data attributes and behaviors.

Figure 3-13

See more: How to remove Terraclicks.com redirect (Virus Removal Guide) | Spanglers – General Blog News

In the above figure, the ISA relationship is used to create a hierarchy within the object class, and all of the lower-level classes will inherit the behaviors. The ISA relationship is used to model the hierarchy which is created as the class entity is decomposed into its logical sub-components. Customers may be PREFERRED_CUSTOMERS or NEW_CUSTOMERS, and orders may be COD_ORDERS or PREPAID_ORDERS, each with their own data items and behaviors.

Let’s look at an application of this system for a vehicle dealership. Occurrences of ITEM’s to a dealership are VEHICLES, and beneath the vehicle class, we may find sub-classes for cars and for boats. Within cars, the classes may be further partitioned into classes for TRUCK, VAN, and SEDAN. The VEHICLE class would contain the data items which are unique to vehicles, including the vehicle ID and the year of manufacture. The CAR class, because it ISA VEHICLE, would inherit the data items of the VEHICLE class. The CAR class might contains data items such as the number of axles and the gross weight of the vehicle. Because the VAN class ISA CAR, which in turn ISA VEHICLE, objects of the VAN class will inherit all data items and behaviors relating to CARS and VEHICLES.

Figure 3-14

Not all classes within a generalization hierarchy will have objects associated with them. The object-oriented paradigm allows for abstraction, which means that a class may exist only for the purpose of passing inherited data and behaviors. The classes VEHICLE and CAR would probably not have any concrete objects, while objects within the VAN class would inherit from the abstract VEHICLE and CAR classes.

Multiple inheritance is also demonstrated by the AMPHIBIAN_CAR class. Any instances of this class will inherit data and behaviors from both the CAR and the BOAT classes.

It is important to note that there is a very big difference between one-to-many relationships and ISA relationships. The ISA construct does not imply any type of recurring association, while the one-to-many and many-to-many relationships imply multiple occurrences of the subclasses. In the above example, this entire class hierarchy describes vehicles which are associated with the ITEM entity in the overall database, and class hierarchies DO NOT imply and data relationships between the classes. While one CUSTOMER may place many ORDERS, it is not true that one CAR may have many SEDANS.

See more: Pick Ticket: The What, Why, & Examples – Everything to Know

Facebook Comments Box

0 ( 0 votes )

Spanglers – General Blog News

https://spanglers.info
Find the latest Blogs news from SPANGLERS. See related science and technology articles, photos, slideshows and videos.

Post

New