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-10, ISC License, Christian Gruen

Field Summary
 Uri baseURI
          Static Base URI.
 Uri collation
          Default collation.
 boolean construct
          Construction mode.
 Context context
          Database context.
 Dat date
          Current Date.
 DBNode[] doc
          Used documents.
 int docs
          Number of documents.
 Dtm dtm
          Current DateTime.
 boolean ftfast
          Fast full-text evaluation (stop after first hit).
 byte ftoknum
          Full-text token counter (for visualization).
 FTOpt ftopt
          Current full-text options.
 FTPosData ftpos
          Full-text position data (for visualization).
 Tokenizer fttoken
          Current full-text token.
 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.
 String query
          Query string.
 int revalidate
          Revalidation Mode.
 Scoring score
          Scoring instance.
 long size
          Current context size.
 boolean spaces
          Default boundary-space.
 HashMap<String,String> stop
          Cached stop word files.
 HashMap<String,String> thes
          Cached thesaurus files.
 Tim time
          Current Time.
 Updates updates
          Pending updates.
 boolean updating
          Indicates if this query performs updates.
 Variables vars
          Variables.
 
Constructor Summary
QueryContext(Context ctx)
          Constructor.
 
Method Summary
 void addColl(NodIter ni, byte[] name)
          Adds a collection.
 void addDoc(DBNode node)
          Adds a document to the document array.
 SeqIter coll(byte[] coll)
          Adds a collection instance or returns an existing one.
 void compile()
          Optimizes the expression.
 void compInfo(String string, Object... ext)
          Adds some optimization info.
 Data data()
          Returns the common database reference of all items or null.
 String det()
          Returns short information on this process.
 DBNode doc(byte[] path, boolean coll, boolean db)
          Adds a database instance or returns an existing one.
 void evalInfo(String string, Object... ext)
          Adds some evaluation info.
 IO file()
          Returns an IO representation of the base uri.
 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(String q)
          Parses the specified module.
 void parse(String q)
          Parses the specified query.
 double prog()
          Returns progress information.
 void serialize(Serializer ser, Item i)
          Serializes the specified item.
 String tit()
          Returns short information on this process.
 String toString()
           
 
Methods inherited from class org.basex.core.Progress
abort, checkStop, detail, progress, progress, stop, title
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

context

public final Context context
Database context.


stop

public HashMap<String,String> stop
Cached stop word files.


thes

public HashMap<String,String> thes
Cached thesaurus files.


query

public 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.


doc

public DBNode[] doc
Used documents.


docs

public int docs
Number of documents.


ftpos

public FTPosData ftpos
Full-text position data (for visualization).


ftoknum

public byte ftoknum
Full-text token counter (for visualization).


ftfast

public boolean ftfast
Fast full-text evaluation (stop after first hit).


score

public Scoring score
Scoring instance.


ftopt

public FTOpt ftopt
Current full-text options.


fttoken

public Tokenizer fttoken
Current full-text token.


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.


nsElem

public byte[] nsElem
Default element namespace.


baseURI

public Uri baseURI
Static Base URI.


collation

public Uri collation
Default collation.


spaces

public boolean spaces
Default boundary-space.


orderGreatest

public boolean orderGreatest
Empty Order mode.


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.


updates

public Updates updates
Pending updates.


updating

public boolean updating
Indicates if this query performs updates.

Constructor Detail

QueryContext

public QueryContext(Context ctx)
Constructor.

Parameters:
ctx - context reference
Method Detail

parse

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

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

module

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

Parameters:
q - input query
Throws:
QueryException - query 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 IOException
Serializes the specified item.

Parameters:
ser - serializer
i - item to serialize
Throws:
IOException - I/O 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

compInfo

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

Parameters:
string - evaluation info
ext - text text extensions

evalInfo

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

Parameters:
string - evaluation info
ext - text text extensions

doc

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

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

addDoc

public void addDoc(DBNode node)
Adds a document to the document array.

Parameters:
node - node to be added

coll

public SeqIter 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 - query 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

file

public IO file()
Returns an IO representation of the base uri.

Returns:
IO reference

info

public String info()
Returns query background information.

Returns:
warning

tit

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

Overrides:
tit in class Progress
Returns:
header information

det

public 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 String toString()
Overrides:
toString in class Object