Xindice API
version 1.2m1

org.apache.xindice.core.query
Class QueryEngine

java.lang.Object
  extended byorg.apache.xindice.util.SimpleConfigurable
      extended byorg.apache.xindice.core.query.QueryEngine
All Implemented Interfaces:
Configurable

public class QueryEngine
extends SimpleConfigurable

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

Version:
$Revision: 541508 $, $Date: 2007-05-24 21:54:12 -0400 (Thu, 24 May 2007) $

Field Summary
 
Fields inherited from class org.apache.xindice.util.SimpleConfigurable
config
 
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, String style, String query, NamespaceMap nsMap, Key[] keys)
          compileQuery compiles a Query against the specified Collection context and returns the compiled Query.
static String expandEntities(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.
 String[] listStyles()
          listStyles returns a list of styles supported by the QueryEngine (ex: XPath, XUpdate)
static String normalizeString(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).
 NodeSet query(Collection col, String style, 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 org.apache.xindice.util.SimpleConfigurable
getConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryEngine

public QueryEngine(Database db)
Method Detail

setConfig

public void setConfig(Configuration config)
               throws XindiceException
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:
XindiceException

getDatabase

public Database getDatabase()

listStyles

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

Returns:
The supported styles

query

public NodeSet query(Collection col,
                     String style,
                     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:
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 NodeSet with the query results
Throws:
DBException
QueryException

compileQuery

public Query compileQuery(Collection col,
                          String style,
                          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 String normalizeString(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 String expandEntities(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

Xindice API
version 1.2m1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.