@comunica/actor-query-operation-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 +22 -0
- package/README.md +42 -0
- package/components/ActorQueryOperationWrapStream.jsonld +230 -0
- package/components/components.jsonld +11 -0
- package/components/context.jsonld +58 -0
- package/lib/ActorQueryOperationWrapStream.d.ts +38 -0
- package/lib/ActorQueryOperationWrapStream.js +75 -0
- package/lib/ActorQueryOperationWrapStream.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/package.json +51 -0
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,42 @@
|
|
|
1
|
+
# Comunica Wrap Stream Query Operation Actor
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@comunica/actor-query-operation-wrap-stream)
|
|
4
|
+
|
|
5
|
+
A comunica Wrap Stream Query Operation 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-query-operation-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-query-operation-wrap-stream/^1.0.0/components/context.jsonld"
|
|
27
|
+
],
|
|
28
|
+
"actors": [
|
|
29
|
+
...
|
|
30
|
+
{
|
|
31
|
+
"@id": "urn:comunica:default:query-operation/actors#wrap-stream",
|
|
32
|
+
"@type": "ActorQueryOperationWrapStream",
|
|
33
|
+
"mediatorQueryOperation": { "@id": "urn:comunica:default:query-operation/mediators#main" },
|
|
34
|
+
"mediatorIteratorTransform": { "@id": "urn:comunica:default:iterator-transform/mediators#main" }
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Config Parameters
|
|
41
|
+
* `mediatorIteratorTransform`: Mediator that will run all actors subscribed to the `bus-iterator-transform` in sequence.
|
|
42
|
+
* `mediatorQueryOperation`: Mediator that runs the query operation that will be wrapped.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-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-query-operation/^4.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-query-operation-wrap-stream",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorQueryOperationWrapStream",
|
|
13
|
+
"extends": [
|
|
14
|
+
"cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation"
|
|
15
|
+
],
|
|
16
|
+
"comment": "A comunica Wrap Stream Query Operation Actor.",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_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": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_mediatorQueryOperation",
|
|
25
|
+
"range": "cc:components/Mediator.jsonld#Mediator",
|
|
26
|
+
"comment": "Mediator that runs the next query operation"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_name",
|
|
30
|
+
"range": "xsd:string",
|
|
31
|
+
"default": {
|
|
32
|
+
"@id": "rdf:subject"
|
|
33
|
+
},
|
|
34
|
+
"comment": "The name for this actor."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_bus",
|
|
38
|
+
"range": {
|
|
39
|
+
"@type": "ParameterRangeGenericComponent",
|
|
40
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
41
|
+
"genericTypeInstances": [
|
|
42
|
+
{
|
|
43
|
+
"@type": "ParameterRangeGenericComponent",
|
|
44
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
45
|
+
"genericTypeInstances": [
|
|
46
|
+
{
|
|
47
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
48
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
52
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
56
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
60
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
66
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
70
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
74
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
78
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"default": {
|
|
83
|
+
"@id": "cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus",
|
|
84
|
+
"@type": "cbqo:components/BusQueryOperation.jsonld#BusQueryOperation"
|
|
85
|
+
},
|
|
86
|
+
"comment": "The bus this actor subscribes to."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_busFailMessage",
|
|
90
|
+
"range": {
|
|
91
|
+
"@type": "ParameterRangeUnion",
|
|
92
|
+
"parameterRangeElements": [
|
|
93
|
+
"xsd:string",
|
|
94
|
+
{
|
|
95
|
+
"@type": "ParameterRangeUndefined"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"default": "Query operation processing failed: none of the configured actors were able to handle the operation type ${action.operation.type}",
|
|
100
|
+
"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}\""
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_beforeActors",
|
|
104
|
+
"range": {
|
|
105
|
+
"@type": "ParameterRangeUnion",
|
|
106
|
+
"parameterRangeElements": [
|
|
107
|
+
{
|
|
108
|
+
"@type": "ParameterRangeArray",
|
|
109
|
+
"parameterRangeValue": {
|
|
110
|
+
"@type": "ParameterRangeGenericComponent",
|
|
111
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
112
|
+
"genericTypeInstances": [
|
|
113
|
+
{
|
|
114
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
115
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
119
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
123
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
127
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"@type": "ParameterRangeUndefined"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"memberFields": [
|
|
141
|
+
{
|
|
142
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream__member_mediatorIteratorTransform",
|
|
143
|
+
"memberFieldName": "mediatorIteratorTransform",
|
|
144
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream__member_mediatorQueryOperation",
|
|
148
|
+
"memberFieldName": "mediatorQueryOperation",
|
|
149
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream__member_constructor",
|
|
153
|
+
"memberFieldName": "constructor"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream__member_test",
|
|
157
|
+
"memberFieldName": "test"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream__member_run",
|
|
161
|
+
"memberFieldName": "run"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream__member_setContextWrapped",
|
|
165
|
+
"memberFieldName": "setContextWrapped"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"constructorArguments": [
|
|
169
|
+
{
|
|
170
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args__constructorArgument",
|
|
171
|
+
"fields": [
|
|
172
|
+
{
|
|
173
|
+
"keyRaw": "mediatorIteratorTransform",
|
|
174
|
+
"value": {
|
|
175
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_mediatorIteratorTransform"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"keyRaw": "mediatorQueryOperation",
|
|
180
|
+
"value": {
|
|
181
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_mediatorQueryOperation"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"keyRaw": "name",
|
|
186
|
+
"value": {
|
|
187
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_name"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"keyRaw": "bus",
|
|
192
|
+
"value": {
|
|
193
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_bus"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"keyRaw": "busFailMessage",
|
|
198
|
+
"value": {
|
|
199
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_busFailMessage"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"keyRaw": "beforeActors",
|
|
204
|
+
"value": {
|
|
205
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_beforeActors"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#IActorQueryOperationWrapStreamArgs",
|
|
214
|
+
"@type": "AbstractClass",
|
|
215
|
+
"requireElement": "IActorQueryOperationWrapStreamArgs",
|
|
216
|
+
"parameters": [],
|
|
217
|
+
"memberFields": [
|
|
218
|
+
{
|
|
219
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#IActorQueryOperationWrapStreamArgs__member_mediatorIteratorTransform",
|
|
220
|
+
"memberFieldName": "mediatorIteratorTransform"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#IActorQueryOperationWrapStreamArgs__member_mediatorQueryOperation",
|
|
224
|
+
"memberFieldName": "mediatorQueryOperation"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"constructorArguments": []
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-wrap-stream/^4.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@comunica/actor-query-operation-wrap-stream",
|
|
6
|
+
"@type": "Module",
|
|
7
|
+
"requireName": "@comunica/actor-query-operation-wrap-stream",
|
|
8
|
+
"import": [
|
|
9
|
+
"caqows:components/ActorQueryOperationWrapStream.jsonld"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
"caqows": "npmd:@comunica/actor-query-operation-wrap-stream/^4.0.0/",
|
|
7
|
+
"ActorQueryOperationWrapStream": {
|
|
8
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_mediatorIteratorTransform": {
|
|
12
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_mediatorIteratorTransform"
|
|
13
|
+
},
|
|
14
|
+
"args_mediatorQueryOperation": {
|
|
15
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_mediatorQueryOperation"
|
|
16
|
+
},
|
|
17
|
+
"args_name": {
|
|
18
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_name"
|
|
19
|
+
},
|
|
20
|
+
"args_bus": {
|
|
21
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_bus"
|
|
22
|
+
},
|
|
23
|
+
"args_busFailMessage": {
|
|
24
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_busFailMessage"
|
|
25
|
+
},
|
|
26
|
+
"args_beforeActors": {
|
|
27
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_beforeActors",
|
|
28
|
+
"@container": "@list"
|
|
29
|
+
},
|
|
30
|
+
"mediatorIteratorTransform": {
|
|
31
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_mediatorIteratorTransform"
|
|
32
|
+
},
|
|
33
|
+
"mediatorQueryOperation": {
|
|
34
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_mediatorQueryOperation"
|
|
35
|
+
},
|
|
36
|
+
"name": {
|
|
37
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_name"
|
|
38
|
+
},
|
|
39
|
+
"bus": {
|
|
40
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_bus"
|
|
41
|
+
},
|
|
42
|
+
"busFailMessage": {
|
|
43
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_busFailMessage"
|
|
44
|
+
},
|
|
45
|
+
"beforeActors": {
|
|
46
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream_args_beforeActors",
|
|
47
|
+
"@container": "@list"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"IActorQueryOperationWrapStreamArgs": {
|
|
52
|
+
"@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#IActorQueryOperationWrapStreamArgs",
|
|
53
|
+
"@prefix": true,
|
|
54
|
+
"@context": {}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MediatorIteratorTransform } from '@comunica/bus-iterator-transform';
|
|
2
|
+
import type { IActionQueryOperation, IActorQueryOperationArgs, MediatorQueryOperation } from '@comunica/bus-query-operation';
|
|
3
|
+
import { ActorQueryOperation } from '@comunica/bus-query-operation';
|
|
4
|
+
import { ActionContextKey } from '@comunica/core';
|
|
5
|
+
import type { TestResult, IActorTest } from '@comunica/core';
|
|
6
|
+
import type { IActionContext, IQueryOperationResult } from '@comunica/types';
|
|
7
|
+
import type { Algebra } from 'sparqlalgebrajs';
|
|
8
|
+
/**
|
|
9
|
+
* A comunica Wrap Stream Query Operation Actor.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ActorQueryOperationWrapStream extends ActorQueryOperation {
|
|
12
|
+
readonly mediatorIteratorTransform: MediatorIteratorTransform;
|
|
13
|
+
readonly mediatorQueryOperation: MediatorQueryOperation;
|
|
14
|
+
constructor(args: IActorQueryOperationWrapStreamArgs);
|
|
15
|
+
test(action: IActionQueryOperation): Promise<TestResult<IActorTest>>;
|
|
16
|
+
run(action: IActionQueryOperation): Promise<IQueryOperationResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Sets KEY_CONTEXT_WRAPPED_QUERY_OPERATION to the operation being executed.
|
|
19
|
+
* @param operation The query operation.
|
|
20
|
+
* @param context The current action context.
|
|
21
|
+
* @returns A new action context with the operation marked as wrapped.
|
|
22
|
+
*/
|
|
23
|
+
setContextWrapped(operation: Algebra.Operation, context: IActionContext): IActionContext;
|
|
24
|
+
}
|
|
25
|
+
export interface IActorQueryOperationWrapStreamArgs extends IActorQueryOperationArgs {
|
|
26
|
+
/**
|
|
27
|
+
* Mediator that runs all transforms defined by user over the output stream of the query operation
|
|
28
|
+
*/
|
|
29
|
+
mediatorIteratorTransform: MediatorIteratorTransform;
|
|
30
|
+
/**
|
|
31
|
+
* Mediator that runs the next query operation
|
|
32
|
+
*/
|
|
33
|
+
mediatorQueryOperation: MediatorQueryOperation;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Key that that stores the last executed operation
|
|
37
|
+
*/
|
|
38
|
+
export declare const KEY_CONTEXT_WRAPPED_QUERY_OPERATION: ActionContextKey<Algebra.Operation>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KEY_CONTEXT_WRAPPED_QUERY_OPERATION = exports.ActorQueryOperationWrapStream = void 0;
|
|
4
|
+
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
5
|
+
const core_1 = require("@comunica/core");
|
|
6
|
+
/**
|
|
7
|
+
* A comunica Wrap Stream Query Operation Actor.
|
|
8
|
+
*/
|
|
9
|
+
class ActorQueryOperationWrapStream extends bus_query_operation_1.ActorQueryOperation {
|
|
10
|
+
constructor(args) {
|
|
11
|
+
super(args);
|
|
12
|
+
}
|
|
13
|
+
async test(action) {
|
|
14
|
+
if (action.context.get(exports.KEY_CONTEXT_WRAPPED_QUERY_OPERATION) === action.operation) {
|
|
15
|
+
return (0, core_1.failTest)('Unable to wrap query source multiple times');
|
|
16
|
+
}
|
|
17
|
+
// Ensure this is always run if not already wrapped
|
|
18
|
+
return (0, core_1.passTest)({ httpRequests: Number.NEGATIVE_INFINITY });
|
|
19
|
+
}
|
|
20
|
+
async run(action) {
|
|
21
|
+
// Prevent infinite recursion. In consequent query operation calls this key should be set to false
|
|
22
|
+
// To allow the operation to wrap ALL query operation runs
|
|
23
|
+
action.context = this.setContextWrapped(action.operation, action.context);
|
|
24
|
+
const output = await this.mediatorQueryOperation.mediate(action);
|
|
25
|
+
switch (output.type) {
|
|
26
|
+
case 'bindings': {
|
|
27
|
+
const bindingIteratorTransformed = await this.mediatorIteratorTransform.mediate({
|
|
28
|
+
type: 'bindings',
|
|
29
|
+
operation: action.operation.type,
|
|
30
|
+
stream: output.bindingsStream,
|
|
31
|
+
metadata: output.metadata,
|
|
32
|
+
originalAction: action,
|
|
33
|
+
context: action.context,
|
|
34
|
+
});
|
|
35
|
+
output.bindingsStream =
|
|
36
|
+
bindingIteratorTransformed.stream;
|
|
37
|
+
output.metadata =
|
|
38
|
+
bindingIteratorTransformed.metadata;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'quads': {
|
|
42
|
+
const iteratorTransformed = await this.mediatorIteratorTransform.mediate({
|
|
43
|
+
type: 'quads',
|
|
44
|
+
operation: action.operation.type,
|
|
45
|
+
stream: output.quadStream,
|
|
46
|
+
metadata: output.metadata,
|
|
47
|
+
context: action.context,
|
|
48
|
+
originalAction: action,
|
|
49
|
+
});
|
|
50
|
+
output.quadStream = iteratorTransformed.stream;
|
|
51
|
+
output.metadata = iteratorTransformed.metadata;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
default: {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return output;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets KEY_CONTEXT_WRAPPED_QUERY_OPERATION to the operation being executed.
|
|
62
|
+
* @param operation The query operation.
|
|
63
|
+
* @param context The current action context.
|
|
64
|
+
* @returns A new action context with the operation marked as wrapped.
|
|
65
|
+
*/
|
|
66
|
+
setContextWrapped(operation, context) {
|
|
67
|
+
return context.set(exports.KEY_CONTEXT_WRAPPED_QUERY_OPERATION, operation);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ActorQueryOperationWrapStream = ActorQueryOperationWrapStream;
|
|
71
|
+
/**
|
|
72
|
+
* Key that that stores the last executed operation
|
|
73
|
+
*/
|
|
74
|
+
exports.KEY_CONTEXT_WRAPPED_QUERY_OPERATION = new core_1.ActionContextKey('@comunica/actor-query-operation:wrapped');
|
|
75
|
+
//# sourceMappingURL=ActorQueryOperationWrapStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationWrapStream.js","sourceRoot":"","sources":["ActorQueryOperationWrapStream.ts"],"names":[],"mappings":";;;AAMA,uEAAoE;AACpE,yCAAsE;AAOtE;;GAEG;AACH,MAAa,6BAA8B,SAAQ,yCAAmB;IAIpE,YAAmB,IAAwC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAA6B;QAC7C,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2CAAmC,CAAC,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;YACjF,OAAO,IAAA,eAAQ,EAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QACD,mDAAmD;QACnD,OAAO,IAAA,eAAQ,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC9D,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAA6B;QAC5C,kGAAkG;QAClG,0DAA0D;QAC1D,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1E,MAAM,MAAM,GAA0B,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxF,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,UAAU,CAAC,CAAC,CAAC;gBAChB,MAAM,0BAA0B,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAC7E;oBACE,IAAI,EAAE,UAAU;oBAChB,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI;oBAChC,MAAM,EAAE,MAAM,CAAC,cAAc;oBAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,cAAc,EAAE,MAAM;oBACtB,OAAO,EAAE,MAAM,CAAC,OAAO;iBACxB,CACF,CAAC;gBACF,MAAM,CAAC,cAAc;oBACW,0BAA0B,CAAC,MAAM,CAAC;gBAClE,MAAM,CAAC,QAAQ;oBACqB,0BAA0B,CAAC,QAAQ,CAAC;gBACxE,MAAM;YACR,CAAC;YACD,KAAK,OAAO,CAAC,CAAC,CAAC;gBACb,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO,CACtE;oBACE,IAAI,EAAE,OAAO;oBACb,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI;oBAChC,MAAM,EAAE,MAAM,CAAC,UAAU;oBACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,cAAc,EAAE,MAAM;iBACvB,CACF,CAAC;gBACF,MAAM,CAAC,UAAU,GAA6B,mBAAmB,CAAC,MAAM,CAAC;gBACzE,MAAM,CAAC,QAAQ,GAAkC,mBAAmB,CAAC,QAAQ,CAAC;gBAC9E,MAAM;YACR,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,SAA4B,EAAE,OAAuB;QAC5E,OAAO,OAAO,CAAC,GAAG,CAAC,2CAAmC,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;CACF;AAtED,sEAsEC;AAaD;;GAEG;AACU,QAAA,mCAAmC,GAAG,IAAI,uBAAgB,CACrE,yCAAyC,CAC1C,CAAC","sourcesContent":["import type { MediatorIteratorTransform } from '@comunica/bus-iterator-transform';\nimport type {\n IActionQueryOperation,\n IActorQueryOperationArgs,\n MediatorQueryOperation,\n} from '@comunica/bus-query-operation';\nimport { ActorQueryOperation } from '@comunica/bus-query-operation';\nimport { ActionContextKey, failTest, passTest } from '@comunica/core';\nimport type { TestResult, IActorTest } from '@comunica/core';\nimport type { IActionContext, IQueryOperationResult, MetadataBindings, MetadataQuads } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\nimport type { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica Wrap Stream Query Operation Actor.\n */\nexport class ActorQueryOperationWrapStream extends ActorQueryOperation {\n public readonly mediatorIteratorTransform: MediatorIteratorTransform;\n public readonly mediatorQueryOperation: MediatorQueryOperation;\n\n public constructor(args: IActorQueryOperationWrapStreamArgs) {\n super(args);\n }\n\n public async test(action: IActionQueryOperation): Promise<TestResult<IActorTest>> {\n if (action.context.get(KEY_CONTEXT_WRAPPED_QUERY_OPERATION) === action.operation) {\n return failTest('Unable to wrap query source multiple times');\n }\n // Ensure this is always run if not already wrapped\n return passTest({ httpRequests: Number.NEGATIVE_INFINITY });\n }\n\n public async run(action: IActionQueryOperation): Promise<IQueryOperationResult> {\n // Prevent infinite recursion. In consequent query operation calls this key should be set to false\n // To allow the operation to wrap ALL query operation runs\n action.context = this.setContextWrapped(action.operation, action.context);\n const output: IQueryOperationResult = await this.mediatorQueryOperation.mediate(action);\n switch (output.type) {\n case 'bindings': {\n const bindingIteratorTransformed = await this.mediatorIteratorTransform.mediate(\n {\n type: 'bindings',\n operation: action.operation.type,\n stream: output.bindingsStream,\n metadata: output.metadata,\n originalAction: action,\n context: action.context,\n },\n );\n output.bindingsStream =\n <AsyncIterator<RDF.Bindings>> bindingIteratorTransformed.stream;\n output.metadata =\n <() => Promise<MetadataBindings>> bindingIteratorTransformed.metadata;\n break;\n }\n case 'quads': {\n const iteratorTransformed = await this.mediatorIteratorTransform.mediate(\n {\n type: 'quads',\n operation: action.operation.type,\n stream: output.quadStream,\n metadata: output.metadata,\n context: action.context,\n originalAction: action,\n },\n );\n output.quadStream = <AsyncIterator<RDF.Quad>> iteratorTransformed.stream;\n output.metadata = <() => Promise<MetadataQuads>> iteratorTransformed.metadata;\n break;\n }\n default: {\n break;\n }\n }\n return output;\n }\n\n /**\n * Sets KEY_CONTEXT_WRAPPED_QUERY_OPERATION to the operation being executed.\n * @param operation The query operation.\n * @param context The current action context.\n * @returns A new action context with the operation marked as wrapped.\n */\n public setContextWrapped(operation: Algebra.Operation, context: IActionContext): IActionContext {\n return context.set(KEY_CONTEXT_WRAPPED_QUERY_OPERATION, operation);\n }\n}\n\nexport interface IActorQueryOperationWrapStreamArgs extends IActorQueryOperationArgs {\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 runs the next query operation\n */\n mediatorQueryOperation: MediatorQueryOperation;\n}\n\n/**\n * Key that that stores the last executed operation\n */\nexport const KEY_CONTEXT_WRAPPED_QUERY_OPERATION = new ActionContextKey<Algebra.Operation>(\n '@comunica/actor-query-operation:wrapped',\n);\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActorQueryOperationWrapStream';
|
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("./ActorQueryOperationWrapStream"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD","sourcesContent":["export * from './ActorQueryOperationWrapStream';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@comunica/actor-query-operation-wrap-stream",
|
|
3
|
+
"version": "4.1.0",
|
|
4
|
+
"description": "A wrap-stream query-operation 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-query-operation-wrap-stream"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/comunica/comunica/issues"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"comunica",
|
|
22
|
+
"actor",
|
|
23
|
+
"query-operation",
|
|
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-query-operation": "^4.1.0",
|
|
46
|
+
"@comunica/core": "^4.1.0",
|
|
47
|
+
"@comunica/types": "^4.1.0",
|
|
48
|
+
"sparqlalgebrajs": "^4.3.8"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "711446473d18f5fd47aa1a67e6c23582234221ec"
|
|
51
|
+
}
|