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
           
private  java.util.ArrayList<Expression> constraints
           
(package private)  java.util.HashMap<java.lang.String,Type> freeVars
           
 Literal head
           
private  int id
           
private static int idGen
           
static java.util.HashSet<java.lang.String> indexBuilt
           
 boolean inverseEmbededWeight
           
 boolean isCRFChainRule
           
 boolean isFictitious
           
private  boolean isScopingRule
           
 boolean isStatic
           
 boolean isView
           
private  java.lang.Double newTuplePrior
           
private static java.util.HashMap<java.lang.Integer,ConjunctiveQuery> objMap
           
 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.
private  double weight
           
 
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

isScopingRule

private boolean isScopingRule

inverseEmbededWeight

public boolean inverseEmbededWeight

newTuplePrior

private java.lang.Double newTuplePrior

isCRFChainRule

public boolean isCRFChainRule

indexBuilt

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

idGen

private static int idGen

isView

public boolean isView

isStatic

public boolean isStatic

isFictitious

public boolean isFictitious

allFreeBinding

public java.lang.String allFreeBinding

objMap

private static java.util.HashMap<java.lang.Integer,ConjunctiveQuery> objMap

id

private int id

sourceClause

public Clause sourceClause

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.


weight

private double weight

type

public ConjunctiveQuery.CLUSTERING_RULE_TYPE type
Type used by CC.


head

public Literal head

body

public java.util.ArrayList<Literal> body

freeVars

java.util.HashMap<java.lang.String,Type> freeVars

constraints

private java.util.ArrayList<Expression> constraints

allVariable

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

ConjunctiveQuery

public ConjunctiveQuery()
Method Detail

setScopingRule

public void setScopingRule(boolean isScopingRule)

isScopingRule

public boolean isScopingRule()

setNewTuplePrior

public void setNewTuplePrior(double prior)

getNetTuplePrior

public java.lang.Double getNetTuplePrior()

getID

public int getID()

getCqById

public static ConjunctiveQuery getCqById(int id)

clone

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

getAllFreeBinding

public java.lang.String getAllFreeBinding()

clearIndexHistory

public static void clearIndexHistory()

setWeight

public void setWeight(double w)

getWeight

public double getWeight()

addConstraint

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

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

getConstraint

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

getConstraint

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

addConstraintAll

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

toString

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

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)

getJoinSQL

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

getBoundedSQL

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

setHead

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

Parameters:
lit -

addBodyLit

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

Parameters:
lit -

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)