list of dots University of Ottawa logo / Université d'Ottawa

User Manual    [Previous]   [Next]   

Abstraction Occurrence

When modeling, it is common to encounter situations where there will be objects (abstractions) that need to store information that will not vary among many other objects (occurrences). We want to avoid duplicating the data in each occurrence.

Examples include:

  • Books (abstraction) have a title and an author; but there are many copies (occurrence) in the library that are separately borrowed by clients. We do not want to duplicate the title and author in each copy object.
  • TV series (abstraction) have stars, a name and a studio; but there are many episodes (occurrences).

It is an antipattern (i.e. poor design) to use the same class for both abstraction and occurrence. It is also an antipattern to use generalization (i.e. erroneously making the occurence a subclass of the abstraction) because that would result in duplication of data in the attributes of the occurrences. This is often not well-understood by inexperienced modelers.

The solution is to create a one-to-many association between the abstraction class and the association class. Umple provides a built-in pattern to make abstraction-occurrence relationships explicit, although using an ordinary association would be a valid alternative.

To use this pattern, add a use statement to incorporate the built-in AbstractionOccurrence.ump file. Then use isA statements to declare which class is an Abstraction, and which is an occurrence (of which Abstraction). Follow what is show in the second block of code below.

This is one of several patterns in Umple Umple that are built into the language as of 1.32 via a use statement. See the code below.

The Abstraction-Occurrence pattern code that is imported by specifying use lib:AbstractionOccurrence.ump

// Generic pattern for abstractions and occurrences
// In any Umple program say 'use lib:AbstractionOccurrence.ump;' to include this pattern.

// Something that has many occurrences
// Examples include a TV show that has episodes, where the show has a name you don't want to repeat in each episode
// Or a route that has runs, or a published book in a library where there are many copies
trait Abstraction {}

// Something representing occurrences of an abstraction
// where both the abstraction and the occurrences need their own instances
// It is common for modellers to make mistakes and just have one class
// Or to consider the Occurrences as instances of the abstractions, but these are antipatterns
trait Occurrence <Abstraction> {
 * -- 1 Abstraction;

Load the above code into UmpleOnline


Example of the Abstraction-Occurrence pattern to specify a library

/* Example of using builtin Umple
 * Abstraction Occurrence pattern file

use lib:AbstractionOccurrence.ump;

class Author {

class Book {
  isA Abstraction;
  * -- * Author;

class CopyOfBook {
  isA Occurrence <Abstraction = Book>;
  Integer barcode;

Load the above code into UmpleOnline