Class: ExpressionBuilder
Create Expression based on the parsed token
Expression allow to optimize and split between Query and Filter
Extends
AbstractParseTreeVisitor
<Query
>
Implements
WebdaQLParserVisitor
<any
>
Constructors
new ExpressionBuilder()
new ExpressionBuilder():
ExpressionBuilder
Returns
Inherited from
AbstractParseTreeVisitor<Query>.constructor
Properties
limit
limit:
number
Contain the parsed limit
Source
packages/core/src/stores/webdaql/query.ts:70
offset
offset:
string
Contain the parsed offset
Source
packages/core/src/stores/webdaql/query.ts:74
orderBy
orderBy:
OrderBy
[]
Source
packages/core/src/stores/webdaql/query.ts:75
Methods
aggregateResult()
protected
aggregateResult(aggregate
,nextResult
):Query
Aggregates the results of visiting multiple children of a node. After
either all children are visited or #shouldVisitNextChild returns
false
, the aggregate value is returned as the result of
#visitChildren.
The default implementation returns nextResult
, meaning
#visitChildren will return the result of the last child visited
(or return the initial value if the node has no children).
Parameters
• aggregate: Query
The previous aggregate value. In the default
implementation, the aggregate value is initialized to
#defaultResult, which is passed as the aggregate
argument
to this method after the first child node is visited.
• nextResult: Query
The result of the immediately preceeding call to visit a child node.
Returns
The updated aggregate result.
Inherited from
AbstractParseTreeVisitor.aggregateResult
Source
node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:77
defaultResult()
protected
defaultResult():Query
Default result for the override
Returns
Overrides
AbstractParseTreeVisitor.defaultResult
Source
packages/core/src/stores/webdaql/query.ts:81
getComparison()
getComparison(
ctx
):any
[]
Simplify Logic expression and regroup them
Parameters
• ctx: AndLogicExpressionContext
| OrLogicExpressionContext
Returns
any
[]
Source
packages/core/src/stores/webdaql/query.ts:179
getLimit()
getLimit():
number
Get limit
Returns
number
Source
packages/core/src/stores/webdaql/query.ts:100
getOffset()
getOffset():
string
Get offset
Returns
string
Source
packages/core/src/stores/webdaql/query.ts:92
shouldVisitNextChild()
protected
shouldVisitNextChild(node
,currentResult
):boolean
This method is called after visiting each child in
#visitChildren. This method is first called before the first
child is visited; at that point currentResult
will be the initial
value (in the default implementation, the initial value is returned by a
call to #defaultResult. This method is not called after the last
child is visited.
The default implementation always returns true
, indicating that
visitChildren
should only return after all children are visited.
One reason to override this method is to provide a "short circuit"
evaluation option for situations where the result of visiting a single
child has the potential to determine the result of the visit operation as
a whole.
Parameters
• node: RuleNode
The RuleNode whose children are currently being visited.
• currentResult: Query
The current aggregate result of the children visited to the current point.
Returns
boolean
true
to continue visiting children. Otherwise return
false
to stop visiting children and immediately return the
current aggregate result from #visitChildren.
Inherited from
AbstractParseTreeVisitor.shouldVisitNextChild
Source
node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:102
visit()
visit(
tree
):Query
{@inheritDoc }
The default implementation calls ParseTree#accept on the specified tree.
Parameters
• tree: ParseTree
Returns
Implementation of
WebdaQLParserVisitor.visit
Inherited from
AbstractParseTreeVisitor.visit
Source
node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:17
visitAndLogicExpression()
visitAndLogicExpression(
ctx
):AndExpression
Get the AndExpression, regrouping all the parameters
By default the parser is doing a AND (b AND (c AND d)) creating 3 depth expressions This visitor simplify to a AND b AND c AND d with only one Expression
Parameters
• ctx: AndLogicExpressionContext
Returns
Implementation of
WebdaQLParserVisitor.visitAndLogicExpression
Source
packages/core/src/stores/webdaql/query.ts:207
visitBinaryComparisonExpression()
visitBinaryComparisonExpression(
ctx
):ComparisonExpression
<ComparisonOperator
>
Implement the BinaryComparison with all methods managed
Parameters
• ctx: BinaryComparisonExpressionContext
Returns
ComparisonExpression
<ComparisonOperator
>
Implementation of
WebdaQLParserVisitor.visitBinaryComparisonExpression
Source
packages/core/src/stores/webdaql/query.ts:214
visitBooleanLiteral()
visitBooleanLiteral(
ctx
):boolean
Read the boolean literal
Parameters
• ctx: BooleanLiteralContext
Returns
boolean
Implementation of
WebdaQLParserVisitor.visitBooleanLiteral
Source
packages/core/src/stores/webdaql/query.ts:276
visitChildren()
visitChildren(
node
):Query
{@inheritDoc }
The default implementation initializes the aggregate result to
#defaultResult defaultResult(). Before visiting each child, it
calls #shouldVisitNextChild shouldVisitNextChild; if the result
is false
no more children are visited and the current aggregate
result is returned. After visiting a child, the aggregate result is
updated by calling #aggregateResult aggregateResult with the
previous aggregate result and the result of visiting the child.
The default implementation is not safe for use in visitors that modify the tree structure. Visitors that modify the tree should override this method to behave properly in respect to the specific algorithm in use.
Parameters
• node: RuleNode
Returns
Implementation of
WebdaQLParserVisitor.visitChildren
Inherited from
AbstractParseTreeVisitor.visitChildren
Source
node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:33
visitContainsExpression()
visitContainsExpression(
ctx
):ComparisonExpression
<"CONTAINS"
>
Map the a CONTAINS 'b'
Parameters
• ctx: ContainsExpressionContext
Returns
ComparisonExpression
<"CONTAINS"
>
Implementation of
WebdaQLParserVisitor.visitContainsExpression
Source
packages/core/src/stores/webdaql/query.ts:250
visitErrorNode()
visitErrorNode(
node
):Query
{@inheritDoc }
The default implementation returns the result of #defaultResult defaultResult.
Parameters
• node: ErrorNode
Returns
Implementation of
WebdaQLParserVisitor.visitErrorNode
Inherited from
AbstractParseTreeVisitor.visitErrorNode
Source
node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:47
visitInExpression()
visitInExpression(
ctx
):ComparisonExpression
<"IN"
>
Map the a IN ['b','c']
Parameters
• ctx: InExpressionContext
Returns
ComparisonExpression
<"IN"
>
Implementation of
WebdaQLParserVisitor.visitInExpression
Source
packages/core/src/stores/webdaql/query.ts:241
visitIntegerLiteral()
visitIntegerLiteral(
ctx
):number
Read the number literal
Parameters
• ctx: IntegerLiteralContext
Returns
number
Implementation of
WebdaQLParserVisitor.visitIntegerLiteral
Source
packages/core/src/stores/webdaql/query.ts:283
visitLikeExpression()
visitLikeExpression(
ctx
):ComparisonExpression
<"LIKE"
>
a LIKE "%A?"
Parameters
• ctx: LikeExpressionContext
Returns
ComparisonExpression
<"LIKE"
>
Implementation of
WebdaQLParserVisitor.visitLikeExpression
Source
packages/core/src/stores/webdaql/query.ts:232
visitLimitExpression()
visitLimitExpression(
ctx
):void
Read the limit
Parameters
• ctx: LimitExpressionContext
Returns
void
Implementation of
WebdaQLParserVisitor.visitLimitExpression
Source
packages/core/src/stores/webdaql/query.ts:108
visitOffsetExpression()
visitOffsetExpression(
ctx
):void
Read the offset if provided
Parameters
• ctx: OffsetExpressionContext
Returns
void
Implementation of
WebdaQLParserVisitor.visitOffsetExpression
Source
packages/core/src/stores/webdaql/query.ts:116
visitOrLogicExpression()
visitOrLogicExpression(
ctx
):OrExpression
Get the OrExpression, regrouping all the parameters
By default the parser is doing a OR (b OR (c OR d)) creating 3 depth expressions This visitor simplify to a OR b OR c OR d with only one Expression
Parameters
• ctx: OrLogicExpressionContext
Returns
Implementation of
WebdaQLParserVisitor.visitOrLogicExpression
Source
packages/core/src/stores/webdaql/query.ts:262
visitOrderExpression()
visitOrderExpression(
ctx
):void
Read the order by values
Parameters
• ctx: OrderExpressionContext
Returns
void
Implementation of
WebdaQLParserVisitor.visitOrderExpression
Source
packages/core/src/stores/webdaql/query.ts:133
visitOrderFieldExpression()
visitOrderFieldExpression(
ctx
):OrderBy
Visit a order field expression
Parameters
• ctx: OrderFieldExpressionContext
Returns
Implementation of
WebdaQLParserVisitor.visitOrderFieldExpression
Source
packages/core/src/stores/webdaql/query.ts:123
visitSetExpression()
visitSetExpression(
ctx
):value
[]
Visit each value of the [..., ..., ...] set
Parameters
• ctx: SetExpressionContext
Returns
value
[]
Implementation of
WebdaQLParserVisitor.visitSetExpression
Source
packages/core/src/stores/webdaql/query.ts:223
visitStringLiteral()
visitStringLiteral(
ctx
):string
Read the string literal (removing the simple or double bracket)
Parameters
• ctx: StringLiteralContext
Returns
string
Implementation of
WebdaQLParserVisitor.visitStringLiteral
Source
packages/core/src/stores/webdaql/query.ts:269
visitTerminal()
visitTerminal(
node
):Query
{@inheritDoc }
The default implementation returns the result of #defaultResult defaultResult.
Parameters
• node: TerminalNode
Returns
Implementation of
WebdaQLParserVisitor.visitTerminal
Inherited from
AbstractParseTreeVisitor.visitTerminal
Source
node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:40
visitWebdaql()
visitWebdaql(
ctx
):Query
Return only AndExpression
Parameters
• ctx: WebdaqlContext
Returns
Implementation of
WebdaQLParserVisitor.visitWebdaql