@comunica/actor-rdf-join-inner-multi-smallest 3.2.4-alpha.47.0 → 3.3.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.
|
@@ -11,13 +11,7 @@
|
|
|
11
11
|
"@type": "Class",
|
|
12
12
|
"requireElement": "ActorRdfJoinMultiSmallest",
|
|
13
13
|
"extends": [
|
|
14
|
-
|
|
15
|
-
"@type": "GenericComponentExtension",
|
|
16
|
-
"component": "cbrj:components/ActorRdfJoin.jsonld#ActorRdfJoin",
|
|
17
|
-
"genericTypeInstances": [
|
|
18
|
-
"carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#IActorRdfJoinMultiSmallestTestSideData"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
14
|
+
"cbrj:components/ActorRdfJoin.jsonld#ActorRdfJoin"
|
|
21
15
|
],
|
|
22
16
|
"comment": "A Multi Smallest RDF Join Actor. It accepts 3 or more streams, joins the smallest two, and joins the result with the remaining streams.",
|
|
23
17
|
"parameters": [
|
|
@@ -64,10 +58,6 @@
|
|
|
64
58
|
{
|
|
65
59
|
"@type": "ParameterRangeGenericTypeReference",
|
|
66
60
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
70
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
71
61
|
}
|
|
72
62
|
]
|
|
73
63
|
},
|
|
@@ -82,10 +72,6 @@
|
|
|
82
72
|
{
|
|
83
73
|
"@type": "ParameterRangeGenericTypeReference",
|
|
84
74
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
88
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
89
75
|
}
|
|
90
76
|
]
|
|
91
77
|
},
|
|
@@ -95,20 +81,6 @@
|
|
|
95
81
|
},
|
|
96
82
|
"comment": "The bus this actor subscribes to."
|
|
97
83
|
},
|
|
98
|
-
{
|
|
99
|
-
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_busFailMessage",
|
|
100
|
-
"range": {
|
|
101
|
-
"@type": "ParameterRangeUnion",
|
|
102
|
-
"parameterRangeElements": [
|
|
103
|
-
"xsd:string",
|
|
104
|
-
{
|
|
105
|
-
"@type": "ParameterRangeUndefined"
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
"default": "RDF joining failed: none of the configured actors were able to handle the join type ${action.type}",
|
|
110
|
-
"comment": "The message that will be configured in the bus for reporting failures. This message may be a template string that contains references to the executed `action`. For example, the following templated string is allowed: \"RDF dereferencing failed: no actors could handle ${action.handle.mediaType}\""
|
|
111
|
-
},
|
|
112
84
|
{
|
|
113
85
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_beforeActors",
|
|
114
86
|
"range": {
|
|
@@ -131,10 +103,6 @@
|
|
|
131
103
|
{
|
|
132
104
|
"@type": "ParameterRangeGenericTypeReference",
|
|
133
105
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
137
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
138
106
|
}
|
|
139
107
|
]
|
|
140
108
|
}
|
|
@@ -158,6 +126,13 @@
|
|
|
158
126
|
"memberFieldName": "mediatorJoin",
|
|
159
127
|
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
160
128
|
},
|
|
129
|
+
{
|
|
130
|
+
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest__member_FACTORY",
|
|
131
|
+
"memberFieldName": "FACTORY",
|
|
132
|
+
"range": {
|
|
133
|
+
"@type": "ParameterRangeWildcard"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
161
136
|
{
|
|
162
137
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest__member_constructor",
|
|
163
138
|
"memberFieldName": "constructor"
|
|
@@ -209,12 +184,6 @@
|
|
|
209
184
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_bus"
|
|
210
185
|
}
|
|
211
186
|
},
|
|
212
|
-
{
|
|
213
|
-
"keyRaw": "busFailMessage",
|
|
214
|
-
"value": {
|
|
215
|
-
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_busFailMessage"
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
187
|
{
|
|
219
188
|
"keyRaw": "beforeActors",
|
|
220
189
|
"value": {
|
|
@@ -230,13 +199,7 @@
|
|
|
230
199
|
"@type": "AbstractClass",
|
|
231
200
|
"requireElement": "IActorRdfJoinMultiSmallestArgs",
|
|
232
201
|
"extends": [
|
|
233
|
-
|
|
234
|
-
"@type": "GenericComponentExtension",
|
|
235
|
-
"component": "cbrj:components/ActorRdfJoin.jsonld#IActorRdfJoinArgs",
|
|
236
|
-
"genericTypeInstances": [
|
|
237
|
-
"carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#IActorRdfJoinMultiSmallestTestSideData"
|
|
238
|
-
]
|
|
239
|
-
}
|
|
202
|
+
"cbrj:components/ActorRdfJoin.jsonld#IActorRdfJoinArgs"
|
|
240
203
|
],
|
|
241
204
|
"parameters": [],
|
|
242
205
|
"memberFields": [
|
|
@@ -250,22 +213,6 @@
|
|
|
250
213
|
}
|
|
251
214
|
],
|
|
252
215
|
"constructorArguments": []
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#IActorRdfJoinMultiSmallestTestSideData",
|
|
256
|
-
"@type": "AbstractClass",
|
|
257
|
-
"requireElement": "IActorRdfJoinMultiSmallestTestSideData",
|
|
258
|
-
"extends": [
|
|
259
|
-
"cbrj:components/ActorRdfJoin.jsonld#IActorRdfJoinTestSideData"
|
|
260
|
-
],
|
|
261
|
-
"parameters": [],
|
|
262
|
-
"memberFields": [
|
|
263
|
-
{
|
|
264
|
-
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#IActorRdfJoinMultiSmallestTestSideData__member_sortedEntries",
|
|
265
|
-
"memberFieldName": "sortedEntries"
|
|
266
|
-
}
|
|
267
|
-
],
|
|
268
|
-
"constructorArguments": []
|
|
269
216
|
}
|
|
270
217
|
]
|
|
271
218
|
}
|
|
@@ -23,9 +23,6 @@
|
|
|
23
23
|
"args_bus": {
|
|
24
24
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_bus"
|
|
25
25
|
},
|
|
26
|
-
"args_busFailMessage": {
|
|
27
|
-
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_busFailMessage"
|
|
28
|
-
},
|
|
29
26
|
"args_beforeActors": {
|
|
30
27
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_beforeActors",
|
|
31
28
|
"@container": "@list"
|
|
@@ -45,9 +42,6 @@
|
|
|
45
42
|
"bus": {
|
|
46
43
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_bus"
|
|
47
44
|
},
|
|
48
|
-
"busFailMessage": {
|
|
49
|
-
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_busFailMessage"
|
|
50
|
-
},
|
|
51
45
|
"beforeActors": {
|
|
52
46
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#ActorRdfJoinMultiSmallest_args_beforeActors",
|
|
53
47
|
"@container": "@list"
|
|
@@ -58,11 +52,6 @@
|
|
|
58
52
|
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#IActorRdfJoinMultiSmallestArgs",
|
|
59
53
|
"@prefix": true,
|
|
60
54
|
"@context": {}
|
|
61
|
-
},
|
|
62
|
-
"IActorRdfJoinMultiSmallestTestSideData": {
|
|
63
|
-
"@id": "carjimsm:components/ActorRdfJoinMultiSmallest.jsonld#IActorRdfJoinMultiSmallestTestSideData",
|
|
64
|
-
"@prefix": true,
|
|
65
|
-
"@context": {}
|
|
66
55
|
}
|
|
67
56
|
}
|
|
68
57
|
]
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import type { IActionRdfJoin, IActorRdfJoinOutputInner, IActorRdfJoinArgs, MediatorRdfJoin
|
|
1
|
+
import type { IActionRdfJoin, IActorRdfJoinOutputInner, IActorRdfJoinArgs, MediatorRdfJoin } from '@comunica/bus-rdf-join';
|
|
2
2
|
import { ActorRdfJoin } from '@comunica/bus-rdf-join';
|
|
3
3
|
import type { MediatorRdfJoinEntriesSort } from '@comunica/bus-rdf-join-entries-sort';
|
|
4
|
-
import type { TestResult } from '@comunica/core';
|
|
5
4
|
import type { IMediatorTypeJoinCoefficients } from '@comunica/mediatortype-join-coefficients';
|
|
6
|
-
import type { IActionContext, IJoinEntryWithMetadata } from '@comunica/types';
|
|
5
|
+
import type { MetadataBindings, IActionContext, IJoinEntryWithMetadata } from '@comunica/types';
|
|
6
|
+
import { Factory } from 'sparqlalgebrajs';
|
|
7
7
|
/**
|
|
8
8
|
* A Multi Smallest RDF Join Actor.
|
|
9
9
|
* It accepts 3 or more streams, joins the smallest two, and joins the result with the remaining streams.
|
|
10
10
|
*/
|
|
11
|
-
export declare class ActorRdfJoinMultiSmallest extends ActorRdfJoin
|
|
11
|
+
export declare class ActorRdfJoinMultiSmallest extends ActorRdfJoin {
|
|
12
12
|
readonly mediatorJoinEntriesSort: MediatorRdfJoinEntriesSort;
|
|
13
13
|
readonly mediatorJoin: MediatorRdfJoin;
|
|
14
|
+
static readonly FACTORY: Factory;
|
|
14
15
|
constructor(args: IActorRdfJoinMultiSmallestArgs);
|
|
15
16
|
/**
|
|
16
17
|
* Order the given join entries using the join-entries-sort bus.
|
|
@@ -19,10 +20,10 @@ export declare class ActorRdfJoinMultiSmallest extends ActorRdfJoin<IActorRdfJoi
|
|
|
19
20
|
* @return {IJoinEntryWithMetadata[]} The sorted join entries.
|
|
20
21
|
*/
|
|
21
22
|
sortJoinEntries(entries: IJoinEntryWithMetadata[], context: IActionContext): Promise<IJoinEntryWithMetadata[]>;
|
|
22
|
-
protected getOutput(action: IActionRdfJoin
|
|
23
|
-
protected getJoinCoefficients(action: IActionRdfJoin,
|
|
23
|
+
protected getOutput(action: IActionRdfJoin): Promise<IActorRdfJoinOutputInner>;
|
|
24
|
+
protected getJoinCoefficients(action: IActionRdfJoin, metadatas: MetadataBindings[]): Promise<IMediatorTypeJoinCoefficients>;
|
|
24
25
|
}
|
|
25
|
-
export interface IActorRdfJoinMultiSmallestArgs extends IActorRdfJoinArgs
|
|
26
|
+
export interface IActorRdfJoinMultiSmallestArgs extends IActorRdfJoinArgs {
|
|
26
27
|
/**
|
|
27
28
|
* The join entries sort mediator
|
|
28
29
|
*/
|
|
@@ -32,6 +33,3 @@ export interface IActorRdfJoinMultiSmallestArgs extends IActorRdfJoinArgs<IActor
|
|
|
32
33
|
*/
|
|
33
34
|
mediatorJoin: MediatorRdfJoin;
|
|
34
35
|
}
|
|
35
|
-
export interface IActorRdfJoinMultiSmallestTestSideData extends IActorRdfJoinTestSideData {
|
|
36
|
-
sortedEntries: IJoinEntryWithMetadata[];
|
|
37
|
-
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorRdfJoinMultiSmallest = void 0;
|
|
4
|
+
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
4
5
|
const bus_rdf_join_1 = require("@comunica/bus-rdf-join");
|
|
5
|
-
const context_entries_1 = require("@comunica/context-entries");
|
|
6
|
-
const core_1 = require("@comunica/core");
|
|
7
|
-
const utils_query_operation_1 = require("@comunica/utils-query-operation");
|
|
8
6
|
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
9
7
|
/**
|
|
10
8
|
* A Multi Smallest RDF Join Actor.
|
|
@@ -30,19 +28,17 @@ class ActorRdfJoinMultiSmallest extends bus_rdf_join_1.ActorRdfJoin {
|
|
|
30
28
|
async sortJoinEntries(entries, context) {
|
|
31
29
|
return (await this.mediatorJoinEntriesSort.mediate({ entries, context })).entries;
|
|
32
30
|
}
|
|
33
|
-
async getOutput(action
|
|
34
|
-
const dataFactory = action.context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
|
|
35
|
-
const algebraFactory = new sparqlalgebrajs_1.Factory(dataFactory);
|
|
31
|
+
async getOutput(action) {
|
|
36
32
|
// Determine the two smallest streams by sorting (e.g. via cardinality)
|
|
37
|
-
const entries =
|
|
33
|
+
const entries = await this.sortJoinEntries(await bus_rdf_join_1.ActorRdfJoin.getEntriesWithMetadatas([...action.entries]), action.context);
|
|
38
34
|
const smallestEntry1 = entries[0];
|
|
39
35
|
const smallestEntry2 = entries[1];
|
|
40
36
|
entries.splice(0, 2);
|
|
41
37
|
// Join the two selected streams, and then join the result with the remaining streams
|
|
42
38
|
const firstEntry = {
|
|
43
|
-
output:
|
|
39
|
+
output: bus_query_operation_1.ActorQueryOperation.getSafeBindings(await this.mediatorJoin
|
|
44
40
|
.mediate({ type: action.type, entries: [smallestEntry1, smallestEntry2], context: action.context })),
|
|
45
|
-
operation:
|
|
41
|
+
operation: ActorRdfJoinMultiSmallest.FACTORY
|
|
46
42
|
.createJoin([smallestEntry1.operation, smallestEntry2.operation], false),
|
|
47
43
|
};
|
|
48
44
|
entries.push(firstEntry);
|
|
@@ -54,16 +50,15 @@ class ActorRdfJoinMultiSmallest extends bus_rdf_join_1.ActorRdfJoin {
|
|
|
54
50
|
}),
|
|
55
51
|
};
|
|
56
52
|
}
|
|
57
|
-
async getJoinCoefficients(action,
|
|
58
|
-
let { metadatas } = sideData;
|
|
53
|
+
async getJoinCoefficients(action, metadatas) {
|
|
59
54
|
metadatas = [...metadatas];
|
|
60
55
|
// Determine the two smallest streams by sorting (e.g. via cardinality)
|
|
61
|
-
const
|
|
56
|
+
const entriesWithMetadata = await this.sortJoinEntries(action.entries
|
|
62
57
|
.map((entry, i) => ({ ...entry, metadata: metadatas[i] })), action.context);
|
|
63
|
-
metadatas =
|
|
58
|
+
metadatas = entriesWithMetadata.map(entry => entry.metadata);
|
|
64
59
|
const requestInitialTimes = bus_rdf_join_1.ActorRdfJoin.getRequestInitialTimes(metadatas);
|
|
65
60
|
const requestItemTimes = bus_rdf_join_1.ActorRdfJoin.getRequestItemTimes(metadatas);
|
|
66
|
-
return
|
|
61
|
+
return {
|
|
67
62
|
iterations: metadatas[0].cardinality.value * metadatas[1].cardinality.value *
|
|
68
63
|
metadatas.slice(2).reduce((acc, metadata) => acc * metadata.cardinality.value, 1),
|
|
69
64
|
persistedItems: 0,
|
|
@@ -72,8 +67,9 @@ class ActorRdfJoinMultiSmallest extends bus_rdf_join_1.ActorRdfJoin {
|
|
|
72
67
|
requestInitialTimes[1] + metadatas[1].cardinality.value * requestItemTimes[1] +
|
|
73
68
|
metadatas.slice(2).reduce((sum, metadata, i) => sum + requestInitialTimes.slice(2)[i] +
|
|
74
69
|
metadata.cardinality.value * requestItemTimes.slice(2)[i], 0),
|
|
75
|
-
}
|
|
70
|
+
};
|
|
76
71
|
}
|
|
77
72
|
}
|
|
78
73
|
exports.ActorRdfJoinMultiSmallest = ActorRdfJoinMultiSmallest;
|
|
74
|
+
ActorRdfJoinMultiSmallest.FACTORY = new sparqlalgebrajs_1.Factory();
|
|
79
75
|
//# sourceMappingURL=ActorRdfJoinMultiSmallest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorRdfJoinMultiSmallest.js","sourceRoot":"","sources":["ActorRdfJoinMultiSmallest.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ActorRdfJoinMultiSmallest.js","sourceRoot":"","sources":["ActorRdfJoinMultiSmallest.ts"],"names":[],"mappings":";;;AAAA,uEAEuC;AAOvC,yDAAsD;AAItD,qDAA0C;AAE1C;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,2BAAY;IAMzD,YAAmB,IAAoC;QACrD,KAAK,CAAC,IAAI,EAAE;YACV,WAAW,EAAE,OAAO;YACpB,YAAY,EAAE,gBAAgB;YAC9B,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,IAAI;YACrB,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,eAAe,CAC1B,OAAiC,EACjC,OAAuB;QAEvB,OAAO,CAAC,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACpF,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,MAAsB;QAC9C,uEAAuE;QACvE,MAAM,OAAO,GAAiB,MAAM,IAAI,CAAC,eAAe,CACtD,MAAM,2BAAY,CAAC,uBAAuB,CAAC,CAAE,GAAG,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G,IAAI,yBAAO,EAAE,CAAC","sourcesContent":["import {\n ActorQueryOperation,\n} from '@comunica/bus-query-operation';\nimport type {\n IActionRdfJoin,\n IActorRdfJoinOutputInner,\n IActorRdfJoinArgs,\n MediatorRdfJoin,\n} from '@comunica/bus-rdf-join';\nimport { ActorRdfJoin } from '@comunica/bus-rdf-join';\nimport type { MediatorRdfJoinEntriesSort } from '@comunica/bus-rdf-join-entries-sort';\nimport type { IMediatorTypeJoinCoefficients } from '@comunica/mediatortype-join-coefficients';\nimport type { MetadataBindings, IJoinEntry, IActionContext, IJoinEntryWithMetadata } from '@comunica/types';\nimport { Factory } from 'sparqlalgebrajs';\n\n/**\n * A Multi Smallest RDF Join Actor.\n * It accepts 3 or more streams, joins the smallest two, and joins the result with the remaining streams.\n */\nexport class ActorRdfJoinMultiSmallest extends ActorRdfJoin {\n public readonly mediatorJoinEntriesSort: MediatorRdfJoinEntriesSort;\n public readonly mediatorJoin: MediatorRdfJoin;\n\n public static readonly FACTORY = new Factory();\n\n public constructor(args: IActorRdfJoinMultiSmallestArgs) {\n super(args, {\n logicalType: 'inner',\n physicalName: 'multi-smallest',\n limitEntries: 3,\n limitEntriesMin: true,\n canHandleUndefs: true,\n isLeaf: false,\n });\n }\n\n /**\n * Order the given join entries using the join-entries-sort bus.\n * @param {IJoinEntryWithMetadata[]} entries An array of join entries.\n * @param context The action context.\n * @return {IJoinEntryWithMetadata[]} The sorted join entries.\n */\n public async sortJoinEntries(\n entries: IJoinEntryWithMetadata[],\n context: IActionContext,\n ): Promise<IJoinEntryWithMetadata[]> {\n return (await this.mediatorJoinEntriesSort.mediate({ entries, context })).entries;\n }\n\n protected async getOutput(action: IActionRdfJoin): Promise<IActorRdfJoinOutputInner> {\n // Determine the two smallest streams by sorting (e.g. via cardinality)\n const entries: IJoinEntry[] = await this.sortJoinEntries(\n await ActorRdfJoin.getEntriesWithMetadatas([ ...action.entries ]),\n action.context,\n );\n const smallestEntry1 = entries[0];\n const smallestEntry2 = entries[1];\n entries.splice(0, 2);\n\n // Join the two selected streams, and then join the result with the remaining streams\n const firstEntry: IJoinEntry = {\n output: ActorQueryOperation.getSafeBindings(await this.mediatorJoin\n .mediate({ type: action.type, entries: [ smallestEntry1, smallestEntry2 ], context: action.context })),\n operation: ActorRdfJoinMultiSmallest.FACTORY\n .createJoin([ smallestEntry1.operation, smallestEntry2.operation ], false),\n };\n entries.push(firstEntry);\n return {\n result: await this.mediatorJoin.mediate({\n type: action.type,\n entries,\n context: action.context,\n }),\n };\n }\n\n protected async getJoinCoefficients(\n action: IActionRdfJoin,\n metadatas: MetadataBindings[],\n ): Promise<IMediatorTypeJoinCoefficients> {\n metadatas = [ ...metadatas ];\n // Determine the two smallest streams by sorting (e.g. via cardinality)\n const entriesWithMetadata = await this.sortJoinEntries(action.entries\n .map((entry, i) => ({ ...entry, metadata: metadatas[i] })), action.context);\n metadatas = entriesWithMetadata.map(entry => entry.metadata);\n const requestInitialTimes = ActorRdfJoin.getRequestInitialTimes(metadatas);\n const requestItemTimes = ActorRdfJoin.getRequestItemTimes(metadatas);\n\n return {\n iterations: metadatas[0].cardinality.value * metadatas[1].cardinality.value *\n metadatas.slice(2).reduce((acc, metadata) => acc * metadata.cardinality.value, 1),\n persistedItems: 0,\n blockingItems: 0,\n requestTime: requestInitialTimes[0] + metadatas[0].cardinality.value * requestItemTimes[0] +\n requestInitialTimes[1] + metadatas[1].cardinality.value * requestItemTimes[1] +\n metadatas.slice(2).reduce((sum, metadata, i) => sum + requestInitialTimes.slice(2)[i] +\n metadata.cardinality.value * requestItemTimes.slice(2)[i], 0),\n };\n }\n}\n\nexport interface IActorRdfJoinMultiSmallestArgs extends IActorRdfJoinArgs {\n /**\n * The join entries sort mediator\n */\n mediatorJoinEntriesSort: MediatorRdfJoinEntriesSort;\n /**\n * A mediator for joining Bindings streams\n */\n mediatorJoin: MediatorRdfJoin;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-rdf-join-inner-multi-smallest",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "A multi-smallest rdf-join actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"funding": {
|
|
8
|
-
"type": "opencollective",
|
|
9
|
-
"url": "https://opencollective.com/comunica-association"
|
|
10
|
-
},
|
|
11
7
|
"homepage": "https://comunica.dev/",
|
|
12
8
|
"repository": {
|
|
13
9
|
"type": "git",
|
|
@@ -41,14 +37,12 @@
|
|
|
41
37
|
"build:components": "componentsjs-generator"
|
|
42
38
|
},
|
|
43
39
|
"dependencies": {
|
|
44
|
-
"@comunica/bus-
|
|
45
|
-
"@comunica/bus-rdf-join
|
|
46
|
-
"@comunica/
|
|
47
|
-
"@comunica/
|
|
48
|
-
"@comunica/
|
|
49
|
-
"
|
|
50
|
-
"@comunica/utils-query-operation": "3.2.4-alpha.47.0",
|
|
51
|
-
"sparqlalgebrajs": "^4.3.8"
|
|
40
|
+
"@comunica/bus-query-operation": "^3.3.0",
|
|
41
|
+
"@comunica/bus-rdf-join": "^3.3.0",
|
|
42
|
+
"@comunica/bus-rdf-join-entries-sort": "^3.3.0",
|
|
43
|
+
"@comunica/mediatortype-join-coefficients": "^3.3.0",
|
|
44
|
+
"@comunica/types": "^3.3.0",
|
|
45
|
+
"sparqlalgebrajs": "^4.3.7"
|
|
52
46
|
},
|
|
53
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "02bde397d206f1f5a523643a6a604c89e792e2f9"
|
|
54
48
|
}
|