edu.berkeley.cs.db.yfilter.filter
Class EXfilterBasic

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--edu.berkeley.cs.db.yfilter.filter.EXfilter
              |
              +--edu.berkeley.cs.db.yfilter.filter.EXfilterBasic
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class EXfilterBasic
extends EXfilter


Field Summary
protected  boolean DEMO_CODE
           
protected  BottomStreams m_bottomStreams
           
protected  ICDEDemo m_demo
           
protected  int m_docSN
           
protected  java.util.ArrayList m_matchedQueries
           
protected  double[] m_matchRatio
           
protected  NFAExecution m_nfa
           
protected  int m_noElements
           
protected  java.util.BitSet m_prevBitSet
           
protected  QueryIndexBasic m_queryIndex
           
protected  java.util.Stack m_runStack
           
 
Fields inherited from class edu.berkeley.cs.db.yfilter.filter.EXfilter
DEBUG_QUERY_PARSING, DEBUG_XML_PARSING, m_contextPath, m_eventIndex, m_events, m_out, m_trace, m_tree
 
Constructor Summary
EXfilterBasic()
           
EXfilterBasic(DTDStat stat)
           
EXfilterBasic(DTDStat stat, ICDEDemo demo)
           
 
Method Summary
 int addQuery(Query query)
           
 void allocateStreams()
          if new queries have been added to the system, allocate more pathtuple streams before executing a new document
 void characters(char[] ch, int start, int count)
          DocumentHandler :: characters:
 void clear()
          clear after each doc is processed
 void deleteQuery(Query query, int queryId)
           
 void endDocument()
          DocumnetHandler :: end document : complete post processing and clear the execution and parsing stacks so that we go back to the start state.
 void endElement()
          DocumentHandler :: end element: now evaluating paths and finding accepts is a job here after attribute checking when the element is read and data value checking when the data is read; need to pop the current element context and drop back to the previous one
 void endElement(java.lang.String uri, java.lang.String local, java.lang.String eleName)
          DocumentHandler :: end element: with preparsing
 java.util.ArrayList getMatchedQueries()
          get the matched queries; fill in m_matchedQuries
 java.util.ArrayList getMatchingElements(int queryId)
          get the elements that have matched a particular query.
 java.util.ArrayList getNewlyMatchedQueries()
          get newly matched queries
 int getNoActiveQueries()
           
 int getNoDistinctPaths()
           
 int getNoDistinctQueries()
           
 int getNoElements()
           
 int getNoMatchedQueries()
           
 int getNoPredicates()
           
 int getNoQueries()
           
 int getNoStates()
           
 double getPathLength()
           
 QueryIndexBasic getQueryIndex()
           
 double getSelectivity()
           
 void preAllocate()
          pre-allocate pathtuple streams after query bulkloading and before processing any documents
 void printQueryIndex()
           
 void printQueryIndexToFile()
           
 void printQueryResults(java.io.PrintStream out)
          Prints all the query results to a binary stream
 void printQueryResults(java.io.PrintWriter out)
          Prints all the query results to an ASCII stream
 void printRunStack()
           
 void startDocument()
          DocumnetHandler :: start document : initialize the execution stack so that we are in the start state.
 void startElement()
          DocumentHandler :: start element: here we need to check all of our current states to see which ones match this element and push the resulting set of states onto the execution stack.
 void startElement(java.lang.String uri, java.lang.String local, java.lang.String elementName, org.xml.sax.Attributes attrs)
          DocumentHandler :: start element: without pre-parsing
 java.lang.String stringOfMatchingElements(int queryId)
          Returns a string representation of the elements that have matched a particular query
 
Methods inherited from class edu.berkeley.cs.db.yfilter.filter.EXfilter
main, setEventSequence, setXMLTree, startParsing, startParsing
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_queryIndex

protected QueryIndexBasic m_queryIndex

m_runStack

protected java.util.Stack m_runStack

m_nfa

protected NFAExecution m_nfa

m_bottomStreams

protected BottomStreams m_bottomStreams

