Generating UML Models from Domain Patterns
the Web.
The web site itself may have changed. You can check the current page or check for previous versions at the Internet Archive.
Yahoo! is not affiliated with the authors of this page or responsible for its content.
Generating UML Models from Domain Patterns
Generating UML Models from Domain Patterns
Dae-Kyoo Kim
kim2@oakland.edu
Department of Computer Science
and Engineering
Oakland University
Rochester, MI 48309
Jon Whittle
jonathw@email.arc.nasa.gov
QSS Group Inc.
NASA Ames Research Center
Moett Field, CA 94035
Abstract
The development of a family of applications in a domain can be greatly eased if patterns in the
domain are systematically reused. Systematic use of such a pattern can be achieved by tools that
support pattern-based development. In this paper, we describe a prototype tool called RBML-
Pattern Instantiator (RBML-PI) that generates UML class diagrams and sequence diagrams
from a pattern specication described in the Role-Based Metamodeling Language (RBML), a
pattern specication language, that denes a domain-specic sub-language of the UML. We give
an overview of the RBML using the Observer design pattern, and demonstrate the tool using
an RBML specication for the CheckIn-CheckOut (CICO) domain pattern that characterizes
services to check in and check out items. We use the CICO pattern specication to generate
UML models of a library system and a vehicle rental system using RBML-PI.
Keywords: Design pattern, object-oriented model, pattern specication, pattern tools, UML
1
Introduction
A domain-specic design pattern (henceforth referred to as domain pattern) captures design solu-
tions for a family of applications in a software domain. Examples of domain patterns are the Cyclic
Execution pattern in the real-time domain that describes controling the execution of tasks in a
dened sequence [1], and the Remote Operation pattern [14] in the network domain that describes
constructing distributed systems based on a client-server architecture. Systematic use of domain
patterns can reduce development time of applications in the domain [11].
In this paper, we describe a prototype tool, RBML Pattern Instantiator (RBML-PI), that
generates UML class diagrams and sequence diagrams from a pattern specication described in the
Role-Based Metamodeling Language (RBML) [4, 6], a pattern specication language that denes
a domain-specic sub-language of the UML [15]. Use of the sub-languages to build models of
applications in the domains results in reuse of design experience embedded in the domain patterns.
RBML-PI uses IBM Rational Rose as a base tool. Pattern authors can use the drawing features
provided by Rose to build an RBML pattern specication because the RBML is based on the UML
syntax. Application developers can then use the RBML specication to generate UML models
using RBML-PI.
Several tools [3, 10, 12] that generate application models from patterns have been developed.
These tools are based on templates and do not allow pattern instantiations to be signicantly
dierent in structure than their dening pattern templates. This is limiting in practice. For exam-
ple, models that implement the Observer design pattern may have one or more classes, depending
on the application, that play the Observer role. Current tools do not support structural varia-
tions of pattern specications such as varying the number of classes playing a role in the design
pattern. RBML-PI does support such variations through variation points where developers can
specify additional information to tailor the instantiation of the pattern specication.
In our previous work [7, 8], we developed the CheckIn-CheckOut (CICO) domain pattern. The
primary purpose of applications in this domain is to provide services for checking in and out items.
Applications within this domain include video rental, car rental, and library systems. We used
the CICO pattern as a basis for developing UML models of a library system and a car rental
system. These models were developed manually. In this paper, we describe how these models can
be generated using RBML-PI.
We give an overview of the RBML in Section 2. We describe the CICO domain pattern in
Section 3. We describe RBML-PI in Section 4 and show how the tool can be used to generate
models from RBML specications in Section 5. We give an overview of related work in Section 6
and conclude in Section 7.
2
Overview of the RBML
The RBML is a language for specifying patterns as families of UML models. An RBML specication
denes a specialization of the UML metamodel at the metamodel level (M2) [15] that characterizes
UML models of pattern solutions at the model level (M1) as shown in Fig. 1.
defines
specialized
M1
M2
defines
Pattern
Specification
Space
Pattern Solution
UML Model Space
UML Metamodel
Figure 1: An Overview of RBML Mechanism
The UML metamodel characterizes valid UML models. It consists of a class diagram and a set
of well-formedness rules that dene the abstract syntax of the UML. Informal descriptions of se-
mantics are also included in the metamodel. The metamodel class diagram consists of classes whose
instances are UML model elements. For example, instances of the metamodel class Association are
UML associations. Well-formedness rules that are not expressible in the metamodel class diagram
are expressed using the OCL where possible, and in natural language otherwise.
Fig. 2 shows a part of the UML metamodel class diagram (class attributes are not shown) [15].
A classier describes a set of instances that have features in common. A class is a kind of classiers
2
Feature
Classifier
BehavioralFeature
StructuralFeature
Property
Operation
Class
Property
1
2..*
*
1
1
*
Association
Figure 2: A Part of the UML Metamodel
whose features are attributes and operations. Attributes of a class are represented by instances of
Property that are owned by the class. Some of these attributes may represent the navigable ends of
binary associations. In Fig. 2 the multiplicity 2..* at the Property end species that an association
must have at least two association ends (properties). Operations of a class are represented by
instances of Operation. An operation is a behavioral feature of a classier that species the name,
type, parameters, and constraints for an associated behavior.
An RBML pattern specication consists of roles [9]. A role denes properties of the pattern
solution characterizing a family of model elements. A role has a base metaclass in the UML
metamodel, and is played by instances of the metaclass that satisfy the properties specied in the
role. A model conforms to a pattern specication if the model has elements that play the roles
dened in the pattern specication.
The RBML provides three types of specications: 1) Static Pattern Specications (SPSs) specify
class diagram views of pattern solutions, 2) Interaction Pattern Specications (ISPs) specify inter-
action diagram views of pattern solutions, and 3) State Machine Pattern Specications (SMPSs)
specify state diagram views of pattern solutions.
In this work, we do not use SMPSs, and thus SMPSs are not described. Interested readers are
referred to [9, 6].
2.1
Static Pattern Specications (SPSs)
An SPS consists of classier and relationship roles whose bases are Classier and Relationship
metaclasses (or their subclasses) in the UML metamodel. A classier role is connected to other
classier roles by relationship roles. An SPS role is associated with well-formedness rules and
constraint templates expressed in the Object Constraint Language (OCL) [16]. Well-formedness
rules are metamodel-level constraints that specialize the UML metamodel so that it species only
models of pattern solutions. A constraint template species model-level constraints (e.g., pre- and
post-conditions) produced by binding role names in the template to conforming model elements.
Fig. 3(a) shows a partial SPS that species solutions of a restricted Observer pattern variant
[5]. The SPS characterizes class diagrams in which subjects are associated with one or more
observers. Each subject can consist of one or more structural features (i.e., attributes) that conform
to SubjectState, and one or more behavioral features (i.e., operations) that conform to Attach.
The Subject role is also associated with a N otif y and a Detach behavioral role (not shown in
the diagram for the sake of brevity). Each observer must have only one structural feature that
3
1
|Observes
Association Role
|Update(|s:|Subject) 1..1
|ObserverState: DataType 1..1
|Sub 1..*
|Attach(|o:|Observer) 1..*
|SubjectState: DataType 1..*
Class Role
Class Role
|Obs 1..1
1..*
|Observer
1..*
|Subject
defines
1
Subject
Attach
1
1
1
1..*
ObserverState
(a) A Partial SPS
1
1..*
Obs
Sub
(b) Partial View of the Specialized UML Metamodel
Parameter
1
1
1
AssociationEnd
StructuralFeature
1
1
Class
BehavioralFeature
1
o
Association
Observes
Observer
Figure 3: An SPS for Simplied Observer Pattern and its Specialized UML Metamodel
conforms to ObserverState, and one behavioral feature that conforms to U pdate behavioral role.
The symbol | is used to indicate roles. A text label (e.g., Class Role) on a role denotes the base
of the role in the UML metamodel. The roles dene subtypes (specializations) of classes in the
UML metamodel as shown in