| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (20 out of 22)

Saving Parameters

Whenever you choose the Save KB option, or whenever you save your KB programmatically, G2 refers to the Saving Parameters system table to obtain information about the saving operation.

Defining the Priority for KB Saving

The Default-priority-for-runtime-saving attribute defines the priority at which G2 schedules the task of saving a KB while it is running.


Note: This is not the default priority for the g2-save-kb or g2-snapshot system procedures, nor is it the priority at which a KB save operation occurs while the KB is reset or paused.

You can set the default priority at any value from 1 - 10. For a description of scheduling tasks and priorities in G2, see Scheduling and Prioritizing Tasks.

Identifying the Current KB

The Identifier-of-basis-kb attribute displays this information:

You cannot edit the value of this attribute. This string appears in ASCII near the beginning of any saved KB.

Identifying the KB File Name

The Filename-of-basis-kb attribute displays the full pathname of the KB that is currently loaded. You cannot edit the value of this attribute.

The next diagram shows how G2 presents the information for this system table.


Adding Comments to a KB

You can add comments to your KB in the KB-file-comments attribute. This attribute accepts text, but does not require quotation marks (").

To add comments to a KB:

  1. Choose:

  2. Edit the KB-file-comments attribute.

You can add whatever comments you want to this attribute. When you add KB comments and save the KB, all comments are saved at the beginning of the KB file as lines of text preceded by a semicolon (;). You can add comments or edit existing text either:

If you add additional comments to the KB file from within a text editor, you must add them at the beginning of the file, and precede each comment with a semicolon (;).

The next example shows two comments in the Saving Parameters KB-file-comments attribute. The author has preceded each comment with the date:


Viewing KB Version Information

The KB-version-information-for-change-logging attribute provides version information for each module (or KB) when change logging is enabled.

You cannot edit the information in this attribute, though you can query it for informational purposes.

Using KB Change Logging

You can keep a record of certain changes made to a KB during processing. This facility is called KB change logging.

The Enable-KB-change-logging? attribute is a truth value, whose default is no. Changing the value to yes enables change logging.

You enable KB change logging for any module (or a KB if it is not yet modularized) to track each change made to the system tables and definitional items. Definitional items include rules and all of the items you can create from the KB Workspace New Definition menu.

To enable change logging:

  1. Choose:

  2. Change the value of the Enable-KB-change-logging attribute to yes.

When KB change logging is enabled in a given module, all edits made interactively through the text editor to the attributes of definitional items and system tables in that module are recorded in those items' Change-log attribute. You can review and revert changes at any time.

Logging Changes in All Modules

By default, enabling KB change logging records only changes made to the top level module. To track changes in lower level modules, you must enable the facility manually. The following procedure iterates over each Saving Parameters system table and changes the value of its Enable-KB-change-logging? attribute to yes (true). Use such a procedure to enable change logging in all modules.


In addition to keeping previous attribute values, the change log also saves the author, the date, and the version of the KB or module at the time of the edit.

Tracking KB Versions

When KB change logging is enabled, G2 keeps track of relevant changes by assigning a KB version number. Whenever a KB or module is saved, G2 increments the current version number. Changes to the attributes of definitional items in the module or KB then correspond to their appropriate version.

KB version information is also stored in the Saving Parameters system table in the KB-version-information-for-change-logging attribute. The next example shows the portion of the Savings Parameter system table where KB version information appears:


Viewing an Item Change Log

The number of changes made to each system table and definitional item in a module appear in the item's Change-log attribute as a number of entries. For example, if you edit a rule twice, the value of the rule's Change-log attribute will be 2 entries. You cannot edit the value of the Change-log attribute; it is for purely informational purposes.

If the value of the Change-log attribute is greater than one, you can view the item change log.

To see an item's change log:

  1. Open the item attribute table.

  2. Click on the name of the Change-log attribute to display its submenu.

  3. Choose view change log.

The next example shows the change log display of an initially rule.


Each change log entry consists of:

Reverting Item Changes

Using the change log, you can restore former attribute values at any time.

To revert a change to an item:

  1. Open the change log for the item whose value you wish to revert.

  2. Edit the attribute value you want to change.

  3. Delete the text of the attribute value.

  4. Select the text of the change log attribute value that you wish to restore. The text is inserted into the editor.

  5. Click End.

For information about removing change logging and version information before deploying and distributing your KB, see Removing KB Change Logging and Version Information.

Class-Specific Attributes of Saving Parameters

The class-specific attributes of the Saving Parameters system table are:

Attribute Description
Default-priority-for-runtime-saving
Indicates the priority of the task of saving your KB while it is running.
Allowable values:
1 - 10
Default value:
8


Identifier-of-basis-kb
Specifies information about the current KB.
Default value:
New KB information.


Filename-of-basis-kb
Specifies the file name (including the full pathname) where the KB was last saved.
Default value:
None


KB-file-comment
Lets you enter any comment you wish to save with the current KB.
Default value:
Blank


Enable-KB-change-logging
Determines whether change logging is in effect for the KB.
Allowable values:
no | yes
Default value:
no


KB-version-information-for-change-logging
Version information about the KB when change logging is in effect.
Default value:
none

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (20 out of 22)

Copyright © 1997 Gensym Corporation, Inc.