m_noElements

protected int m_noElements

m_docSN

protected int m_docSN

m_matchedQueries

protected java.util.ArrayList m_matchedQueries

m_matchRatio

protected double[] m_matchRatio

m_prevBitSet

protected java.util.BitSet m_prevBitSet

m_demo

protected ICDEDemo m_demo

DEMO_CODE

protected boolean DEMO_CODE
Constructor Detail

EXfilterBasic

public EXfilterBasic()

EXfilterBasic

public EXfilterBasic(DTDStat stat)

EXfilterBasic

public EXfilterBasic(DTDStat stat,
                     ICDEDemo demo)
Method Detail

clear

public void clear()
clear after each doc is processed

Overrides:
clear in class EXfilter

preAllocate

public void preAllocate()
pre-allocate pathtuple streams after query bulkloading and before processing any documents


allocateStreams

public void allocateStreams()
if new queries have been added to the system, allocate more pathtuple streams before executing a new document


addQuery

public int addQuery(Query query)
Specified by:
addQuery in class EXfilter

deleteQuery

public void deleteQuery(Query query,
                        int queryId)
Specified by:
deleteQuery in class EXfilter

getQueryIndex

public QueryIndexBasic getQueryIndex()

printQueryIndex

public void printQueryIndex()

printQueryIndexToFile

public void printQueryIndexToFile()

getNoElements

public int getNoElements()

getNoQueries

public int getNoQueries()

getNoDistinctQueries

public int getNoDistinctQueries()

getNoActiveQueries

public int getNoActiveQueries()

getNoDistinctPaths

public int getNoDistinctPaths()

getPathLength

public double getPathLength()

getNoPredicates

public int getNoPredicates()

getNoStates

public int getNoStates()

getSelectivity

public double getSelectivity()

getNewlyMatchedQueries

public java.util.ArrayList getNewlyMatchedQueries()
get newly matched queries


getNoMatchedQueries

public int getNoMatchedQueries()

getMatchedQueries

public java.util.ArrayList getMatchedQueries()
get the matched queries; fill in m_matchedQuries

Returns:
an array list containing the query identifiers

getMatchingElements

public java.util.ArrayList getMatchingElements(int queryId)
                                        throws java.lang.Exception
get the elements that have matched a particular query.

java.lang.Exception

stringOfMatchingElements

public java.lang.String stringOfMatchingElements(int queryId)
                                          throws java.lang.Exception
Returns a string representation of the elements that have matched a particular query

Parameters:
queryId -
Returns:
String
Throws:
java.lang.Exception

printQueryResults

public void printQueryResults(java.io.PrintWriter out)
Prints all the query results to an ASCII stream

Parameters:
out - the stream

printQueryResults

public void printQueryResults(java.io.PrintStream out)
Prints all the query results to a binary stream

Parameters:
out - the stream

startDocument

public void startDocument()
DocumnetHandler :: start document : initialize the execution stack so that we are in the start state.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class EXfilter

endDocument

public void endDocument()
DocumnetHandler :: end document : complete post processing and clear the execution and parsing stacks so that we go back to the start state.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class EXfilter

startElement

public void startElement()
DocumentHandler :: start element: here we need to check all of our current states to see which ones match this element and push the resulting set of states onto the execution stack.

Overrides:
startElement in class EXfilter

endElement

public void endElement()
DocumentHandler :: end element: now evaluating paths and finding accepts is a job here after attribute checking when the element is read and data value checking when the data is read; need to pop the current element context and drop back to the previous one

Overrides:
endElement in class EXfilter

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String elementName,
                         org.xml.sax.Attributes attrs)
DocumentHandler :: start element: without pre-parsing

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class EXfilter

characters

public void characters(char[] ch,
                       int start,
                       int count)
DocumentHandler :: characters:

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class EXfilter

endElement

public void endElement(java.lang.String uri,
                       java.lang.String local,
                       java.lang.String eleName)
DocumentHandler :: end element: with preparsing

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class EXfilter

printRunStack

public void printRunStack()