Extents

Extents

When an ODL class is part of the database being described, we need to differentiate the class definition itself from the set of objects of that class that exist at a given time. The difference is the same as that between a relation schema and a relation instance, even though both can be referred to by the name of the relation, depending on context. Similarly, in the E/R model we need to differentiate between the definition of an entity set and the set of existing entities of that kind.

In ODL, the difference is made explicit by giving the class and its extent, or set of existing objects, different names. Hence,  the class name is a schema for the class, while the extent is the name of the current set of objects of that class. We provide a name for the extent of a class by following the class name by a parenthesized expression comprising the keyword extent and the name chosen for the extent.

Example : Generally, we find it a useful convention to name classes by a singular noun and name the corresponding extent by the same noun in plural. Following this convention, we could call the extent for class Movie by the name Movies. To declare this name for the extent, we would begin the declaration of class Movie by:

class Movie (extent Movies)  {
      attribute string title;
          . .  .

As we shall see when we study the query language OQL that is designed for querying ODL data, we refer to the extent Movies, not to the class Movie, when we want to observe the movies currently stored in our database. Keep in mind that the choice of a name for the extent of a class is completely arbitrary, though we shall follow the "make it plural" convention in this blog.

interfaces



Tags