felix.operator
Class LROperator

java.lang.Object
  extended by java.lang.Thread
      extended by felix.dstruct.StatOperator
          extended by felix.operator.LROperator
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Runnable

public class LROperator
extends StatOperator

A LR operator in Felix.

Author:
Ce Zhang

Nested Class Summary
 
Nested classes/interfaces inherited from class felix.dstruct.StatOperator
StatOperator.OPType
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class felix.dstruct.StatOperator
allRelevantFelixClause, belongsToBucket, clauseConstraints, commonCandidate, currentState, dataCrackerSignature, db, dd_PriorClauses, fq, inputPredicates, isBinaryArbLR, isMarginal, nStartingRules, outputPredicates, partitionedInto, throwAwayPredicatesNames, type
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LROperator(FelixQuery _fq, java.util.HashSet<FelixPredicate> _goalPredicates, FelixCommandOptions _opt)
          The constructor of LROperator.
 
Method Summary
 java.lang.String explain()
          Human-readable representation of the logic plan.
<E> java.lang.Integer
getAndAddToDomain(E obj, java.util.HashMap<java.lang.String,java.lang.Integer> map)
          Adds object to domain if necessary.
 void inferAndDumpToTmpFile(java.lang.String signature, double[] weights, java.util.ArrayList<java.lang.Integer> noneZeroWeights, java.io.BufferedWriter bw)
          Infer and dump answers to the given buffered writer (with a format that can be COPY into postgres table directly).
 void learn()
          Deprecated.  
static double logAdd(double logX, double logY)
          Returns sum of given log numbers.
 void prepare()
          Prepares operator for execution.
 void prepareDMO(java.util.HashSet<tuffy.ra.ConjunctiveQuery> lrQueries)
          Generate Data Movement Operator used by this LR Operator.
 void prepareDMO4ForLearning(java.util.HashSet<tuffy.ra.ConjunctiveQuery> lrQueries)
          Deprecated. Prepares DMOs for learning.
 void run()
          Executes operator.
 
Methods inherited from class felix.dstruct.StatOperator
clone, getAllDMOs, getPrecedence, getTargetPredicateIfHasOnlyOne, pushPredicateScopes, registerRelevantClause, sealDefinition, setPrecedence, toNoParString, toString, translateFelixClasesIntoFactorGraphEdgeQueries, translateFelixClasesIntoLearningQueriesForVictor
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LROperator

public LROperator(FelixQuery _fq,
                  java.util.HashSet<FelixPredicate> _goalPredicates,
                  FelixCommandOptions _opt)
The constructor of LROperator.

Parameters:
_fq - Felix query.
_goalPredicates - target predicates of this coref operator.
_opt - Command line options of this Felix run.
Method Detail

getAndAddToDomain

public <E> java.lang.Integer getAndAddToDomain(E obj,
                                               java.util.HashMap<java.lang.String,java.lang.Integer> map)
Adds object to domain if necessary.

Parameters:
obj -
map -
Returns:

learn

public void learn()
Deprecated. 

Specified by:
learn in class StatOperator

prepare

public void prepare()
Prepares operator for execution.

Specified by:
prepare in class StatOperator

prepareDMO4ForLearning

public void prepareDMO4ForLearning(java.util.HashSet<tuffy.ra.ConjunctiveQuery> lrQueries)
Deprecated. Prepares DMOs for learning.

Parameters:
lrQueries -

run

public void run()
Executes operator.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class StatOperator

explain

public java.lang.String explain()
Description copied from class: StatOperator
Human-readable representation of the logic plan. Any valid Felix operator should implement this method. TODO: need to think out a better to explain physical plan. (e.g., a graph?)

Specified by:
explain in class StatOperator

prepareDMO

public void prepareDMO(java.util.HashSet<tuffy.ra.ConjunctiveQuery> lrQueries)
Generate Data Movement Operator used by this LR Operator.

Parameters:
rules - rules defining this operator.

logAdd

public static double logAdd(double logX,
                            double logY)
Returns sum of given log numbers.

Parameters:
logX -
logY -
Returns:

inferAndDumpToTmpFile

public void inferAndDumpToTmpFile(java.lang.String signature,
                                  double[] weights,
                                  java.util.ArrayList<java.lang.Integer> noneZeroWeights,
                                  java.io.BufferedWriter bw)
Infer and dump answers to the given buffered writer (with a format that can be COPY into postgres table directly).

Parameters:
signature - signature of current predicate instance.
weights - array of weights. Each entry corresponding to the weight of a label.
bw -