◷ Reading Time: 6 minutes
What is Natural Language (NL)?
NL is a way of modeling business rules and logic using business terminologies. The benefit of using Natural Language is that it hides all the technical complexity (i.e., expressions, method call, etc.) from users. Modeling logic and business rules in NL
- Define a business glossary.
- Define the context of rules (given)
- Define your rules and logic (when section)
- Extend the rule using other logic (when sections)
Adding New NL
To add a new NL, you can simply select Natural Language in a Decision or Validation folder.
To add a new Natural Language document,
Document Types --> Decision Logic --> Natural Language
Once you add a document, this will be the window.
Natural Language Properties
- Implementation: Business Logic and Rules
There will be no item in the toolbox.
At the top menu, you can see the following items.
- Find: Find terms in the file
- Business Glossary: Link Business Glossaries or Boxed Expressions
- Logic: When you click on any line in the file, it will show the logic name of the line
- Find a logic: Find a logic (by name) in the file
- Add a new logic: Add a new logic to the file
- Properties: properties of the document
- Variable parameters: Add/ update/ remove variables
- Compile to execution plan: Show the XML code of the document
To add or remove glossaries, you can simply click on the Business Glossary in the top menu and the following screen that allows you to manage references of glossaries for this NL file will be displayed:
To learn more about managing Glossaries please visit business glossaries.
By setting up the rule context, you pass information to the rule for execution. The Rule context can be defined by the Input Parameters of the rule. A Natural Language rule can define input and output parameters in a Natural Language context section. When both the Declaration and Natural Language context is used, the result will be the union of all of the parameters.
These are blocks of when-then-otherwise-end. To understand more about Natural Language check the Logic Format.
You can enter the rules using
Ctrl + Space bar. This will suggest the rules that you can pick from the list.
Use the arrow keys to select the rule and press
Enter to insert the rule.
To navigate between rules argument, press
Ctrl + Space bar to suggest the parameters and select a parameter from the suggestion box using
. after parameter name and suggestion box navigates through the elements.
In list items, you can use
Alt + Insert to insert values in a list.
Furthermore, hovering the mouse on a term suggests more information regarding a term or acceptable values.
Mouse-hovering on a term, a hint is shown about the definition of the term.
Entering a generic value (i.e., string, number, etc.) and hint shows what type of value is expected.
Entering values when the term has some selectable options, a list will ask you to choose the right option.
Debugging enables you to step into every line of your logic, execute that specific line and then check the values on the Parameter window in an NL document.
In order to start the debugging mode make sure you provide values for the input parameters as expected.
Sample Natural Language
Download the sample project using the attachment which contains Natural Language (PotentialTheftRating-NL.xml).