edu.berkeley.cs.db.yfilter.querymodule
Class QueryIndexBasic

java.lang.Object
  |
  +--edu.berkeley.cs.db.yfilter.querymodule.QueryIndexBasic

public class QueryIndexBasic
extends java.lang.Object

this class encodes a set of xpath queries as a query tree consisting of a set of hashtables with links to each other


Constructor Summary
QueryIndexBasic()
          initialize the query tree with the start node which is an empty hashtable
QueryIndexBasic(DTDStat stat)
           
QueryIndexBasic(java.util.Hashtable elements)
           
QueryIndexBasic(java.lang.String dtdFile)
           
 
Method Summary
 int addQuery(Query query)
          add a given xpath to the query tree this just adds ** and * into the hash table the same as any other symbol.
 void clearAcceptingStates_DocID()
           
 void deleteQuery(Query query, int queryId)
          this function only removes (1) the identifiers of paths from the accepting states of the NFA without changing the structure of the NFA; and (2) the data structure containing query predicates from the list of queries.
 java.util.BitSet getDSlashChild()
           
 int getNoActiveQueries()
           
 java.util.HashMap getNode(int htId)
           
 java.util.ArrayList getNodes()
           
 int getNoDistinctPaths()
           
 int getNoPaths()
           
 int getNoPaths(int queryId)
           
 int getNoPredicates()
           
 int getNoQueries()
           
 int getNoStates()
           
 double getPathLength()
           
 java.util.ArrayList getQueries()
           
 int indexPath(int queryId, int pathId, java.lang.String[] steps)
           
 int indexPath(int queryId, Path path)
          now match the new query against the existing data structure until we need to start adding new nodes.
 void printIndex()
          render the query tree to stdout
 void printIndexToFile()
           
 void printQueries()
           
 void printQueriesToFile()
           
 void removePath(int queryId, Path path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryIndexBasic

public QueryIndexBasic()
initialize the query tree with the start node which is an empty hashtable


QueryIndexBasic

public QueryIndexBasic(java.lang.String dtdFile)

QueryIndexBasic

public QueryIndexBasic(DTDStat stat)

QueryIndexBasic

public QueryIndexBasic(java.util.Hashtable elements)
Method Detail

getQueries

public java.util.ArrayList getQueries()

getNoQueries

public int getNoQueries()

getNoActiveQueries

public int getNoActiveQueries()

getNoPaths

public int getNoPaths()

getNoPaths

public int getNoPaths(int queryId)

getNoPredicates

public int getNoPredicates()

getPathLength

public double getPathLength()

getNodes

public java.util.ArrayList getNodes()

getNode

public java.util.HashMap getNode(int htId)

getDSlashChild

public java.util.BitSet getDSlashChild()

getNoStates

public int getNoStates()

getNoDistinctPaths

public int getNoDistinctPaths()

clearAcceptingStates_DocID

public void clearAcceptingStates_DocID()

addQuery

public int addQuery(Query query)
add a given xpath to the query tree this just adds ** and * into the hash table the same as any other symbol.


deleteQuery

public void deleteQuery(Query query,
                        int queryId)
this function only removes (1) the identifiers of paths from the accepting states of the NFA without changing the structure of the NFA; and (2) the data structure containing query predicates from the list of queries. the effects are the following: if queries are evaluated on the fly driven by the matching of paths, removal of the path ids from the NFA will never trigger the query evaluation; otherwise, i.e., queries are evaluated at the end of document in batch, the null pointer in the query list will also cause this queries to be ignored. periodic reconstruction is needed to clean up the NFA and the query list, and reassign query identifers.


indexPath

public int indexPath(int queryId,
                     Path path)
now match the new query against the existing data structure until we need to start adding new nodes. just follow the hash tables until we can't find the attribute and create a new subtree. set miss to true if xpath[level] doesn't hash to a new table


indexPath

public int indexPath(int queryId,
                     int pathId,
                     java.lang.String[] steps)

removePath

public void removePath(int queryId,
                       Path path)

printIndex

public void printIndex()
render the query tree to stdout


printIndexToFile

public void printIndexToFile()

printQueries

public void printQueries()

printQueriesToFile

public void printQueriesToFile()