org.basex.query
Class QueryContext

java.lang.Object
  extended by org.basex.core.Progress
      extended by org.basex.query.QueryContext

public final class QueryContext
extends Progress

This abstract query expression provides the architecture for a compiled query.

Author:
Workgroup DBIS, University of Konstanz 2005-09, ISC License, Christian Gruen

Field Summary
 Uri baseURI
          Static Base URI.
 Uri collation
          Default collation.
 boolean construct
          Construction mode.
 Dat date
          Current Date.
 DBNode[] docs
          Used documents.
 Dtm dtm
          Current DateTime.
 byte[] encoding
          Default encoding.
 IO file
          Reference to the query file.
 int ftcount
          Count number of FTIndex.
 IntList[] ftd
          Temporary place for ftdata.
 FTPosData ftdata
          Current fulltext item.
 FTTokenizer ftitem
          Current fulltext item.
 FTOpt ftopt
          Current fulltext options.
 FTPos ftpos
          Current fulltext position filter.
 Functions fun
          Functions.
 Item item
          Current context.
 boolean leaf
          Current leaf flag.
 NSLocal ns
          Namespaces.
 byte[] nsElem
          Default element namespace.
 byte[] nsFunc
          Default function namespace.
 boolean nsInherit
          Inherit Namespaces.
 boolean nsPreserve
          Preserve Namespaces.
 boolean ordered
          Ordering mode.
 boolean orderGreatest
          Empty Order mode.
 long pos
          Current context position.
 java.lang.String query
          Query string.
 int revalidate
          Revalidation Mode.
 int rootDocs
          Initial number of documents.
 long size
          Current context size.
 boolean spaces
          Default boundary-space.
 java.util.HashMap<java.lang.String,java.lang.String> stop
          Cached stop word files.
 Tim time
          Current Time.
 Variables vars
          Variables.
 
Constructor Summary
QueryContext()
           
 
Method Summary
 void addColl(NodIter ni, byte[] name)
          Adds a collection.
 void close()
          Closes the context.
 Iter coll(byte[] coll)
          Adds a collection instance or returns an existing one.
 void compile()
          Optimizes the expression.
 void compInfo(java.lang.String string, java.lang.Object... ext)
          Adds some optimization info.
 Data data()
          Returns the common database reference of all items or null.
 java.lang.String det()
          Returns short information on this process.
 DBNode doc(byte[] db, boolean coll)
          Adds a database instance or returns an existing one.
 void evalInfo(java.lang.String string, java.lang.Object... ext)
          Adds some evaluation info.
 java.lang.String info()
          Returns query background information.
 Iter iter()
          Returns a result iterator.
 Iter iter(Expr e)
          Evaluates the specified expression and returns an iterator.
 void module(java.lang.String q)
          Parses the specified module.
 void parse(java.lang.String q)
          Parses the specified query.
 double prog()
          Returns progress information.
 void serialize(Serializer ser, Item i)
          Serializes the specified item.
 java.lang.String tit()
          Returns short information on this process.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.core.Progress
checkStop, detail, progress, progress, stop, title
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stop

public java.util.HashMap<java.lang.String,java.lang.String> stop
Cached stop word files.


file

public IO file
Reference to the query file.


query

public java.lang.String query
Query string.


ns

public NSLocal ns
Namespaces.


fun

public Functions fun
Functions.


vars

public Variables vars
Variables.


item

public Item item
Current context.


pos

public long pos
Current context position.


size

public long size
Current context size.


leaf

public boolean leaf
Current leaf flag.


ftdata

public FTPosData ftdata
Current fulltext item.


ftitem

public FTTokenizer ftitem
Current fulltext item.


ftopt

public FTOpt ftopt
Current fulltext options.


ftpos

public FTPos ftpos
Current fulltext position filter.


ftcount

public int ftcount
Count number of FTIndex.


ftd

public IntList[] ftd
Temporary place for ftdata.


date

public Dat date
Current Date.


dtm

public Dtm dtm
Current DateTime.


time

public Tim time
Current Time.


nsFunc

public byte[] nsFunc
Default function namespace.


baseURI

public Uri baseURI
Static Base URI.


nsElem

public byte[] nsElem
Default element namespace.


collation

public Uri collation
Default collation.


docs

public DBNode[] docs
Used documents.


rootDocs

public int rootDocs
Initial number of documents.


spaces

public boolean spaces
Default boundary-space.


orderGreatest

public boolean orderGreatest
Empty Order mode.


encoding

public byte[] encoding
Default encoding.


nsPreserve

public boolean nsPreserve
Preserve Namespaces.


nsInherit

public boolean nsInherit
Inherit Namespaces.


ordered

public boolean ordered
Ordering mode.


construct

public boolean construct
Construction mode.


revalidate

public int revalidate
Revalidation Mode.

Constructor Detail

QueryContext

public QueryContext()
Method Detail

parse

public void parse(java.lang.String q)
           throws QueryException
Parses the specified query.

Parameters:
q - input query
Throws:
QueryException - xquery exception

module

public void module(java.lang.String q)
            throws QueryException
Parses the specified module.

Parameters:
q - input query
Throws:
QueryException - xquery exception

compile

public void compile()
             throws QueryException
Optimizes the expression.

Throws:
QueryException - query exception

iter

public Iter iter()
          throws QueryException
Returns a result iterator.

Returns:
result iterator
Throws:
QueryException - query exception

serialize

public void serialize(Serializer ser,
                      Item i)
               throws java.io.IOException
Serializes the specified item.

Parameters:
ser - serializer
i - item to serialize
Throws:
java.io.IOException - query exception

iter

public Iter iter(Expr e)
          throws QueryException
Evaluates the specified expression and returns an iterator.

Parameters:
e - expression to be evaluated
Returns:
iterator
Throws:
QueryException - query exception

close

public void close()
           throws java.io.IOException
Closes the context.

Throws:
java.io.IOException - query exception

compInfo

public void compInfo(java.lang.String string,
                     java.lang.Object... ext)
Adds some optimization info.

Parameters:
string - evaluation info
ext - text text extensions

evalInfo

public void evalInfo(java.lang.String string,
                     java.lang.Object... ext)
Adds some evaluation info.

Parameters:
string - evaluation info
ext - text text extensions

doc

public DBNode doc(byte[] db,
                  boolean coll)
           throws QueryException
Adds a database instance or returns an existing one.

Parameters:
db - database name or file path
coll - collection flag
Returns:
database instance
Throws:
QueryException - evaluation exception

coll

public Iter coll(byte[] coll)
          throws QueryException
Adds a collection instance or returns an existing one.

Parameters:
coll - name of the collection to be returned.
Returns:
collection
Throws:
QueryException - evaluation exception

addColl

public void addColl(NodIter ni,
                    byte[] name)
Adds a collection.

Parameters:
ni - collection nodes
name - name

data

public Data data()
          throws QueryException
Returns the common database reference of all items or null.

Returns:
database reference or null
Throws:
QueryException - query exception

info

public java.lang.String info()
Returns query background information.

Returns:
warning

tit

public java.lang.String tit()
Description copied from class: Progress
Returns short information on this process. Can be overwritten to give more detailed information.

Returns:
header information

det

public java.lang.String det()
Description copied from class: Progress
Returns short information on this process.

Overrides:
det in class Progress
Returns:
header information

prog

public double prog()
Description copied from class: Progress
Returns progress information. Can be overwritten to give more detailed information.

Overrides:
prog in class Progress
Returns:
header information

toString

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