Rule Visual Modeling Language
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.
RVML includes 8 graphical elements (Figures 1 and 2). At the same time, 5 are basic, 3 are used in the FuzzyRVML extension.
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.
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).
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.
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.
Fig.4 An example of a generalized rule (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).
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|
(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|
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.