Skip to content

Commit

Permalink
Extract expression evaluators to utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
jitsedesmet authored Oct 8, 2024
1 parent 35fe59c commit 1320785
Show file tree
Hide file tree
Showing 532 changed files with 1,046 additions and 1,127 deletions.
102 changes: 2 additions & 100 deletions .componentsjs-generator-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"packages/statistic-base",
"packages/statistic-link-dereference",
"packages/statistic-link-discovery",
"packages/utils-expression-evaluator",
"packages/utils-bindings-factory",
"packages/utils-bindings-index",
"packages/utils-data-factory",
Expand Down Expand Up @@ -82,106 +83,7 @@
"ExpressionEvaluator",
"AggregateEvaluator",
"ExpressionFunctionBase",
"TermFunctionBase",

"TermTransformer",
"IInternalEvaluator",
"FunctionApplication",
"IEvalContext",
"OverloadTree",
"FunctionArgumentsCache",
"prepareEvaluatorActionContext",
"declare",
"bool",
"string",
"double",
"integer",
"dateTime",
"langString",
"decimal",
"float",
"expressionToVar",
"Builder",
"ExpressionError",
"isExpressionError",
"EmptyAggregateError",
"RDFEqualTypeError",
"IncompatibleLanguageOperation",
"InvalidTimezoneCall",
"InvalidArgumentTypes",
"CoalesceError",
"InError",
"NoAggregator",
"UnboundVariableError",
"CastError",
"ExtensionFunctionError",
"InvalidLexicalForm",
"InvalidArity",
"UnknownOperator",
"typedLiteral",
"TypeURL",
"TypeAlias",
"SparqlOperator",
"SparqlOperators",
"NamedOperator",
"GeneralOperator",
"KnownOperator",
"KnownLiteralTypes",
"isSubTypeOf",
"dayTimeDurationsToSeconds",
"defaultedDateTimeRepresentation",
"defaultedDayTimeDurationRepresentation",
"defaultedDurationRepresentation",
"defaultedYearMonthDurationRepresentation",
"extractRawTimeZone",
"negateDuration",
"toDateTimeRepresentation",
"toUTCDate",
"yearMonthDurationsToMonths",
"DateTimeLiteral",
"DayTimeDurationLiteral",
"DateLiteral",
"DurationLiteral",
"TimeLiteral",
"LangStringLiteral",
"Term",
"YearMonthDurationLiteral",
"Quad",
"Operator",
"NamedNode",
"Variable",
"NumericLiteral",
"BooleanLiteral",
"BlankNode",
"DecimalLiteral",
"DefaultGraph",
"DoubleLiteral",
"Aggregate",
"Existence",
"ExpressionType",
"Literal",
"IntegerLiteral",
"FloatLiteral",
"NonLexicalLiteral",
"StringLiteral",
"TermExpression",
"VariableExpression",
"Expression",
"isNonLexicalLiteral",
"OperatorExpression",
"addDurationToDateTime",
"elapsedDuration",
"parseDateTime",
"parseDayTimeDuration",
"parseDuration",
"parseTime",
"parseYearMonthDuration",
"parseXSDDecimal",
"parseXSDFloat",
"parseXSDInteger",
"parseDate",
"trimToYearMonthDuration",
"trimToDayTimeDuration"
"TermFunctionBase"
],
"modulePrefix": {
"@comunica/actor-query-operation-service": "caqoser",
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const config: Config.InitialOptions = {
transform,
coveragePathIgnorePatterns: [
'<rootDir>/engines/query-sparql/test/util.ts',
'<rootDir>/packages/expression-evaluator/test/util/',
'<rootDir>/packages/utils-expression-evaluator/test/util/',
'engine-default.js',
'index.js',
'node_modules',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { MediatorFunctionFactory, MediatorFunctionFactoryUnsafe } from '@co
import { KeysInitQuery } from '@comunica/context-entries';
import type { IActorTest, TestResult } from '@comunica/core';
import { failTest, passTestVoid } from '@comunica/core';
import { SparqlOperator } from '@comunica/expression-evaluator';
import { SparqlOperator } from '@comunica/utils-expression-evaluator';
import { AverageAggregator } from './AverageAggregator';

export interface IActorBindingsAggregatorFactoryAverageArgs extends IActorBindingsAggregatorFactoryArgs {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-factory';
import { AggregateEvaluator } from '@comunica/bus-bindings-aggregator-factory';
import type { ITermFunction } from '@comunica/bus-function-factory';
import type { IExpressionEvaluator } from '@comunica/expression-evaluator';
import * as Eval from '@comunica/expression-evaluator';
import type { ComunicaDataFactory } from '@comunica/types';
import type { ComunicaDataFactory, IExpressionEvaluator } from '@comunica/types';
import * as Eval from '@comunica/utils-expression-evaluator';
import type * as RDF from '@rdfjs/types';

interface IAverageState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@comunica/bus-function-factory": "^3.2.1",
"@comunica/context-entries": "^3.2.1",
"@comunica/core": "^3.2.1",
"@comunica/expression-evaluator": "^3.2.1",
"@comunica/types": "^3.2.1",
"@comunica/utils-expression-evaluator": "^3.2.1",
"@rdfjs/types": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import type { MediatorFunctionFactory } from '@comunica/bus-function-factory';
import { createFuncMediator } from '@comunica/bus-function-factory/test/util';
import { Bus } from '@comunica/core';
import type { IActionContext } from '@comunica/types';
import { getMockEEActionContext, getMockMediatorExpressionEvaluatorFactory, makeAggregate } from '@comunica/utils-jest';
import {
getMockEEActionContext,
getMockMediatorExpressionEvaluatorFactory,
makeAggregate,
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import { ActorBindingsAggregatorFactoryAverage } from '../lib';
import '@comunica/utils-jest';

describe('ActorBindingsAggregatorFactoryAverage', () => {
let bus: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { ActorExpressionEvaluatorFactory } from '@comunica/bus-expression-e
import type { MediatorFunctionFactory } from '@comunica/bus-function-factory';
import { createFuncMediator } from '@comunica/bus-function-factory/test/util';
import { KeysInitQuery } from '@comunica/context-entries';
import { SparqlOperator } from '@comunica/expression-evaluator';
import type { IActionContext } from '@comunica/types';
import { SparqlOperator } from '@comunica/utils-expression-evaluator';
import {
BF,
decimal,
Expand All @@ -17,7 +17,7 @@ import {
getMockEEFactory,
int,
makeAggregate,
} from '@comunica/utils-jest';
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import type * as RDF from '@rdfjs/types';
import { AverageAggregator } from '../lib/AverageAggregator';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-factory';
import { AggregateEvaluator } from '@comunica/bus-bindings-aggregator-factory';
import type { IExpressionEvaluator } from '@comunica/expression-evaluator';
import { typedLiteral, TypeURL } from '@comunica/expression-evaluator';
import type { IExpressionEvaluator } from '@comunica/types';
import { typedLiteral, TypeURL } from '@comunica/utils-expression-evaluator';
import type * as RDF from '@rdfjs/types';

export class CountAggregator extends AggregateEvaluator implements IBindingsAggregator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"dependencies": {
"@comunica/bus-bindings-aggregator-factory": "^3.2.1",
"@comunica/core": "^3.2.1",
"@comunica/expression-evaluator": "^3.2.1",
"@comunica/types": "^3.2.1",
"@comunica/utils-expression-evaluator": "^3.2.1",
"@rdfjs/types": "*",
"sparqlalgebrajs": "^4.2.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import type {
} from '@comunica/bus-expression-evaluator-factory';
import { Bus } from '@comunica/core';
import type { IActionContext } from '@comunica/types';
import { getMockEEActionContext, getMockMediatorExpressionEvaluatorFactory, makeAggregate } from '@comunica/utils-jest';
import {
getMockEEActionContext,
getMockMediatorExpressionEvaluatorFactory,
makeAggregate,
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import { Algebra } from 'sparqlalgebrajs';
import { Wildcard } from 'sparqljs';
import { ActorBindingsAggregatorFactoryCount } from '../lib';
import '@comunica/utils-jest';

describe('ActorExpressionEvaluatorAggregateCount', () => {
let bus: any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-factory';
import type { ActorExpressionEvaluatorFactory } from '@comunica/bus-expression-evaluator-factory';
import type { IActionContext } from '@comunica/types';
import { BF, DF, getMockEEActionContext, getMockEEFactory, int, makeAggregate } from '@comunica/utils-jest';
import {
BF,
DF,
getMockEEActionContext,
getMockEEFactory,
int,
makeAggregate,
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import type * as RDF from '@rdfjs/types';
import { CountAggregator } from '../lib';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-factory';
import { AggregateEvaluator } from '@comunica/bus-bindings-aggregator-factory';
import * as Eval from '@comunica/expression-evaluator';
import type { ComunicaDataFactory } from '@comunica/types';
import type { ComunicaDataFactory, IExpressionEvaluator } from '@comunica/types';
import * as Eval from '@comunica/utils-expression-evaluator';
import type * as RDF from '@rdfjs/types';

export class GroupConcatAggregator extends AggregateEvaluator implements IBindingsAggregator {
Expand All @@ -11,7 +11,7 @@ export class GroupConcatAggregator extends AggregateEvaluator implements IBindin
private readonly separator: string;

public constructor(
evaluator: Eval.IExpressionEvaluator,
evaluator: IExpressionEvaluator,
distinct: boolean,
private readonly dataFactory: ComunicaDataFactory,
separator?: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"@comunica/bus-bindings-aggregator-factory": "^3.2.1",
"@comunica/context-entries": "^3.2.1",
"@comunica/core": "^3.2.1",
"@comunica/expression-evaluator": "^3.2.1",
"@comunica/types": "^3.2.1",
"@comunica/utils-expression-evaluator": "^3.2.1",
"@rdfjs/types": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import {
getMockEEActionContext,
getMockMediatorExpressionEvaluatorFactory,
makeAggregate,
} from '@comunica/utils-jest';
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import { ArrayIterator } from 'asynciterator';
import { ActorBindingsAggregatorFactoryGroupConcat } from '../lib';
import '@comunica/utils-jest';

describe('ActorBindingsAggregatorFactoryGroupConcat', () => {
let bus: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-fact
import type { ActorExpressionEvaluatorFactory } from '@comunica/bus-expression-evaluator-factory';
import { KeysInitQuery } from '@comunica/context-entries';
import type { IActionContext } from '@comunica/types';
import { BF, DF, getMockEEActionContext, getMockEEFactory, int, makeAggregate } from '@comunica/utils-jest';
import {
BF,
DF,
getMockEEActionContext,
getMockEEFactory,
int,
makeAggregate,
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import type * as RDF from '@rdfjs/types';
import { GroupConcatAggregator } from '../lib/GroupConcatAggregator';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-factory';
import { AggregateEvaluator } from '@comunica/bus-bindings-aggregator-factory';
import type { ITermComparator } from '@comunica/bus-term-comparator-factory';
import type { IExpressionEvaluator } from '@comunica/expression-evaluator';
import type { IExpressionEvaluator } from '@comunica/types';
import type * as RDF from '@rdfjs/types';

export class MaxAggregator extends AggregateEvaluator implements IBindingsAggregator {
Expand Down
4 changes: 2 additions & 2 deletions packages/actor-bindings-aggregator-factory-max/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"dependencies": {
"@comunica/bus-bindings-aggregator-factory": "^3.2.1",
"@comunica/core": "^3.2.1",
"@comunica/types": "^3.2.1",
"@rdfjs/types": "*"
},
"devDependencies": {
"@comunica/bus-term-comparator-factory": "^3.2.1",
"@comunica/expression-evaluator": "^3.2.1"
"@comunica/bus-term-comparator-factory": "^3.2.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import {
getMockEEActionContext,
getMockMediatorExpressionEvaluatorFactory,
makeAggregate,
} from '@comunica/utils-jest';
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import { ArrayIterator } from 'asynciterator';
import { ActorBindingsAggregatorFactoryMax } from '../lib';
import '@comunica/utils-jest';

describe('ActorBindingsAggregatorFactoryMax', () => {
let bus: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
makeAggregate,
nonLiteral,
string,
} from '@comunica/utils-jest';
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import type * as RDF from '@rdfjs/types';
import { MaxAggregator } from '../lib';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-factory';
import { AggregateEvaluator } from '@comunica/bus-bindings-aggregator-factory';
import type { ITermComparator } from '@comunica/bus-term-comparator-factory';
import type { IExpressionEvaluator } from '@comunica/expression-evaluator';
import type { IExpressionEvaluator } from '@comunica/types';
import type * as RDF from '@rdfjs/types';

export class MinAggregator extends AggregateEvaluator implements IBindingsAggregator {
Expand Down
4 changes: 2 additions & 2 deletions packages/actor-bindings-aggregator-factory-min/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"dependencies": {
"@comunica/bus-bindings-aggregator-factory": "^3.2.1",
"@comunica/core": "^3.2.1",
"@comunica/types": "^3.2.1",
"@rdfjs/types": "*"
},
"devDependencies": {
"@comunica/bus-term-comparator-factory": "^3.2.1",
"@comunica/expression-evaluator": "^3.2.1"
"@comunica/bus-term-comparator-factory": "^3.2.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import {
getMockEEActionContext,
getMockMediatorExpressionEvaluatorFactory,
makeAggregate,
} from '@comunica/utils-jest';
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import { ArrayIterator } from 'asynciterator';
import { ActorBindingsAggregatorFactoryMin } from '../lib';
import '@comunica/utils-jest';

describe('ActorBindingsAggregatorFactoryMin', () => {
let bus: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
makeAggregate,
nonLiteral,
string,
} from '@comunica/utils-jest';
} from '@comunica/utils-expression-evaluator/test/util/helpers';
import type * as RDF from '@rdfjs/types';
import { MinAggregator } from '../lib/MinAggregator';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IBindingsAggregator } from '@comunica/bus-bindings-aggregator-factory';
import { AggregateEvaluator } from '@comunica/bus-bindings-aggregator-factory';
import type { IExpressionEvaluator } from '@comunica/expression-evaluator';
import type { IExpressionEvaluator } from '@comunica/types';
import type * as RDF from '@rdfjs/types';

export class SampleAggregator extends AggregateEvaluator implements IBindingsAggregator {
Expand Down
Loading

0 comments on commit 1320785

Please sign in to comment.