@comunica/actor-query-operation-join 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 +22 -0
- package/lib/ActorQueryOperationJoin.js +18 -0
- package/lib/ActorQueryOperationJoin.js.map +1 -1
- package/package.json +11 -10
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.
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ActorQueryOperationJoin = void 0;
|
|
4
4
|
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
5
5
|
const bus_rdf_join_1 = require("@comunica/bus-rdf-join");
|
|
6
|
+
const context_entries_1 = require("@comunica/context-entries");
|
|
6
7
|
const core_1 = require("@comunica/core");
|
|
7
8
|
const utils_algebra_1 = require("@comunica/utils-algebra");
|
|
8
9
|
const utils_metadata_1 = require("@comunica/utils-metadata");
|
|
@@ -37,6 +38,23 @@ class ActorQueryOperationJoin extends bus_query_operation_1.ActorQueryOperationT
|
|
|
37
38
|
for (const entry of entries) {
|
|
38
39
|
entry.output.bindingsStream.close();
|
|
39
40
|
}
|
|
41
|
+
// No physical join actor runs in this case, so record why the plan stops here.
|
|
42
|
+
const physicalQueryPlanLogger = context
|
|
43
|
+
.get(context_entries_1.KeysInitQuery.physicalQueryPlanLogger);
|
|
44
|
+
if (physicalQueryPlanLogger) {
|
|
45
|
+
const planNode = physicalQueryPlanLogger.logOperation({
|
|
46
|
+
logicalOperator: 'join-inner',
|
|
47
|
+
physicalOperator: 'empty',
|
|
48
|
+
parentNode: context.get(context_entries_1.KeysInitQuery.physicalQueryPlanNode),
|
|
49
|
+
actor: this.name,
|
|
50
|
+
});
|
|
51
|
+
for (const entry of entries) {
|
|
52
|
+
const entryNode = physicalQueryPlanLogger.getNodeForOutput(entry.output);
|
|
53
|
+
if (entryNode) {
|
|
54
|
+
planNode.adoptInput(entryNode);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
40
58
|
return {
|
|
41
59
|
bindingsStream: new asynciterator_1.ArrayIterator([], { autoStart: false }),
|
|
42
60
|
metadata: async () => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryOperationJoin.js","sourceRoot":"","sources":["ActorQueryOperationJoin.ts"],"names":[],"mappings":";;;AACA,uEAEuC;AAEvC,yDAAsD;
|
|
1
|
+
{"version":3,"file":"ActorQueryOper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AAY,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;iBACnG,CAAC;gBACF,IAAI,EAAE,UAAU;aACjB,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;CACF;AAhED,0DAgEC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport {\n ActorQueryOperationTypedMediated,\n} from '@comunica/bus-query-operation';\nimport type { MediatorRdfJoin } from '@comunica/bus-rdf-join';\nimport { ActorRdfJoin } 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 {\n IQueryOperationResult,\n IActionContext,\n IJoinEntry,\n IPhysicalQueryPlanLogger,\n} from '@comunica/types';\nimport { Algebra } from '@comunica/utils-algebra';\nimport { MetadataValidationState } from '@comunica/utils-metadata';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\nimport { ArrayIterator } from 'asynciterator';\nimport { DataFactory } from 'rdf-data-factory';\n\n/**\n * A comunica Join Query Operation Actor.\n */\nexport class ActorQueryOperationJoin extends ActorQueryOperationTypedMediated<Algebra.Join> {\n public readonly mediatorJoin: MediatorRdfJoin;\n\n public constructor(args: IActorQueryOperationJoinArgs) {\n super(args, Algebra.Types.JOIN);\n this.mediatorJoin = args.mediatorJoin;\n }\n\n public async testOperation(_operation: Algebra.Join, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(\n operationOriginal: Algebra.Join,\n context: IActionContext,\n ): Promise<IQueryOperationResult> {\n const entries: IJoinEntry[] = (await Promise.all(operationOriginal.input\n .map(async subOperation => ({\n output: await this.mediatorQueryOperation.mediate({ operation: subOperation, context }),\n operation: subOperation,\n }))))\n .map(({ output, operation }) => ({\n output: getSafeBindings(output),\n operation,\n }));\n\n // Return immediately if one of the join entries has cardinality zero, to avoid actor testing overhead.\n if ((await Promise.all(entries.map(entry => entry.output.metadata())))\n .some(entry => (entry.cardinality.value === 0 && entry.cardinality.type === 'exact'))) {\n for (const entry of entries) {\n entry.output.bindingsStream.close();\n }\n\n // No physical join actor runs in this case, so record why the plan stops here.\n const physicalQueryPlanLogger: IPhysicalQueryPlanLogger | undefined = context\n .get(KeysInitQuery.physicalQueryPlanLogger);\n if (physicalQueryPlanLogger) {\n const planNode = physicalQueryPlanLogger.logOperation({\n logicalOperator: 'join-inner',\n physicalOperator: 'empty',\n parentNode: context.get(KeysInitQuery.physicalQueryPlanNode),\n actor: this.name,\n });\n for (const entry of entries) {\n const entryNode = physicalQueryPlanLogger.getNodeForOutput(entry.output);\n if (entryNode) {\n planNode.adoptInput(entryNode);\n }\n }\n }\n\n return {\n bindingsStream: new ArrayIterator<RDF.Bindings>([], { autoStart: false }),\n metadata: async() => ({\n state: new MetadataValidationState(),\n cardinality: { type: 'exact', value: 0 },\n variables: ActorRdfJoin.joinVariables(new DataFactory(), await ActorRdfJoin.getMetadatas(entries)),\n }),\n type: 'bindings',\n };\n }\n\n return this.mediatorJoin.mediate({ type: 'inner', entries, context });\n }\n}\n\nexport interface IActorQueryOperationJoinArgs 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-join",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "A join query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,16 +41,17 @@
|
|
|
41
41
|
"build:components": "componentsjs-generator"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@comunica/bus-query-operation": "^5.
|
|
45
|
-
"@comunica/bus-rdf-join": "^5.
|
|
46
|
-
"@comunica/
|
|
47
|
-
"@comunica/
|
|
48
|
-
"@comunica/
|
|
49
|
-
"@comunica/utils-
|
|
50
|
-
"@comunica/utils-
|
|
44
|
+
"@comunica/bus-query-operation": "^5.5.0",
|
|
45
|
+
"@comunica/bus-rdf-join": "^5.5.0",
|
|
46
|
+
"@comunica/context-entries": "^5.5.0",
|
|
47
|
+
"@comunica/core": "^5.5.0",
|
|
48
|
+
"@comunica/types": "^5.5.0",
|
|
49
|
+
"@comunica/utils-algebra": "^5.5.0",
|
|
50
|
+
"@comunica/utils-metadata": "^5.5.0",
|
|
51
|
+
"@comunica/utils-query-operation": "^5.5.0",
|
|
51
52
|
"@rdfjs/types": "*",
|
|
52
53
|
"asynciterator": "^3.10.0",
|
|
53
|
-
"rdf-data-factory": "^2.
|
|
54
|
+
"rdf-data-factory": "^2.1.0"
|
|
54
55
|
},
|
|
55
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "3a258e018a9c5f0b03f531b30ee1cdc659b5b7c9"
|
|
56
57
|
}
|