operator
Class COREFOperator

java.lang.Object
  extended by java.lang.Thread
      extended by dstruct.StatOperator
          extended by 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 dstruct.StatOperator
StatOperator.OPType
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  FelixPredicate corefHead
          Target predicate of this Coref operator.
(package private)  DataMovementOperator hardNegDMO
          The DataMovementOperator which is the union of all hard-neg DataMovementOperators.
(package private)  java.util.ArrayList<DataMovementOperator> hardNegDMOs
          DMOs for hard negative edges.
(package private)  DataMovementOperator hardPosDMO
          The DataMovementOperator which is the union of all hard-pos DataMovementOperators.
(package private)  java.util.ArrayList<DataMovementOperator> hardPosDMOs
          DMOs for hard positive edges.
(package private)  DataMovementOperator nodeListDMO
          DMO for retrieving the node's domain.
(package private)  java.util.ArrayList<DataMovementOperator> softNegDMOs
          DMOs for soft negative edges.
(package private)  DataMovementOperator softPosDMO
          The DataMovementOperator which is the union of all soft-pos DataMovementOperators.
(package private)  java.util.ArrayList<DataMovementOperator> softPosDMOs
          DMOs for soft positive edges.
 boolean usePairwiseRepresentation
          Whether represent clusterings results using pairwise representation.
 
Fields inherited from class dstruct.StatOperator
allDMOs, allRelevantFelixClause, belongsToBucket, clauseConstraints, dataCrackerSignature, db, fq, inputPredicates, isMarginal, options, outputPredicates, partitionedInto, precedence, type
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
COREFOperator(FelixQuery _fq, java.util.HashSet<FelixPredicate> _goalPredicates, parser.CommandOptions _opt)
          The constructor of COREFOperator.
 
Method Summary
 void cluster()
          Clustering worker.
 void dumpAnswerToDBTable(mln.Predicate p, 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(mln.Predicate p)
          Get the size of domain on which clustering is conducted.
 void prepare()
          Generate the operator-specified logic plan, i.e., all data movement operators that will be used for inference.
 void prepareDMO(java.util.HashSet<mln.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()
          Method that executes this operator.
 
Methods inherited from class dstruct.StatOperator
clone, getAllDMOs, getPrecedence, getTargetPredicateIfHasOnlyOne, toString, translateFelixClasesIntoFactorGraphEdgeQueries
 
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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

softPosDMOs

java.util.ArrayList<DataMovementOperator> softPosDMOs
DMOs for soft positive edges.


softNegDMOs

java.util.ArrayList<DataMovementOperator> softNegDMOs
DMOs for soft negative edges.


hardPosDMOs

java.util.ArrayList<DataMovementOperator> hardPosDMOs
DMOs for hard positive edges.


hardNegDMOs

java.util.ArrayList<DataMovementOperator> hardNegDMOs
DMOs for hard negative edges.


nodeListDMO

DataMovementOperator nodeListDMO
DMO for retrieving the node's domain.


hardNegDMO

DataMovementOperator hardNegDMO
The DataMovementOperator which is the union of all hard-neg DataMovementOperators.


hardPosDMO

DataMovementOperator hardPosDMO
The DataMovementOperator which is the union of all hard-pos DataMovementOperators.


softPosDMO

DataMovementOperator softPosDMO
The DataMovementOperator which is the union of all soft-pos DataMovementOperators.


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.


corefHead

FelixPredicate corefHead
Target predicate of this Coref operator.

Constructor Detail

COREFOperator

public COREFOperator(FelixQuery _fq,
                     java.util.HashSet<FelixPredicate> _goalPredicates,
                     parser.CommandOptions _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(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<mln.ConjunctiveQuery> rules)
Generate Data Movement Operator used by this Coref Operator.

Parameters:
rules - rules defining this operator.

prepare

public void prepare()
Description copied from class: StatOperator
Generate the operator-specified logic plan, i.e., all data movement operators that will be used for inference. This function should be invoked after a new instance of operator is created. Any valid Felix operator should implement this method.

Specified by:
prepare in class StatOperator

run

public void run()
Description copied from class: StatOperator
Method that executes this operator. Any valid Felix operator should implement this method.

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(mln.Predicate p,
                                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.