UML Common Structure
Namespace is an abstract named element that contains (or owns) a set of named elements that can be identified by name. In other words, namespace is a container for named elements.
Some examples (subclasses) of the namespace are:
Namespace is an abstract named element and a container for named elements.
Members of a namespace are the elements either directly owned by the namespace or elements introduced into the namespace by inheriting or importing. Thus, a member of a namespace could be one of the following:
- owned member,
- inherited member,
- imported member.
A named element may be owned by at most one namespace.
UML 2.x is not very clear about inherited members of the namespace. While inherited members are mentioned in the the namespace context, inherited members are actually defined at the classifier level which is a subclass of the namespace.
Elements could be imported into namespace either individually or all at once. A member can have multiple names in a namespace, if it is imported more than once with different aliases.
A namespace provides a way of identifying named elements by simple or qualified name. Imported elements could be referred to in the importing namespace without qualification. In the case of naming conflicts, qualified names or aliases should be used to distinguish the referenced elements.
Members of a namespace (owned, imported or inherited named elements) could be referred to
by a composite name in the form:
One namespace could be enclosed into another namespace. Names that can be referred to unqualified within enclosed namespace include members of the namespace and all unhidden members of enclosing namespaces.
The default rule to distinguish one named element from another is that two elements are distinguishable if
- they have unrelated types, or
- related types but different names.
This rule may be overridden for particular cases, e.g. operations of a class are distinguished by their signature.
Namespace has no notation in its own right. Some subclasses define their own specific notation. See package, classifier, behavioral feature, state, region.