@comunica/actor-rdf-join-wrap-stream 4.1.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.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Comunica Wrap Stream RDF Join Actor
2
+
3
+ [![npm version](https://badge.fury.io/js/%40comunica%2Factor-rdf-join-wrap-stream.svg)](https://www.npmjs.com/package/@comunica/actor-rdf-join-wrap-stream)
4
+
5
+ A comunica Wrap Stream RDF Join Actor. This actor calls the `bus-iterator-transform` for all iterators produced by `query-operation` actors.
6
+ This actor should only be included if you require the functionality of `bus-iterator-transform` as it may slow down query execution.
7
+
8
+ This module is part of the [Comunica framework](https://github.com/comunica/comunica),
9
+ and should only be used by [developers that want to build their own query engine](https://comunica.dev/docs/modify/).
10
+
11
+ [Click here if you just want to query with Comunica](https://comunica.dev/docs/query/).
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ $ yarn add @comunica/actor-rdf-join-wrap-stream
17
+ ```
18
+
19
+ ## Configure
20
+
21
+ After installing, this package can be added to your engine's configuration as follows:
22
+ ```text
23
+ {
24
+ "@context": [
25
+ ...
26
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-join-wrap-stream/^1.0.0/components/context.jsonld"
27
+ ],
28
+ "actors": [
29
+ ...
30
+ {
31
+ "@id": "urn:comunica:default:rdf-join/actors#wrap-stream",
32
+ "@type": "ActorRdfJoinWrapStream"
33
+ }
34
+ ]
35
+ }
36
+ ```
37
+
38
+ ### Config Parameters
39
+ * `mediatorIteratorTransform`: Mediator that will run all actors subscribed to the `bus-iterator-transform` in sequence.
40
+ * `mediatorJoin`: Mediator that runs the join operation that will be wrapped.
@@ -0,0 +1,247 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-join-wrap-stream/^4.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-join/^4.0.0/components/context.jsonld"
6
+ ],
7
+ "@id": "npmd:@comunica/actor-rdf-join-wrap-stream",
8
+ "components": [
9
+ {
10
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream",
11
+ "@type": "Class",
12
+ "requireElement": "ActorRdfJoinWrapStream",
13
+ "extends": [
14
+ "cbrj:components/ActorRdfJoin.jsonld#ActorRdfJoin"
15
+ ],
16
+ "comment": "A comunica Wrap Stream RDF Join Actor.",
17
+ "parameters": [
18
+ {
19
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorIteratorTransform",
20
+ "range": "cc:components/Mediator.jsonld#Mediator",
21
+ "comment": "Mediator that runs all transforms defined by user over the output stream of the query operation"
22
+ },
23
+ {
24
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoin",
25
+ "range": "cc:components/Mediator.jsonld#Mediator",
26
+ "comment": "Mediator that calls next join to be wrapped"
27
+ },
28
+ {
29
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoinSelectivity",
30
+ "range": "cc:components/Mediator.jsonld#Mediator"
31
+ },
32
+ {
33
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_name",
34
+ "range": "xsd:string",
35
+ "default": {
36
+ "@id": "rdf:subject"
37
+ },
38
+ "comment": "The name for this actor."
39
+ },
40
+ {
41
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_bus",
42
+ "range": {
43
+ "@type": "ParameterRangeGenericComponent",
44
+ "component": "cc:components/Bus.jsonld#Bus",
45
+ "genericTypeInstances": [
46
+ {
47
+ "@type": "ParameterRangeGenericComponent",
48
+ "component": "cc:components/Actor.jsonld#Actor",
49
+ "genericTypeInstances": [
50
+ {
51
+ "@type": "ParameterRangeGenericTypeReference",
52
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
53
+ },
54
+ {
55
+ "@type": "ParameterRangeGenericTypeReference",
56
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
57
+ },
58
+ {
59
+ "@type": "ParameterRangeGenericTypeReference",
60
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
61
+ },
62
+ {
63
+ "@type": "ParameterRangeGenericTypeReference",
64
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "@type": "ParameterRangeGenericTypeReference",
70
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
71
+ },
72
+ {
73
+ "@type": "ParameterRangeGenericTypeReference",
74
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
75
+ },
76
+ {
77
+ "@type": "ParameterRangeGenericTypeReference",
78
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
79
+ },
80
+ {
81
+ "@type": "ParameterRangeGenericTypeReference",
82
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
83
+ }
84
+ ]
85
+ },
86
+ "default": {
87
+ "@id": "cbrj:components/ActorRdfJoin.jsonld#ActorRdfJoin_default_bus",
88
+ "@type": "cc:components/Bus.jsonld#Bus"
89
+ },
90
+ "comment": "The bus this actor subscribes to."
91
+ },
92
+ {
93
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_busFailMessage",
94
+ "range": {
95
+ "@type": "ParameterRangeUnion",
96
+ "parameterRangeElements": [
97
+ "xsd:string",
98
+ {
99
+ "@type": "ParameterRangeUndefined"
100
+ }
101
+ ]
102
+ },
103
+ "default": "RDF joining failed: none of the configured actors were able to handle the join type ${action.type}",
104
+ "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}\""
105
+ },
106
+ {
107
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_beforeActors",
108
+ "range": {
109
+ "@type": "ParameterRangeUnion",
110
+ "parameterRangeElements": [
111
+ {
112
+ "@type": "ParameterRangeArray",
113
+ "parameterRangeValue": {
114
+ "@type": "ParameterRangeGenericComponent",
115
+ "component": "cc:components/Actor.jsonld#Actor",
116
+ "genericTypeInstances": [
117
+ {
118
+ "@type": "ParameterRangeGenericTypeReference",
119
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
120
+ },
121
+ {
122
+ "@type": "ParameterRangeGenericTypeReference",
123
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
124
+ },
125
+ {
126
+ "@type": "ParameterRangeGenericTypeReference",
127
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
128
+ },
129
+ {
130
+ "@type": "ParameterRangeGenericTypeReference",
131
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
132
+ }
133
+ ]
134
+ }
135
+ },
136
+ {
137
+ "@type": "ParameterRangeUndefined"
138
+ }
139
+ ]
140
+ },
141
+ "comment": "Actor that must be registered in the bus before this actor."
142
+ }
143
+ ],
144
+ "memberFields": [
145
+ {
146
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream__member_mediatorJoin",
147
+ "memberFieldName": "mediatorJoin",
148
+ "range": "cc:components/Mediator.jsonld#Mediator"
149
+ },
150
+ {
151
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream__member_mediatorIteratorTransform",
152
+ "memberFieldName": "mediatorIteratorTransform",
153
+ "range": "cc:components/Mediator.jsonld#Mediator"
154
+ },
155
+ {
156
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream__member_constructor",
157
+ "memberFieldName": "constructor"
158
+ },
159
+ {
160
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream__member_test",
161
+ "memberFieldName": "test"
162
+ },
163
+ {
164
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream__member_getOutput",
165
+ "memberFieldName": "getOutput"
166
+ },
167
+ {
168
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream__member_getJoinCoefficients",
169
+ "memberFieldName": "getJoinCoefficients"
170
+ },
171
+ {
172
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream__member_setContextWrapped",
173
+ "memberFieldName": "setContextWrapped"
174
+ }
175
+ ],
176
+ "constructorArguments": [
177
+ {
178
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args__constructorArgument",
179
+ "fields": [
180
+ {
181
+ "keyRaw": "mediatorIteratorTransform",
182
+ "value": {
183
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorIteratorTransform"
184
+ }
185
+ },
186
+ {
187
+ "keyRaw": "mediatorJoin",
188
+ "value": {
189
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoin"
190
+ }
191
+ },
192
+ {
193
+ "keyRaw": "mediatorJoinSelectivity",
194
+ "value": {
195
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoinSelectivity"
196
+ }
197
+ },
198
+ {
199
+ "keyRaw": "name",
200
+ "value": {
201
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_name"
202
+ }
203
+ },
204
+ {
205
+ "keyRaw": "bus",
206
+ "value": {
207
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_bus"
208
+ }
209
+ },
210
+ {
211
+ "keyRaw": "busFailMessage",
212
+ "value": {
213
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_busFailMessage"
214
+ }
215
+ },
216
+ {
217
+ "keyRaw": "beforeActors",
218
+ "value": {
219
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_beforeActors"
220
+ }
221
+ }
222
+ ]
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#IActorRdfJoinWrapStreamArgs",
228
+ "@type": "AbstractClass",
229
+ "requireElement": "IActorRdfJoinWrapStreamArgs",
230
+ "extends": [
231
+ "cbrj:components/ActorRdfJoin.jsonld#IActorRdfJoinArgs"
232
+ ],
233
+ "parameters": [],
234
+ "memberFields": [
235
+ {
236
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#IActorRdfJoinWrapStreamArgs__member_mediatorIteratorTransform",
237
+ "memberFieldName": "mediatorIteratorTransform"
238
+ },
239
+ {
240
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#IActorRdfJoinWrapStreamArgs__member_mediatorJoin",
241
+ "memberFieldName": "mediatorJoin"
242
+ }
243
+ ],
244
+ "constructorArguments": []
245
+ }
246
+ ]
247
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-join-wrap-stream/^4.0.0/components/context.jsonld"
4
+ ],
5
+ "@id": "npmd:@comunica/actor-rdf-join-wrap-stream",
6
+ "@type": "Module",
7
+ "requireName": "@comunica/actor-rdf-join-wrap-stream",
8
+ "import": [
9
+ "carjws:components/ActorRdfJoinWrapStream.jsonld"
10
+ ]
11
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
4
+ {
5
+ "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
+ "carjws": "npmd:@comunica/actor-rdf-join-wrap-stream/^4.0.0/",
7
+ "ActorRdfJoinWrapStream": {
8
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream",
9
+ "@prefix": true,
10
+ "@context": {
11
+ "args_mediatorIteratorTransform": {
12
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorIteratorTransform"
13
+ },
14
+ "args_mediatorJoin": {
15
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoin"
16
+ },
17
+ "args_mediatorJoinSelectivity": {
18
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoinSelectivity"
19
+ },
20
+ "args_name": {
21
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_name"
22
+ },
23
+ "args_bus": {
24
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_bus"
25
+ },
26
+ "args_busFailMessage": {
27
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_busFailMessage"
28
+ },
29
+ "args_beforeActors": {
30
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_beforeActors",
31
+ "@container": "@list"
32
+ },
33
+ "mediatorIteratorTransform": {
34
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorIteratorTransform"
35
+ },
36
+ "mediatorJoin": {
37
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoin"
38
+ },
39
+ "mediatorJoinSelectivity": {
40
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_mediatorJoinSelectivity"
41
+ },
42
+ "name": {
43
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_name"
44
+ },
45
+ "bus": {
46
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_bus"
47
+ },
48
+ "busFailMessage": {
49
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_busFailMessage"
50
+ },
51
+ "beforeActors": {
52
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#ActorRdfJoinWrapStream_args_beforeActors",
53
+ "@container": "@list"
54
+ }
55
+ }
56
+ },
57
+ "IActorRdfJoinWrapStreamArgs": {
58
+ "@id": "carjws:components/ActorRdfJoinWrapStream.jsonld#IActorRdfJoinWrapStreamArgs",
59
+ "@prefix": true,
60
+ "@context": {}
61
+ }
62
+ }
63
+ ]
64
+ }
@@ -0,0 +1,39 @@
1
+ import type { MediatorIteratorTransform } from '@comunica/bus-iterator-transform';
2
+ import type { IActionRdfJoin, IActorRdfJoinOutputInner, IActorRdfJoinArgs, MediatorRdfJoin, IActorRdfJoinTestSideData } from '@comunica/bus-rdf-join';
3
+ import { ActorRdfJoin } from '@comunica/bus-rdf-join';
4
+ import type { TestResult } from '@comunica/core';
5
+ import { ActionContextKey } from '@comunica/core';
6
+ import type { IMediatorTypeJoinCoefficients } from '@comunica/mediatortype-join-coefficients';
7
+ import type { IActionContext, IJoinEntry } from '@comunica/types';
8
+ /**
9
+ * A comunica Wrap Stream RDF Join Actor.
10
+ */
11
+ export declare class ActorRdfJoinWrapStream extends ActorRdfJoin {
12
+ readonly mediatorJoin: MediatorRdfJoin;
13
+ readonly mediatorIteratorTransform: MediatorIteratorTransform;
14
+ constructor(args: IActorRdfJoinWrapStreamArgs);
15
+ test(action: IActionRdfJoin): Promise<TestResult<IMediatorTypeJoinCoefficients, IActorRdfJoinTestSideData>>;
16
+ getOutput(action: IActionRdfJoin): Promise<IActorRdfJoinOutputInner>;
17
+ protected getJoinCoefficients(_action: IActionRdfJoin, sideData: IActorRdfJoinTestSideData): Promise<TestResult<IMediatorTypeJoinCoefficients, IActorRdfJoinTestSideData>>;
18
+ /**
19
+ * Sets KEY_CONTEXT_WRAPPED_RDF_JOIN key in the context to the entries being joined.
20
+ * @param action The join action being executed
21
+ * @param context The ActionContext
22
+ * @returns The updated ActionContext
23
+ */
24
+ setContextWrapped(action: IActionRdfJoin, context: IActionContext): IActionContext;
25
+ }
26
+ export interface IActorRdfJoinWrapStreamArgs extends IActorRdfJoinArgs {
27
+ /**
28
+ * Mediator that runs all transforms defined by user over the output stream of the query operation
29
+ */
30
+ mediatorIteratorTransform: MediatorIteratorTransform;
31
+ /**
32
+ * Mediator that calls next join to be wrapped
33
+ */
34
+ mediatorJoin: MediatorRdfJoin;
35
+ }
36
+ /**
37
+ * Key that shows if the query operation has already been wrapped by a process iterator call
38
+ */
39
+ export declare const KEY_CONTEXT_WRAPPED_RDF_JOIN: ActionContextKey<IJoinEntry[]>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KEY_CONTEXT_WRAPPED_RDF_JOIN = exports.ActorRdfJoinWrapStream = void 0;
4
+ const bus_rdf_join_1 = require("@comunica/bus-rdf-join");
5
+ const core_1 = require("@comunica/core");
6
+ /**
7
+ * A comunica Wrap Stream RDF Join Actor.
8
+ */
9
+ class ActorRdfJoinWrapStream extends bus_rdf_join_1.ActorRdfJoin {
10
+ constructor(args) {
11
+ super(args, {
12
+ logicalType: 'inner',
13
+ physicalName: 'wrap-stream',
14
+ limitEntries: 0,
15
+ limitEntriesMin: true,
16
+ canHandleUndefs: true,
17
+ isLeaf: false,
18
+ });
19
+ }
20
+ async test(action) {
21
+ if (action.context.get(exports.KEY_CONTEXT_WRAPPED_RDF_JOIN) === action.entries) {
22
+ return (0, core_1.failTest)('Unable to wrap join operation multiple times');
23
+ }
24
+ const metadatas = await bus_rdf_join_1.ActorRdfJoin.getMetadatas(action.entries);
25
+ return await this.getJoinCoefficients(action, { metadatas });
26
+ }
27
+ async getOutput(action) {
28
+ // Prevent infinite recursion. In consequent query operation calls this key is set to false
29
+ // To allow the operation to wrap ALL rdf-join runs
30
+ action.context = this.setContextWrapped(action, action.context);
31
+ const result = await this.mediatorJoin.mediate(action);
32
+ const { stream, metadata } = (await this.mediatorIteratorTransform.mediate({
33
+ type: result.type,
34
+ operation: action.type,
35
+ stream: result.bindingsStream,
36
+ metadata: result.metadata,
37
+ context: action.context,
38
+ originalAction: action,
39
+ }));
40
+ result.bindingsStream = stream;
41
+ result.metadata = metadata;
42
+ return { result };
43
+ }
44
+ async getJoinCoefficients(_action, sideData) {
45
+ return (0, core_1.passTestWithSideData)({
46
+ iterations: -1,
47
+ persistedItems: -1,
48
+ blockingItems: -1,
49
+ requestTime: -1,
50
+ }, sideData);
51
+ }
52
+ /**
53
+ * Sets KEY_CONTEXT_WRAPPED_RDF_JOIN key in the context to the entries being joined.
54
+ * @param action The join action being executed
55
+ * @param context The ActionContext
56
+ * @returns The updated ActionContext
57
+ */
58
+ setContextWrapped(action, context) {
59
+ return context.set(exports.KEY_CONTEXT_WRAPPED_RDF_JOIN, action.entries);
60
+ }
61
+ }
62
+ exports.ActorRdfJoinWrapStream = ActorRdfJoinWrapStream;
63
+ /**
64
+ * Key that shows if the query operation has already been wrapped by a process iterator call
65
+ */
66
+ exports.KEY_CONTEXT_WRAPPED_RDF_JOIN = new core_1.ActionContextKey('@comunica/actor-rdf-join:wrapped');
67
+ //# sourceMappingURL=ActorRdfJoinWrapStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActorRdfJoinWrapStream.js","sourceRoot":"","sources":["ActorRdfJoinWrapStream.ts"],"names":[],"mappings":";;;AAQA,yDAAsD;AAEtD,yCAAkF;AAMlF;;GAEG;AACH,MAAa,sBAAuB,SAAQ,2BAAY;IAItD,YAAmB,IAAiC;QAClD,KAAK,CAAC,IAAI,EAAE;YACV,WAAW,EAAE,OAAO;YACpB,YAAY,EAAE,aAAa;YAC3B,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,IAAI;YACrB,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;IAEe,KAAK,CAAC,IAAI,CAAC,MAAsB;QAE/C,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oCAA4B,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;YACxE,OAAO,IAAA,eAAQ,EAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,2BAAY,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClE,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/D,CAAC;IAEe,KAAK,CAAC,SAAS,CAAC,MAAsB;QACpD,2FAA2F;QAC3F,mDAAmD;QACnD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,MAAM,GAAkC,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEtF,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO,CACxE;YACE,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,MAAM,CAAC,IAAI;YACtB,MAAM,EAAE,MAAM,CAAC,cAAc;YAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,cAAc,EAAE,MAAM;SACvB,CACF,CAAC,CAAC;QAEH,MAAM,CAAC,cAAc,GAAiC,MAAM,CAAC;QAC7D,MAAM,CAAC,QAAQ,GAAqC,QAAQ,CAAC;QAE7D,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;IAES,KAAK,CAAC,mBAAmB,CACjC,OAAuB,EACvB,QAAmC;QAEnC,OAAO,IAAA,2BAAoB,EAAC;YAC1B,UAAU,EAAE,CAAC,CAAC;YACd,cAAc,EAAE,CAAC,CAAC;YAClB,aAAa,EAAE,CAAC,CAAC;YACjB,WAAW,EAAE,CAAC,CAAC;SAChB,EAAE,QAAQ,CAAC,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,MAAsB,EAAE,OAAuB;QACtE,OAAO,OAAO,CAAC,GAAG,CAAC,oCAA4B,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;CACF;AArED,wDAqEC;AAaD;;GAEG;AACU,QAAA,4BAA4B,GAAG,IAAI,uBAAgB,CAC9D,kCAAkC,CACnC,CAAC","sourcesContent":["import type { MediatorIteratorTransform } from '@comunica/bus-iterator-transform';\nimport type {\n IActionRdfJoin,\n IActorRdfJoinOutputInner,\n IActorRdfJoinArgs,\n MediatorRdfJoin,\n IActorRdfJoinTestSideData }\n from '@comunica/bus-rdf-join';\nimport { ActorRdfJoin } from '@comunica/bus-rdf-join';\nimport type { TestResult } from '@comunica/core';\nimport { ActionContextKey, failTest, passTestWithSideData } from '@comunica/core';\nimport type { IMediatorTypeJoinCoefficients } from '@comunica/mediatortype-join-coefficients';\nimport type { IActionContext, IJoinEntry, IQueryOperationResultBindings, MetadataBindings } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\n\n/**\n * A comunica Wrap Stream RDF Join Actor.\n */\nexport class ActorRdfJoinWrapStream extends ActorRdfJoin {\n public readonly mediatorJoin: MediatorRdfJoin;\n public readonly mediatorIteratorTransform: MediatorIteratorTransform;\n\n public constructor(args: IActorRdfJoinWrapStreamArgs) {\n super(args, {\n logicalType: 'inner',\n physicalName: 'wrap-stream',\n limitEntries: 0,\n limitEntriesMin: true,\n canHandleUndefs: true,\n isLeaf: false,\n });\n }\n\n public override async test(action: IActionRdfJoin):\n Promise<TestResult<IMediatorTypeJoinCoefficients, IActorRdfJoinTestSideData>> {\n if (action.context.get(KEY_CONTEXT_WRAPPED_RDF_JOIN) === action.entries) {\n return failTest('Unable to wrap join operation multiple times');\n }\n\n const metadatas = await ActorRdfJoin.getMetadatas(action.entries);\n return await this.getJoinCoefficients(action, { metadatas });\n }\n\n public override async getOutput(action: IActionRdfJoin): Promise<IActorRdfJoinOutputInner> {\n // Prevent infinite recursion. In consequent query operation calls this key is set to false\n // To allow the operation to wrap ALL rdf-join runs\n action.context = this.setContextWrapped(action, action.context);\n const result: IQueryOperationResultBindings = await this.mediatorJoin.mediate(action);\n\n const { stream, metadata } = (await this.mediatorIteratorTransform.mediate(\n {\n type: result.type,\n operation: action.type,\n stream: result.bindingsStream,\n metadata: result.metadata,\n context: action.context,\n originalAction: action,\n },\n ));\n\n result.bindingsStream = <AsyncIterator<RDF.Bindings>> stream;\n result.metadata = <() => Promise<MetadataBindings>> metadata;\n\n return { result };\n }\n\n protected async getJoinCoefficients(\n _action: IActionRdfJoin,\n sideData: IActorRdfJoinTestSideData,\n ): Promise<TestResult<IMediatorTypeJoinCoefficients, IActorRdfJoinTestSideData>> {\n return passTestWithSideData({\n iterations: -1,\n persistedItems: -1,\n blockingItems: -1,\n requestTime: -1,\n }, sideData);\n }\n\n /**\n * Sets KEY_CONTEXT_WRAPPED_RDF_JOIN key in the context to the entries being joined.\n * @param action The join action being executed\n * @param context The ActionContext\n * @returns The updated ActionContext\n */\n public setContextWrapped(action: IActionRdfJoin, context: IActionContext): IActionContext {\n return context.set(KEY_CONTEXT_WRAPPED_RDF_JOIN, action.entries);\n }\n}\n\nexport interface IActorRdfJoinWrapStreamArgs extends IActorRdfJoinArgs {\n /**\n * Mediator that runs all transforms defined by user over the output stream of the query operation\n */\n mediatorIteratorTransform: MediatorIteratorTransform;\n /**\n * Mediator that calls next join to be wrapped\n */\n mediatorJoin: MediatorRdfJoin;\n}\n\n/**\n * Key that shows if the query operation has already been wrapped by a process iterator call\n */\nexport const KEY_CONTEXT_WRAPPED_RDF_JOIN = new ActionContextKey<IJoinEntry[]>(\n '@comunica/actor-rdf-join:wrapped',\n);\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './ActorRdfJoinWrapStream';
package/lib/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ActorRdfJoinWrapStream"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC","sourcesContent":["export * from './ActorRdfJoinWrapStream';\n"]}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@comunica/actor-rdf-join-wrap-stream",
3
+ "version": "4.1.0",
4
+ "description": "A wrap-stream rdf-join actor",
5
+ "lsd:module": true,
6
+ "license": "MIT",
7
+ "funding": {
8
+ "type": "opencollective",
9
+ "url": "https://opencollective.com/comunica-association"
10
+ },
11
+ "homepage": "https://comunica.dev/",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/comunica/comunica.git",
15
+ "directory": "packages/actor-rdf-join-wrap-stream"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/comunica/comunica/issues"
19
+ },
20
+ "keywords": [
21
+ "comunica",
22
+ "actor",
23
+ "rdf-join",
24
+ "wrap-stream"
25
+ ],
26
+ "sideEffects": false,
27
+ "main": "lib/index.js",
28
+ "typings": "lib/index",
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "files": [
33
+ "components",
34
+ "lib/**/*.d.ts",
35
+ "lib/**/*.js",
36
+ "lib/**/*.js.map"
37
+ ],
38
+ "scripts": {
39
+ "build": "npm run build:ts && npm run build:components",
40
+ "build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
41
+ "build:components": "componentsjs-generator"
42
+ },
43
+ "dependencies": {
44
+ "@comunica/bus-iterator-transform": "^4.1.0",
45
+ "@comunica/bus-rdf-join": "^4.1.0",
46
+ "@comunica/core": "^4.1.0",
47
+ "@comunica/mediatortype-join-coefficients": "^4.1.0",
48
+ "@comunica/types": "^4.1.0"
49
+ },
50
+ "gitHead": "711446473d18f5fd47aa1a67e6c23582234221ec"
51
+ }