|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.endeca.navigation.analytics.Statement
public class Statement
A Statement represents a pass over a set of input records
(those of the FROM table) to generate a set of output records. Input
records and output records may be filtered; output records are populated
with derived values, and with values by which the records are GROUPed. The
output record set may be sorted and paged.
A Statement has the form:
RETURN {table-name} AS // required: or DEFINE: see setShown()
SELECT // required
{expr1} AS {field1}, // required: at least one assignment.
{expr2} AS {field2},
...
FROM {input-table-name} // optional
WHERE {filter} // optional
GROUP // optional: or GROUP BY {field}, {field},...
HAVING {filter} // optional
ORDER BY {field},{field}... // optional
PAGE({start}, {end}) // optional
Note that NavStateRecords and AllBaseRecords are reserved table names.
NavStateRecords is the default if the FROM clause is omitted.
| Constructor Summary | |
|---|---|
Statement()
Constructs a new, empty Statement, which in its
initial state will act as a simple pass-through of records. |
|
| Method Summary | |
|---|---|
int |
getFirstPage()
If the Statement is paged, returns the first row-number requested. |
String |
getFromStatementName()
Gets the name of the FROM statement. |
GroupByList |
getGroupByList()
Gets the GroupByList for this Statement. |
Filter |
getHavingFilter()
Gets the "HAVING clause" Filter for this
Statement. |
String |
getName()
Gets the name of the current Statement. |
OrderByList |
getOrderByList()
Gets the OrderByList for this Statement. |
int |
getPagesRequested()
If the Statement is paged, returns the number of rows requested. |
SelectList |
getSelectList()
Gets the list of Select operations for this
Statement. |
Filter |
getWhereFilter()
Gets the "WHERE clause" Filter for this
Statement. |
boolean |
isPaged()
Tests whether this Statement is paged. |
boolean |
isShown()
Tests whether the Statement is a Return or
Define Statement. |
void |
setFromStatementName(String name)
Specifies the name of the statement whose records are scanned as input to the current Statement. |
void |
setGroupByList(GroupByList groupByList)
Sets the GroupByList for this Statement. |
void |
setHavingFilter(Filter filter)
Adds a "HAVING clause" to this Statement. |
void |
setName(String _name)
Sets the name of the current Statement. |
void |
setOrderByList(OrderByList orderByList)
Sets the OrderByList for this Statement. |
void |
setReturnRows(int first,
int num)
Sets the paging parameters for the Statement. |
void |
setSelectList(SelectList selectList)
Sets the list of Select expressions for this
Statement. |
void |
setShown(boolean show)
Specifies whether the Statement is Return or Define. |
void |
setWhereFilter(Filter filter)
Adds the "WHERE clause" for this Statement. |
String |
toString()
Returns the string form of this Statement. |
String |
toWire()
Prints the wire format of this Statement. |
void |
validateSyntax()
Validates the syntax of this Statement. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Statement()
Statement, which in its
initial state will act as a simple pass-through of records.
| Method Detail |
|---|
public void setReturnRows(int first,
int num)
Statement. After ordering,
records with index less than first or greater or equal to first + num
will be discarded.
Calling this method sets the paged setting of
the Statement to true.
first - the first row-number requested.num - the number of rows requested.public boolean isPaged()
Statement is paged.
A Statement is paged if the application only wants
a subset of the records that the Statement computes.
By default, the paged setting is false. Calling
setReturnRows sets paged to true.
true if this Statement is paged, false otherwise.public int getFirstPage()
Statement is paged, returns the first row-number requested.
Statement is not paged, 0 is returned.public int getPagesRequested()
Statement is paged, returns the number of rows requested.
0 if the Statement is not paged.public void setFromStatementName(String name)
Statement.
name - a String representing the name of the statementpublic String getFromStatementName()
FROM statement.
The FROM statement is the statement whose records are
the input for this Statement. Note that the return value
may be null; when the Statement is
computed, a missing FROM clause is interpreted as
"FROM NavStateRecords".
String representing the FROM
statement whose records are the input for this Statement,
or null if no name exists.public void setName(String _name)
Statement. Once the query is sent
to the MDEX Engine and a response is returned, this name must be used as
the parameter to the
Navigation.getAnalyticsStatementResult(String) method to
obtain an AnalyticsStatementResult containing the records associated
with the Statement.
_name - a String representing the name of the current Statementpublic String getName()
Statement. The name must be non-null in
order for the Statement to be syntactically valid.
String representing the name of the
current Statement, or null if no name has been set.public void setShown(boolean show)
Statement is Return or Define.
Return means that the results should be returned to the client, while
Define means that it will only be used to compute other results.
show - true to specify a Return statement or
false to specify a Define statementpublic boolean isShown()
Statement is a Return or
Define Statement.
true if the current Statement is
a Return statement (indicates that the application wants
to see its result records), or false if it is
a Define statement (indicates that it is only used as
an intermediate calculation).public void setSelectList(SelectList selectList)
Select expressions for this
Statement. Each Select associates a
derived value with each result aggregated record produced by this
Statement.
selectList - a SelectList containing the
Select expressions for this Statementpublic SelectList getSelectList()
Select operations for this
Statement. Each Select associates a
derived value with each result aggregated record produced by this
Statement.
SelectList containing the
Select expressions for this Statement.public void setWhereFilter(Filter filter)
Statement. A "WHERE clause"
acts as a filter on input records that will be grouped
into result aggregates. In other words, this method specifies a pre-filter for
this Statement.
filter - a Filter containing the
"WHERE clause" for this Statementpublic Filter getWhereFilter()
Filter for this
Statement. The "WHERE clause" acts as a filter on
input records that will be grouped into result aggregates.
In other words, it specifies a pre-filter for
this Statement.
Filter containing the
"WHERE clause" for this Statement.public void setHavingFilter(Filter filter)
Statement. A "HAVING clause"
acts as a filter on output aggregated records. In other words,
this method specifies a post-filter for this Statement.
filter - a Filter containing the
"HAVING clause" for this Statementpublic Filter getHavingFilter()
Filter for this
Statement. The "HAVING clause" acts as a filter on
result aggregated records. In other words, it specifies a
post-filter for this Statement.
Filter containing the
"HAVING clause" for this Statement.public void setGroupByList(GroupByList groupByList)
GroupByList for this Statement.
The GroupByList
determines the way that input records are grouped into result
aggregated records. Basically, each GroupBy in
the specified GroupByList represents a grouping
property or dimension, and input records are assigned to a
resulting aggregate based on their values for these properties
and dimensions. Note that if an empty GroupByList
is attached to a Statement, it indicates that the
input records will be GROUPed to a single record.
groupByList - a GroupByList that is either empty or
contains GroupBy instances.public GroupByList getGroupByList()
GroupByList for this Statement.
See the setGroupByList method for an explanation
of the purpose of the GroupByList.
GroupByList that is either empty (code>null) or
contains GroupBy instances.public void setOrderByList(OrderByList orderByList)
OrderByList for this Statement.
The list of OrderBy specifications for the
Statement determines the order in which result
aggregated records will be returned, and determines the ranks
of result aggregated records used by paging controls
associated with GroupBy specifications.
orderByList - an OrderByList that
contains one or more OrderBy instances. Note that the
OrderByList cannot be empty.public OrderByList getOrderByList()
OrderByList for this Statement.
The list of OrderBy specifications for the
Statement determines the order in which result
aggregated records will be returned, and determines the ranks
of result aggregated records used by paging controls
associated with GroupBy specifications.
OrderByList that contains one or
more OrderBy instances.public String toString()
Statement. See the class comments
for the format of the Statement.
toString in interface QueryNodetoString in class ObjectStatement in the specified format.public String toWire()
Statement. This method is not
intended for public use because the wire format is subject to change.
toWire in interface QueryNode
public void validateSyntax()
throws SyntaxException
Statement. A Statement is valid if
(1) the table-name is non-null and non-empty,
(2) the SelectList is non-null and valid, and
(3) if any of whereFilter, havingFilter,
groupByList, and orderByList
are non-null, they must be valid.
validateSyntax in interface QueryNodeSyntaxException - if the syntax requirements are not satisfied.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||