About | Projects | Publications | Contacts
Русский | English



Rule Visual Modeling Language

Rule Visual Modeling Language

Specification 3.2021

Rule Visual Modeling Language (RVML) is a a visual language designed for modeling knowledge bases containing logical rules and generating source codes in programming languages that implement this formalism.

RVML is based on UML and can be considered as its extension profile using the terminology of class diagrams, so the concepts of "class" and "association" are used as the basic elements.

RVML allows you to present logical rules in a generalized form, abstracting from the features of specific programming languages. At the same time, it contains tools for determining the priority of rules and the slots values by "default".

RVML has an extension called FuzzyRVML that supports the use of linguistic (fuzzy) variables and certainty factor to account for fuzziness and uncertainty in reasoning. The value of a linguistic variable is determined using so-called fuzzy sets. A fuzzy set is defined in terms of some basic scale (a set of basic values) and the membership function µ (x). The membership function is a curve that defines how each point in the range relates to the membership value (or degree of membership) in the interval [0, 1]. Thus, the membership function determines the subjective degree of confidence of the expert that a particular value of the base scale corresponds to a certain fuzzy set. There are two ways to set the membership function: tabular and analytical. The following types of description of the membership function for the analytical method are defined: triangular; trapezoidal; S-shaped; Z-shaped; U-shaped, etc.

Formal description

RVML = { Fact }, { Template }, { Rule }, { Relationship }, { FuzzyVar }, { GeneralizedRule }. Rule = (Condition { Condition }), Core, (Action { Action }). Condition = ConditionElement { ConditionElement }. Action = ActionElement { ActionElement }. ConditionElement = ConditionOperator, Fact { Fact } | ConditionOperator, ConditionElement. ActionElement = ActionOperator, (Fact { Fact }). ActionOperator = "Add" | "Delete" | "Modify" | "Stop". ConditionOperator = "AND" | "OR" | "NOT". Fact = Name, CertaintyFactor, Slot { Slot }. Slot = Name, Constraint, Value, [DataType], [Term]. Core = Name, CertaintyFactor, Priority. Name = String. Value = Number | String | Set. String = Symbol { Symbol }. Symbol = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "А" | "а" | "Б" | "б" | "В" | "в" | "Г" | "г" | "Д" | "д" | "Е" | "е" | "Ё" | "ё" | "Ж" | "ж" | "З" | "з" | "И" | "и" | "Й" | "й" | "К" | "к" | "Л" | "л" | "М" | "м" | "Н" | "н" | "О" | "о" | "П" | "п" | "Р" | "р" | "С" | "с" | "Т" | "т" | "У" | "у" | "Ф" | "ф" | "Х" | "х" | "Ц" | "ц" | "Ч" | "ч" | "Ш" | "ш" | "Щ" | "щ" | "Ъ" | "ъ" | "Ы" | "ы" | "Ь" | "ь" | "Э" | "э" | "Ю" | "ю" | "Я" | "я"| "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" . Set = Value ";" { Set }. Constraint = ">" | "<" | "=" | ">=" | "<=" | "<>". CertaintyFactor = [0,1]. Priority = [1,100]. Template = Name, Slot { Slot }, FuzzyVar { FuzzyVar }. DataType = "String" | "Number" | "Fuzzy". Relationship = Element, Connection, Element. Connection = Kind, Name. Kind = "Association" | "Dependenses". Element = Condition | Action | Template | Core | FuzzyVar | Term | Fact. Term = Name, FunctionType, TermValue { TermValue }, FunctionType. TermValue = Value, Probability. Probability = [0,1]. FuzzyVar = Name, Term { Term }, Domain, Units, FunctionType. FunctionType = Tabular | Analytical. Tabular = "T". Analytical = "A". Domain = "[" Number { Number } "," Number { Number } "]". Number = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9". Units = String. GeneralizedRule = (Template { Template }), Core, (Template { Template }).

Graphical elements

RVML includes 8 graphical elements (Figures 1 and 2). At the same time, 5 are basic, 3 are used in the FuzzyRVML extension.
Basic elements:
1. The fact template (Figure 1, 1) is used to describe fact templates and parts of generalized rules (rule templates), such as condition and action. The fact templateiIncludes the name and description of the slots. Each slot contains its own name, data type, and "default" value.
2. The node element (or core) of the rule (Fig.1, 2) is the connecting link in the representation of the rule as a composition of a set of facts, as conditions and facts, as actions. The node element allows you to represent the name of the rule, the certainty factor (CF), and the priority (P).
3. The fact, as an element of the rule action (Fig. 1, 3), is used to represent the facts that are manipulated in the working memory. This element allows you to present the name of the fact and its description in certain slots, but also the certainty factor (CF).
4. A fact, as an element of a rule condition (Fig. 1, 4), is used to represent the facts that activate the rules in working memory. To indicate the controlling nature of these facts, by analogy with control flow diagrams, a dotted image of all the lines of the graphic element is used. This element allows you to present the name of the fact and its description through certain slots, but also the certainty factor (CF).
5. The connection between the elements (Fig.1, 5) is represented as an association containing a node for displaying operations with facts in working memory: "+" – adding; "-" – deleting; "~" – changing; "!" – stopping logical inference.

