felix.operator
Class COREFOperator

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

public class COREFOperator
extends StatOperator

A COREF 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
 boolean usePairwiseRepresentation
          Whether represent clusterings results using pairwise representation.
 
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
COREFOperator(FelixQuery _fq, java.util.HashSet<FelixPredicate> _goalPredicates, FelixCommandOptions _opt)
          The constructor of COREFOperator.
 
Method Summary
 void cluster()
          Clustering worker.
 void dumpAnswerToDBTable(tuffy.mln.Predicate p, tuffy.util.UnionFind<java.lang.Integer> clusters, java.util.ArrayList<java.lang.Integer> nodes)
          Dump answers to a database table (or create view for it).
 java.lang.String explain()
          Human-readable representation of the logic plan.
 int getDomainSize(tuffy.mln.Predicate p)
          Get the size of domain on which clustering is conducted.
 void learn()
           
 void prepare()
          Prepares operator for execution.
 void prepareDMO(java.util.HashSet<tuffy.ra.ConjunctiveQuery> rules)
          Generate Data Movement Operator used by this Coref Operator.
 java.util.List<java.lang.Integer> retrieveHardNegEdges(java.lang.Integer m1)
          Get hard-neg neighbors of a given node.
 java.util.List<java.lang.Integer> retrieveNeighbors(java.lang.Integer m1)
          Get soft-pos neighbors of a given node.
 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
 

Field Detail

usePairwiseRepresentation

public boolean usePairwiseRepresentation
Whether represent clusterings results using pairwise representation. Note that, setting this parameter to true will cause quadratic numbers of result tuples.

Constructor Detail

COREFOperator

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

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

getDomainSize

public int getDomainSize(tuffy.mln.Predicate p)
Get the size of domain on which clustering is conducted.

Parameters:
p - clustering predicate
Returns:

prepareDMO

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

Parameters:
rules - rules defining this operator.

prepare

public void prepare()
Prepares operator for execution.

Specified by:
prepare in class StatOperator

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

cluster

public void cluster()
             throws java.lang.Exception
Clustering worker.

Throws:
java.lang.Exception

retrieveNeighbors

public java.util.List<java.lang.Integer> retrieveNeighbors(java.lang.Integer m1)
                                                    throws java.sql.SQLException
Get soft-pos neighbors of a given node.

Parameters:
m1 -
Returns:
Throws:
java.sql.SQLException

retrieveHardNegEdges

public java.util.List<java.lang.Integer> retrieveHardNegEdges(java.lang.Integer m1)
                                                       throws java.sql.SQLException
Get hard-neg neighbors of a given node.

Parameters:
m1 -
Returns:
Throws:
java.sql.SQLException

dumpAnswerToDBTable

public void dumpAnswerToDBTable(tuffy.mln.Predicate p,
                                tuffy.util.UnionFind<java.lang.Integer> clusters,
                                java.util.ArrayList<java.lang.Integer> nodes)
Dump answers to a database table (or create view for it).

Parameters:
p - clustering predicate.
clusters - clustering result.
nodes - domain on which clustering is conducted.

learn

public void learn()
Specified by:
learn in class StatOperator