tuffy.ra
Class ConjunctiveQuery

java.lang.Object
  extended by tuffy.ra.ConjunctiveQuery
All Implemented Interfaces:
java.lang.Cloneable

public class ConjunctiveQuery
extends java.lang.Object
implements java.lang.Cloneable

A conjunctive query. Used by Datalog and scoping rules.


Nested Class Summary
static class ConjunctiveQuery.CLUSTERING_RULE_TYPE
          Type used by CC.
 class ConjunctiveQuery.StringSet
           
 
Field Summary
 java.lang.String additionalWhereClause
           
 java.lang.String allFreeBinding
           
 java.util.HashSet<java.lang.String> allVariable
           
 java.util.ArrayList<Literal> body
           
 Literal head
           
static java.util.HashSet<java.lang.String> indexBuilt
           
 boolean inverseEmbededWeight
           
 boolean isCRFChainRule
           
 boolean isFictitious
           
 boolean isStatic
           
 boolean isView
           
 java.util.HashMap<java.lang.String,java.sql.PreparedStatement> psMap
          Maps from binding patterns to corresponding prepared statements.
 Clause sourceClause
           
 ConjunctiveQuery.CLUSTERING_RULE_TYPE type
          Type used by CC.
 
Constructor Summary
ConjunctiveQuery()
           
 
Method Summary
 void addBodyLit(Literal lit)
          Add a body literal.
 void addConstraint(Expression e)
          Add a constraint that must hold.
 void addConstraintAll(java.util.Collection<Expression> es)
           
 void buildIndexes(RDB db, java.lang.Boolean truth, java.util.Set<Predicate> IDB, java.lang.String tableName, boolean addM1LessThanM2, java.util.ArrayList<java.lang.String> additionalSel)
           
static void clearIndexHistory()
           
 ConjunctiveQuery clone()
           
 java.lang.String getAllFreeBinding()
           
 java.lang.String getBoundedSQL(java.util.HashSet<java.lang.String> whichToBound)
           
 java.util.ArrayList<Expression> getConstraint()
           
 java.util.ArrayList<Expression> getConstraint(java.util.HashSet<java.lang.String> allVariables)
           
static ConjunctiveQuery getCqById(int id)
           
 int getID()
           
 java.lang.String getJoinSQL(java.util.HashSet<java.lang.String> whichToBound)
           
 java.lang.Double getNetTuplePrior()
           
 double getWeight()
           
 boolean isScopingRule()
           
 void materialize(RDB db, java.lang.Boolean truth, java.util.ArrayList<java.lang.String> orderBy)
          Execute this conjunctive query.
 void setHead(Literal lit)
          Set the head of this query.
 void setNewTuplePrior(double prior)
           
 void setScopingRule(boolean isScopingRule)
           
 void setWeight(double w)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

additionalWhereClause

public java.lang.String additionalWhereClause

allFreeBinding

public java.lang.String allFreeBinding

allVariable

public java.util.HashSet<java.lang.String> allVariable

body

public java.util.ArrayList<Literal> body

head

public Literal head

indexBuilt

public static java.util.HashSet<java.lang.String> indexBuilt

inverseEmbededWeight

public boolean inverseEmbededWeight

isCRFChainRule

public boolean isCRFChainRule

isFictitious

public boolean isFictitious

isStatic

public boolean isStatic

isView

public boolean isView

psMap

public java.util.HashMap<java.lang.String,java.sql.PreparedStatement> psMap
Maps from binding patterns to corresponding prepared statements. Here the binding pattern is a string like "11011", which means the third parameter need to be queried, while other four are provided.


sourceClause

public Clause sourceClause

type

public ConjunctiveQuery.CLUSTERING_RULE_TYPE type
Type used by CC.

Constructor Detail

ConjunctiveQuery

public ConjunctiveQuery()
Method Detail

addBodyLit

public void addBodyLit(Literal lit)
Add a body literal.

Parameters:
lit -

addConstraint

public void addConstraint(Expression e)
Add a constraint that must hold.

Parameters:
e - A bool expression that must be TRUE.

addConstraintAll

public void addConstraintAll(java.util.Collection<Expression> es)

buildIndexes

public void buildIndexes(RDB db,
                         java.lang.Boolean truth,
                         java.util.Set<Predicate> IDB,
                         java.lang.String tableName,
                         boolean addM1LessThanM2,
                         java.util.ArrayList<java.lang.String> additionalSel)

clearIndexHistory

public static void clearIndexHistory()

clone

public ConjunctiveQuery clone()
Overrides:
clone in class java.lang.Object

getAllFreeBinding

public java.lang.String getAllFreeBinding()

getBoundedSQL

public java.lang.String getBoundedSQL(java.util.HashSet<java.lang.String> whichToBound)

getConstraint

public java.util.ArrayList<Expression> getConstraint()

getConstraint

public java.util.ArrayList<Expression> getConstraint(java.util.HashSet<java.lang.String> allVariables)

getCqById

public static ConjunctiveQuery getCqById(int id)

getID

public int getID()

getJoinSQL

public java.lang.String getJoinSQL(java.util.HashSet<java.lang.String> whichToBound)

getNetTuplePrior

public java.lang.Double getNetTuplePrior()

getWeight

public double getWeight()

isScopingRule

public boolean isScopingRule()

materialize

public void materialize(RDB db,
                        java.lang.Boolean truth,
                        java.util.ArrayList<java.lang.String> orderBy)
Execute this conjunctive query.

Parameters:
db - the DB connection
truth - the truth value for the newly materialized tuples (of the head predicate)

setHead

public void setHead(Literal lit)
Set the head of this query.

Parameters:
lit -

setNewTuplePrior

public void setNewTuplePrior(double prior)

setScopingRule

public void setScopingRule(boolean isScopingRule)

setWeight

public void setWeight(double w)

toString

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