*******************************************************************************
                            T R A N S L A T I O N
*******************************************************************************
Other:
------
Values	
        IF--->PR:prValue
        IF<---PR:proPR_Term
        PR<---NL:sbGetDE_Val
Left/Right-side Terms
        IF--->PR:cprTerm

Sentences:
----------
IF	--->	PR	cprTerm
IF	<---	PR	proPR_Term
IF	--->	NL	conSentence
NL	--->	ST	parSynTree
ST	--->	PR	prPredicate

Queries:
--------
IF	--->	NL	conQuery
IF	<---	PR	proPR_Term
PR	<---	ST	tbqQuery+prQuery
ST	<---	NL	parSynTree


Sentence Rules:
---------------
IF	--->	RTif	rcnTree
IF	<---	PR	proPR_Term
PR	<---	RTif	rlgPR	
RTif	--->	RTnl	rtrNL
	<---   		rtrIF
RTif	--->	XML	xmlFromRule
        <---		xmlToRule
RTnl	--->	tree 	rtrMakeTree

Certainty Rules:
----------------
IF	--->	XML	xmlFromCR
        <---            xmlToCR

Functions:
----------
IF	--->	NL	conFunction
IF	<---	ST	parTerm
IF	<---	PR	proPR_Term
PR	<---	ST	tbqFunction+prFunction
ST	<---	NL	parSynTree
*******************************************************************************
                             D A T A B A S E
*******************************************************************************
the clause record: CLAUSE = clause(integer,ILIST,integer,integer,string,STERM,STERM)	
data elements:
1 : record type 
    (a) sign: >0 active <0 inactive [applies to types 3,5) only]
    (b) abs. value: 1=derived fact         [always > 0]
                          2=source fact           [always > 0]
                          3=rule                     [signed]
                          4=function               [always > 0]
                          5=derived rule         [signed]
                          6=certainty rule       [always > 0]
                          8=derived fact during re-derivation [always > 0]
        				(c/m/h-graphs are regarded as source facts) 
    (c) above value x10 if record is SUSPENDED
2 : creation time stamp
3 : realm sentence# (in source) (0,1,2,...) [has only significance for types 3,5]
4 : realm sub-sentence# (1,2,...)              [                   do.                         ]
5 : realm name
6 : left of :- part of term; or certainty rule body
7 : right of :- part of term; atom("true") for types 1,2; nill for certainty rules   

Notes:
PIE only considers records with type 1,2,3,4,5 
*******************************************************************************
                             I N D E X E S
*******************************************************************************
Indexes:    Unique: Structure:
RELARG:    no         Predicate|Entity1[|Entity2]
TOKEN:		no         Language|FirstToken
SYN1:		 no         Language|KB_Id
SYN2:		 no         Language|KB_Id|SyntaxClass
SYN3:		 yes        Language|KB_Id|SyntaxClass|SyntaxForm
REALM:		no         Realm|KBid
RULE:		 yes        Chain|Realm|SentNo|SubNo
RTYP:		 no          RecordType|Chain
CRT:         no          Rulename|KB_Id
                                * used to retrieve IRRs also during inference. could probably be replaced
                                   by seq. search in chain without much impact on performance (20.4.5)

INDEX USAGE:
                          RELARG   TOKEN   SYN1   SYN2    SYN3  RULE   RTYP   REALM  CRT         
1                            X                                                                             X                
2     v|t                   X             X          X        X          X                            X                 
2     v|s                   X             X                                                              X                 
20   v|t                   X             X          X        X          X                 X         X                 
20   v|s                   X             X                                                   X         X                 
2                            X                                                                              X                
20                          X                                                                  X          X                 
3,5                                                                                  X         X          X                 
4                                                                                                X          X                 
6                                                                                                X          X        X       
*******************************************************************************
                           W O R K   D A T A B A S E
*******************************************************************************
-----------------
SOLUTION DATABASE
-----------------
The solution database is used to store solutions and tables during a session with Pro/3.

chain "H" (one record per sol.set)
      domain STERM format: cmp("H",
                              [int(SOLREF),
                              int(NSOL),      #solutions
                              int(TRACED),    1=sol.set has been traced  0=else
                              int(NCOMPS),    #components
                              QUERY,          original query which set is a response to
                              int(ALTERED)])  1=set has been altered  0=else
      indexes: H1:SOLREF (un)
       