The basic elements of RVML: 1) fact template; 2) rule node element; 3) fact; 4) condition; 5) connections of elements indicating actions

Fig.1 The basic elements of RVML: 1) fact template; 2) rule node element; 3) fact; 4) condition; 5) connections of elements indicating actions.

The extension elements are displayed as dotted lines to indicate that they are not clear or not up to a certain character:
1. A fuzzy or linguistic variable (Fig.2, 1) contains information about the name of the variable, the range of possible values, units of measurement, the type of membership function, and terms.
2. Term (Fig. 2, 2), which determines the value of a certain fuzzy variable according to a given membership function. Term contains the name, type of membership function, and possible values with an indication of their probability.
3. The connection between the elements (Fig.2, 3) is represented as a dependency that captures the relationship between a fuzzy variable and its terms (Fig.2, 4), as well as templates and fuzzy variables (Fig.3, 1), facts and terms (Fig.3, 2).

The main elements of FuzzyRVML: 1) a linguistic (fuzzy) variable; 2) a term; 3) a relationship of the

Fig.2 The main elements of FuzzyRVML are: 1) a linguistic (fuzzy) variable; 2) a term; 3) a relationship of the "dependency" type; 4) a representation of the relationship between a fuzzy variable and its terms.

The main elements and extension elements can be used together, in particular, Figure 3 shows examples of describing a fact template with a linguistic (fuzzy) variable, as well as describing a fact with a fuzzy term.

Examples of integration of RVML and FuzzyRVML elements: 1) a fact template with a linguistic (fuzzy) variable; 2) a fact with a term

Fig.3 Examples of integration of RVML and FuzzyRVML elements: 1) a fact template with a linguistic (fuzzy) variable; 2) a fact with a term.

An example of a generalized rule (rule template) in RVML notation (screenshot of the PKBD software)

Fig.4 An example of a generalized rule (rule template) in RVML notation (screenshot of the PKBD software).

An example of a rule (an instance of a rule template) in RVML notation (screenshot of the PKBD software)

Fig.5 An example of a rule (an instance of a rule template) in RVML notation (screenshot of the PKBD software).

Examples of PKBD user interface forms: 1) a form for describing a linguistic (fuzzy) variable; 2) a representation of a linguistic (fuzzy) variable and its terms in FuzzyRVML; 3) an integrated representation of RVML and FuzzyRVML elements when describing a fact template with a linguistic (fuzzy) variable

Fig.6 Examples of PKBD user interface forms: 1) a form for describing a linguistic (fuzzy) variable; 2) a representation of a linguistic (fuzzy) variable and its terms in FuzzyRVML; 3) an integrated representation of RVML and FuzzyRVML elements when describing a fact template with a linguistic (fuzzy) variable.

Transformations to source code

One of the purposes of RVML is to bridge the semantic gap between visual models and source codes, and in this regard, an unambiguous correspondence between graphic elements and language constructs of rules programming languages for intelligent systems, in particular, CLIPS (FuzzyCLIPS) and Drools, is provided. This correspondence is further used for the implementation of automated code generation. Table 1 shows examples of matches.

Examples of RVML/FuzzyRVML elements Corresponding elements of CLIPS/FuzzyCLIPS
FuzzyVar with terms (deftemplate F-AGE 0 120 ( (YOUNG (25 1) (50 0)) (OLD (50 0) (65 1)) ) )
Template with FuzzyVar (deftemplate Person (slot age (default "F-AGE")) )
Fact with term (Alex (age "YOUNG") ) CF 0.9
Rule (defrule Rule-1 "Description"<br> (Temperature ;Тemperature (Value "+35") (cf "1") ) (Precipitation ;Precipitation (Amount 0) (cf "1") ) (Wind ;Wind (Speed 1) (Direction "SOUTH") (cf "0.9") ) => (assert (Weather-conditions ; (Type "DRY") (Fire-Risk "HIGH") (cf "0.9") )) )
Certainty factor in the rules (defrule <RuleName> (declare (CF <CertaintyFactorValue>)) ...

Features

Main features of RVML (including extension):

  • Separate graphical elements for all rule components without any stereotypes or typed classes, as in UML.
  • Clear visual indication of the actions produced by the rules (add, delete, change, stop).
  • It can be considered as a UML extension profile that uses the terminology of class diagrams: the concepts of "class", "association", and "dependency" are the basis for its elements.
  • Abstracting from various specific knowledge representation languages: logical rules are presented in a generalized form.
  • It can be used for modeling incompleteness and fuzziness and contains specialized elements: a data type (Fyzzy); a linguistic (fuzzy) variable (FuzzyVar) and a set of fuzzy terms as possible values of the linguistic variable; Certainty Factor.
  • It can be used to synthesize source codes in CLIPS, FuzzyCLIPS, Drools, etc.

The current RVML specification allows you to describe only simple rules, but it is possible to expand its expressive abilities with the help of the Object Constrained Language (OCL). Also, the current version does not support functions, generic procedures, variables, calculated values, and other features of different rule programming languages.

RSS.The Knowledge Core News:

03.03.2020
PKBD 4.2020.0303
01.02.2018
PKBD 4.2018.0201
28.10.2016
PKBD 4.2016.1028
15.10.2015
PKBD 3.2015.1015