dbXML API

## com.dbxml.db.core.query
Class QueryEngine

    java.lang.Object
      com.dbxml.util.SimpleConfigurable
          com.dbxml.db.core.query.QueryEngine

All Implemented Interfaces:
  Configurable

public class QueryEngine
extends SimpleConfigurable

QueryEngine is the dbXML Query Engine. Its purpose is to orchestrate query operations against the dbXML repository. The QueryEngine basically just manages a set of QueryResolvers that actually perform the work.

Constructor Summary
`QueryEngine(Database db)`

Method Summary
`static Key[]` `andKeySets(Key[][] keySets)` andKeySets takes several sets of unique Keys and returns the ANDed set (elements that exist in all sets).
`Query` `compileQuery(Collection col, java.lang.String style, java.lang.String query, NamespaceMap nsMap, Key[] keys)` compileQuery compiles a Query against the specified Collection context and returns the compiled Query.
`static java.lang.String` `expandEntities(java.lang.String value)` expandEntities expands the String's pre-defined XML entities (<, >, etc...) into their actual character representations.
`Database` `getDatabase()`
`static Key[]` `getUniqueKeys(IndexMatch[] matches)` getUniqueKeys takes a set of IndexMatch objects and extracts all of its unique Keys in sorted order.
`java.lang.String[]` `listStyles()` listStyles returns a list of styles supported by the QueryEngine (ex: XPath, XUpdate)
`static java.lang.String` `normalizeString(java.lang.String value)` normalizeString normalizes the specific String by stripping all leading, trailing, and continuous runs of white space.
`static Key[]` `orKeySets(Key[][] keySets)` orKeySets takes several sets of unique Keys and returns the ORed set (all unique elements).
`ResultSet` `query(Transaction tx, Collection col, java.lang.String style, java.lang.String query, NamespaceMap nsMap, Key[] keys)` query performs the specified query and returns a NodeSet with any possible results from that query.
`void` `setConfig(Configuration config)` setConfig sets the configuration information for the Configurable object instance.

Methods inherited from class com.dbxml.util.SimpleConfigurable
`getConfig`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### QueryEngine

    public QueryEngine(Database db)

Method Detail

### setConfig

    public void setConfig(Configuration config)
                   throws dbXMLException

  Description copied from interface: `Configurable`
  setConfig sets the configuration information for the Configurable object instance.

  Specified by:
    `setConfig` in interface `Configurable`
  Overrides:
    `setConfig` in class `SimpleConfigurable`
  Throws:
    `dbXMLException`

### getDatabase

    public Database getDatabase()

### listStyles

    public java.lang.String[] listStyles()

  listStyles returns a list of styles supported by the QueryEngine (ex: XPath, XUpdate)

  Returns:
    The supported styles

### query

    public ResultSet query(Transaction tx,
                           Collection col,
                           java.lang.String style,
                           java.lang.String query,
                           NamespaceMap nsMap,
                           Key[] keys)
                    throws DBException,
                           QueryException

  query performs the specified query and returns a NodeSet with any possible results from that query. The query is performed in the context of a Collection.

  Parameters:
    `tx` - The controlling Transaction
    `col` - The Collection context
    `style` - The query style (XPath, Fulltext, etc...)
    `query` - The Query
    `nsMap` - The namespace Map (if any)
    `keys` - The initial Key set to use (if any)
  Returns:
    A ResultSet with the query results
  Throws:
    `DBException`
    `QueryException`

### compileQuery

    public Query compileQuery(Collection col,
                              java.lang.String style,
                              java.lang.String query,
                              NamespaceMap nsMap,
                              Key[] keys)
                       throws DBException,
                              QueryException

  compileQuery compiles a Query against the specified Collection context and returns the compiled Query. This DOES NOT actually run the query, merely just parses it and primes any possible Indexers that the query might need.

  Parameters:
    `col` - The Collection context
    `style` - The query style (XPath, Fulltext, etc...)
    `query` - The Query
    `nsMap` - The namespace Map (if any)
    `keys` - The initial Key set to use (if any)
  Returns:
    The compiled Query
  Throws:
    `DBException`
    `QueryException`

### getUniqueKeys

    public static Key[] getUniqueKeys(IndexMatch[] matches)

  getUniqueKeys takes a set of IndexMatch objects and extracts all of its unique Keys in sorted order.

  Parameters:
    `matches` - The Match Set
  Returns:
    The unique Keys in order

### andKeySets

    public static Key[] andKeySets(Key[][] keySets)

  andKeySets takes several sets of unique Keys and returns the ANDed set (elements that exist in all sets). The first dimension of the array holds the individual sets, the second holds the actual Keys.

  Parameters:
    `keySets` - 2-dimensional set of Keys
  Returns:
    The ANDed set of Keys in order

### orKeySets

    public static Key[] orKeySets(Key[][] keySets)

  orKeySets takes several sets of unique Keys and returns the ORed set (all unique elements). The first dimension of the array holds the individual sets, the second holds the actual Keys.

  Parameters:
    `keySets` - 2-dimensional set of Keys
  Returns:
    The ORed set of Keys in order

### normalizeString

    public static java.lang.String normalizeString(java.lang.String value)

  normalizeString normalizes the specific String by stripping all leading, trailing, and continuous runs of white space.

  Parameters:
    `value` - The value to normalize
  Returns:
    The result

### expandEntities

    public static java.lang.String expandEntities(java.lang.String value)

  expandEntities expands the String's pre-defined XML entities (<, >, etc...) into their actual character representations.

  Parameters:
    `value` - The value to expand entities for
  Returns:
    The expanded String

dbXML API

Copyright (c) 2004 The dbXML Group