RuleRegistry Population

In this section, you will learn how to populate (load) defined rules into the RuleRegistry.

Loading rules from a file and applying them to a graph view is an easy task, as the following example shows.

Example 6.4. Load and apply rules from file

try
{
  RuleRegistry ruleRegistry= 
    RuleRegistry.loadRulesFromResource(
      RESOURCE_PATH+ "rules.xml", this.getClass());

  graphView.setRuleRegistry(ruleRegistry);
}
catch(ReadException e)
{
  e.printStackTrace();
}

Note

It is important to remember that each view instance has its own rule registry assigned to it.