WILL BE REMOVED IN V5.9 REFER TO NEW KNOWLEDGE BASE CLUSTERING FUNCTIONALITY

Multi-KB configurations (MKCs) refer to any configuration where a KB is accessing chains in one or more external databases (DBs). Access can be read-only or read-write. The terminology multi-KB configuration rather than multi-DB configuration, is used since each external database itself is an independent knowledge base (in technical terms although not necessarily in conceptual terms).

It is important to note that each KB in the configuration maintains its own dependency graph, and that in this respect, knowledge nodes in external databases are ignored. This is a particularly valid point of view  in case of cyclic multi-KB configurations, which by design are such that an imaginary global dependency graph would have had cycles in it (dependency graphs cannot be acyclic).

First a warning!

Do not use MKCs until you are an experienced Pro/3 user. MKCs give room for many types of KE errors (missed-out external chains, conflicting chains (external and internal), index problems and other), and they are much harder to troubleshoot. MKCs came about mainly for two reasons, to get around performance issues in very large KBs (e.g. bigger than 300 MB), and to allow for smarter test and production configurations. Today's much more powerful processors and bigger RAMs, have made the first reason less important. It is now practical to work with fairly big single KBs. 

 

MAIN DB - EXTERNAL DB - ACCESS SCOPE

 

An open or active MKC always consists of a main DB and one or more external DBs. A DB consists of several chains. The access-scope in a MKC consists of all chains in the main DB and one or more chains in each of the external DBs. In other words, only a sub-set of the chains in an external DB forms  a part of the access scope. A chain is either the set of all sentences in a particular sentence group plus all sentence rules which conclude (infer; derive) sentences in that group; all the definitions of a particular function; and also all inexact rules of the same class.

Script-file (in MKCs)

Only the main database is explicitly opened by the KE - external databases are opened automatically by Pro/3 based on the contents of the script-file associated with the KB (XXX.xml for knowledge base XXX.3kb). All KBs must have a script-file (although the file serves no practical purpose for one-database KBs), which is generated automatically by PRO3.EXE. It can be edited as required.   

 

Example

The following example is the script-file for one of the KBs in the Einstein-puzzle model:

<?xml version="1.0" ?>
<pro3script version="4" release="0" build="1" createdTime="2005-02-25T21:42:32.000+00:00" author="Pro/3" format="PR">
<databaseLocations>
<mainDatabaseId>C</mainDatabaseId>
<externalDatabase>
<externalDatabaseId>P</externalDatabaseId>
<externalDatabaseFile>C:\PRO3KBS\einstein\es_is_kept_on.3kb</externalDatabaseFile>
<access>READ</access>
<chain>pIsKeptOn</chain>
</externalDatabase>
<externalDatabase>
<externalDatabaseId>L</externalDatabaseId>
<externalDatabaseFile>C:\PRO3KBS\einstein\es_lives_on.3kb</externalDatabaseFile>
<access>READ</access>
<chain>pLivesOn</chain>
</externalDatabase>
<externalDatabase>
<externalDatabaseId>H</externalDatabaseId>
<externalDatabaseFile>C:\PRO3KBS\einstein\es_stands_on.3kb</externalDatabaseFile>
<access>READ</access>
<chain>pStandsOn</chain>
</externalDatabase>
<externalDatabase>
<externalDatabaseId>G</externalDatabaseId>
<externalDatabaseFile>C:\PRO3KBS\einstein\es_is_not_smoked_on.3kb</externalDatabaseFile>
<access>READ</access>
<chain>pIsNotSmokedOn</chain>
</externalDatabase>
<externalDatabase>
<externalDatabaseId>B</externalDatabaseId>
<externalDatabaseFile>C:\PRO3KBS\einstein\es_is_consumed_on.3kb</externalDatabaseFile>
<access>READ</access>
<chain>pIsConsumedOn</chain>
</externalDatabase>
<externalDatabase>
<externalDatabaseId>A</externalDatabaseId>
<externalDatabaseFile>C:\PRO3KBS\einstein\es_basics.3kb</externalDatabaseFile>
<access>READ</access>
<chain>v</chain>
<access>READ</access>
<chain>q</chain>
<access>READ</access>
<chain>pExists</chain>
</externalDatabase>
</databaseLocations>
</pro3script>

