public class ViewExpression extends Object
Visually, a view expression is quite similar to a query in a declarative language like SQL. A view expression is composed of several clauses, including:
Source
, which defines the stream of values from which the expression's Element
s are generated.Element
s that generate values.Element
s that define the order of the stream. By definition,
the sort order is the lexicographic order of the elements when packed together as tuple.
QueryPredicate
Because view expressions are quite general but are closely tied to the semantics of the tuple layer, they are very
useful for planning tasks such as incremental index selection. To see how an index is represented as a view
expression, see fromIndexDefinition(String, Collection, KeyExpression)
.
Modifier and Type | Class and Description |
---|---|
static class |
ViewExpression.Builder
A builder class for constructing an (immutable) view expression.
|
Constructor and Description |
---|
ViewExpression(List<Element> select,
QueryPredicate predicate,
Source rootSource,
List<Element> orderBy) |
Modifier and Type | Method and Description |
---|---|
static ViewExpression.Builder |
builder() |
static ViewExpression |
fromIndexDefinition(String indexType,
Collection<String> recordTypes,
KeyExpression rootExpression)
Generate a view expression that represents the structure of an index defined using a
KeyExpression . |
List<Element> |
getOrderBy() |
public static ViewExpression fromIndexDefinition(@Nonnull String indexType, @Nonnull Collection<String> recordTypes, @Nonnull KeyExpression rootExpression)
KeyExpression
.indexType
- the type of the index as specified in the meta-datarecordTypes
- the set of record types used to generate the indexrootExpression
- the root key expression of the index as specified in the meta-datapublic static ViewExpression.Builder builder()