Core Concepts
Every policy is built from three core concepts: selectors, properties, and rules.
Selectors
A selector identifies which object in your data the rule applies to. Selectors are wrapped in double asterisks: **Name**.
**Person****Customer****driving test**Selectors map to top-level keys in your JSON data:
{ "Person": { "age": 25 }, "Customer": { "membership": "gold" }}Selectors can also use dot notation for nested objects: **user.profile**.
Properties
A property accesses a value from an object. Properties are wrapped in double underscores: __name__.
__age____email____date of birth__Properties are read from the selector’s object in the JSON data. For a selector **Person** and property __age__, the engine reads data.Person.age.
You link a property to its selector with of:
__age__ of **Person**the __email__ of the **Customer**The words the are optional and ignored by the parser — use them for readability.
Rules
A rule combines a selector, an outcome, and one or more conditions:
A **Person** gets approved if __age__ of **Person** is greater than 18.Structure
[Label.] A/An **Selector** outcome_verb outcome_value if condition [and/or condition]... .| Component | Required | Example |
|---|---|---|
| Label | No | Age Check. |
| Article | Yes | A or An |
| Selector | Yes | **Person** |
| Outcome | Yes | gets approved |
| Conditions | Yes | if __age__ of **Person** is greater than 18 |
| Period | Yes | . |
Outcomes
The outcome is what the rule produces. The engine supports many natural-language verbs:
gets, passes, is, has, receives, qualifies for, meets, satisfies, achieves, earns, gains, obtains, secures, deserves, merits, warrants, requires, needs, completes, fulfills, demonstrates, shows, proves, maintains, holds, possesses, provides, delivers, confirms, validates, verifies, supports, ensures, guarantees, undergoes, experiences, encounters, faces, enjoys, benefits from, suffers, lacks, misses, fails, succeeds in, excels at, reaches, arrives at, comes to
Conditions
Conditions check property values. They can be chained with and / or:
A **User** is eligible if __age__ of **User** is greater than 18 and __status__ of **User** is equal to "active" or __role__ of **User** is equal to "admin".