dstruct
Class FelixPredicate

java.lang.Object
  extended by mln.Predicate
      extended by dstruct.FelixPredicate

public class FelixPredicate
extends mln.Predicate

The predicate object used in Felix, which extends the Predicate class in Tuffy to contain Felix-related fields and methods.

Author:
Ce Zhang

Nested Class Summary
static class FelixPredicate.FPProperty
          Properties that can be assigned to each predicate.
 
Field Summary
(package private)  java.util.HashMap<FelixClause,java.util.ArrayList<java.lang.String>> chainRulePartitions
          Map from chain-rule clauses to possible partitions of sequence.
 boolean isCorefMapPredicate
          Whether this predicate is the view-based representation of a coref operator.
(package private)  java.util.HashSet<java.lang.Integer> keyPositions
          If this predicate has key constraints, this set records the position of keys.
 StatOperator.OPType mustbe
          The type of operator this predicate must be assigned to.
 FelixPredicate oriCorefPredicate
          If isCorefMapPredicate is true, to which this predicate serves.
(package private)  java.util.HashMap<FelixPredicate.FPProperty,java.util.HashSet<FelixClause>> properities
          Map from predicate properties (FelixPredicate.FPProperty) to clauses satisfying the corresponding property.
(package private)  java.util.HashSet<FelixClause> registeredClauses
          Clauses related to this predicate.
(package private) static int tmpPredCounter
          Global counter for temporary predicates.
 
Fields inherited from class mln.Predicate
hasSoftEvidence, iclauses, intCounterStep, isBuiltIn, isCRFHead, isCurrentlyView, isDedupalogHead, isInMem, isLRHead, mln, nextTupleID, posOfCRFFollowField, posOfLRField, seqName, toDump
 
Constructor Summary
FelixPredicate(java.lang.String aname, boolean aClosedWorld)
          The constructor.
 
Method Summary
 java.util.ArrayList<java.lang.String> getCRFPartitionFields()
          Get partitioning fields of sequence if this predicate is CRF.
 java.util.ArrayList<java.lang.String> getKeyFieldsArgs()
          Get the key position if this predicate is LR or CRF.
 java.util.HashSet<java.lang.Integer> getKeyPositions()
          Get keyPositions.
 java.util.ArrayList<java.lang.String> getLabelFieldsArgs()
          Get the label fields' name if this predicate is LR or CRF.
 java.util.ArrayList<java.lang.String> getLabelFieldsTypeTable()
          Get the label types if this predicate is LR or CRF.
 java.util.ArrayList<java.lang.Integer> getLabelPositions()
          Get the label position if this predicate is LR or CRF.
static java.lang.String getNextTmpPredicateName()
          Get the name of the next temporary predicate.
 FelixPredicate getOriCorefPredicate()
          If isCorefMapPredicate is true, to which this predicate serves.
 java.util.HashSet<FelixClause> getPropertyClauses(FelixPredicate.FPProperty prop)
          Get clauses associated to the given property.
 java.util.HashSet<FelixClause> getRelevantClauses()
          Get all clauses related to this predicate.
 boolean hasProperty(FelixPredicate.FPProperty prop)
          Whether this predicate has the given property.
 boolean isCorefMap()
          Whether this predicate is the view-based representation of a coref operator.
 void registerProperty(FelixPredicate.FPProperty prop, FelixClause evid, int... _pos)
          Add a property to this predicate, along with the clause with this property.
 java.lang.String toString()
           
 void tryToExtractSeqFromChainRule(FelixClause fc)
          If the given clause is a CRF chain rule, try to extract the partitions of sequence.
 
Methods inherited from class mln.Predicate
addDependentAttrPosition, addEvidence, addFunctionalDependency, addQuery, addRelatedClause, appendArgument, appendArgument, arity, closeFiles, flushEvidence, getArgPositionByName, getArgs, getBuiltInPredByName, getDependentAttrPositions, getDependentAttrs, getID, getKeyAttrPositions, getKeyAttrs, getName, getQueryAtoms, getRelAct, getRelatedClauses, getRelName, getTypeAt, groundAndStoreAtom, hasDependentAttributes, hasEvidence, hasMoreToGround, hasQuery, hasSoftEvidence, isBuiltInPredName, isChainPredicate, isClosedWorld, isCompletelySepcified, isImmutable, isSafeRefOnly, nextTupleID, nextTupleID, nextTupleIDAndUpdate, noNeedToGround, prepareDB, prepareDBAgain, sealDefinition, setAllQuery, setClosedWorld, setCompeletelySpecified, setHasSoftEvidence, setID, setSafeRefOnly, storeQueries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mustbe

