@comunica/bus-bindings-aggregator-factory 4.5.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-bindings-aggregator-factory/^4.0.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-bindings-aggregator-factory/^5.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^5.0.0/components/context.jsonld"
5
5
  ],
6
6
  "@id": "npmd:@comunica/bus-bindings-aggregator-factory",
7
7
  "components": [
@@ -58,37 +58,37 @@
58
58
  "genericTypeInstances": [
59
59
  {
60
60
  "@type": "ParameterRangeGenericTypeReference",
61
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
61
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
62
62
  },
63
63
  {
64
64
  "@type": "ParameterRangeGenericTypeReference",
65
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
65
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
66
66
  },
67
67
  {
68
68
  "@type": "ParameterRangeGenericTypeReference",
69
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
69
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
70
70
  },
71
71
  {
72
72
  "@type": "ParameterRangeGenericTypeReference",
73
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
73
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
74
74
  }
75
75
  ]
76
76
  },
77
77
  {
78
78
  "@type": "ParameterRangeGenericTypeReference",
79
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
79
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
80
80
  },
81
81
  {
82
82
  "@type": "ParameterRangeGenericTypeReference",
83
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
83
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
84
84
  },
85
85
  {
86
86
  "@type": "ParameterRangeGenericTypeReference",
87
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
87
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
88
88
  },
89
89
  {
90
90
  "@type": "ParameterRangeGenericTypeReference",
91
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
91
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
92
92
  }
93
93
  ]
94
94
  },
@@ -125,19 +125,19 @@
125
125
  "genericTypeInstances": [
126
126
  {
127
127
  "@type": "ParameterRangeGenericTypeReference",
128
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
128
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
129
129
  },
130
130
  {
131
131
  "@type": "ParameterRangeGenericTypeReference",
132
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
132
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
133
133
  },
134
134
  {
135
135
  "@type": "ParameterRangeGenericTypeReference",
136
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
136
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
137
137
  },
138
138
  {
139
139
  "@type": "ParameterRangeGenericTypeReference",
140
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
140
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
141
141
  }
142
142
  ]
143
143
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-bindings-aggregator-factory/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-bindings-aggregator-factory/^5.0.0/components/context.jsonld"
4
4
  ],
5
5
  "@id": "npmd:@comunica/bus-bindings-aggregator-factory",
6
6
  "@type": "Module",
@@ -3,7 +3,7 @@
3
3
  "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
