| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (2 out of 11)

Overview

Items are the fundamental data structures within G2 that you use to represent knowledge. You use items to collect and organize knowledge about real objects, processes, and relationships. You use G2 to collect and organize a set of items in a knowledge base (KB). The items in a KB represent a set of application knowledge.

Each item represents knowledge that has a distinct identity, that persists, and which you can reference directly or indirectly. Each item also represents a set of knowledge that has a particular pattern or template, based on its class. G2's object-oriented support for defining items enables you to design custom classes and to create as many items of each class as required.

As you develop a KB, you work with items interactively by creating them, naming them, moving and transferring them upon workspaces, and so on. When G2 runs the current KB, the KB's own processing works with items by reasoning about them programmatically in actions, rules, procedures, functions, and formulas.


Note: To perform an operation programmatically means that you perform it by executing a G2 executable item, such as an action button, rule, procedure, method, and so on. To perform an operation programmatically, the current KB must be running.

Items play the role of objects in other object-oriented programming languages. For historical reasons, G2 uses the term item rather than object.

Logical Components of Items

Through its class inheritance, each item contains information that enables it to represent various kinds of knowledge. Internally, every item consists of several logical components, which may be accessible interactively, programmatically, or both:

Logical component: Description
Table attributes
The attributes of an item that are displayed in its attribute table.
Hidden attributes
The user-accessible attributes associated with an item that are not visible in its attribute, but which you can access programmatically, such as information about an item's Name-box, the relationships in which it participates, or which attributes are visible in an attribute table for a particular user mode.
Status
Information about whether an item is one of several pre-defined states: OK, INCOMPLETE, or BAD. The status of an item also includes information such as whether the item is permanent or transient, enabled or disabled, activated or deactivated.
Position
The workspace x and y coordinates of an item upon a workspace. You can return the integer value representing an item's position, using the expressions:
Size
The width and height of the icon of an item in workspace units. You can return the integer value representing an item's width and height, using the expressions:
Representation
The color or color-pattern of an item. For example, you can interactively or programmatically change the background-color of a workspace. Similarly, you can change the color of the named regions of an item's icon, or for textual items, such as messages, the text color or size.

The logical components of items are further described in Understanding the Knowledge Contained in Items and Item Representation.

You work with items interactively using the G2 developer's environment. By default, when you click the mouse on an item, it displays its menu. An item menu presents operations that you can apply to that item.

You can display the values stored in the attributes of an item by displaying the item table. Each table shows the name and class of the item, its list of attributes, and the current value of each attribute. You can also display the current value of a particular attribute by creating an attribute display, which appears next to the item itself upon a workspace.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (2 out of 11)

Copyright © 1997 Gensym Corporation, Inc.