public class LocalEdgeRecognizerSyntaxTreeAssembler extends PathPredicateBinaryExprTreeAssembler
visits
(traverses) the given predicate expression syntax tree depth-first using an
adapted shunting-yard algorithm and assembles a resulting binary tree
structure. In typical usage scenarios, a single expression tree is assembled
once, and then used to evaluate any number of graph edge or other results
based on a given context.
The adapted shunting-yard algorithm in general uses a stack of operators and operands, and as new binary tree nodes are detected and created they are pushed onto the operand stack based on operator precedence. The resulting binary expression tree reflects the syntax of the underlying query expression including the precedence of its operators.
The use of binary expression tree evaluation for post processing of graph edge results is necessary in columnar data stores, as an entity with multiple properties is necessarily persisted across multiple columns. And while these data stores provide many useful column oriented filters, the capability to select an entity based on complex criteria which spans several columns is generally not supported, as such filters are column oriented. Yet even for simple queries (e.g. "where entity.c1 = 'foo' and entity.c2 = 'bar'") column c1 and its value exists in one cell and column c2 exists in another table cell. Since columnar data store filters cannot generally span columns, both cells must be returned and the results post processed within the context of the binary expression tree.
LocalEdgeRecognizerRelationalBinaryExpr,
LocalEdgeRecognizerWildcardBinaryExpr,
ExprAssembler| Modifier and Type | Field and Description |
|---|---|
protected DataGraphMapping |
graphConfig |
columnKeyFactory, edgeTypecontextExpression, contextProperty, contextQueryProperty, contextType, predicates, rootType| Constructor and Description |
|---|
LocalEdgeRecognizerSyntaxTreeAssembler(org.plasma.query.model.Where predicate,
DataGraphMapping graphConfig,
org.plasma.sdo.PlasmaType edgeType,
org.plasma.sdo.PlasmaType rootType,
StoreMappingContext mappingContext)
Constructs an assembler based on the given predicate and graph edge type.
|
| Modifier and Type | Method and Description |
|---|---|
LogicalBinaryExpr |
createLogicalBinaryExpr(Expr left,
Expr right,
org.plasma.query.model.LogicalOperator operator) |
PredicateBinaryExpr |
createPredicateBinaryExpr(org.plasma.query.model.Property property,
org.plasma.query.model.Literal literal,
org.plasma.query.model.PredicateOperator operator) |
RelationalBinaryExpr |
createRelationalBinaryExpr(org.plasma.query.model.Property property,
org.plasma.query.model.Literal literal,
org.plasma.query.model.RelationalOperator operator) |
endend, getResult, log, serialize, traversegetChildExpressionCount, getChildExpressions, getLogicalOperatorCount, hasChildExpressions, hasWildcardend, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, end, getContext, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, start, startprotected DataGraphMapping graphConfig
public LocalEdgeRecognizerSyntaxTreeAssembler(org.plasma.query.model.Where predicate,
DataGraphMapping graphConfig,
org.plasma.sdo.PlasmaType edgeType,
org.plasma.sdo.PlasmaType rootType,
StoreMappingContext mappingContext)
predicate - the predicateedgeType - the graph edge type which is the type for the reference property
within the graph which represents an edgerootType - the graph root typegraphConfig - the graph configpublic RelationalBinaryExpr createRelationalBinaryExpr(org.plasma.query.model.Property property, org.plasma.query.model.Literal literal, org.plasma.query.model.RelationalOperator operator)
createRelationalBinaryExpr in interface ExprAssemblercreateRelationalBinaryExpr in class DefaultBinaryExprTreeAssemblerpublic PredicateBinaryExpr createPredicateBinaryExpr(org.plasma.query.model.Property property, org.plasma.query.model.Literal literal, org.plasma.query.model.PredicateOperator operator)
createPredicateBinaryExpr in interface ExprAssemblercreatePredicateBinaryExpr in class DefaultBinaryExprTreeAssemblerpublic LogicalBinaryExpr createLogicalBinaryExpr(Expr left, Expr right, org.plasma.query.model.LogicalOperator operator)
createLogicalBinaryExpr in interface ExprAssemblercreateLogicalBinaryExpr in class DefaultBinaryExprTreeAssemblerCopyright © 2021. All Rights Reserved.