4
4
  {
5
5
  "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
- "cbbaf": "npmd:@comunica/bus-bindings-aggregator-factory/^4.0.0/",
6
+ "cbbaf": "npmd:@comunica/bus-bindings-aggregator-factory/^5.0.0/",
7
7
  "ActorBindingsAggregatorFactory": {
8
8
  "@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory",
9
9
  "@prefix": true,
@@ -1,8 +1,8 @@
1
1
  import type { MediatorExpressionEvaluatorFactory } from '@comunica/bus-expression-evaluator-factory';
2
2
  import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';
3
3
  import { Actor } from '@comunica/core';
4
+ import type { Algebra } from '@comunica/utils-algebra';
4
5
  import type * as RDF from '@rdfjs/types';
5
- import type { Algebra } from 'sparqlalgebrajs';
6
6
  /**
7
7
  * A comunica actor for creating Binding-Aggregator-factories.
8
8
  *
@@ -14,6 +14,7 @@ const core_1 = require("@comunica/core");
14
14
  * @see IActorBindingsAggregatorFactoryOutput
15
15
  */
16
16
  class ActorBindingsAggregatorFactory extends core_1.Actor {
17
+ mediatorExpressionEvaluatorFactory;
17
18
  /* eslint-disable max-len */
18
19
  /**
19
20
  * @param args -
@@ -1 +1 @@
1
- {"version":3,"file":"ActorBindingsAggregatorFactory.js","sourceRoot":"","sources":["ActorBindingsAggregatorFactory.ts"],"names":[],"mappings":";;;AAIA,yCAAuC;AAIvC;;;;;;;;;;GAUG;AACH,MAAsB,8BAA+C,SAAQ,YAK5E;IAEC,4BAA4B;IAC5B;;;;OAIG;IACH,2BAA2B;IAC3B,YAAsB,IAA6C;QACjE,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,kCAAkC,GAAG,IAAI,CAAC,kCAAkC,CAAC;IACpF,CAAC;CACF;AAlBD,wEAkBC","sourcesContent":["import type {\n MediatorExpressionEvaluatorFactory,\n} from '@comunica/bus-expression-evaluator-factory';\nimport type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';\nimport { Actor } from '@comunica/core';\nimport type * as RDF from '@rdfjs/types';\nimport type { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica actor for creating Binding-Aggregator-factories.\n *\n * Actor types:\n * * Input: IActionBindingsAggregatorFactory: A SPARQL expression and a factory for an expression evaluator.\n * * Test: <none>\n * * Output: IActorBindingsAggregatorFactoryOutput: An aggregator of RDF bindings.\n *\n * @see IActionBindingsAggregatorFactory\n * @see IActorBindingsAggregatorFactoryOutput\n */\nexport abstract class ActorBindingsAggregatorFactory<TS = undefined> extends Actor<\nIActionBindingsAggregatorFactory,\nIActorTest,\nIActorBindingsAggregatorFactoryOutput,\nTS\n> {\n protected readonly mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;\n /* eslint-disable max-len */\n /**\n * @param args -\n * \\ @defaultNested {<default_bus> a <cc:components/Bus.jsonld#Bus>} bus\n * \\ @defaultNested {Creation of Aggregator failed: none of the configured actors were able to handle ${action.expr.aggregator}} busFailMessage\n */\n /* eslint-enable max-len */\n protected constructor(args: IActorBindingsAggregatorFactoryArgs<TS>) {\n super(args);\n this.mediatorExpressionEvaluatorFactory = args.mediatorExpressionEvaluatorFactory;\n }\n}\n\nexport interface IActionBindingsAggregatorFactory extends IAction {\n expr: Algebra.AggregateExpression;\n}\n\n/**\n * Instances of this interface perform a specific aggregation of bindings.\n * You can put bindings and when all bindings have been put, request the result.\n */\nexport interface IBindingsAggregator {\n /**\n * Registers bindings to the aggregator. Each binding you put has the ability to change the aggregation result.\n * @param bindings the bindings to put.\n */\n putBindings: (bindings: RDF.Bindings) => Promise<void>;\n\n /**\n * Request the result term of aggregating the bindings you have put in the aggregator.\n */\n result: () => Promise<RDF.Term | undefined>;\n}\n\nexport interface IActorBindingsAggregatorFactoryOutput extends IActorOutput, IBindingsAggregator {}\n\nexport interface IActorBindingsAggregatorFactoryArgs<TS = undefined> extends IActorArgs<\nIActionBindingsAggregatorFactory,\nIActorTest,\nIActorBindingsAggregatorFactoryOutput,\nTS\n> {\n mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;\n}\n\nexport type MediatorBindingsAggregatorFactory = Mediate<\nIActionBindingsAggregatorFactory,\nIActorBindingsAggregatorFactoryOutput\n>;\n"]}
1
+ {"version":3,"file":"ActorBindingsAggregatorFactory.js","sourceRoot":"","sources":["ActorBindingsAggregatorFactory.ts"],"names":[],"mappings":";;;AAIA,yCAAuC;AAIvC;;;;;;;;;;GAUG;AACH,MAAsB,8BAA+C,SAAQ,YAK5E;IACoB,kCAAkC,CAAqC;IAC1F,4BAA4B;IAC5B;;;;OAIG;IACH,2BAA2B;IAC3B,YAAsB,IAA6C;QACjE,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,kCAAkC,GAAG,IAAI,CAAC,kCAAkC,CAAC;IACpF,CAAC;CACF;AAlBD,wEAkBC","sourcesContent":["import type {\n MediatorExpressionEvaluatorFactory,\n} from '@comunica/bus-expression-evaluator-factory';\nimport type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';\nimport { Actor } from '@comunica/core';\nimport type { Algebra } from '@comunica/utils-algebra';\nimport type * as RDF from '@rdfjs/types';\n\n/**\n * A comunica actor for creating Binding-Aggregator-factories.\n *\n * Actor types:\n * * Input: IActionBindingsAggregatorFactory: A SPARQL expression and a factory for an expression evaluator.\n * * Test: <none>\n * * Output: IActorBindingsAggregatorFactoryOutput: An aggregator of RDF bindings.\n *\n * @see IActionBindingsAggregatorFactory\n * @see IActorBindingsAggregatorFactoryOutput\n */\nexport abstract class ActorBindingsAggregatorFactory<TS = undefined> extends Actor<\nIActionBindingsAggregatorFactory,\nIActorTest,\nIActorBindingsAggregatorFactoryOutput,\nTS\n> {\n protected readonly mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;\n /* eslint-disable max-len */\n /**\n * @param args -\n * \\ @defaultNested {<default_bus> a <cc:components/Bus.jsonld#Bus>} bus\n * \\ @defaultNested {Creation of Aggregator failed: none of the configured actors were able to handle ${action.expr.aggregator}} busFailMessage\n */\n /* eslint-enable max-len */\n protected constructor(args: IActorBindingsAggregatorFactoryArgs<TS>) {\n super(args);\n this.mediatorExpressionEvaluatorFactory = args.mediatorExpressionEvaluatorFactory;\n }\n}\n\nexport interface IActionBindingsAggregatorFactory extends IAction {\n expr: Algebra.AggregateExpression;\n}\n\n/**\n * Instances of this interface perform a specific aggregation of bindings.\n * You can put bindings and when all bindings have been put, request the result.\n */\nexport interface IBindingsAggregator {\n /**\n * Registers bindings to the aggregator. Each binding you put has the ability to change the aggregation result.\n * @param bindings the bindings to put.\n */\n putBindings: (bindings: RDF.Bindings) => Promise<void>;\n\n /**\n * Request the result term of aggregating the bindings you have put in the aggregator.\n */\n result: () => Promise<RDF.Term | undefined>;\n}\n\nexport interface IActorBindingsAggregatorFactoryOutput extends IActorOutput, IBindingsAggregator {}\n\nexport interface IActorBindingsAggregatorFactoryArgs<TS = undefined> extends IActorArgs<\nIActionBindingsAggregatorFactory,\nIActorTest,\nIActorBindingsAggregatorFactoryOutput,\nTS\n> {\n mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;\n}\n\nexport type MediatorBindingsAggregatorFactory = Mediate<\nIActionBindingsAggregatorFactory,\nIActorBindingsAggregatorFactoryOutput\n>;\n"]}
File without changes
@@ -9,12 +9,18 @@ const RdfString = require("rdf-string");
9
9
  * NOTE: The wildcard count aggregator significantly differs from the others and overloads parts of this class.
10
10
  */
11
11
  class AggregateEvaluator {
12
+ evaluator;
13
+ distinct;
14
+ throwError;
15
+ errorOccurred = false;
16
+ variableValues;
17
+ superTypeProvider;
18
+ termTransformer;
12
19
  constructor(evaluator, distinct, throwError = false) {
13
20
  this.evaluator = evaluator;
14
21
  this.distinct = distinct;
15
22
  this.throwError = throwError;
16
23
  this.errorOccurred = false;
17
- this.errorOccurred = false;
18
24
  this.superTypeProvider = evaluator.context.getSafe(context_entries_1.KeysExpressionEvaluator.superTypeProvider);
19
25
  this.termTransformer = new Eval.TermTransformer(this.superTypeProvider);
20
26
  this.variableValues = new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"AggregateEvaluator.js","sourceRoot":"","sources":["AggregateEvaluator.ts"],"names":[],"mappings":";;;AAAA,+DAAoE;AAEpE,6DAA6D;AAE7D,wCAAwC;AAExC;;;GAGG;AACH,MAAsB,kBAAkB;IAQtC,YACqB,SAA+B,EAC/B,QAAiB,EACnB,aAAa,KAAK;QAFhB,cAAS,GAAT,SAAS,CAAsB;QAC/B,aAAQ,GAAR,QAAQ,CAAS;QACnB,eAAU,GAAV,UAAU,CAAQ;QAV7B,kBAAa,GAAG,KAAK,CAAC;QAY5B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,yCAAuB,CAAC,iBAAiB,CAAC,CAAC;QAC9F,IAAI,CAAC,eAAe,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAExE,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;IAClC,CAAC;IAKM,cAAc;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACI,UAAU;QACf,MAAM,GAAG,GA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AC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,IAAc;QAC3C,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAC1G,CAAC;aAAM,IACL,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAChG,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,KAAK,eAAe,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAC1I,CAAC;QACD,OAA6B,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC3E,CAAC;CACF;AA5FD,gDA4FC","sourcesContent":["import { KeysExpressionEvaluator } from '@comunica/context-entries';\nimport type { IExpressionEvaluator, ISuperTypeProvider } from '@comunica/types';\nimport * as Eval from '@comunica/utils-expression-evaluator';\nimport type * as RDF from '@rdfjs/types';\nimport * as RdfString from 'rdf-string';\n\n/**\n * This is the base class for all aggregators.\n * NOTE: The wildcard count aggregator significantly differs from the others and overloads parts of this class.\n */\nexport abstract class AggregateEvaluator {\n private errorOccurred = false;\n\n protected readonly variableValues: Set<string>;\n\n protected readonly superTypeProvider: ISuperTypeProvider;\n protected readonly termTransformer: Eval.TermTransformer;\n\n protected constructor(\n protected readonly evaluator: IExpressionEvaluator,\n protected readonly distinct: boolean,\n private readonly throwError = false,\n ) {\n this.errorOccurred = false;\n this.superTypeProvider = evaluator.context.getSafe(KeysExpressionEvaluator.superTypeProvider);\n this.termTransformer = new Eval.TermTransformer(this.superTypeProvider);\n\n this.variableValues = new Set();\n }\n\n protected abstract putTerm(term: RDF.Term): void;\n protected abstract termResult(): RDF.Term | undefined;\n\n public emptyValueTerm(): RDF.Term | undefined {\n return undefined;\n }\n\n /**\n * The spec says to throw an error when a set function is called on an empty\n * set (unless explicitly mentioned otherwise like COUNT).\n * However, aggregate error handling says to not bind the result in case of an\n * error. So to simplify logic in the caller, we return undefined by default.\n */\n public emptyValue(): RDF.Term | undefined {\n const val = this.emptyValueTerm();\n if (val === undefined && this.throwError) {\n throw new Eval.EmptyAggregateError();\n }\n return val;\n }\n\n /**\n * Base implementation of putBindings, that evaluates to a term and then calls putTerm.\n * The WildcardCountAggregator will completely discard this implementation.\n * @param bindings\n */\n public async putBindings(bindings: RDF.Bindings): Promise<void> {\n if (this.errorOccurred) {\n return;\n }\n try {\n const term = await this.evaluator.evaluate(bindings);\n if (!term || this.errorOccurred) {\n return;\n }\n\n // Handle DISTINCT before putting the term\n if (!this.distinct || !this.variableValues.has(RdfString.termToString(term))) {\n this.putTerm(term);\n if (this.distinct) {\n this.variableValues.add(RdfString.termToString(term));\n }\n }\n } catch (error: unknown) {\n this.safeThrow(error);\n }\n }\n\n public async result(): Promise<RDF.Term | undefined> {\n if (this.errorOccurred) {\n return undefined;\n }\n return this.termResult();\n }\n\n private safeThrow(err: unknown): void {\n if (this.throwError) {\n throw err;\n } else {\n this.errorOccurred = true;\n }\n }\n\n protected termToNumericOrError(term: RDF.Term): Eval.NumericLiteral {\n if (term.termType !== 'Literal') {\n throw new Error(`Term with value ${term.value} has type ${term.termType} and is not a numeric literal`);\n } else if (\n !Eval.isSubTypeOf(term.datatype.value, Eval.TypeAlias.SPARQL_NUMERIC, this.superTypeProvider)) {\n throw new Error(`Term datatype ${term.datatype.value} with value ${term.value} has type ${term.termType} and is not a numeric literal`);\n }\n return <Eval.NumericLiteral> this.termTransformer.transformLiteral(term);\n }\n}\n"]}
1
+ {"version":3,"file":"AggregateEvaluator.js","sourceRoot":"","sources":["AggregateEvalu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AAI,CAAC,QAAQ,CAAC,KAAK,eAAe,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAC1I,CAAC;QACD,OAA6B,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC3E,CAAC;CACF;AA5FD,gDA4FC","sourcesContent":["import { KeysExpressionEvaluator } from '@comunica/context-entries';\nimport type { IExpressionEvaluator, ISuperTypeProvider } from '@comunica/types';\nimport * as Eval from '@comunica/utils-expression-evaluator';\nimport type * as RDF from '@rdfjs/types';\nimport * as RdfString from 'rdf-string';\n\n/**\n * This is the base class for all aggregators.\n * NOTE: The wildcard count aggregator significantly differs from the others and overloads parts of this class.\n */\nexport abstract class AggregateEvaluator {\n private errorOccurred = false;\n\n protected readonly variableValues: Set<string>;\n\n protected readonly superTypeProvider: ISuperTypeProvider;\n protected readonly termTransformer: Eval.TermTransformer;\n\n protected constructor(\n protected readonly evaluator: IExpressionEvaluator,\n protected readonly distinct: boolean,\n private readonly throwError = false,\n ) {\n this.errorOccurred = false;\n this.superTypeProvider = evaluator.context.getSafe(KeysExpressionEvaluator.superTypeProvider);\n this.termTransformer = new Eval.TermTransformer(this.superTypeProvider);\n\n this.variableValues = new Set();\n }\n\n protected abstract putTerm(term: RDF.Term): void;\n protected abstract termResult(): RDF.Term | undefined;\n\n public emptyValueTerm(): RDF.Term | undefined {\n return undefined;\n }\n\n /**\n * The spec says to throw an error when a set function is called on an empty\n * set (unless explicitly mentioned otherwise like COUNT).\n * However, aggregate error handling says to not bind the result in case of an\n * error. So to simplify logic in the caller, we return undefined by default.\n */\n public emptyValue(): RDF.Term | undefined {\n const val = this.emptyValueTerm();\n if (val === undefined && this.throwError) {\n throw new Eval.EmptyAggregateError();\n }\n return val;\n }\n\n /**\n * Base implementation of putBindings, that evaluates to a term and then calls putTerm.\n * The WildcardCountAggregator will completely discard this implementation.\n * @param bindings\n */\n public async putBindings(bindings: RDF.Bindings): Promise<void> {\n if (this.errorOccurred) {\n return;\n }\n try {\n const term = await this.evaluator.evaluate(bindings);\n if (!term || this.errorOccurred) {\n return;\n }\n\n // Handle DISTINCT before putting the term\n if (!this.distinct || !this.variableValues.has(RdfString.termToString(term))) {\n this.putTerm(term);\n if (this.distinct) {\n this.variableValues.add(RdfString.termToString(term));\n }\n }\n } catch (error: unknown) {\n this.safeThrow(error);\n }\n }\n\n public async result(): Promise<RDF.Term | undefined> {\n if (this.errorOccurred) {\n return undefined;\n }\n return this.termResult();\n }\n\n private safeThrow(err: unknown): void {\n if (this.throwError) {\n throw err;\n } else {\n this.errorOccurred = true;\n }\n }\n\n protected termToNumericOrError(term: RDF.Term): Eval.NumericLiteral {\n if (term.termType !== 'Literal') {\n throw new Error(`Term with value ${term.value} has type ${term.termType} and is not a numeric literal`);\n } else if (\n !Eval.isSubTypeOf(term.datatype.value, Eval.TypeAlias.SPARQL_NUMERIC, this.superTypeProvider)) {\n throw new Error(`Term datatype ${term.datatype.value} with value ${term.value} has type ${term.termType} and is not a numeric literal`);\n }\n return <Eval.NumericLiteral> this.termTransformer.transformLiteral(term);\n }\n}\n"]}
package/lib/index.d.ts CHANGED
File without changes
package/lib/index.js CHANGED
File without changes
package/lib/index.js.map CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/bus-bindings-aggregator-factory",
3
- "version": "4.5.0",
3
+ "version": "5.0.2",
4
4
  "description": "A comunica actor for creating Binding-Aggregators.",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -36,14 +36,14 @@
36
36
  "build:components": "componentsjs-generator"
37
37
  },
38
38
  "dependencies": {
39
- "@comunica/bus-expression-evaluator-factory": "^4.5.0",
40
- "@comunica/context-entries": "^4.5.0",
41
- "@comunica/core": "^4.5.0",
42
- "@comunica/types": "^4.5.0",
43
- "@comunica/utils-expression-evaluator": "^4.5.0",
39
+ "@comunica/bus-expression-evaluator-factory": "^5.0.2",
40
+ "@comunica/context-entries": "^5.0.2",
41
+ "@comunica/core": "^5.0.2",
42
+ "@comunica/types": "^5.0.0",
43
+ "@comunica/utils-algebra": "^5.0.0",
44
+ "@comunica/utils-expression-evaluator": "^5.0.2",
44
45
  "@rdfjs/types": "*",
45
- "rdf-string": "^1.6.3",
46
- "sparqlalgebrajs": "^5.0.2"
46
+ "rdf-string": "^2.0.1"
47
47
  },
48
- "gitHead": "2bcd98c387a021fc5c08d375793c205ca3d1bf0d"
48
+ "gitHead": "3b29f914010fd2fc56682a0ceff962ef6ff24f32"
49
49
  }