Previous UML Classes Table of Contents UML Packages Next

7.3.39 PackageImport


   A package import is a relationship that allows the use of unqualified names to refer to package members from other namespaces.



    DirectedRelationship (from Kernel ) on page 62


   A package import is defined as a directed relationship that identifies a package whose members are to be imported by a namespace.




   [1] The visibility of a PackageImport is either public or private.

   self.visibility = #public or self.visibility = #private


   A package import is a relationship between an importing namespace and a package, indicating that the importing namespace adds the names of the members of the package to its own namespace. Conceptually, a package import is equivalent to having an element import to each individual member of the imported namespace, unless there is already a separately-defined element import.


   A package import is shown using a dashed arrow with an open arrowhead from the importing namespace to the imported package. A keyword is shown near the dashed arrow to identify which kind of package import is intended. The predefined keywords are «import» for a public package import, and «access» for a private package import.

*Presentation Options

   As an alternative to the dashed arrow, it is possible to show an element import by having a text that uniquely identifies the imported element within curly brackets either below or after the name of the namespace. The textual syntax is then:

   ‘{import ’ <qualified-name> ‘}’ | ‘{access ’ <qualified-name> ‘}’


   In Figure 7.64, a number of package imports are shown. The elements in Types are imported to ShoppingCart, and then further imported to WebShop. However, the elements of Auxiliary are only accessed from ShoppingCart, and cannot be referenced using unqualified names from WebShop.

Figure 7.64 - Examples of public and private package imports