icon
menu

Imports

Resources, perspectives, and contexts can be defined in one diagram and imported into another using an import statement.

Declaring imports

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, perspectives, and contexts 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 Ilograph source file. This is not a strict requirement, however. The same diagram can be imported multiple times side-by-side if given different (unique) namespaces. See also chained imports.

What can be imported depends on your Ilograph environment:

All Environments - All environments have access to the following built-in 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.

Confluence Cloud - Diagrams in the same space can be imported using the pattern spaceId/diagramName.

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 (::).

Using imported contexts

Contexts from imported diagrams are also available for use in the importing diagram. Just like with perspectives, all imported context are automatically hidden. To use an imported context, you must declare a new context and then extend it with the extends property.

Like imported top-level resources and perspectives, imported contexts are referenced using the namespace defined in the import followed by two colons (::).

Chained imports

Chained diagram imports, where imported diagrams in turn import other diagrams, are permitted. Circular imports are not allowed, however.

Duplicated imported resources

When using imports, especially when imported diagrams are chained together, the same diagram and its resources can end up being imported multiple times. By default, resources that have been imported multiple times are deduplicated and treated as one resource when rendered. This can be overriden on a per-perspective basis by setting the deduplicateImportedResources property on a perspective to false. In the below example, the Users and Outside Resource resources are not deduplicated when deduplicateImportedResources is set to false: