For more information about the Knowledge Language in general, see Knowledge Advisor User's Guide: Engineering Knowledge Language. |
This page contains information concerning the languages to be used when working with the Knowledge Expert application.
When defining rules in Knowledge Expert, you may use 2 languages:
KWE Language
Visual Basic
When defining checks in Knowledge Expert, you may use 3 languages:
|
|
|
|
|
Using statements
Rules and checks variables are declared in the For All
field. |
Note that:
Variables must comprise letters and/or digits.
Variable names have no size limitation.
Variable names are case-sensitive character strings.
Variable names must not conflict with unit names. To get an exhaustive list of the units supported by Knowledge Expert, see the Units field of the Knowledge Expert browser in the Check/Rule Editor.
Types starting with a digit (2DCircle) or containing a special character (+,-,...) must be written as follows: %2DCircle%, "%" acting like delimitators.
When using KWE language, you may now declare autoreferencing variables in the Check or the Rule body by using Thisrule or Thischeck. For more information, see Accessing the Expert Check in the Check Body. |
Temporary variables can be declared by using the let keyword. A temporary variable does not persist as a parameter after the check/rule execution is finished.
let Mylist(List) |
The types described below are those you can use in the Rule Editor or in the Check Editor by using the Object Browser.
In the (For all) field,
use the following syntax:
type_identifier:type_name
Examples:
|
Type declarations must be separated with semi-colons. |
The types attributes described below are those you can select in the Object Browser available from the Rule Editor or the Check Editor.
Types are allocated attributes that you can key in in the check or rule body or that you can select in the Object Browser.
|
type_identifier.object_name
Example:
if H.Diameter > 10.0 then H.Activity = False
Functions supported by Knowledge Expert may be entered manually in the check or rule body or can be selected from the Object Browser (See description above to know how to access the browser.)
|
(for all)
Prod1:Product ; Prod2:Product
|
The control structures described below are the one you can use in the Rule Editor or in the Check Editor. |
Any KWE script is built out of a series of statements. A statement can be an assignment, a function call, or a conditional statement. Statements usually end with a semicolon. In addition, statements can be grouped into a statement-group by encapsulating a group of statements within curly braces.
This construct allows for conditional execution of code fragments. Note that "if" constructs cannot be nested.
if (Hole.HoleType
== "Simple") } |
|
Conditionally executes a group of statements, depending on the value of an expression. You can use either block form syntaxes:
|
statement1 => statement2 (if
statement1 then statement2)
Displays a message (if type is Warning or Information) and turns to red in the
specification tree each time statement2 is invalid as statement1
is fulfilled.
Note that the if...then...else construct is only
available for:
|
if then else
statements are used for conditional computation.
The else
statement is optional. Statements can be nested
that is, contained within one another.
H:Hole
|
Note that the while construct is only available for:
|
while
loops are used to execute a statement if an expression
evaluates to true.
let Mylist(List) |
Note that the for construct is only available for:
|
for executes a loop based
on the element of a list. See syntax opposite. It executes a statement
Nth times where N is the number of elements of the list.In the example opposite:
|
For x inside List Example
|
fo r executes a loop until
an expression becomes false. See syntax opposite.In the example opposite:
Note that the second for operator can lead to infinite loops.
|
For x while predicate |
+
Addition operator (also concatenates
strings)
-
Subtraction operator
*
Multiplication operator
/
Division operator
<> Not equal to
== Equal to
>= Greater or equal to
<= Less than or equal to
< Less than
> Greater than
=
Assignment operator
** Exponentiation operator
The Filter Operator (=>) is designed for implication: It enables you to restrict the check operation on a subset of the features that were specified in the For all field:
Given the check below:
H:Hole |
The check report will only provide you with the results of the H.Diameter > 10 mm tests on the holes with a Cost attribute. Tests on other holes won't be performed. |
H.Diameter >
3mm =>H.Depth>10mm |
If the diameter of a hole is greater than 3mm, its depth must be greater than 10mm. |