Semantic filtering

You use semantic filtering to filter which vocabulary and which types of expressions are valid for a given abstract syntax element.

Deprecated feature:

Deprecation icon Support for custom business rule languages is deprecated in V8.8.1. This feature will be removed in a future release of the product. See Deprecated features for migration details.

When a rule is being edited in the Intellirule or Guided Rule Editor, the choices available in the drop-down list are computed dynamically. You use semantic filtering to filter which vocabulary elements and which types of expressions are valid for a given abstract syntax element. Invalid choices do not appear in the rule editor drop-down lists.

You associate a semantic filter with an element type of the abstract syntax, using the property semanticFilter. The value of this property must be the name of a class that implements the interface IlrBRLSemanticFilter .

This interface defines acceptance methods for each type of object to be filtered:

boolean acceptValue(IlrBRLSemanticContext context,
                      IlrSyntaxTree.Node node,
                      IlrConcept concept);

boolean acceptConceptInstance(IlrBRLSemanticContext context,
                                IlrSyntaxTree.Node node,
                                IlrConceptInstance conceptInstance);

boolean acceptSentence(IlrBRLSemanticContext context,
                         IlrSyntaxTree.Node node,
                         IlrSentence sentence);

boolean acceptConcept(IlrBRLSemanticContext context,
                        IlrSyntaxTree.Node node,
                        IlrConcept concept);

boolean acceptVariable(IlrBRLSemanticContext context,
                         IlrSyntaxTree.Node node,
                         IlrBRLVariable variable);

boolean acceptExpression(IlrBRLSemanticContext context, 
                           IlrSyntaxTree.Node node, 
                           IlrBRLGrammar.Node expression);

Each method is invoked for the relevant type whenever the rule editor drop-down lists are computed. If it returns false, the object is not proposed in the rule editor drop-down lists.

You can associate a semantic filter that is invoked for all constructions in a language by using the property globalSemanticFilter. The value of this property must be the name of a class that implements the interface IlrBRLSemanticFilter . An instance of the specified class is created for a language and invoked for each prediction while editing a rule. This property is useful for filtering predictions everywhere in a language, such as when using vocabulary elements that depend on a custom user property on the rule being edited.