Previous | UML Classes | Table of Contents | UML Packages | Next |
An instance specification is a model element that represents an instance in a modeled system.
•
PackageableElement (from Kernel ) on page 111
An instance specification specifies existence of an entity in a modeled system and completely or partially describes the entity.
The description may include:
•
Classification of the entity by one or more classifiers of which the entity is an instance. If the only classifier specified
is abstract, then the instance specification only partially describes the entity.
•
The kind of instance, based on its classifier or classifiers. For example, an instance specification whose classifier is a
class describes an object of that class, while an instance specification whose classifier is an association describes a link
of that association.
•
Specification of values of structural features of the entity. Not all structural features of all classifiers of the instance
specification need be represented by slots, in which case the instance specification is a partial description.
•
Specification of how to compute, derive, or construct the instance (optional).
InstanceSpecification is a concrete class.
No additional attributes
• classifier : Classifier [0..*] The classifier or classifiers of the represented instance. If multiple classifiers are specified, the instance is classified by all of them.
• slot : Slot [*] A slot giving the value or values of a structural feature of the instance. An instance specification can have one slot per structural feature of its classifiers, including inherited features. It is not necessary to model a slot for each structural feature, in which case the instance specification is a partial description. Subsets
Element::ownedElement
• specification : ValueSpecification [0..1] A specification of how to compute, derive, or construct the instance. Subsets
Element::ownedElement
[1] The defining feature of each slot is a structural feature (directly or inherited) of a classifier of the instance specification.
slot->forAll(s | classifier->exists (c | c.allFeatures()->includes (s.definingFeature)))
[2] One structural feature (including the same feature inherited from multiple classifiers) is the defining feature of at
most one slot in an instance specification.
classifier->forAll(c | (c.allFeatures()->forAll(f | slot->select(s | s.definingFeature = f)->size() <= 1)))
An instance specification may specify the existence of an entity in a modeled system. An instance specification may provide
an illustration or example of a possible entity in a modeled system. An instance specification describes the entity. These
details can be incomplete. The purpose of an instance specification is to show what is of interest about an entity in the
modeled system. The entity conforms to the specification of each classifier of the instance specification, and has features
with values indicated by each slot of the instance specification. Having no slot in an instance specification for some feature
does not mean that the represented entity does not have the feature, but merely that the feature is not of interest in the
model.
An instance specification can represent an entity at a point in time (a snapshot). Changes to the entity can be modeled using
multiple instance specifications, one for each snapshot.
Issue 8719 -add clarifying paragraph
It is important to keep in mind that InstanceSpecification is a model element and should not be confused with the dynamic
element that it is modeling. Therefore, one should not expect the dynamic semantics of InstanceSpecification model elements
in a model repository to conform to the semantics of the dynamic elements that they represent.
Note – When used to provide an illustration or example of an entity in a modeled system, an InstanceSpecification class does
not depict a precise run-time structure. Instead, it describes information about such structures. No conclusions can be drawn
about the implementation detail of run-time structure. When used to specify the existence of an entity in a modeled system,
an instance specification represents part of that system. Instance specifications can be modeled incompletely — required structural
features can be omitted, and classifiers of an instance specification can be abstract, even though an actual entity would
have a concrete classification.
An instance specification is depicted using the same notation as its classifier, but in place of the classifier name appears
an underlined concatenation of the instance name (if any), a colon (‘:’) and the classifier name or names. The convention
for showing multiple classifiers is to separate their names by commas.
Names are optional for UML classifiers and instance specifications. The absence of a name in a diagram may reflect its absence
in the underlying model.
The standard notation for an anonymous instance specification of an unnamed classifier is an underlined colon (‘:’).
If an instance specification has a value specification as its specification, the value specification is shown either after
an equal sign (=) following the name, or without an equal sign below the name. If the instance specification is shown using
an enclosing shape (such as a rectangle) that contains the name, the value specification is shown within the enclosing shape.
Figure 7.52 - Specification of an instance of String
Slot s are shown using similar notation to that of the corresponding structural features. Where a feature would be shown textually
in a compartment, a slot for that feature can be shown textually as a feature name followed by an equal sign (‘=’) and a value
specification. Other properties of the feature, such as its type, can optionally be shown.
Figure 7.53 - Slot s with values
An instance specification whose classifier is an association represents a link and is shown using the same notation as for
an association, but the solid path or paths connect instance specifications rather than classifiers. It is not necessary to
show an underlined name where it is clear from its connection to instance specifications that it represents a link and not
an association. End names can adorn the ends. Navigation arrows can be shown, but if shown, they must agree with the navigation
of the association ends.
father son
Figure 7.54 - Instance specifications representing two objects connected by a link
Presentation Options
A slot value for an attribute can be shown using a notation similar to that for a link. A solid path runs from the owning
instance specification to the target instance specification representing the slot value, and the name of the attribute adorns
the target end of the path. Navigability, if shown, must be only in the direction of the target.