Software Disclaimer

Abstract Class UML 2.5::Namespace

Description:

A Namespace is an Element in a model that owns and/or imports a set of NamedElements that can be identified by name.

Direct Superclasses: NamedElement

Direct Subclasses: Transition, StructuredActivityNode, State, Region, Package, InteractionOperand, Classifier, BehavioralFeature

Class Precedence List: Namespace, NamedElement, Element

Properties:

elementImport : ElementImport (0 *); -- source Namespace
importedMember : PackageableElement (0 *); -- source Namespace
member : NamedElement (0 *); -- source Namespace
ownedMember : NamedElement (0 *); -- source Namespace
ownedRule : Constraint (0 *); -- source Namespace

Specifies a set of Constraints owned by this Namespace.
{composite}
Subsets: Namespace.ownedMember
Opposite: Constraint.context

packageImport : PackageImport (0 *); -- source Namespace
clientDependency : Dependency (0 *); -- source NamedElement
name : String (0 1); -- source NamedElement
nameExpression : StringExpression (0 1); -- source NamedElement
namespace : Namespace (0 1); -- source NamedElement
qualifiedName : String (0 1); -- source NamedElement
visibility : VisibilityKind (0 1); -- source NamedElement
ownedComment : Comment (0 *); -- source Element
ownedElement : Element (0 *); -- source Element
owner : Element (0 1); -- source Element

Constraints:

No additional constraints.

Operations:

Signature: membersAreDistinguishable() : Boolean;
Description: The Boolean query membersAreDistinguishable() determines whether all of the Namespace's members are distinguishable within it.
Expression: result = (member->forAll( memb | member->excluding(memb)->forAll(other | memb.isDistinguishableFrom(other, self))))

Signature: importedMember.1() : PackageableElement;
Description: The importedMember property is derived as the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports.
Expression: result = (self.importMembers(elementImport.importedElement->asSet()->union(packageImport.importedPackage->collect(p | p.visibleMembers()))->asSet()))

Signature: importMembers(imps : PackageableElement; ) : PackageableElement;
Description: The query importMembers() defines which of a set of PackageableElements are actually imported into the Namespace. This excludes hidden ones, i.e., those which have names that conflict with names of ownedMembers, and it also excludes PackageableElements that would have the indistinguishable names when imported.
Expression: result = (self.excludeCollisions(imps)->select(imp | self.ownedMember->forAll(mem | imp.isDistinguishableFrom(mem, self))))

Signature: getNamesOfMember(element : NamedElement; ) : String;
Description: The query getNamesOfMember() gives a set of all of the names that a member would have in a Namespace, taking importing into account. In general a member can have multiple names in a Namespace if it is imported more than once with different aliases.
Expression: result = (if self.ownedMember ->includes(element) then Set{element.name} else let elementImports : Set(ElementImport) = self.elementImport->select(ei | ei.importedElement = element) in if elementImports->notEmpty() then elementImports->collect(el | el.getName())->asSet() else self.packageImport->select(pi | pi.importedPackage.visibleMembers().oclAsType(NamedElement)->includes(element))-> collect(pi | pi.importedPackage.getNamesOfMember(element))->asSet() endif endif)

Signature: excludeCollisions(imps : PackageableElement; ) : PackageableElement;
Description: The query excludeCollisions() excludes from a set of PackageableElements any that would not be distinguishable from each other in this Namespace.
Expression: result = (imps->reject(imp1 | imps->exists(imp2 | not imp1.isDistinguishableFrom(imp2, self))))



Send questions or comments to [email protected].