diff --git a/packages/actor-bindings-aggregator-factory-average/lib/ActorBindingsAggregatorFactoryAverage.ts b/packages/actor-bindings-aggregator-factory-average/lib/ActorBindingsAggregatorFactoryAverage.ts index 48fe952e1e..aad1dfe3b7 100644 --- a/packages/actor-bindings-aggregator-factory-average/lib/ActorBindingsAggregatorFactoryAverage.ts +++ b/packages/actor-bindings-aggregator-factory-average/lib/ActorBindingsAggregatorFactoryAverage.ts @@ -27,7 +27,7 @@ export class ActorBindingsAggregatorFactoryAverage extends ActorBindingsAggregat Promise { return { aggregator: new AverageAggregator( - await factory.createEvaluator(expr, context), + await factory.createEvaluator(expr.expression, context), expr.distinct, await factory.createFunction({ functionName: RegularOperator.ADDITION, diff --git a/packages/actor-bindings-aggregator-factory-count/lib/ActorBindingsAggregatorFactoryCount.ts b/packages/actor-bindings-aggregator-factory-count/lib/ActorBindingsAggregatorFactoryCount.ts index 3c222a6fed..7314058972 100644 --- a/packages/actor-bindings-aggregator-factory-count/lib/ActorBindingsAggregatorFactoryCount.ts +++ b/packages/actor-bindings-aggregator-factory-count/lib/ActorBindingsAggregatorFactoryCount.ts @@ -29,7 +29,7 @@ export class ActorBindingsAggregatorFactoryCount extends ActorBindingsAggregator public async run(action: IActionBindingsAggregatorFactory): Promise { return { aggregator: new CountAggregator( - await action.factory.createEvaluator(action.expr, action.context), + await action.factory.createEvaluator(action.expr.expression, action.context), action.expr.distinct, ), }; diff --git a/packages/actor-bindings-aggregator-factory-count/test/CountAggregator-test.ts b/packages/actor-bindings-aggregator-factory-count/test/CountAggregator-test.ts index bd7a0614c5..91f9d94cdc 100644 --- a/packages/actor-bindings-aggregator-factory-count/test/CountAggregator-test.ts +++ b/packages/actor-bindings-aggregator-factory-count/test/CountAggregator-test.ts @@ -4,7 +4,7 @@ import { BF, DF, int, makeAggregate } from '@comunica/jest'; import type { IActionContext, IBindingsAggregator, IExpressionEvaluatorFactory } from '@comunica/types'; import type * as RDF from '@rdfjs/types'; import { ArrayIterator } from 'asynciterator'; -import { CountAggregator } from '../lib/CountAggregator'; +import { CountAggregator } from '../lib'; async function runAggregator(aggregator: IBindingsAggregator, input: RDF.Bindings[]): Promise { for (const bindings of input) { @@ -42,11 +42,12 @@ describe('CountAggregator', () => { describe('non distinctive count', () => { let aggregator: IBindingsAggregator; - beforeEach(() => { + beforeEach(async() => { aggregator = new CountAggregator( - makeAggregate('count', false), - expressionEvaluatorFactory, - context, + await expressionEvaluatorFactory.createEvaluator( + makeAggregate('count', false), new ActionContext({}), + ), + false, ); }); @@ -69,11 +70,12 @@ describe('CountAggregator', () => { describe('distinctive count', () => { let aggregator: IBindingsAggregator; - beforeEach(() => { + beforeEach(async() => { aggregator = new CountAggregator( - makeAggregate('count', true), - expressionEvaluatorFactory, - context, + await expressionEvaluatorFactory.createEvaluator( + makeAggregate('count', true), new ActionContext({}), + ), + true, ); }); diff --git a/packages/actor-bindings-aggregator-factory-group-concat/lib/ActorBindingsAggregatorFactoryGroupConcat.ts b/packages/actor-bindings-aggregator-factory-group-concat/lib/ActorBindingsAggregatorFactoryGroupConcat.ts index 44da25adeb..369de85e52 100644 --- a/packages/actor-bindings-aggregator-factory-group-concat/lib/ActorBindingsAggregatorFactoryGroupConcat.ts +++ b/packages/actor-bindings-aggregator-factory-group-concat/lib/ActorBindingsAggregatorFactoryGroupConcat.ts @@ -27,7 +27,7 @@ export class ActorBindingsAggregatorFactoryGroupConcat extends ActorBindingsAggr public async run(action: IActionBindingsAggregatorFactory): Promise { return { aggregator: new GroupConcatAggregator( - await action.factory.createEvaluator(action.expr, action.context), + await action.factory.createEvaluator(action.expr.expression, action.context), action.expr.distinct, action.expr.separator, ), diff --git a/packages/actor-bindings-aggregator-factory-max/lib/ActorBindingsAggregatorFactoryMax.ts b/packages/actor-bindings-aggregator-factory-max/lib/ActorBindingsAggregatorFactoryMax.ts index 4a9215d28a..704c79ffc9 100644 --- a/packages/actor-bindings-aggregator-factory-max/lib/ActorBindingsAggregatorFactoryMax.ts +++ b/packages/actor-bindings-aggregator-factory-max/lib/ActorBindingsAggregatorFactoryMax.ts @@ -27,7 +27,7 @@ export class ActorBindingsAggregatorFactoryMax extends ActorBindingsAggregatorFa public async run(action: IActionBindingsAggregatorFactory): Promise { return { aggregator: new MaxAggregator( - await action.factory.createEvaluator(action.expr, action.context), + await action.factory.createEvaluator(action.expr.expression, action.context), action.expr.distinct, await action.factory.createOrderByEvaluator(action.context), ), diff --git a/packages/actor-bindings-aggregator-factory-min/lib/ActorBindingsAggregatorFactoryMin.ts b/packages/actor-bindings-aggregator-factory-min/lib/ActorBindingsAggregatorFactoryMin.ts index 487c4c5794..b56d9dcf19 100644 --- a/packages/actor-bindings-aggregator-factory-min/lib/ActorBindingsAggregatorFactoryMin.ts +++ b/packages/actor-bindings-aggregator-factory-min/lib/ActorBindingsAggregatorFactoryMin.ts @@ -27,7 +27,7 @@ export class ActorBindingsAggregatorFactoryMin extends ActorBindingsAggregatorFa public async run(action: IActionBindingsAggregatorFactory): Promise { return { aggregator: new MinAggregator( - await action.factory.createEvaluator(action.expr, action.context), + await action.factory.createEvaluator(action.expr.expression, action.context), action.expr.distinct, await action.factory.createOrderByEvaluator(action.context), ), diff --git a/packages/actor-bindings-aggregator-factory-sample/lib/ActorBindingsAggregatorFactorySample.ts b/packages/actor-bindings-aggregator-factory-sample/lib/ActorBindingsAggregatorFactorySample.ts index 46006ec293..3df38ada99 100644 --- a/packages/actor-bindings-aggregator-factory-sample/lib/ActorBindingsAggregatorFactorySample.ts +++ b/packages/actor-bindings-aggregator-factory-sample/lib/ActorBindingsAggregatorFactorySample.ts @@ -27,7 +27,7 @@ export class ActorBindingsAggregatorFactorySample extends ActorBindingsAggregato public async run(action: IActionBindingsAggregatorFactory): Promise { return { aggregator: new SampleAggregator( - await action.factory.createEvaluator(action.expr, action.context), + await action.factory.createEvaluator(action.expr.expression, action.context), action.expr.distinct, ), }; diff --git a/packages/actor-bindings-aggregator-factory-sum/lib/ActorBindingsAggregatorFactorySum.ts b/packages/actor-bindings-aggregator-factory-sum/lib/ActorBindingsAggregatorFactorySum.ts index 285706225d..eb5030c3ad 100644 --- a/packages/actor-bindings-aggregator-factory-sum/lib/ActorBindingsAggregatorFactorySum.ts +++ b/packages/actor-bindings-aggregator-factory-sum/lib/ActorBindingsAggregatorFactorySum.ts @@ -30,7 +30,7 @@ export class ActorBindingsAggregatorFactorySum extends ActorBindingsAggregatorFa Promise { return { aggregator: new SumAggregator( - await factory.createEvaluator(expr, context), + await factory.createEvaluator(expr.expression, context), expr.distinct, await factory.createFunction({ functionName: RegularOperator.ADDITION, diff --git a/packages/actor-bindings-aggregator-factory-wildcard-count/lib/ActorBindingsAggregatorFactoryWildcardCount.ts b/packages/actor-bindings-aggregator-factory-wildcard-count/lib/ActorBindingsAggregatorFactoryWildcardCount.ts index 3e75b0ccd0..80f663d98f 100644 --- a/packages/actor-bindings-aggregator-factory-wildcard-count/lib/ActorBindingsAggregatorFactoryWildcardCount.ts +++ b/packages/actor-bindings-aggregator-factory-wildcard-count/lib/ActorBindingsAggregatorFactoryWildcardCount.ts @@ -27,7 +27,7 @@ export class ActorBindingsAggregatorFactoryWildcardCount extends ActorBindingsAg public async run(action: IActionBindingsAggregatorFactory): Promise { return { aggregator: new WildcardCountAggregator( - await action.factory.createEvaluator(action.expr, action.context), + await action.factory.createEvaluator(action.expr.expression, action.context), action.expr.distinct, ), }; diff --git a/packages/bus-bindings-aggregator-factory/lib/AggregateEvaluator.ts b/packages/bus-bindings-aggregator-factory/lib/AggregateEvaluator.ts index 9bd6e445c6..f9e1eead0d 100644 --- a/packages/bus-bindings-aggregator-factory/lib/AggregateEvaluator.ts +++ b/packages/bus-bindings-aggregator-factory/lib/AggregateEvaluator.ts @@ -13,15 +13,13 @@ import * as RdfString from 'rdf-string'; * NOTE: The wildcard count aggregator significantly differs from the others and overloads parts of this class. */ export abstract class AggregateEvaluator { - private readonly throwError: boolean; private errorOccurred = false; protected readonly variableValues: Set; protected constructor(protected readonly evaluator: IExpressionEvaluator, protected readonly distinct: boolean, - throwError?: boolean) { - this.throwError = throwError || false; + private readonly throwError: boolean = false) { this.errorOccurred = false; this.variableValues = new Set();