chain "V" (one record per sol. set)
      domain STERM format: cmp("V",
                              [int(SOLREF),
                               int(COMPNO),
                               str(VAR)]
      indexes: V1:SOLREF|COMPNO (un)
               V2:SOLREF|VAR    (un)                            
               V3:SOLREF        (nu)
	
chain "Snn.." (one record per solution in sol.set nn..)
      domain STERM format: cmp("S",[int(SolNo)|VALUES])
                           note that SolNo is 0 while solutions are being inserted and
                           thereafter set to 1,..,N (after call on solSetEnumerate)
      indexes: Snn..:SOLNO  (un)  note that there is one index table per chain
      

1/ queries on unary relations:
interpretation	solution	components
--------------	---------------	---------------------------------------------------------------------
attributes	entity		the entity's attributes:
(same entity			1/1:OUTRIGHTcontract_no=str("O-1")
type)				1/2:OUTRIGHTtrade_dt=int(9054)

entity		entity		only one component:
(different			1/1:X=cmp("spot",[str("S-1"),int(9054),str("direct"),str("Dresdner,
entity				HK"),fix(1000000),str("USD"),fix(1550000),str("DEM"),str("Deutsche, Frankfurt"),
types)				str("NDEMDB-101"),str("Citibank, NY"),str("FUSDCB-301")])  

2/ queries on binary relations:
each solution represents the solution for all arguments.
each argument is represented as in either of the two case above (the representation for the two
arguments does not need to be the same).
--------------
TABLE DATABASE
--------------
chain "TM" (one record per sol. set)
      domain STERM format: cmp("TM",
                              [int(SOLREF),
                               int(NTABLES),
                               str(PREDKB),
                               str(PREDNL),
                               int(NENTARGS),
                               int(NARGS)]
      indexes: TM1:SOLREF (un)
	
chain "TH" (one record per table)
	domain STERM format: cmp("TH"
	                        [int(SOLREF),
	                         int(TABNO),
	                         int(NCOLS),
	                         int(NROWS),
	                         str(ST),
	                         int(SORTED)    1=table is sorted, 0=not sorted
	                         int(ASCENDING) 1=ascending, -1=descending (only relevant of SORTED=1)
	                         int(WRAPPED)]  1=column headers are wrapped, else -1
	indexes: TH1:SOLREF|TABNO
	         TH2:SOLREF|ST
	
chain "TA" (one record per table argument)
	domain STERM format: cmp("TA"
	                        [int(SOLREF),
	                         int(TABNO),
	                         int(ARGNO),
	                         str(ARGKB),
	                         str(ARGNL),
	                         int(NDES)]

	indexes: TA1:SOLREF|TABNO|ARGNO
		                          
chain "TD" (one record per table column)
	domain STERM format: cmp("TD"
	                        [int(SOLREF),
	                         int(TABNO),
	                         int(ARGNO),
	                         int(DENO),
	                         int(COLNO),
	                         str(DEKB),
	                         str(DENL),
	                         str(DOMAIN),
	                         str(FORMAT),
	                         int(WIDTH),
	                         int(PIXELS),
	                         int(DISPLAY),    1=column id displayed, else -1
	                         int(SORTNO)]     0=not sort key, else 1 or 2 .. or NCOLS
	                         
	indexes: TD1:SOLREF|TABNO|ARGNO|DENO
		 TD2:SOLREF|TABNO|COLNO
                               	       
chain "Sn..Tm.." (one record per table cell - one chain per table)
	domain STERM format: cmp("T",
	                        [int(ROWNO),
	                         int(COLNO),
	                         str(VALNL),
	                         VAL])

	indexes: Sn..Tm.. ROWNO|COLNO

if a table is sorted:
---------------------
chain "USn..Tm.." (one record per table row)
	domain STERM format cmp("",[int(PHYSROW),int(LOGROW)])
	
	indexes: USn..Tm.. VALNLkVALNLm (the values are padded with blanks according to format)
	         XSn..Tm.. LOGROW
	         
	To find the physical row no corresponding to the row logical sequence no N:
	stbGetRowL_P
*******************************************************************************
                         S E N T E N C E    R U L E S
*******************************************************************************
 
rule types: --> rubRuleType
rule components (from list box(es)) --> rtrCompMess
rule elements (buttons) --> rtrElmMess

