Chaining

Introduction

Chaining is when some properties resulting from one rule are fed back as new context assignments, resulting in new matches.

These context assignments are "implied" by the current assignments are applied, (resulting in a revised computation of the current property map, and possible further chaining).

Referring to the rules listed below, we can see how this particular chaining sequence happens:

  • The field=isAngularDeveloper value is assigned into the context by MetaFormGroupComponent and activates rules 1 - 5.

  • The type property from rule 1 is chained/implicitly assigned backed into the context and activates rules 4 and 5.

  • The editing property from 2 is chained/implicitly assigned backed into the context and activates rule 3.

  • The editable property from 3 is chained/implicitly assigned backed into the context and activates rule 4.

1) If selectors [class=User, field=isAngularDeveloper]
match the current context values,
then apply the properties
[type:Boolean]
2) If selectors [operation=create, field=any]
match the current context values,
then apply the properties
[editing:true]
3) If selectors [field=any,editing=true]
match the current context values,
then apply the properties
[editable:true]
4) If selectors [field=any, type=Boolean, editable=any]
match the current context values,
then apply the properties
[component:CheckboxComponent]
5) If selectors [field=any, type=Boolean]
match the current context values,
then apply the properties
[bindings: {value=value}]

Not all properties are chained. The following are some of the interesting properties that are chained:

  • class

  • type

  • elementType

  • trait

  • editable

  • editing

  • layout

  • component

You should now have a sense of the power of rule based UI. Most of the rules to generate the UI are already available from the domain object, or are conventions that are redundant to repeat. We don't need to worry about updating all the areas every time we add/remove/change a field.