proper.imp
Class PostProcessor

java.lang.Object
  extended by proper.core.ProperObject
      extended by proper.imp.PostProcessor
All Implemented Interfaces:
ProperInterface

public class PostProcessor
extends ProperObject

This class performs post processing of the stored predicates, like finding inconsistent ones, trying to fix inconsistencies. It also widens predicates if there are for the same argument position different functors, e.g.

   p(f(1)).
   p(g(2)).
 
then becomes
   p(f(1),NULL).
   p(NULL,g(2)).
 
where the table "p" then has two instead of one columns, with the correct references to the other tables "f" and "g".
A problem here is with the definition of the indexes in the import program, i.e. it could lead to inconsistencies - so be careful!
For more comprehensive information have a look at the process() method.

Version:
$Revision: 1.2 $
Author:
FracPete
See Also:
process(), Import, Importer

Field Summary
static int ORDER_DIGITS
          the number of digits of the number preceding the name of the predicate, used for ordering the arguments
static boolean USE_FIXMULTIPLEOCCURENCE
          whether to fix multiple occurences of a predicate in others -> we loose all but one relationship!
static boolean USE_SPLITTING
          whether to use splitting of predicates if they have more than one index
static boolean USE_WIDENING
          whether to use widening of predicates or not
 
Fields inherited from interface proper.core.ProperInterface
VERSION
 
Constructor Summary
PostProcessor(Traverser traverser, Indexer indexer)
          initializes the object
 
Method Summary
 java.lang.String getAsymmetric()
          returns the list of predicates that have an asymmetric relationship
 java.lang.String getForeignKeys()
          returns the foreign key relations
 boolean getUseReducing()
          returns the current state, whether lists are reduced to "regular" arguments if they all have the same size
 Traverser process()
          performs the postprocessing, i.e.
 void setAsymmetric(java.lang.String asymmetric)
          sets the list of predicates that have more than one index, but are asymmetric.
 void setForeignKeys(java.lang.String foreignKeys)
          sets the foreign key relations (comma separated list).
They're of the format <predicate1>=<predicate2> E.g.
 void setUseReducing(boolean useReducing)
          sets whether lists with the same size are reduced to "regular" arguments of a predicate
 java.lang.String toString()
          the stored predicates in string representation
 
Methods inherited from class proper.core.ProperObject
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

USE_WIDENING

public static final boolean USE_WIDENING
whether to use widening of predicates or not

See Also:
process(), Constant Field Values

USE_SPLITTING

public static final boolean USE_SPLITTING
whether to use splitting of predicates if they have more than one index

See Also:
process(), Constant Field Values

USE_FIXMULTIPLEOCCURENCE

public static final boolean USE_FIXMULTIPLEOCCURENCE
whether to fix multiple occurences of a predicate in others -> we loose all but one relationship!

See Also:
process(), Constant Field Values

ORDER_DIGITS

public static final int ORDER_DIGITS
the number of digits of the number preceding the name of the predicate, used for ordering the arguments

See Also:
Constant Field Values
Constructor Detail

PostProcessor

public PostProcessor(Traverser traverser,
                     Indexer indexer)
initializes the object

Method Detail

setUseReducing

public void setUseReducing(boolean useReducing)
sets whether lists with the same size are reduced to "regular" arguments of a predicate


getUseReducing

public boolean getUseReducing()
returns the current state, whether lists are reduced to "regular" arguments if they all have the same size


setForeignKeys

public void setForeignKeys(java.lang.String foreignKeys)
sets the foreign key relations (comma separated list).
They're of the format <predicate1>=<predicate2> E.g. the following two predicates where 'a' references 'b' a(1,pos). and b(1,blabla).
can be written like this:
a:first=b:first


getForeignKeys

public java.lang.String getForeignKeys()
returns the foreign key relations

See Also:
setForeignKeys(String)

setAsymmetric

public void setAsymmetric(java.lang.String asymmetric)
sets the list of predicates that have more than one index, but are asymmetric. For each index a single table is created that are linked to the original one via the 'split_id' column


getAsymmetric

public java.lang.String getAsymmetric()
returns the list of predicates that have an asymmetric relationship


process

public Traverser process()
performs the postprocessing, i.e. widening of predicates, fixing inconsistencies, discarding inconsistent predicates. it also tries to reduce lists.

See Also:
setUseReducing(boolean), setForeignKeys(String), USE_WIDENING, USE_FIXMULTIPLEOCCURENCE, Import

toString

public java.lang.String toString()
the stored predicates in string representation

Overrides:
toString in class ProperObject