Natural Language

◷ 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

  1. Define a business glossary.
  2. Define the context of rules (given)
  3. Define your rules and logic (when section)
  4. 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

  1. Implementation: Business Logic and Rules

Toolbox

There will be no item in the toolbox.

Check Natural Language Syntax to see how to write a code in NL.

Top Menu

At the top menu, you can see the following items.

  1. Find: Find terms in the file
  2. Business Glossary: Link Business Glossaries or Business Formulas
  3. Logic: When you click on any line in the file, it will show the logic name of the line
  4. Find a logic: Find a logic (by name) in the file
  5. Add a new logic: Add a new logic to the file

  6. Properties: properties of the document
  7. Variable parameters: Add/ update/ remove variables
  8. Compile to execution plan: Show the XML code of the document

Managing Glossaries

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.

Rule Context

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.

Logic Format

These are blocks of when-then-otherwise-end. To understand more about Natural Language check the Logic Format.

Rule Entry

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 Tab.

Use Ctrl + Space bar to suggest the parameters and select a parameter from the suggestion box using Enter.
Press . 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

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.

Video Description

Sample Natural Language

Download the sample project using the attachment which contains Natural Language (PotentialTheftRating-NL.xml).

Updated on December 7, 2023

Article Attachments

Was this article helpful?

Related Articles