Resources and perspectives can be defined in one diagram and imported into another using an import statement.
Imports are declared under the top-level imports property. Each import has two required properties, from and namespace. from indicates what diagram to import, and namespace defines the namespace the imported resources and perspectives will have. namespace values must be unique within a diagram, and cannot contain restricted characters (/, ^, *, [, ], or ,).
imports: - from: myUsername/myImportedDiagram namespace: MyImportedDiagram
By convention, imports are defined at the top of an IDL file. This is not a strict requirement, however.
What can be imported depends on your Ilograph environment:
All Environments - All environments have access to the following built-in libraries:
- ilograph/aws - Amazon Web Services (AWS) resources
- More to come soon. Contribute to the Ilograph built-in library repository here: https://github.com/billy-pilger/ilograph-standard-libraries
Ilograph Desktop - Other local diagrams can be imported using relative paths. Use the forward-slash (/) to delimit directories, even when on Windows. When working with a diagram that has not been saved yet, imports will be unavailable.
Team Workspaces - Other diagrams in the team workspace can be imported using the pattern teamName/diagramName.
Personal Workspaces - Other personal diagrams, and those that have been shared with you, can be imported using the pattern userName/diagramName.
Chained diagram imports are permitted; however, circular imports are not allowed. The same diagram can be imported multiple times side-by-side if given different (unique) namespaces.
Using imported resources
After declaring an import, all resources from the imported diagram will be available for use in the importing diagram. The imported top-level resources can be referenced using the namespace defined in the import followed by two colons (::) like so:
imports: - from: myUsername/myImportedDiagram namespace: MyImportedDiagram ... perspectives: - name: A Perspective relations: - from: SomeResource to: MyImportedDiagram::AnImportedResource
Child resources of imported resources will not have the namespace:: prefix; they can be referenced using normal resource reference rules.
Using imported perspectives
After declaring an import, all perspectives from the imported diagram will be available for use in the importing diagram. All imported perspectives are automatically hidden. To use an imported perspective, you must declare a new perspective and then extend the imported perspective like so:
imports: - from: myUsername/myImportedDiagram namespace: MyImportedDiagram ... perspectives: - name: A Perspective extends: MyImportedDiagram::AnImportedPerspective
Just like with imported top-level resources, imported perspectives are referenced using the namespace defined in the import followed by two colons (::).