Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.query
Class QueryProcessor

    java.lang.Object
      org.basex.core.Progress
          org.basex.query.QueryProcessor

    public final class QueryProcessor

extends Progress

This abstract class contains various methods which allow querying in the database. A variety of hierarchical parsers (XPath, XQuery, etc..) can be implemented on top of this class.

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

Field Summary
`QueryContext` | `ctx` Expression context.

Constructor Summary
`QueryProcessor(String qu, Context cx)` Default constructor.
`QueryProcessor(String qu, Nodes nodes, Context cx)` Constructor with an initial context set.

Method Summary
`void` | `close()` Closes the processor.
`void` | `compile()` Compiles the query.
`String` | `det()` Returns short information on this process.
`String` | `info(boolean all)` Returns query background information.
`Iter` | `iter()` Returns a result iterator.
`void` | `module(String ns, String file)` Adds a module reference.
`void` | `parse()` Parses the query.
`void` | `plan(Serializer ser)` Returns the query plan in the dot notation.
`double` | `prog()` Returns progress information.
`Result` | `query()` Evaluates the specified query and returns the result.
`Nodes` | `queryNodes()` Evaluates the specified query and returns the result nodes.
`void` | `setQuery(String qu)` Sets a new query.
`String` | `tit()` Returns short information on this process.

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, toString, wait, wait, wait`

Field Detail

### ctx

    public final QueryContext ctx

  Expression context.

Constructor Detail

### QueryProcessor

    public QueryProcessor(String qu,
                          Context cx)

  Default constructor.

  Parameters:
    `qu` - query to process
    `cx` - database context

### QueryProcessor

    public QueryProcessor(String qu,
                          Nodes nodes,
                          Context cx)

  Constructor with an initial context set.

  Parameters:
    `qu` - query
    `nodes` - initial context set
    `cx` - database context

Method Detail

### parse

    public void parse()
               throws QueryException

  Parses the query.

  Throws:
    `QueryException` - query exception

### compile

    public void compile()
                 throws QueryException

  Compiles the query.

  Throws:
    `QueryException` - query exception

### iter

    public Iter iter()
              throws QueryException

  Returns a result iterator.

  Returns:
    result iterator
  Throws:
    `QueryException` - query exception

### query

    public Result query()
                 throws QueryException

  Evaluates the specified query and returns the result.

  Returns:
    result of query
  Throws:
    `QueryException` - query exception

### queryNodes

    public Nodes queryNodes()
                     throws QueryException

  Evaluates the specified query and returns the result nodes.

  Returns:
    result nodes
  Throws:
    `QueryException` - query exception

### module

    public void module(String ns,
                       String file)

  Adds a module reference.

  Parameters:
    `ns` - module namespace
    `file` - file name

### setQuery

    public void setQuery(String qu)

  Sets a new query. Should be called before parsing the query.

  Parameters:
    `qu` - query

### close

    public void close()
               throws IOException

  Closes the processor.

  Throws:
    `IOException` - I/O exception

### info

    public String info(boolean all)

  Returns query background information.

  Parameters:
    `all` - show all information
  Returns:
    background information

### plan

    public void plan(Serializer ser)
              throws Exception

  Returns the query plan in the dot notation.

  Parameters:
    `ser` - serializer
  Throws:
    `Exception` - exception

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD