org.basex.query.xquery
Class XQContext

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

public final class XQContext
extends QueryContext

XQuery Context.

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

Field Summary
 Uri baseURI
          Static Base URI.
 Uri collation
          Default collation.
 boolean construct
          Construction mode (currently ignored).
 Dat date
          Current Date.
 Dtm dtm
          Current DateTime.
 byte[] encoding
          Default encoding (currently ignored).
 FTTokenizer ftitem
          Current fulltext item.
 FTOpt ftopt
          Current fulltext options.
 FTPos ftpos
          Current fulltext position filter.
 Functions fun
          Functions.
 Item item
          Current context.
 NSLocal ns
          Namespaces.
 byte[] nsElem
          Default element namespace.
 byte[] nsFunc
          Default function namespace.
 boolean nsInherit
          Inherit Namespaces (currently ignored).
 boolean nsPreserve
          Preserve Namespaces (currently ignored).
 boolean ordered
          Ordering mode (currently ignored).
 boolean orderGreatest
          Empty Order mode.
 int pos
          Current context position.
 int size
          Current context size.
 boolean spaces
          Default boundary-space.
 Tim time
          Current Time.
 Variables vars
          Variables.
 
Fields inherited from class org.basex.query.QueryContext
file, PLAN, query
 
Constructor Summary
XQContext()
           
 
Method Summary
 void addColl(NodIter nod, byte[] name)
          Adds a collection.
 Item atomic(Expr expr, Expr call, boolean empty)
          Returns the specified expression as an item.
 NodIter coll(byte[] coll)
          Adds a collection instance or returns an existing one.
 Expr comp(Expr e)
          Evaluates the specified expression and returns an iterator.
 XQContext compile(Nodes nodes)
          Optimizes the expression.
 DNode doc(byte[] db)
          Adds a database instance or returns an existing one.
 XQResult eval(Nodes nodes)
          Evaluates the expression with the specified context set.
 Iter iter()
          Returns a result iterator.
 Iter iter(Expr e)
          Evaluates the specified expression and returns an iterator.
 void plan(Serializer ser)
          Recursively serializes the query plan.
 void serialize(Serializer ser, Item i)
          Serializes the specified item.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.QueryContext
compInfo, det, evalInfo, info, planDot, planXML, prog, tit
 
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

ns

public NSLocal ns
Namespaces.


fun

public Functions fun
Functions.


vars

public Variables vars
Variables.


item

public Item item
Current context.


pos

public int pos
Current context position.


size

public int size
Current context size.


ftitem

public FTTokenizer ftitem
Current fulltext item.


ftopt

public FTOpt ftopt
Current fulltext options.


ftpos

public FTPos ftpos
Current fulltext position filter.


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.


spaces

public boolean spaces
Default boundary-space.


orderGreatest

public boolean orderGreatest
Empty Order mode.


encoding

public byte[] encoding
Default encoding (currently ignored).


nsPreserve

public boolean nsPreserve
Preserve Namespaces (currently ignored).


nsInherit

public boolean nsInherit
Inherit Namespaces (currently ignored).


ordered

public boolean ordered
Ordering mode (currently ignored).


construct

public boolean construct
Construction mode (currently ignored).

Constructor Detail

XQContext

public XQContext()
Method Detail

compile

public XQContext compile(Nodes nodes)
                  throws XQException
Description copied from class: QueryContext
Optimizes the expression.

Parameters:
nodes - node context
Returns:
query context
Throws:
XQException

eval

public XQResult eval(Nodes nodes)
              throws XQException
Description copied from class: QueryContext
Evaluates the expression with the specified context set.

Parameters:
nodes - initial context set
Returns:
resulting value
Throws:
XQException

iter

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

Returns:
result iterator
Throws:
XQException - 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

plan

public void plan(Serializer ser)
          throws java.io.IOException
Description copied from class: QueryContext
Recursively serializes the query plan.

Parameters:
ser - serializer
Throws:
java.io.IOException

comp

public Expr comp(Expr e)
          throws XQException
Evaluates the specified expression and returns an iterator.

Parameters:
e - expression to be evaluated
Returns:
iterator
Throws:
XQException - evaluation exception

iter

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

Parameters:
e - expression to be evaluated
Returns:
iterator
Throws:
XQException - evaluation exception

atomic

public Item atomic(Expr expr,
                   Expr call,
                   boolean empty)
            throws XQException
Returns the specified expression as an item. Empty sequences are handled by the empty flag.

Parameters:
expr - expression to be evaluated
call - calling expression
empty - if set to true, empty sequences are returned as null. Otherwise, an error is thrown
Returns:
iterator
Throws:
XQException - evaluation exception

doc

public DNode doc(byte[] db)
          throws XQException
Adds a database instance or returns an existing one.

Parameters:
db - database name or file path
Returns:
database instance
Throws:
XQException - evaluation exception

coll

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

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

addColl

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

Parameters:
nod - collection nodes
name - name

toString

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