Preferences can be set at the Schema level which affect how Schemas nodes load within a Ruleset editor.
When opening a Ruleset, any referenced Schema automatically loads the many elements, attributes, and fields (generally referred to as nodes) into the source and target fields of the Ruleset editor. Depending on the size of the Schema(s), this loading process can take a long time, and use substantial memory.
To alleviate this, Clarify allows you to set loading properties for each Schema. This setting is called Lazy Loading, which when enabled, defers the initialization of a node until it is actually needed.
For example, if a Schema being used has a certain element with hundreds of child nodes, you can set the Schema to show only the parent element initially; however you can further expand each child within the Ruleset editor if you wish. This setting is meant for large Schemas containing hundreds of elements (which typically take a long time to load into memory).
This setting can be applied to your source, target, and update Schemas.
How to configure
- From the Project Explorer, navigate to the Schema to be configured.
- Right click and select Properties.
- Select the Schema tab, as shown here.
- Select the Use Lazy Loading checkbox to enable loading preferences.
- Specify the initial load depth by entering a number from 1 to 100.
Note: Load depth is the amount of expanded nodes (child or leaf) from the root. This number defines how the Ruleset editor initially loads the selected Schema. Every node before the defined depth loads up-front in the editor, but anything past that depth only gets loaded when requested by the Ruleset.
In this simple example, consider a Person element in our XSD, with several child attributes. One of these - Address - has children of its own. When setting the initial load depth to 1, only the first level element loads each child, whereas an initial load depth of 2 loads the next node level - in the example to the right - Address.
Behind the scenes
Once the settings have been applied, Clarify creates a hidden .settings folder that contains a org.eclipse.core.resources.prefs file with these two properties: lazyload and initial.load.depth. These settings are specified at the Project level, but reference specific Schema objects. This settings are committable, so anyone checking out the Project is able to take advantage of the defined loading preferences.
A few caveats
When working in the Ruleset editor with Schemas with set loading preferences, please be aware of these slight usability differences:
Using the Expand-All: Using the Expand All in the Ruleset Editor's source or target Schema sections only expands the nodes currently loaded. To load more, navigate to the specific node that you would like to load, and it will load it on-demand. Once loaded, it will now be included in the Expand-All.
Marker on Schema View: When creating a Rule in the editor under normal circumstances, the nodes being referenced by a rule have a blue indicator (marker) on the far-right side of the Schema view. However, when the node is not part of the initial loading, the marker won't appear. To make the marker appear, just select the node.