| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (6 out of 14)

Loading a KB File

Loading a knowledge base means replacing the current KB with knowledge read from any KB file, including KB snapshot files.


Note: When you load a KB, G2 replaces the entire current KB with the new KB.

G2 loads a KB by reading from a KB file that you have saved, as described in Saving the Current KB to a KB File and Saving a KB Snapshot File.

The procedure for loading a KB file and a KB snapshot file are essentially the same, except for the options that you might want to specify, as outlined in Selecting Options When Loading a KB File.

Also, after loading a KB snapshot file, you can warmboot your KB. For information on warmbooting, see Warmbooting a KB Snapshot File.

To load a KB file interactively:

  1. Pause or reset the KB by selecting Pause or Reset from the Main Menu.

  2. Select Main Menu > Load KB.

G2 displays the Load KB dialog, described in the next section.

To load a KB file programmatically:

As G2 loads a KB file, it displays a table that informs you of its progress. The display also shows this progress as a percentage. It does not indicate the real size of the KB being loaded.


Note: You can load KB files that you saved using previous versions of G2. However, you cannot load KB files that you save using a later version of G2 into a previous version.

You can also load a KB file by using an initialization file. For details see Using an Initialization File.

Using the Load KB Dialog

When you load a KB file interactively, G2 displays the Load KB dialog, as shown in the next figure:


The first time you use the Load KB dialog, G2 displays in the edit area the current directory of the G2 process. Thereafter, the default directory is the directory pathname most recently specified in a successfully executed Load KB, Merge KB, or Save KB operation.

In this dialog, you can navigate to any directory where KB files are stored. You can enter the name of the KB file to load, or select it from the list of files that appears at the bottom of the dialog.

To display the contents of a directory:

The trailing delimiter character depends on your platform: / on UNIX platforms, ] on VMS platforms, and \ on Windows platforms.

G2 displays a list of subdirectories and KB (or KL) filenames contained in the specified directory. This figure shows how the Load KB dialog displays these lists:


At this point, you can select a KB file to load or another subdirectory. If you select a subdirectory, continue following the above procedure until you find the desired KB file.


Note: G2 cannot load an empty file or a file that is not a KB file. If you attempt this, G2 signals an error.

Loading the KB File

To load the specified KB file:

G2 reports it progress.

When loading is complete, G2 presents the contents of the loaded KB in the state in which is was saved. For information on what G2 saves in KB files and KB snapshot files, see Saving a KB File.

In addition, G2 does the following:

After you load a KB file, the current KB contains the initial permanent knowledge that was stored in that file. For information on how items represent permanent knowledge, see Understanding the Knowledge Contained in Items.

Using Wildcards in Filenames When Loading a KB

You can enter a wildcard in the filename when loading a KB file. G2 displays a list of names that meet the specified criteria.


Note: The wildcard characters work on any G2 operating system from within G2.

For instance, you can enter kb*s.kb to display a list of all KB files in the current directory, whose file names begin with the characters "kb" and end with the characters "s.kb".

To use wildcards in the filename, use combinations of the following characters:

Wildcard Character/ Purpose Example
* (asterisk) Matches zero or more characters
Entering kb*s matches the files or directories named kbfiles and kbs
? (question mark) Matches any one character
Entering kbfile? matches the files or directories named kbfiles and kbfilez
{abc} (braces) Matches one occurrence of the character a or b or c, where a, b, and c each represents a character
Entering kb{ef}iles matches the files or directories named kbfiles and kbeiles
{abc}* (braces and asterisk) Matches zero or more occurrences of the character a or b or c; where a, b, and c each represents a character
Entering kb{xyz}*files matches the files or directories named kbfiles and kbzzzfiles
! (exclamation point) Escape (ESC) character allows use of other characters in the wildcard name
Entering kbfile!{s!} matches the file or directory named kbfile{s}

You can also use these characters in the text of the argument passed to the g2-files-in-directory and g2-subdirectories-in-directory system procedures, as described in the G2 System Procedures Reference Manual.


Note: G2 does not expand VMS logical symbols that contain directory names.

Selecting Options When Loading a KB File

You can modify how G2 loads the selected KB file by selecting one or more options on the Load KB dialog. To select a loading option, check its associated box.

Notice that the check boxes appear in pairs. For example, merge in this KB and merge in this KB and install its system tables pertain only to merging a KB file. You should not select both options in a pair at the same time.

This table explains each option on the Load KB dialog:

Load KB Option Description
start afterwards
Begin running the new KB immediately after loading the KB file. Selecting this option overrides the setting of the Start-KB-after-load? attribute in the Miscellaneous Parameters system table of the loaded KB.
never start afterwards
Do not begin running the new KB after loading the KB file. Selecting this option overrides the setting of the Start-KB-after-load? attribute in the Miscellaneous Parameters system table of the loaded KB.
warmboot afterwards
When loading a KB snapshot file, resumes running the KB from the point at which it was saved. This option has no effect if you are loading a normal KB file. For more information, see Warmbooting a KB Snapshot File.
warmboot afterwards with catch-up feature
When loading a KB snapshot file, sets the scheduler's internal current time to the current time saved in the snapshot file, and the Scheduler-mode attribute of the Timing Parameters system to as fast as possible. This option has no effect if you are loading a normal KB file. For more information, see Warmbooting a KB Snapshot File.
merge in this KB
Merges the contents of the KB into the current KB. This is described in detail in Merging a KB File.
merge in this KB and install its system tables
Merges the contents of the KB into the current KB, and makes the merged module's system tables the installed system tables. This is described in Merging a KB File.
bring formats up-to-date
Applies to all loaded items the formatting defaults specific to the current version of G2. For example, the width of text items are based on system-defined defaults that might vary from version to version. Note: Selecting this option can significantly affect the appearance and layout of items when loading them into new G2 versions. In general, we do not recommended selecting this option unless you want to mix items developed under a different G2 versions.
automatically resolve conflicts
When loading a modularized KB, automatically checks for conflicts among class definitions contained in the KB, and in any directly and indirectly required modules that G2 also loads. Using the automatically resolve conflicts feature is described in Detecting Conflicting Class Definitions.

Searching for KB Files

When loading KB files, G2 searches for .kb and .KB files in the specified directory and in the current G2 directory. It also searches for .kl and .KL files in these directories. When loading KB files, you can specify an extension or not.


Note: The use of .KL and .kl files (known as knowledge libraries) is obsolete except for certain libraries supplied by Gensym to assist in localization, as described in Chapter 39, Natural Language Facilities.

When loading a KB file, G2 searches for a file with the following filenames in the following order:

  1. If you specify a directory path, first G2 searches that path for a file named filename.kl.

  2. If you specify a directory path, next G2 searches that path for a file named filename.kb.

  3. If you do not specify a directory path, G2 searches for a file named filename.kl in the current G2 directory.

  4. If you do not specify a directory path, G2 searches for a file named filename.kb in the current G2 directory.

  5. If G2 cannot find a KB file to load after conducting this search, G2 displays an error.

You can specify a G2 process's home directory pathname in the G2_HOME environment variable. If no such specification exists, the home directory is the directory from which you launched G2.

You can specify an unqualified filename, that is, a filename without an extension. If you specify an unqualified filename:

  1. First, G2 seeks a file with the specified name, without an extension.

  2. If not found, G2 seeks the specified filename with a .kl extension.

  3. If not found, G2 sees the specified filename with a .kb extension.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (6 out of 14)

Copyright © 1997 Gensym Corporation, Inc.