@comunica/actor-query-operation-leftjoin 5.4.0 → 5.5.0

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.
package/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
4
+ Comunica Association and Ghent University – imec, Belgium
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActorQueryOperationLeftJoin = void 0;
4
4
  const bus_query_operation_1 = require("@comunica/bus-query-operation");
5
- const context_entries_1 = require("@comunica/context-entries");
6
5
  const core_1 = require("@comunica/core");
7
6
  const utils_algebra_1 = require("@comunica/utils-algebra");
8
7
  const utils_query_operation_1 = require("@comunica/utils-query-operation");
@@ -19,30 +18,19 @@ class ActorQueryOperationLeftJoin extends bus_query_operation_1.ActorQueryOperat
19
18
  return (0, core_1.passTestVoid)();
20
19
  }
21
20
  async runOperation(operationOriginal, context) {
22
- const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
23
- const algebraFactory = new utils_algebra_1.AlgebraFactory(dataFactory);
24
- // Delegate to join bus
25
- const entries = (await Promise.all(operationOriginal.input
26
- .map(async (subOperation, index) => {
27
- const output = (0, utils_query_operation_1.getSafeBindings)(await this.mediatorQueryOperation.mediate({ operation: subOperation, context }));
28
- // If we have an expression in the left join,
29
- // we attach the expression to the right-hand operation,
30
- // and enforce a bind-join.
31
- if (operationOriginal.expression && index === 1) {
32
- const filterOperation = utils_algebra_1.algebraUtils.withMetadata(algebraFactory.createFilter(subOperation, operationOriginal.expression));
33
- filterOperation.metadata.isHoistedLeftJoinFilter = true;
34
- return {
35
- output,
36
- operation: filterOperation,
37
- operationRequired: true,
38
- };
39
- }
40
- return {
41
- output,
42
- operation: subOperation,
43
- };
21
+ // Delegate to join bus, which decides how the expression is evaluated
22
+ const entries = await Promise.all(operationOriginal.input
23
+ .map(async (subOperation) => ({
24
+ output: (0, utils_query_operation_1.getSafeBindings)(await this.mediatorQueryOperation.mediate({ operation: subOperation, context })),
25
+ operation: subOperation,
44
26
  })));
45
- return await this.mediatorJoin.mediate({ type: 'optional', entries, context });
27
+ const expression = operationOriginal.expression;
28
+ return await this.mediatorJoin.mediate({
29
+ type: 'optional',
30
+ entries,
31
+ context,
32
+ ...expression ? { expression } : {},
33
+ });
46
34
  }
47
35
  }
48
36
  exports.ActorQueryOperationLeftJoin = ActorQueryOperationLeftJoin;
@@ -1 +1 @@
1
- {"version":3,"file":"ActorQueryOperationLeftJoin.js","sourceRoot":"","sources":["ActorQueryOperationLeftJoin.ts"],"names":[],"mappings":";;;AACA,uEAAiF;AAEjF,+DAA0D;AAE1D,yCAA8C;AAE9C,2DAAgF;AAChF,2EAAkE;AAElE;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sDAAkD;IACjF,YAA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C;QACJ,CAAC,CAAC,CAAC,CAAC,CAAC;QAEP,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;CACF;AA5CD,kEA4CC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport type { MediatorRdfJoin } from '@comunica/bus-rdf-join';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { ComunicaDataFactory, IActionContext, IJoinEntry, IQueryOperationResult } from '@comunica/types';\nimport { Algebra, AlgebraFactory, algebraUtils } from '@comunica/utils-algebra';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\n\n/**\n * A comunica LeftJoin Query Operation Actor.\n */\nexport class ActorQueryOperationLeftJoin extends ActorQueryOperationTypedMediated<Algebra.LeftJoin> {\n public readonly mediatorJoin: MediatorRdfJoin;\n\n public constructor(args: IActorQueryOperationLeftJoinArgs) {\n super(args, Algebra.Types.LEFT_JOIN);\n this.mediatorJoin = args.mediatorJoin;\n }\n\n public async testOperation(_operation: Algebra.LeftJoin, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(operationOriginal: Algebra.LeftJoin, context: IActionContext):\n Promise<IQueryOperationResult> {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new AlgebraFactory(dataFactory);\n\n // Delegate to join bus\n const entries: IJoinEntry[] = (await Promise.all(operationOriginal.input\n .map(async(subOperation, index) => {\n const output = getSafeBindings(await this.mediatorQueryOperation.mediate({ operation: subOperation, context }));\n\n // If we have an expression in the left join,\n // we attach the expression to the right-hand operation,\n // and enforce a bind-join.\n if (operationOriginal.expression && index === 1) {\n const filterOperation =\n algebraUtils.withMetadata(algebraFactory.createFilter(subOperation, operationOriginal.expression));\n filterOperation.metadata.isHoistedLeftJoinFilter = true;\n return {\n output,\n operation: filterOperation,\n operationRequired: true,\n };\n }\n\n return {\n output,\n operation: subOperation,\n };\n })));\n\n return await this.mediatorJoin.mediate({ type: 'optional', entries, context });\n }\n}\n\nexport interface IActorQueryOperationLeftJoinArgs extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for joining Bindings streams\n */\n mediatorJoin: MediatorRdfJoin;\n}\n"]}
1
+ {"version":3,"file":"ActorQueryOperationLeftJoin.js","sourceRoot":"","sources":["ActorQueryOperationLeftJoin.ts"],"names":[],"mappings":";;;AACA,uEAAiF;AAGjF,yCAA8C;AAE9C,2DAAkD;AAClD,2EAAkE;AAElE;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sDAAkD;IACjF,YAAY,CAAkB;IAE9C,YAAmB,IAAsC;QACvD,KAAK,CAAC,IAAI,EAAE,uBAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAA4B,EAAE,QAAwB;QAC/E,OAAO,IAAA,mBAAY,GAAE,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,iBAAmC,EAAE,OAAuB;QAEpF,sEAAsE;QACtE,MAAM,OAAO,GAAiB,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK;aACpE,GAAG,CAAC,KAAK,EAAC,YAAY,EAAC,EAAE,CAAC,CAAC;YAC1B,MAAM,EAAE,IAAA,uCAAe,EAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC;YACxG,SAAS,EAAE,YAAY;SACxB,CAAC,CAAC,CAAC,CAAC;QAEP,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAChD,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;YACrC,IAAI,EAAE,UAAU;YAChB,OAAO;YACP,OAAO;YACP,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AA7BD,kEA6BC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport type { MediatorRdfJoin } from '@comunica/bus-rdf-join';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { IActionContext, IJoinEntry, IQueryOperationResult } from '@comunica/types';\nimport { Algebra } from '@comunica/utils-algebra';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\n\n/**\n * A comunica LeftJoin Query Operation Actor.\n */\nexport class ActorQueryOperationLeftJoin extends ActorQueryOperationTypedMediated<Algebra.LeftJoin> {\n public readonly mediatorJoin: MediatorRdfJoin;\n\n public constructor(args: IActorQueryOperationLeftJoinArgs) {\n super(args, Algebra.Types.LEFT_JOIN);\n this.mediatorJoin = args.mediatorJoin;\n }\n\n public async testOperation(_operation: Algebra.LeftJoin, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(operationOriginal: Algebra.LeftJoin, context: IActionContext):\n Promise<IQueryOperationResult> {\n // Delegate to join bus, which decides how the expression is evaluated\n const entries: IJoinEntry[] = await Promise.all(operationOriginal.input\n .map(async subOperation => ({\n output: getSafeBindings(await this.mediatorQueryOperation.mediate({ operation: subOperation, context })),\n operation: subOperation,\n })));\n\n const expression = operationOriginal.expression;\n return await this.mediatorJoin.mediate({\n type: 'optional',\n entries,\n context,\n ...expression ? { expression } : {},\n });\n }\n}\n\nexport interface IActorQueryOperationLeftJoinArgs extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for joining Bindings streams\n */\n mediatorJoin: MediatorRdfJoin;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-leftjoin",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "A leftjoin query-operation actor",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -41,13 +41,12 @@
41
41
  "build:components": "componentsjs-generator"
42
42
  },
43
43
  "dependencies": {
44
- "@comunica/bus-query-operation": "^5.4.0",
45
- "@comunica/bus-rdf-join": "^5.4.0",
46
- "@comunica/context-entries": "^5.4.0",
47
- "@comunica/core": "^5.4.0",
48
- "@comunica/types": "^5.4.0",
49
- "@comunica/utils-algebra": "^5.4.0",
50
- "@comunica/utils-query-operation": "^5.4.0"
44
+ "@comunica/bus-query-operation": "^5.5.0",
45
+ "@comunica/bus-rdf-join": "^5.5.0",
46
+ "@comunica/core": "^5.5.0",
47
+ "@comunica/types": "^5.5.0",
48
+ "@comunica/utils-algebra": "^5.5.0",
49
+ "@comunica/utils-query-operation": "^5.5.0"
51
50
  },
52
- "gitHead": "8a0a10913cb705adda45997210ebbe5502274a60"
51
+ "gitHead": "3a258e018a9c5f0b03f531b30ee1cdc659b5b7c9"
53
52
  }