Vocabulary

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Policies >

Vocabulary

Overview

Vocabularies are definitions that obtain or set information to be used in Expressions and Policies. The main advantage of Vocabularies is that their values are easily changed by end users in the Work Portal, allowing flexibility and adaptability to changing business conditions.

 

The operation of the Policies is based on the definitions of the vocabulary. They are mandatory to create any Policy item.

 

Vocabulary can be Constant definitions or XPath definitions (values from the data model):

 

Vocabulary1

 

According to the nature of the information stored, Vocabulary is classified in :

 

Constant definitions: Store values that do not depend on the data model and are directly defined as a constant value.

XPath definitions: Store values that depend on the data model. They are always related to and attribute or function over Entities.

 

A definition is used either to get a information (from a constant or an XPath) or set information (to an XPath), and can be classified into two types namely.

 

SET: Receives values as result of Policies actions. A Set Vocabulary is always depicted in blue.

GET: Stores values to be evaluated in Expressions or Policies. A Get Vocabulary is always depicted in green.

 

When creating a Policy the SET definitions are always related to actions and the GET definitions are related to conditions to be evaluated. In the following sections we will learn how to use these definitions.

 

Creating Vocabularies

Vocabularies can be created in two ways: from the Expert view or when creating a Policy.

 

Vocabularies can be created at three levels:

Global: at this level, you can only create constant definitions.

Application: you can create constant or xpath definitions that can be used by multiple processes of the same application.

Process: you can create constant or xpath definitions that can only be used by the process.

 

note_pin

We recommend to avoid creating vocabularies for embedded processes because this type of process uses the same context of the parent process. In scenarios where you need to use vocabularies in embedded sub processes, create them at the level of the parent process.

 

Creating Vocabularies at the global level

Go to the Business Rule Module in the Expert View. Select Vocabulary within Business Rules and right-click Constant Definition. Click New definition.

 

Vocabulary17

 

Creating Vocabularies at the application level

Go to the Business Rules Module in the Expert View.  Select the Application where the Vocabulary will be created.

Then, select Vocabulary and right-click the type of Definition you wish to create. Click New definition.

 

Vocabulary18

 

Creating Vocabularies at the process level

Go to the Processes Module in the Expert View.  Select the Process where the Vocabulary will be created.

Then, select Vocabulary within Business Rules and right-click the type of Definition you wish to create. Click New definition.

 

Vocabulary2

 

Creating Vocabularies when creating a Policy

1. Open or create a Policy rule, a Decision table, a Rule group or a Precondition.  

 

PolicyManager2

 

2. In any of Policy items you will find access to the Vocabulary on the left panel.

 

Vocabulary3

 

3. Right-click on the type of Definition you wish to create and then click New Definition.

 

Preconditions9

 

A wizard will launch to configure the new Definition.

 

Creating Vocabularies from Expressions

1. From the expression editor click the Vocabulary option.

 

Vocabulary14

 

2. In the new window select New.

 

Vocabulary15

 

3. Select the level in which the vocabulary will be created: Process, application or global.

 

Vocabulary16

 

A wizard will launch to configure the new Definition.  

 

How Bizagi look for definitions at different levels

You can get the value of a vocabulary within business rules. Refer to Obtain and Use Vocabulary Values. To do that Bizagi uses the name of the vocabulary. You could have definitions of vocabularies at different levels, with the same name. Therefore, Bizagi has a logic to determine which vocabulary definition is retrieved in a rule.

 

Bizagi uses the following syntax to get values of vocabulary:

 

CHelper.resolveVocabulary(Me,"VocabularyName")

 

The Me object gives the context where the rule is triggered. By context, it means that Bizagi identifies the element (task or event), case, and process where the rule is invoked. For further information about Me, refer to Me Functions.

 

To get the value of a vocabulary Bizagi follows this hierarchy:

 

1.Bizagi looks for the vocabulary name in the context where the rule is invoked. For example, if the rule is invoked in version 1.0 of the Purchase Request process, Bizagi looks for the vocabulary related to the version of the process.

 

note_pin

If you define the vocabulary in an embedded sub-process, Bizagi considers the parent process context and will look for a vocabulary at the parent process level. Therefore, we do not recommend defining vocabularies within embedded sub-processes.

 

2.If there is no vocabulary at the process level, then Bizagi looks for a vocabulary with the same name at the application level.

3.If there is no vocabulary at the application level, then Bizagi looks for a vocabulary with the same name at the global level.

4.If Bizagi does not found any vocabulary in previous steps, then it makes a final search over all the vocabularies in the project and uses the first coincidence with the name that it founds.