Package
Packages are namespaces that contain member elements that may be owned or unowned. It is used as a container for organizing other elements within the model. For more information, see the Key concepts page. Additionally, a package can import members of another package as unowned members. You can also filter imported elements based on certain conditions.
Creating package elements
Creating a package element via the Textual Editor
To create a package element via the Textual Editor
- In the Textual Editor, place the cursor where you want to create the element and declare the keyword:
package.
- library package.
- Specify the element name.
- (Optional) Specify the package.
- Click the Synchronize button.
library package Policies; // library package element
package 'Vehicle Features' { // package element
private import Policies::**;
filter @SysML::Systems::PartUsage;
}
Creating a package element via the Create Element command
To create a package element via the Create Element command
- In the Containment tree, right-click a root namespace, and in the shortcut menu, click Create Element.
- In the Create Element dialog, select one of the following:
- package to create a package element.
- library package to create a library package element.
- Name the element.
- (Optional) Specify the package.
Specifying packages
Importing elements to packages
An import relationship allows one package to import memberships from another package. The member elements from imported memberships become (unowned) members of the importing package in addition to being members of the imported package. In particular, this allows members of the imported package to be referenced in textual notations within the scope of the importing package without having to qualify the member names with the name of the imported package.
- For more information and procedures, see the Importing elements procedure on the Importing and filtering elements page.
Specifying element import filters
Packages have the capability to filter elements upon import based on certain conditions, usually defined in terms of the metadata provided by annotations of those elements. Only elements that meet all filter conditions become imported members of the packages.
- For more information and procedures, see the Element import filtering section on the Importing and filtering elements page.
Package members display in symbolic views
- To display package members in the Members compartment of the package symbol, display the compartment.
- To control whether the Members compartment displays only owned members or imported ones as well, use the Show Only Owned symbol style.