public StatOperator.OPType mustbe
The type of operator this predicate must be assigned to.


isCorefMapPredicate

public boolean isCorefMapPredicate
Whether this predicate is the view-based representation of a coref operator. This predicate must with a name suffix ``_map''.


oriCorefPredicate

public FelixPredicate oriCorefPredicate
If isCorefMapPredicate is true, to which this predicate serves.


properities

java.util.HashMap<FelixPredicate.FPProperty,java.util.HashSet<FelixClause>> properities
Map from predicate properties (FelixPredicate.FPProperty) to clauses satisfying the corresponding property.


registeredClauses

java.util.HashSet<FelixClause> registeredClauses
Clauses related to this predicate.


keyPositions

java.util.HashSet<java.lang.Integer> keyPositions
If this predicate has key constraints, this set records the position of keys.


chainRulePartitions

java.util.HashMap<FelixClause,java.util.ArrayList<java.lang.String>> chainRulePartitions
Map from chain-rule clauses to possible partitions of sequence.


tmpPredCounter

static int tmpPredCounter
Global counter for temporary predicates.

Constructor Detail

FelixPredicate

public FelixPredicate(java.lang.String aname,
                      boolean aClosedWorld)
The constructor.

Parameters:
aname -
aClosedWorld -
Method Detail

getLabelPositions

public java.util.ArrayList<java.lang.Integer> getLabelPositions()
Get the label position if this predicate is LR or CRF.

Returns:

getCRFPartitionFields

public java.util.ArrayList<java.lang.String> getCRFPartitionFields()
Get partitioning fields of sequence if this predicate is CRF.

Returns:

getKeyFieldsArgs

public java.util.ArrayList<java.lang.String> getKeyFieldsArgs()
Get the key position if this predicate is LR or CRF.

Returns:

getLabelFieldsTypeTable

public java.util.ArrayList<java.lang.String> getLabelFieldsTypeTable()
Get the label types if this predicate is LR or CRF.

Returns:

getLabelFieldsArgs

public java.util.ArrayList<java.lang.String> getLabelFieldsArgs()
Get the label fields' name if this predicate is LR or CRF.

Returns:

getNextTmpPredicateName

public static java.lang.String getNextTmpPredicateName()
Get the name of the next temporary predicate.

Returns:

isCorefMap

public boolean isCorefMap()
Whether this predicate is the view-based representation of a coref operator.

Returns:

getOriCorefPredicate

public FelixPredicate getOriCorefPredicate()
If isCorefMapPredicate is true, to which this predicate serves.

Returns:

getPropertyClauses

public java.util.HashSet<FelixClause> getPropertyClauses(FelixPredicate.FPProperty prop)
Get clauses associated to the given property.

Parameters:
prop -
Returns:

hasProperty

public boolean hasProperty(FelixPredicate.FPProperty prop)
Whether this predicate has the given property.

Parameters:
prop -
Returns:

getKeyPositions

public java.util.HashSet<java.lang.Integer> getKeyPositions()
Get keyPositions.

Returns:

getRelevantClauses

public java.util.HashSet<FelixClause> getRelevantClauses()
Get all clauses related to this predicate.

Returns:

registerProperty

public void registerProperty(FelixPredicate.FPProperty prop,
                             FelixClause evid,
                             int... _pos)
Add a property to this predicate, along with the clause with this property.

Parameters:
prop -
evid -
_pos - if this property is key constraint, this parameter is the position of keys.

tryToExtractSeqFromChainRule

public void tryToExtractSeqFromChainRule(FelixClause fc)
If the given clause is a CRF chain rule, try to extract the partitions of sequence.

Parameters:
fc -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object