| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (4 out of 12)

Showing Items on a Workspace

You can use the Inspect facility to search the KB for particular types of items by using the show on a workspace command as described in Using the Inspect Facility. G2 can show specific items or classes of items, and graphical representations of various hierarchies in the KB.

Syntax

Showing Items and Classes

You can use the show on a workspace Inspect command to show a particular item, or a named item of a particular class. Here are some examples:

You can also show classes of items and class of items that meet a particular criteria. When searching for classes of items, you can specify a filter to qualify the search. For information about filters, see Filtering Classes of Items. For example:


Tip: When inspecting classes of items using the every syntax, specify a class as low as possible in the class hierarchy to uniquely identify the item(s). If you specify a class that is very high in the hierarchy, such as the OBJECT class, the Inspect facility must search through all items of the specified class, which can be time consuming.

G2 displays a short representation of each item that meets the criteria, or the item itself. This figure shows two Inspect workspaces, one with a short representation of an item, and the other with two actual rules.



Note: If more than one item has the same name, G2 shows you all of them.

Showing the Workspace Hierarchy

You can show the workspace hierarchy of a particular workspace or object, and you can show the overall workspace hierarchy. G2 displays a graphical representation of the specified workspace hierarchy on a temporary workspace.

For example, this workspace shows the workspace hierarchy of a workspace and an item.


Showing the Class Hierarchy

You can show the class hierarchy for a particular class or all classes. G2 displays a temporary workspace that shows a graphical representation of the class hierarchy. When showing the class hierarchy for a particular class, G2 also displays all the superior classes. For example:


When displaying the class hierarchy of a class that uses multiple inheritance, the graphical representation shows the specified class as a subclass of each superior class, as shown in this example.


Showing the Module Hierarchy

You can show the module hierarchy for the entire knowledge base, or for a particular module. G2 displays a temporary workspace that shows a graphical representation of the module hierarchy. In this example, the top-level module has two submodules.


If more than one module in the hierarchy directly requires the same module, the module appears multiple times in the hierarchy. However, if the directly required module also has directly required modules, the submodules appear only once.

The following example shows the module hierarchy for the guide module. Notice that the uil module is directly required by five different modules in the hierarchy, but its submodules only appear once.


Showing Procedure Invocation Hierarchy

You can show the hierarchy of all procedures that invoke, or are invoked by, a specified procedure. The invocation can be either a call or a start. The grammar is:

For example, given the following hierarchy of procedures:


Inspect shows the following hierarchies for the queries indicated:



The procedure-name can be a method name, and the method name can be class-qualified. If an unqualified method name is given, and more than one method exists with that name, Inspect displays information for all of the methods.

Inspect can show only invocation hierarchy that is statically defined in the compiled code. Invocations that are computed at run time, such as a call to a procedure passed as an argument to the calling procedure, do not appear.

Showing Method Definition Hierarchy

You can show the hierarchy for all classes that define methods with a particular name. G2 displays a temporary workspace that shows a tree representation of the class hierarchy, including a short representation of the classes and the methods defined for each class.

The following example shows the result of showing the hierarchy of classes that define the introduce method. The class hierarchy is such that CLASS-A is the superior class of CLASS-B and CLASS-C, and CLASS-D multiply inherits from CLASS-B and CLASS-C. All the classes except CLASS-D define two introduce methods, both of which appear in the hierarchy. However, because CLASS-D multiply inherits from two classes, two methods appear in the hierarchy for this class as well.


You can also show the method inheritance path for a particular class, which is useful for determining the methods defined for a particular class and its superior classes. This Inspect command is also useful for determining the order in which G2 calls the various methods defined by a class when using the call next method statement.

G2 displays a temporary workspace that shows a graphical representation of the class inheritance path, method declarations, and methods for the class. The methods are arranged from left-to-right, with the most specific method on the left and the least specific method on the right for the specified class. If there is no method declaration, G2 displays the method name in the hierarchy.

This example shows the method inheritance path for CLASS-D. Notice that CLASS-D defines four methods, configure, introduce, reconfigure, and setup. All of these methods have method declarations except reconfigure.


Finally, you can show both the method inheritance path for a particular class, and the class hierarchy of classes that define a particular method, on the same temporary workspace, as this example shows.


| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (4 out of 12)

Copyright © 1997 Gensym Corporation, Inc.