Chapter 5: Working with Libraries
A library is an arbitrary collection of useful designs that can be freely inserted into projects.
Unlike notation templates, libraries are unstructured and intended to save the user time and
effort in creating their own frequently-used designs. They also provide a convenient means for sharing
useful designs with other users. Libraries can be easily modified/extended without affecting the
projects that have used them.
The designs contained by a library are divided into two categories:
- Symbols which are useful shapes (e.g., Clip Art style shapes) that users may want to insert in their
models. Each symbol is defined in the library as a primitive group. The user can insert a library symbol
into a model either as a primitive or as a place.
- Patterns which are useful design patterns that are often employed in models. Each pattern is defined
in the library as a place group. When the user inserts a library pattern into a model, a copy of the
pattern members is inserted in the model.
A normal UMLStudio project is used for creating a library (e.g., Library.pro).
The library should be partitioned into categories of
related designs by putting each category of designs in a separate model in the project.
Specifically, symbol designs and pattern designs should appear in separate models.
For example, to create a library called MyLibrary that provides three categories of symbols
(General, Communication, and Leisure), and two categories of patterns
(Creation and Transformation), create a project called MyLibrary.pro, and create five models
inside it and name them accordingly. Select each model and create each symbol/pattern for that category as a
The folder in which UMLStudio is installed, contains a subfolder (called Libraries)
where you can place your libraries.
The predefined libraries that are shipped with the product also appear in this folder. One of these libraries
can be nominated as the default library. The default library can be set via the
When you launch the application, it automatically opens and loads the default library, so that it is
ready for use.
To use a library, the user selects a design from the library menu
and clicks in the drawing pane. An exact copy of the design is thus inserted into the current model. The
insertion is called a replica of the original design.
The following diagram illustrates the appearance of the library menu when the sample library shipped with the
product (SampleLib.pro) is loaded.
The first set of submenus inside the menu contain the library symbols. The second set of submenus contain
the library patterns. (Each submenu corresponds directly to one model within the library project file.)
Library symbols can be inserted in a project either as primitives or as places. This is controlled
by the first two options in the menu. The third command (Load Library) allows you to load a different
The following diagram illustrates the appearance of a submenu from the patterns section of the menu:
The following rules should be observed when creating or modifying a library:
- Within a library project, primitive groups constitute valid symbols, and place groups constitute
valid patterns. All other drawables
(e.g., other primitives, links, places, and tags), although harmless, are ignored.
- The make-up of a symbol (as a primitive group) follows the same rules and principles as the
design of a place. Specifically, if the group contains an editable text primitive, then this will be
used as the place text box when the symbol is later inserted as a place. Otherwise, a default text
box will be created for such a place.
- To help the appearance of a pattern in the library menu, you should give its corresponding
place group an appropriate name. UMLStudio will display this name above the
pattern in the menu.
- The actual size of a symbol/pattern is significant. Every replica of a symbol/pattern will be identical in size
to the original (the user can, however, resize it after creation). For the purpose
of display within the library popup menu, however, the symbols/patterns are proportionally scaled so
that they all look roughly the same size.
- If a category (model) within a library project contains no valid symbols/patterns (i.e., no
groups), then that category will still show up inside the library popup menu, but will be
- It is not recommended that you place your symbol and pattern designs inside the same model in your
library, because then it is not obvious whether this model should appear in the symbol section of the
library menu or in the pattern section. If you do mix them, UMLStudio will
treat the model as a symbol category if there are more symbols than patterns and vice-versa.
- The model hierarchy within a library project is not significant. Regardless of whether the models
are deeply nested or all appear at the root level, they get flattened so that the result is a list
- The order in which the symbols/patterns appear in the popup submenu of a category is roughly the same as
the order in which they appear in the corresponding model in the library. Symbols/patterns are sorted
vertically and then horizontally for this purpose.
The key differences between a library and a notation template are:
- A notation template has a predetermined structure (containing diagram, link, and place designs).
A library is unstructured and can store arbitrary designs.
- Each symbol in a notation template has a unique kind (e.g., Class, State, Category).
All symbols in a library have the same kind (i.e., Group).
- A notation template cannot provide primitive symbols. A library cannot provide new link designs.
- Switching the notation template of a project causes all links and places within that project to
be automatically converted to conform to the new template. Loading a new library has no effect on the
symbols replicated from the previous library.
- A project always remembers the notation template it is based on. No such information is kept
about libraries, i.e., a project has no dependency on the libraries it uses.
This section describes the generic tasks which you would do when manipulating libraries.
- Choose File:New to create a new project.
The notation template used for the library project is only significant for patterns, not symbols.
- Choose Model:New to create a new model for each of the categories
in the library, and rename the models accordingly.
- Select each model and:
- if it is to be a symbol category, create each of its symbols as a primitive group, or
- if it is to be a pattern category, create each of its patterns as a place group.
- Choose File:Save As and save the library in the Libraries folder.
- Choose File:Open to open the library project (or double-click its icon in an explorer window).
- Make your changes to the library models and symbols/patterns.
- Choose File:Save to save the changes.
The new library is loaded, replacing the previous one.
- Choose Load Library from the library menu.
- Navigate to the desired library project and press Open.
Table of Contents | Chapter 4 | Chapter 6
Copyright © 1996-2010 PragSoft Corporation (www.pragsoft.com)