Skip to main content

@webda/coreReadme | API


Class: PartialExpressionBuilder

Create Expression based on the parsed token

Expression allow to optimize and split between Query and Filter

Extends

Constructors

new PartialExpressionBuilder()

new PartialExpressionBuilder(): PartialExpressionBuilder

Returns

PartialExpressionBuilder

Inherited from

ExpressionBuilder.constructor

Properties

limit

limit: number

Contain the parsed limit

Inherited from

ExpressionBuilder.limit

Source

packages/core/src/stores/webdaql/query.ts:70


offset

offset: string

Contain the parsed offset

Inherited from

ExpressionBuilder.offset

Source

packages/core/src/stores/webdaql/query.ts:74


orderBy

orderBy: OrderBy[]

Inherited from

ExpressionBuilder.orderBy

Source

packages/core/src/stores/webdaql/query.ts:75


partial

partial: boolean

Enforce the partial mode

Source

packages/core/src/stores/webdaql/query.ts:760


partialMatch

partialMatch: boolean

If eval was called in partial mode

Source

packages/core/src/stores/webdaql/query.ts:764

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

Query

The updated aggregate result.

Inherited from

ExpressionBuilder.aggregateResult

Source

node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:77


defaultResult()

protected defaultResult(): Query

Default result for the override

Returns

Query

Inherited from

ExpressionBuilder.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[]

Inherited from

ExpressionBuilder.getComparison

Source

packages/core/src/stores/webdaql/query.ts:179


getLimit()

getLimit(): number

Get limit

Returns

number

Inherited from

ExpressionBuilder.getLimit

Source

packages/core/src/stores/webdaql/query.ts:100


getOffset()

getOffset(): string

Get offset

Returns

string

Inherited from

ExpressionBuilder.getOffset

Source

packages/core/src/stores/webdaql/query.ts:92


setPartial()

setPartial(partial): void

Parameters

partial: boolean

Returns

void

Source

packages/core/src/stores/webdaql/query.ts:766


setPartialMatch()

setPartialMatch(partial): void

Parameters

partial: boolean

Returns

void

Source

packages/core/src/stores/webdaql/query.ts:770


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

ExpressionBuilder.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

Query

Inherited from

ExpressionBuilder.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

AndExpression

Inherited from

ExpressionBuilder.visitAndLogicExpression

Source

packages/core/src/stores/webdaql/query.ts:207


visitBinaryComparisonExpression()

visitBinaryComparisonExpression(ctx): PartialComparisonExpression<any>

Implement the BinaryComparison with all methods managed

Parameters

ctx: any

Returns

PartialComparisonExpression<any>

Overrides

ExpressionBuilder.visitBinaryComparisonExpression

Source

packages/core/src/stores/webdaql/query.ts:787


visitBooleanLiteral()

visitBooleanLiteral(ctx): boolean

Read the boolean literal

Parameters

ctx: BooleanLiteralContext

Returns

boolean

Inherited from

ExpressionBuilder.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

Query

Inherited from

ExpressionBuilder.visitChildren

Source

node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:33


visitContainsExpression()

visitContainsExpression(ctx): PartialComparisonExpression<"CONTAINS">

Map the a CONTAINS 'b'

Parameters

ctx: any

Returns

PartialComparisonExpression<"CONTAINS">

Overrides

ExpressionBuilder.visitContainsExpression

Source

packages/core/src/stores/webdaql/query.ts:805


visitErrorNode()

visitErrorNode(node): Query

{@inheritDoc }

The default implementation returns the result of #defaultResult defaultResult.

Parameters

node: ErrorNode

Returns

Query

Inherited from

ExpressionBuilder.visitErrorNode

Source

node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:47


visitInExpression()

visitInExpression(ctx): PartialComparisonExpression<"IN">

Map the a IN ['b','c']

Parameters

ctx: any

Returns

PartialComparisonExpression<"IN">

Overrides

ExpressionBuilder.visitInExpression

Source

packages/core/src/stores/webdaql/query.ts:796


visitIntegerLiteral()

visitIntegerLiteral(ctx): number

Read the number literal

Parameters

ctx: IntegerLiteralContext

Returns

number

Inherited from

ExpressionBuilder.visitIntegerLiteral

Source

packages/core/src/stores/webdaql/query.ts:283


visitLikeExpression()

visitLikeExpression(ctx): PartialComparisonExpression<"LIKE">

a LIKE "%A?"

Parameters

ctx: any

Returns

PartialComparisonExpression<"LIKE">

Overrides

ExpressionBuilder.visitLikeExpression

Source

packages/core/src/stores/webdaql/query.ts:778


visitLimitExpression()

visitLimitExpression(ctx): void

Read the limit

Parameters

ctx: LimitExpressionContext

Returns

void

Inherited from

ExpressionBuilder.visitLimitExpression

Source

packages/core/src/stores/webdaql/query.ts:108


visitOffsetExpression()

visitOffsetExpression(ctx): void

Read the offset if provided

Parameters

ctx: OffsetExpressionContext

Returns

void

Inherited from

ExpressionBuilder.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

OrExpression

Inherited from

ExpressionBuilder.visitOrLogicExpression

Source

packages/core/src/stores/webdaql/query.ts:262


visitOrderExpression()

visitOrderExpression(ctx): void

Read the order by values

Parameters

ctx: OrderExpressionContext

Returns

void

Inherited from

ExpressionBuilder.visitOrderExpression

Source

packages/core/src/stores/webdaql/query.ts:133


visitOrderFieldExpression()

visitOrderFieldExpression(ctx): OrderBy

Visit a order field expression

Parameters

ctx: OrderFieldExpressionContext

Returns

OrderBy

Inherited from

ExpressionBuilder.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[]

Inherited from

ExpressionBuilder.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

Inherited from

ExpressionBuilder.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

Query

Inherited from

ExpressionBuilder.visitTerminal

Source

node_modules/antlr4ts/tree/AbstractParseTreeVisitor.d.ts:40


visitWebdaql()

visitWebdaql(ctx): Query

Return only AndExpression

Parameters

ctx: WebdaqlContext

Returns

Query

Inherited from

ExpressionBuilder.visitWebdaql

Source

packages/core/src/stores/webdaql/query.ts:144