| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 8)

Using Values Stored in Items

Your KB's activities work primarily with values stored in item attributes. In some cases, the KB uses the value in one attribute to assign the value of another attribute. In other cases, the KB obtains values to write them to external files or to pass them to external processes, such as G2 Gateway bridge applications.

Your KB can also obtain other values that are part of an item's knowledge, such as the location of the item upon its workspace, its relations or connections, the text attribute of a procedure, rule, or other text-based item, and the value given by a variable or parameter. For description of the kinds of information that are part of an item's knowledge, see Understanding the Knowledge Contained in Items.

Using Attribute Values

An item can store values in its attributes. An attribute might also have no value, in which case G2 displays the symbol none as its value in an attribute table.

You can use the conclude and change actions to update the values of all user-defined attributes and most system-defined attributes as follows:

Use this action: For system-defined attributes that are:
conclude that the x of y = value
value-writable
change the text of the x of y to "text-value"
text-writable

Each chapter of this document that describes a system-defined class includes a section describing the characteristics of each system-defined attribute. Check there to find which attributes you can edit. Refer to the G2 Class Reference Manual for information about whether an attribute is value- or text-writable.

Using Text Attribute Values of Items

Some items include a text value, which is distinct from other attributes. This text attribute appears in the attribute table of relevant items without an attribute name called Text, but is referred to programmatically with the expression the text of y, where y is any item of these classes:

For information on rules, procedures, and methods, see Chapter 23, Rules, Inferencing, and Chaining, Chapter 21, Procedures, and Chapter 22, Methods.

For more information about messages and each free text, borderless free text, word inserter, character inserter, or character sequence inserters see Chapter 31, Messages and Chapter 28, Text Items.

The text attribute of an item always stores a value of type text. For more information about text values, see Using the Text Type.

Using Values Given by Variables and Parameters

Each variable and parameter stores a value that is distinct from the values of its attributes. See Chapter 15, Variables and Parameters for more information.

Checking for the Existence of an Attribute Value

The attributes of items can hold values, a subobject, or nothing, which appears as none.

You can determine whether an item attribute has a value by using the following expressions:

For more information about these expressions, see Chapter 20, Expressions.

Using Local Names for Values

Your KB can also declare and manipulate values that are not part of any item's knowledge and that exist only when the current KB is running. For instance, you can use local names to represent values used only within one rule or procedure. See Using Local Names in Expressions.

Expiration of Variable Values

The value of each instance of a variable has an expiration time, which is the time interval after which G2 must perform data seeking to obtain a valid value. The expiration time can be never, indicating that the value is valid indefinitely.

The expiration time of a variable is determined by its Validity-interval attribute. If a variable value expires, and is then required by an expression referring to that value, G2 attempts to obtain a new value to replace the expired one.

The expiration time of variable values also affects the expiration time of the expressions in which those values participate. G2 must compare the expiration time of a value used in a computation, such as in a rule or procedure, with the time required to complete the execution of a rule or procedure that uses that value. If a value expires before G2 can finish performing all portions of a rule or procedure that refers to that value, G2 must perform data seeking to obtain a new current value that replaces the expired value. How G2 data seeks for the values of variables is explained in Obtaining Values for Variables.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 8)

Copyright © 1997 Gensym Corporation, Inc.