edu.northwestern.at.wordhoard.swing.calculator.cql
Class CQLQuery

java.lang.Object
  extended by edu.northwestern.at.wordhoard.swing.calculator.cql.CQLQuery

public class CQLQuery
extends java.lang.Object

A WordHoard Corpus Query Language query.


Field Summary
protected static java.lang.String fromClauseTemplate
          From clause template.
protected static java.lang.String fromWordClauseTemplate
          From word clause template.
static int FULLWORDRESULTS
          Types of query results to obtain.
protected static java.lang.String fullWordSelectClauseTemplate
          Full word select clause template.
protected  java.util.List queryPhrases
          Ordered list of query phrases defining a query.
protected static java.lang.String startOfWordFromClause
          Start of word from clause.
protected static java.lang.String startOfWorkFromClause
          Start of work from clause.
protected static java.lang.String startOfWorkPartFromClause
          Start of work part from clause.
protected static java.lang.String whereClauseWordTemplate
          Where clause template for words.
protected static java.lang.String whereClauseWorkPartTemplate
          Where clause template for works and work parts.
static int WORDRESULTS
           
protected static java.lang.String wordSelectClauseTemplate
          Word select clause template.
protected static java.lang.String wordTagsWhereClause
          Start of where clause for word tags.
static int WORKPARTRESULTS
           
protected static java.lang.String workPartSelectClauseTemplate
          Work part select clause template.
protected static java.lang.String workPartsWhereClause
          Start of where clause for work parts.
static int WORKRESULTS
           
protected static java.lang.String workSelectClauseTemplate
          Work select clause template.
protected static java.lang.String worksWhereClause
          Start of where clause for works.
 
Constructor Summary
CQLQuery()
          Create a query.
CQLQuery(CQLPhrase[] queryPhrases)
          Create a query from a collection of query phrases.
CQLQuery(CQLQueryTokenizer tokenizer)
          Create a new query from a CQLQueryTokenizer.
CQLQuery(java.util.List queryPhrases)
          Create a query from a collection of query phrases.
CQLQuery(java.lang.String queryText)
          Create a new query from a query string.
 
Method Summary
 java.lang.String[] getHQL()
          Get Hibernate HQL version of query.
 java.lang.String[] getHQL(java.lang.String selector, int resultsType)
          Get Hibernate HQL version of query.
 java.util.List getQueryPhrases()
          Get the query phrases for this phrase.
 java.lang.String toString()
          Displayable version of query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FULLWORDRESULTS

public static final int FULLWORDRESULTS
Types of query results to obtain.

See Also:
Constant Field Values

WORDRESULTS

public static final int WORDRESULTS
See Also:
Constant Field Values

WORKRESULTS

public static final int WORKRESULTS
See Also:
Constant Field Values

WORKPARTRESULTS

public static final int WORKPARTRESULTS
See Also:
Constant Field Values

fullWordSelectClauseTemplate

protected static final java.lang.String fullWordSelectClauseTemplate
Full word select clause template.

See Also:
Constant Field Values

wordSelectClauseTemplate

protected static final java.lang.String wordSelectClauseTemplate
Word select clause template.

See Also:
Constant Field Values

startOfWordFromClause

protected static final java.lang.String startOfWordFromClause
Start of word from clause.

See Also:
Constant Field Values

startOfWorkFromClause

protected static final java.lang.String startOfWorkFromClause
Start of work from clause.

See Also:
Constant Field Values

startOfWorkPartFromClause

protected static final java.lang.String startOfWorkPartFromClause
Start of work part from clause.

See Also:
Constant Field Values

fromClauseTemplate

protected static final java.lang.String fromClauseTemplate
From clause template.

See Also:
Constant Field Values

fromWordClauseTemplate

protected static final java.lang.String fromWordClauseTemplate
From word clause template.

See Also:
Constant Field Values

worksWhereClause

protected static final java.lang.String worksWhereClause
Start of where clause for works.

See Also:
Constant Field Values

workPartsWhereClause

protected static final java.lang.String workPartsWhereClause
Start of where clause for work parts.

See Also:
Constant Field Values

wordTagsWhereClause

protected static final java.lang.String wordTagsWhereClause
Start of where clause for word tags.

See Also:
Constant Field Values

whereClauseWordTemplate

protected static final java.lang.String whereClauseWordTemplate
Where clause template for words.

See Also:
Constant Field Values

whereClauseWorkPartTemplate

protected static final java.lang.String whereClauseWorkPartTemplate
Where clause template for works and work parts.

See Also:
Constant Field Values

workSelectClauseTemplate

protected static final java.lang.String workSelectClauseTemplate
Work select clause template.

See Also:
Constant Field Values

workPartSelectClauseTemplate

protected static final java.lang.String workPartSelectClauseTemplate
Work part select clause template.

See Also:
Constant Field Values

queryPhrases

protected java.util.List queryPhrases
Ordered list of query phrases defining a query.

Constructor Detail

CQLQuery

public CQLQuery()
Create a query.


CQLQuery

public CQLQuery(java.util.List queryPhrases)
Create a query from a collection of query phrases.

Parameters:
queryPhrases - The query phrases defining the query.

CQLQuery

public CQLQuery(CQLPhrase[] queryPhrases)
Create a query from a collection of query phrases.

Parameters:
queryPhrases - The query phrases defining the query.

CQLQuery

public CQLQuery(CQLQueryTokenizer tokenizer)
         throws InvalidCQLQueryException
Create a new query from a CQLQueryTokenizer.

Parameters:
tokenizer - The CQLQueryTokenizer. Should be pointing at the start of a set of CQLPhrase definitions.
Throws:
InvalidCQLQueryException - if the CQL syntax is bad.

CQLQuery

public CQLQuery(java.lang.String queryText)
         throws InvalidCQLQueryException
Create a new query from a query string.

Parameters:
queryText - The query text.
Throws:
InvalidCQLQueryException - if the CQL syntax is bad.
Method Detail

getQueryPhrases

public java.util.List getQueryPhrases()
Get the query phrases for this phrase.

Returns:
The list of query term sets.

getHQL

public java.lang.String[] getHQL(java.lang.String selector,
                                 int resultsType)
Get Hibernate HQL version of query.

Parameters:
selector - A custom selector to add to the "where" clause. Examples: word.workPart in (:workParts) word.tag in (:wordTags) null or blank adds nothing.
resultsType - Type of query results to generate. WORDRESULTS : word-level results WORKRESULTS : distinct works WORKPARTRESULTS : distinct work parts
Returns:
hqlQuery The series of Hibernate HQL queries corresponding to this CQL query.

Each phrase in the query is mapped to a separate HQL query.


getHQL

public java.lang.String[] getHQL()
Get Hibernate HQL version of query.

Returns:
hqlQuery The series of Hibernate HQL queries corresponding to this CQL query. All queries are generated as word queries.

Each phrase in the query is mapped to a separate HQL query.


toString

public java.lang.String toString()
Displayable version of query.

Overrides:
toString in class java.lang.Object