Access to an external chain is either READ or WRITE. See pro3_Script.xsd for details.

The presence of external chains are also stored in the main database using the chain is in external DB sentences. These sentences are adjusted (added, deleted or updates) according the contents of the script file (which is read when the main database is opened).

Note that the index tables in the main database cover records in the entire access scope. This impose some problems and overheads since external databases can be updated while separately opened or opened from another main database. (A database can serve as an external database for different KBs, and also as main database in another KB). Pro/3 uses KB timing event is in the KB sentences to administer this.

The upper window shows the timing sentences in the database containing the external chains (that is the update times of the database's public chains and its index tables). The lower window shows the single timing sentence in the database using the external chains. Clearly, the index tables in the latter database were updated after changes in the "source" database and the tables are thus up-to-date.

CROSS-DATABASE UPDATES

An external chains must be declared as public in its database, more precisely as either read-only or read-write. Only read-write externals chain can updated (inserted/updated/deleted) as external chain. A read-only external chain can only be updated by opening its database as a main database. The chain is a public chain sentence type is used:

The following chains can not be declared as public (i.e. can not be used as external chains):

NL

KB

is in the KB

x

is in external KB

z

determines

c

derives

m

defines

h

is a public chain

p3_pIpch

is in external DB

p3_pIxdb

 

EXTERNAL CHAINS - PUBLIC CHAINS

The chains in the access scope in a MKC fall into two groups - internal chains and external chains. The external chains are the chains belonging to external DBs, while the internal chains are the chains belonging to the main DB. Note that a given chain can only belong to one DB in a MKC, i.e. a chain cannot be both internal and external, and secondly an external chain cannot belong to more than one external database. This constraint is only concerned with chains within the access scope, such that the same chain can very well exists in two or more of the external DBs as long as only one of these chain existences form a part of the access scope.

External chains are either declared in the access scope as read-only or as read-write. The latter means that records in the chain can be added, deleted or changed while used as an external chain. A chain must be declared as public before it can be opened as an external chain. This can only be done while the chain is internal, that is, the database to which it belongs must be opened as the main DB. Declarations of chains as public as well as external, are stored in the KB as ordinary sentences:

   

 

FUNCTIONS

Note that each function (i.e. the definitions which make up a function) is a chain itself. With respect to being internal, external and or public, they are just like any other chain. Note however that Pro/3 built-in functions are globally callable i.e. do not declare them as public or external.  

The Pro/3 function library source files include sentences which declare them as public. 

 

WINDOWS FOR DEFINING PUBLIC AND EXTERNAL CHAINS

Since declarations of public and external chains are stored as any other factual knowledge, all standard ways of inputting, modifying or deleting such declarations are available. Two windows in the KB-menu can also be used for this purpose:

The first prefix of the external chains in the list is the corresponding database identifiers. The second prefix W signifies that the chains are read-write (as opposed to R for read-only).  

The prefix R signifies that the chains are public read-only (as opposed to W for read-write). 

 

WORKING WITH PUBLIC AND EXTERNAL CHAINS

Processing of external databases and external chains take place when a KB is opened and include the following:

  1. KB xxx is opened.
  2. The corresponding script file xxx.XML is opened and reviewed. The file lists external database and external chain declarations.
  3. The declarations are compared with the external chain sentences already in the KB. These sentences are updated so that they completely match the declarations in the chain location file. Any changes to external chains (compared with external chain sentences) will require index table regeneration.
  4. The external databases are opened one by one. The following checks are carried out:
  5. That the external database exists and is unique with respect to the specified DB identifier.
  6. The external chains are checked one by one. The following checks are carried out:
  7. That the chain is not already opened an internal or external chain.
  8. That the chain is declared as public in its database, and that the access mode is compatible with its public access mode.
  9. Whether or not index regeneration is required: regeneration is required if the chain has been updated after last index table update. Refer to KB timing events.
  10. Index tables are regenerated if required. Index tables are local to a KB.

It is important to note that opening of external chains take place in connection with the opening of the KB. Changes to external database or external chain declarations which take place during a session with the KB do not take effect until the next opening of the KB. The same is essentially valid for public chain declarations as well, however this is unimportant since the current version of Pro/3 does not allow a database to be concurrently opened by two or more KBs. In other words, public chain declarations are not relevant until the database where they are declared is closed.

The processing which takes place when the KB is closed is as follows:

  1. The external databases are closed one by one.
  2. It is first checked whether or not any of the external chains have been updated. The KB timing events in the external database are updated accordingly. The external DB is then closed.
  3. The script file xxx.XML is updated and closed.
  4. KB xxx is closed.

CYCLIC MKCs

Consider the following financial problem. 

A bank has agreed to finance the full cost of building a factory for making wireless tranceivers. The construction will take 10 months and the first sales revenues are expected 2 months after completion of the construction. All non-financial project costs for the first 12 months is 100 mill. USD. The loan matures in five equal installments, however a one year grace period is given such that the first installment is due at the end of the second year. 10% interest is due every 12 months - the first interest payment is to be paid 12 months after the disbursement of the loan. 

The factory has no revenues to cover the first 10 mill. interest payment, and the bank has agreed to cover these costs in the financing plan by  increasing the loan amount to 110 mill. However, the interest costs will in this case increase to 11 mill. and the loan should then rather be 111 mill. The problem is principally unsolvable, but can in practice be resolved through iteration until the required laccuracy is achieved.

A KB cannot contain cycles in the dependency graph, and recursive/self-referential problems as the one above will result in such cycles. One way around this is to use two KBs, where each KB uses the other as an external DB. Consider the KB "L" which derives one sentence stating the required loan amount, and the KB "I" which derives one sentence which states the amount of interest paid during the year of construction. The dependency graph in each KB ignores knowledge nodes in the external DB, and consequently each dependency graph s acyclic.

We basically need only one rule in each database, that is, if the first year interest X is payable, then the loan (100,000,000.00+X) is required in the loan KB, and if the loan X is required, then the first year interest (X*10%) is payable. However, since there are no first year interest payable sentence to start the iteration, one starter rule is added to the loan KB: if false(first year interest X is payable), then the loan 100,000,000.00 is required.

We can the proceed as follows:

  1. Derive all sentences in the loan KB - the result is one sentence loan with amount=100,000,000.00 is required
  2. Derive all sentences in the interest KB - the result is one sentence first year interest with amount=10,000,000.00 is payable.
  3. Re-derive all sentences in the loan KB - the result is one sentence loan with amount=110,000,000.00 is required
  4. Re-derive all sentences in the interest KB - the result is one sentence first year interest with amount=11,000,000.00 is payable.
  5. Repeat step 3 and 4 until a sufficient accurate loan amount is derived. The loan amount after 10 derivations is 111,111,111.10.

A considerably more complex MKC is used in solving the Einstein Puzzle

MULTI-KB SENTENCE DERIVATION WINDOW

A special processing window is included in Sentences-menu to make the operations above a little easier to carry out:

The window makes it possible to carry out sentence derivation activities in a MKC in one operation, i.e. sentence derivation in across a set of inter-related KBs (whether cyclic or not).

The list of KBs in the set is defined in the window (and subsequently stored and retrieved from a derivation script-file e.g. rederivation.xml). See pro3_Script.xsd for details.

Example:

<?xml version="1.0" ?>
<pro3script version="3" release="40" build="1" createdTime="2005-01-10T20:48:23.000+00:00" author="Pro/3" format="PR">
<rederivation>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_stands_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_does_not_stand_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_is_consumed_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_is_kept_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_is_not_consumed_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_is_not_kept_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_is_not_smoked_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_is_smoked_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_lives_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_does_not_live_on.3kb</externalDatabaseFile>
<externalDatabaseFile>C:\Pro3KBS\einstein\es_basics.3kb</externalDatabaseFile>
</rederivation>
</pro3script>
 

The following actions can be carried out with the set:

  1. Deletion of all derived sentences.
  2. Regeneration of all dependency graphs (as explained over, each KB in an interrelated set of KBs maintain their own graph).
  3. Derivation of sentences (which can be carried out one time, or more than one time in case of cyclic MKCs).

1+2 combined and 1+2+3 combined can also be done.