@comunica/bus-bindings-aggregator-factory 3.2.4-alpha.47.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 +27 -0
- package/components/ActorBindingsAggregatorFactory.jsonld +283 -0
- package/components/components.jsonld +11 -0
- package/components/context.jsonld +67 -0
- package/lib/ActorBindingsAggregatorFactory.d.ts +47 -0
- package/lib/ActorBindingsAggregatorFactory.js +26 -0
- package/lib/ActorBindingsAggregatorFactory.js.map +1 -0
- package/lib/AggregateEvaluator.d.ts +36 -0
- package/lib/AggregateEvaluator.js +89 -0
- package/lib/AggregateEvaluator.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/package.json +49 -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,27 @@
|
|
|
1
|
+
# Comunica Bus Bindings Aggregator Factory
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@comunica/bus-expression-evaluator-aggregate)
|
|
4
|
+
|
|
5
|
+
A comunica bus for bindings-aggregator-factory events.
|
|
6
|
+
|
|
7
|
+
This module is part of the [Comunica framework](https://github.com/comunica/comunica),
|
|
8
|
+
and should only be used by [developers that want to build their own query engine](https://comunica.dev/docs/modify/).
|
|
9
|
+
|
|
10
|
+
[Click here if you just want to query with Comunica](https://comunica.dev/docs/query/).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
$ yarn add @comunica/bus-bindings-aggregator-factory
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
## Bus usage
|
|
21
|
+
|
|
22
|
+
* **Context**: `"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-bindings-aggregator-factory/^1.0.0/components/context.jsonld"`
|
|
23
|
+
* **Bus name**: `ActorBindingsAggregatorFactory:_default_bus`
|
|
24
|
+
|
|
25
|
+
## Creating actors on this bus
|
|
26
|
+
|
|
27
|
+
Actors extending [`ActorBindingsAggregatorFactory`](https://comunica.github.io/comunica/modules/_comunica_bus_bindings_aggregator_factory.html) are automatically subscribed to this bus.
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-bindings-aggregator-factory/^3.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^3.0.0/components/context.jsonld"
|
|
5
|
+
],
|
|
6
|
+
"@id": "npmd:@comunica/bus-bindings-aggregator-factory",
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory",
|
|
10
|
+
"@type": "AbstractClass",
|
|
11
|
+
"requireElement": "ActorBindingsAggregatorFactory",
|
|
12
|
+
"extends": [
|
|
13
|
+
{
|
|
14
|
+
"@type": "GenericComponentExtension",
|
|
15
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
16
|
+
"genericTypeInstances": [
|
|
17
|
+
"cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActionBindingsAggregatorFactory",
|
|
18
|
+
"cc:components/Actor.jsonld#IActorTest",
|
|
19
|
+
"cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryOutput",
|
|
20
|
+
{
|
|
21
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
22
|
+
"parameterRangeGenericType": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory__generic_TS"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"comment": "A comunica actor for creating Binding-Aggregator-factories. Actor types: * Input: IActionBindingsAggregatorFactory: A SPARQL expression and a factory for an expression evaluator. * Test: <none> * Output: IActorBindingsAggregatorFactoryOutput: An aggregator of RDF bindings.",
|
|
28
|
+
"genericTypeParameters": [
|
|
29
|
+
{
|
|
30
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory__generic_TS",
|
|
31
|
+
"default": {
|
|
32
|
+
"@type": "ParameterRangeUndefined"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"parameters": [
|
|
37
|
+
{
|
|
38
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_mediatorExpressionEvaluatorFactory",
|
|
39
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_name",
|
|
43
|
+
"range": "xsd:string",
|
|
44
|
+
"default": {
|
|
45
|
+
"@id": "rdf:subject"
|
|
46
|
+
},
|
|
47
|
+
"comment": "The name for this actor."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_bus",
|
|
51
|
+
"range": {
|
|
52
|
+
"@type": "ParameterRangeGenericComponent",
|
|
53
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
54
|
+
"genericTypeInstances": [
|
|
55
|
+
{
|
|
56
|
+
"@type": "ParameterRangeGenericComponent",
|
|
57
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
58
|
+
"genericTypeInstances": [
|
|
59
|
+
{
|
|
60
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
61
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
65
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
69
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
73
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
79
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
83
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
87
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
91
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"default": {
|
|
96
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_default_bus",
|
|
97
|
+
"@type": "cc:components/Bus.jsonld#Bus"
|
|
98
|
+
},
|
|
99
|
+
"comment": "The bus this actor subscribes to."
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_busFailMessage",
|
|
103
|
+
"range": {
|
|
104
|
+
"@type": "ParameterRangeUnion",
|
|
105
|
+
"parameterRangeElements": [
|
|
106
|
+
"xsd:string",
|
|
107
|
+
{
|
|
108
|
+
"@type": "ParameterRangeUndefined"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"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}\""
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_beforeActors",
|
|
116
|
+
"range": {
|
|
117
|
+
"@type": "ParameterRangeUnion",
|
|
118
|
+
"parameterRangeElements": [
|
|
119
|
+
{
|
|
120
|
+
"@type": "ParameterRangeArray",
|
|
121
|
+
"parameterRangeValue": {
|
|
122
|
+
"@type": "ParameterRangeGenericComponent",
|
|
123
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
124
|
+
"genericTypeInstances": [
|
|
125
|
+
{
|
|
126
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
127
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
131
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
135
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
139
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"@type": "ParameterRangeUndefined"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"memberFields": [
|
|
153
|
+
{
|
|
154
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory__member_mediatorExpressionEvaluatorFactory",
|
|
155
|
+
"memberFieldName": "mediatorExpressionEvaluatorFactory",
|
|
156
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory__member_constructor",
|
|
160
|
+
"memberFieldName": "constructor"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"constructorArguments": [
|
|
164
|
+
{
|
|
165
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args__constructorArgument",
|
|
166
|
+
"fields": [
|
|
167
|
+
{
|
|
168
|
+
"keyRaw": "mediatorExpressionEvaluatorFactory",
|
|
169
|
+
"value": {
|
|
170
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_mediatorExpressionEvaluatorFactory"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"keyRaw": "name",
|
|
175
|
+
"value": {
|
|
176
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_name"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"keyRaw": "bus",
|
|
181
|
+
"value": {
|
|
182
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_bus"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"keyRaw": "busFailMessage",
|
|
187
|
+
"value": {
|
|
188
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_busFailMessage"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"keyRaw": "beforeActors",
|
|
193
|
+
"value": {
|
|
194
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_beforeActors"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActionBindingsAggregatorFactory",
|
|
203
|
+
"@type": "AbstractClass",
|
|
204
|
+
"requireElement": "IActionBindingsAggregatorFactory",
|
|
205
|
+
"extends": [
|
|
206
|
+
"cc:components/Actor.jsonld#IAction"
|
|
207
|
+
],
|
|
208
|
+
"parameters": [],
|
|
209
|
+
"memberFields": [
|
|
210
|
+
{
|
|
211
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActionBindingsAggregatorFactory__member_expr",
|
|
212
|
+
"memberFieldName": "expr"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"constructorArguments": []
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IBindingsAggregator",
|
|
219
|
+
"@type": "AbstractClass",
|
|
220
|
+
"requireElement": "IBindingsAggregator",
|
|
221
|
+
"comment": "Instances of this interface perform a specific aggregation of bindings. You can put bindings and when all bindings have been put, request the result.",
|
|
222
|
+
"parameters": [],
|
|
223
|
+
"memberFields": [
|
|
224
|
+
{
|
|
225
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IBindingsAggregator__member_putBindings",
|
|
226
|
+
"memberFieldName": "putBindings"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IBindingsAggregator__member_result",
|
|
230
|
+
"memberFieldName": "result"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"constructorArguments": []
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryOutput",
|
|
237
|
+
"@type": "AbstractClass",
|
|
238
|
+
"requireElement": "IActorBindingsAggregatorFactoryOutput",
|
|
239
|
+
"extends": [
|
|
240
|
+
"cc:components/Actor.jsonld#IActorOutput",
|
|
241
|
+
"cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IBindingsAggregator"
|
|
242
|
+
],
|
|
243
|
+
"parameters": [],
|
|
244
|
+
"constructorArguments": []
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryArgs",
|
|
248
|
+
"@type": "AbstractClass",
|
|
249
|
+
"requireElement": "IActorBindingsAggregatorFactoryArgs",
|
|
250
|
+
"extends": [
|
|
251
|
+
{
|
|
252
|
+
"@type": "GenericComponentExtension",
|
|
253
|
+
"component": "cc:components/Actor.jsonld#IActorArgs",
|
|
254
|
+
"genericTypeInstances": [
|
|
255
|
+
"cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActionBindingsAggregatorFactory",
|
|
256
|
+
"cc:components/Actor.jsonld#IActorTest",
|
|
257
|
+
"cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryOutput",
|
|
258
|
+
{
|
|
259
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
260
|
+
"parameterRangeGenericType": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryArgs__generic_TS"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"genericTypeParameters": [
|
|
266
|
+
{
|
|
267
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryArgs__generic_TS",
|
|
268
|
+
"default": {
|
|
269
|
+
"@type": "ParameterRangeUndefined"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"parameters": [],
|
|
274
|
+
"memberFields": [
|
|
275
|
+
{
|
|
276
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryArgs__member_mediatorExpressionEvaluatorFactory",
|
|
277
|
+
"memberFieldName": "mediatorExpressionEvaluatorFactory"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"constructorArguments": []
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-bindings-aggregator-factory/^3.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@comunica/bus-bindings-aggregator-factory",
|
|
6
|
+
"@type": "Module",
|
|
7
|
+
"requireName": "@comunica/bus-bindings-aggregator-factory",
|
|
8
|
+
"import": [
|
|
9
|
+
"cbbaf:components/ActorBindingsAggregatorFactory.jsonld"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
"cbbaf": "npmd:@comunica/bus-bindings-aggregator-factory/^3.0.0/",
|
|
7
|
+
"ActorBindingsAggregatorFactory": {
|
|
8
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_mediatorExpressionEvaluatorFactory": {
|
|
12
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_mediatorExpressionEvaluatorFactory"
|
|
13
|
+
},
|
|
14
|
+
"args_name": {
|
|
15
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_name"
|
|
16
|
+
},
|
|
17
|
+
"args_bus": {
|
|
18
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_bus"
|
|
19
|
+
},
|
|
20
|
+
"args_busFailMessage": {
|
|
21
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_busFailMessage"
|
|
22
|
+
},
|
|
23
|
+
"args_beforeActors": {
|
|
24
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_beforeActors",
|
|
25
|
+
"@container": "@list"
|
|
26
|
+
},
|
|
27
|
+
"mediatorExpressionEvaluatorFactory": {
|
|
28
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_mediatorExpressionEvaluatorFactory"
|
|
29
|
+
},
|
|
30
|
+
"name": {
|
|
31
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_name"
|
|
32
|
+
},
|
|
33
|
+
"bus": {
|
|
34
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_bus"
|
|
35
|
+
},
|
|
36
|
+
"busFailMessage": {
|
|
37
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_busFailMessage"
|
|
38
|
+
},
|
|
39
|
+
"beforeActors": {
|
|
40
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#ActorBindingsAggregatorFactory_args_beforeActors",
|
|
41
|
+
"@container": "@list"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"IActionBindingsAggregatorFactory": {
|
|
46
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActionBindingsAggregatorFactory",
|
|
47
|
+
"@prefix": true,
|
|
48
|
+
"@context": {}
|
|
49
|
+
},
|
|
50
|
+
"IBindingsAggregator": {
|
|
51
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IBindingsAggregator",
|
|
52
|
+
"@prefix": true,
|
|
53
|
+
"@context": {}
|
|
54
|
+
},
|
|
55
|
+
"IActorBindingsAggregatorFactoryOutput": {
|
|
56
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryOutput",
|
|
57
|
+
"@prefix": true,
|
|
58
|
+
"@context": {}
|
|
59
|
+
},
|
|
60
|
+
"IActorBindingsAggregatorFactoryArgs": {
|
|
61
|
+
"@id": "cbbaf:components/ActorBindingsAggregatorFactory.jsonld#IActorBindingsAggregatorFactoryArgs",
|
|
62
|
+
"@prefix": true,
|
|
63
|
+
"@context": {}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { MediatorExpressionEvaluatorFactory } from '@comunica/bus-expression-evaluator-factory';
|
|
2
|
+
import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';
|
|
3
|
+
import { Actor } from '@comunica/core';
|
|
4
|
+
import type * as RDF from '@rdfjs/types';
|
|
5
|
+
import type { Algebra } from 'sparqlalgebrajs';
|
|
6
|
+
/**
|
|
7
|
+
* A comunica actor for creating Binding-Aggregator-factories.
|
|
8
|
+
*
|
|
9
|
+
* Actor types:
|
|
10
|
+
* * Input: IActionBindingsAggregatorFactory: A SPARQL expression and a factory for an expression evaluator.
|
|
11
|
+
* * Test: <none>
|
|
12
|
+
* * Output: IActorBindingsAggregatorFactoryOutput: An aggregator of RDF bindings.
|
|
13
|
+
*
|
|
14
|
+
* @see IActionBindingsAggregatorFactory
|
|
15
|
+
* @see IActorBindingsAggregatorFactoryOutput
|
|
16
|
+
*/
|
|
17
|
+
export declare abstract class ActorBindingsAggregatorFactory<TS = undefined> extends Actor<IActionBindingsAggregatorFactory, IActorTest, IActorBindingsAggregatorFactoryOutput, TS> {
|
|
18
|
+
protected readonly mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;
|
|
19
|
+
/**
|
|
20
|
+
* @param args - @defaultNested {<default_bus> a <cc:components/Bus.jsonld#Bus>} bus
|
|
21
|
+
*/
|
|
22
|
+
protected constructor(args: IActorBindingsAggregatorFactoryArgs<TS>);
|
|
23
|
+
}
|
|
24
|
+
export interface IActionBindingsAggregatorFactory extends IAction {
|
|
25
|
+
expr: Algebra.AggregateExpression;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Instances of this interface perform a specific aggregation of bindings.
|
|
29
|
+
* You can put bindings and when all bindings have been put, request the result.
|
|
30
|
+
*/
|
|
31
|
+
export interface IBindingsAggregator {
|
|
32
|
+
/**
|
|
33
|
+
* Registers bindings to the aggregator. Each binding you put has the ability to change the aggregation result.
|
|
34
|
+
* @param bindings the bindings to put.
|
|
35
|
+
*/
|
|
36
|
+
putBindings: (bindings: RDF.Bindings) => Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Request the result term of aggregating the bindings you have put in the aggregator.
|
|
39
|
+
*/
|
|
40
|
+
result: () => Promise<RDF.Term | undefined>;
|
|
41
|
+
}
|
|
42
|
+
export interface IActorBindingsAggregatorFactoryOutput extends IActorOutput, IBindingsAggregator {
|
|
43
|
+
}
|
|
44
|
+
export interface IActorBindingsAggregatorFactoryArgs<TS = undefined> extends IActorArgs<IActionBindingsAggregatorFactory, IActorTest, IActorBindingsAggregatorFactoryOutput, TS> {
|
|
45
|
+
mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;
|
|
46
|
+
}
|
|
47
|
+
export type MediatorBindingsAggregatorFactory = Mediate<IActionBindingsAggregatorFactory, IActorBindingsAggregatorFactoryOutput>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActorBindingsAggregatorFactory = void 0;
|
|
4
|
+
const core_1 = require("@comunica/core");
|
|
5
|
+
/**
|
|
6
|
+
* A comunica actor for creating Binding-Aggregator-factories.
|
|
7
|
+
*
|
|
8
|
+
* Actor types:
|
|
9
|
+
* * Input: IActionBindingsAggregatorFactory: A SPARQL expression and a factory for an expression evaluator.
|
|
10
|
+
* * Test: <none>
|
|
11
|
+
* * Output: IActorBindingsAggregatorFactoryOutput: An aggregator of RDF bindings.
|
|
12
|
+
*
|
|
13
|
+
* @see IActionBindingsAggregatorFactory
|
|
14
|
+
* @see IActorBindingsAggregatorFactoryOutput
|
|
15
|
+
*/
|
|
16
|
+
class ActorBindingsAggregatorFactory extends core_1.Actor {
|
|
17
|
+
/**
|
|
18
|
+
* @param args - @defaultNested {<default_bus> a <cc:components/Bus.jsonld#Bus>} bus
|
|
19
|
+
*/
|
|
20
|
+
constructor(args) {
|
|
21
|
+
super(args);
|
|
22
|
+
this.mediatorExpressionEvaluatorFactory = args.mediatorExpressionEvaluatorFactory;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ActorBindingsAggregatorFactory = ActorBindingsAggregatorFactory;
|
|
26
|
+
//# sourceMappingURL=ActorBindingsAggregatorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActorBindingsAggregatorFactory.js","sourceRoot":"","sources":["ActorBindingsAggregatorFactory.ts"],"names":[],"mappings":";;;AAIA,yCAAuC;AAIvC;;;;;;;;;;GAUG;AACH,MAAsB,8BAA+C,SAAQ,YAK5E;IAGC;;OAEG;IACH,YAAsB,IAA6C;QACjE,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,kCAAkC,GAAG,IAAI,CAAC,kCAAkC,CAAC;IACpF,CAAC;CACF;AAfD,wEAeC","sourcesContent":["import type {\n MediatorExpressionEvaluatorFactory,\n} from '@comunica/bus-expression-evaluator-factory';\nimport type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';\nimport { Actor } from '@comunica/core';\nimport type * as RDF from '@rdfjs/types';\nimport type { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica actor for creating Binding-Aggregator-factories.\n *\n * Actor types:\n * * Input: IActionBindingsAggregatorFactory: A SPARQL expression and a factory for an expression evaluator.\n * * Test: <none>\n * * Output: IActorBindingsAggregatorFactoryOutput: An aggregator of RDF bindings.\n *\n * @see IActionBindingsAggregatorFactory\n * @see IActorBindingsAggregatorFactoryOutput\n */\nexport abstract class ActorBindingsAggregatorFactory<TS = undefined> extends Actor<\nIActionBindingsAggregatorFactory,\nIActorTest,\nIActorBindingsAggregatorFactoryOutput,\nTS\n> {\n protected readonly mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;\n\n /**\n * @param args - @defaultNested {<default_bus> a <cc:components/Bus.jsonld#Bus>} bus\n */\n protected constructor(args: IActorBindingsAggregatorFactoryArgs<TS>) {\n super(args);\n this.mediatorExpressionEvaluatorFactory = args.mediatorExpressionEvaluatorFactory;\n }\n}\n\nexport interface IActionBindingsAggregatorFactory extends IAction {\n expr: Algebra.AggregateExpression;\n}\n\n/**\n * Instances of this interface perform a specific aggregation of bindings.\n * You can put bindings and when all bindings have been put, request the result.\n */\nexport interface IBindingsAggregator {\n /**\n * Registers bindings to the aggregator. Each binding you put has the ability to change the aggregation result.\n * @param bindings the bindings to put.\n */\n putBindings: (bindings: RDF.Bindings) => Promise<void>;\n\n /**\n * Request the result term of aggregating the bindings you have put in the aggregator.\n */\n result: () => Promise<RDF.Term | undefined>;\n}\n\nexport interface IActorBindingsAggregatorFactoryOutput extends IActorOutput, IBindingsAggregator {}\n\nexport interface IActorBindingsAggregatorFactoryArgs<TS = undefined> extends IActorArgs<\nIActionBindingsAggregatorFactory,\nIActorTest,\nIActorBindingsAggregatorFactoryOutput,\nTS\n> {\n mediatorExpressionEvaluatorFactory: MediatorExpressionEvaluatorFactory;\n}\n\nexport type MediatorBindingsAggregatorFactory = Mediate<\nIActionBindingsAggregatorFactory,\nIActorBindingsAggregatorFactoryOutput\n>;\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IExpressionEvaluator, ISuperTypeProvider } from '@comunica/types';
|
|
2
|
+
import * as Eval from '@comunica/utils-expression-evaluator';
|
|
3
|
+
import type * as RDF from '@rdfjs/types';
|
|
4
|
+
/**
|
|
5
|
+
* This is the base class for all aggregators.
|
|
6
|
+
* NOTE: The wildcard count aggregator significantly differs from the others and overloads parts of this class.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class AggregateEvaluator {
|
|
9
|
+
protected readonly evaluator: IExpressionEvaluator;
|
|
10
|
+
protected readonly distinct: boolean;
|
|
11
|
+
private readonly throwError;
|
|
12
|
+
private errorOccurred;
|
|
13
|
+
protected readonly variableValues: Set<string>;
|
|
14
|
+
protected readonly superTypeProvider: ISuperTypeProvider;
|
|
15
|
+
protected readonly termTransformer: Eval.TermTransformer;
|
|
16
|
+
protected constructor(evaluator: IExpressionEvaluator, distinct: boolean, throwError?: boolean);
|
|
17
|
+
protected abstract putTerm(term: RDF.Term): void;
|
|
18
|
+
protected abstract termResult(): RDF.Term | undefined;
|
|
19
|
+
emptyValueTerm(): RDF.Term | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The spec says to throw an error when a set function is called on an empty
|
|
22
|
+
* set (unless explicitly mentioned otherwise like COUNT).
|
|
23
|
+
* However, aggregate error handling says to not bind the result in case of an
|
|
24
|
+
* error. So to simplify logic in the caller, we return undefined by default.
|
|
25
|
+
*/
|
|
26
|
+
emptyValue(): RDF.Term | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Base implementation of putBindings, that evaluates to a term and then calls putTerm.
|
|
29
|
+
* The WildcardCountAggregator will completely discard this implementation.
|
|
30
|
+
* @param bindings
|
|
31
|
+
*/
|
|
32
|
+
putBindings(bindings: RDF.Bindings): Promise<void>;
|
|
33
|
+
result(): Promise<RDF.Term | undefined>;
|
|
34
|
+
private safeThrow;
|
|
35
|
+
protected termToNumericOrError(term: RDF.Term): Eval.NumericLiteral;
|
|
36
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateEvaluator = void 0;
|
|
4
|
+
const context_entries_1 = require("@comunica/context-entries");
|
|
5
|
+
const Eval = require("@comunica/utils-expression-evaluator");
|
|
6
|
+
const RdfString = require("rdf-string");
|
|
7
|
+
/**
|
|
8
|
+
* This is the base class for all aggregators.
|
|
9
|
+
* NOTE: The wildcard count aggregator significantly differs from the others and overloads parts of this class.
|
|
10
|
+
*/
|
|
11
|
+
class AggregateEvaluator {
|
|
12
|
+
constructor(evaluator, distinct, throwError = false) {
|
|
13
|
+
this.evaluator = evaluator;
|
|
14
|
+
this.distinct = distinct;
|
|
15
|
+
this.throwError = throwError;
|
|
16
|
+
this.errorOccurred = false;
|
|
17
|
+
this.errorOccurred = false;
|
|
18
|
+
this.superTypeProvider = evaluator.context.getSafe(context_entries_1.KeysExpressionEvaluator.superTypeProvider);
|
|
19
|
+
this.termTransformer = new Eval.TermTransformer(this.superTypeProvider);
|
|
20
|
+
this.variableValues = new Set();
|
|
21
|
+
}
|
|
22
|
+
emptyValueTerm() {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The spec says to throw an error when a set function is called on an empty
|
|
27
|
+
* set (unless explicitly mentioned otherwise like COUNT).
|
|
28
|
+
* However, aggregate error handling says to not bind the result in case of an
|
|
29
|
+
* error. So to simplify logic in the caller, we return undefined by default.
|
|
30
|
+
*/
|
|
31
|
+
emptyValue() {
|
|
32
|
+
const val = this.emptyValueTerm();
|
|
33
|
+
if (val === undefined && this.throwError) {
|
|
34
|
+
throw new Eval.EmptyAggregateError();
|
|
35
|
+
}
|
|
36
|
+
return val;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Base implementation of putBindings, that evaluates to a term and then calls putTerm.
|
|
40
|
+
* The WildcardCountAggregator will completely discard this implementation.
|
|
41
|
+
* @param bindings
|
|
42
|
+
*/
|
|
43
|
+
async putBindings(bindings) {
|
|
44
|
+
if (this.errorOccurred) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const term = await this.evaluator.evaluate(bindings);
|
|
49
|
+
if (!term || this.errorOccurred) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Handle DISTINCT before putting the term
|
|
53
|
+
if (!this.distinct || !this.variableValues.has(RdfString.termToString(term))) {
|
|
54
|
+
this.putTerm(term);
|
|
55
|
+
if (this.distinct) {
|
|
56
|
+
this.variableValues.add(RdfString.termToString(term));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
this.safeThrow(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async result() {
|
|
65
|
+
if (this.errorOccurred) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
return this.termResult();
|
|
69
|
+
}
|
|
70
|
+
safeThrow(err) {
|
|
71
|
+
if (this.throwError) {
|
|
72
|
+
throw err;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.errorOccurred = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
termToNumericOrError(term) {
|
|
79
|
+
if (term.termType !== 'Literal') {
|
|
80
|
+
throw new Error(`Term with value ${term.value} has type ${term.termType} and is not a numeric literal`);
|
|
81
|
+
}
|
|
82
|
+
else if (!Eval.isSubTypeOf(term.datatype.value, Eval.TypeAlias.SPARQL_NUMERIC, this.superTypeProvider)) {
|
|
83
|
+
throw new Error(`Term datatype ${term.datatype.value} with value ${term.value} has type ${term.termType} and is not a numeric literal`);
|
|
84
|
+
}
|
|
85
|
+
return this.termTransformer.transformLiteral(term);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.AggregateEvaluator = AggregateEvaluator;
|
|
89
|
+
//# sourceMappingURL=AggregateEvaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AggregateEvaluator.js","sourceRoot":"","sources":["AggregateEvaluator.ts"],"names":[],"mappings":";;;AAAA,+DAAoE;AAEpE,6DAA6D;AAE7D,wCAAwC;AAExC;;;GAGG;AACH,MAAsB,kBAAkB;IAQtC,YACqB,SAA+B,EAC/B,QAAiB,EACnB,aAAa,KAAK;QAFhB,cAAS,GAAT,SAAS,CAAsB;QAC/B,aAAQ,GAAR,QAAQ,CAAS;QACnB,eAAU,GAAV,UAAU,CAAQ;QAV7B,kBAAa,GAAG,KAAK,CAAC;QAY5B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,yCAAuB,CAAC,iBAAiB,CAAC,CAAC;QAC9F,IAAI,CAAC,eAAe,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAExE,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;IAClC,CAAC;IAKM,cAAc;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACI,UAAU;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAClC,IAAI,GAAG,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,WAAW,CAAC,QAAsB;QAC7C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACrD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBAChC,OAAO;YACT,CAAC;YAED,0CAA0C;YAC1C,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBAC7E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACnB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAEO,SAAS,CAAC,GAAY;QAC5B,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM,GAAG,CAAC;QACZ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,IAAc;QAC3C,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAC1G,CAAC;aAAM,IACL,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAChG,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,KAAK,eAAe,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAC1I,CAAC;QACD,OAA6B,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC3E,CAAC;CACF;AA5FD,gDA4FC","sourcesContent":["import { KeysExpressionEvaluator } from '@comunica/context-entries';\nimport type { IExpressionEvaluator, ISuperTypeProvider } from '@comunica/types';\nimport * as Eval from '@comunica/utils-expression-evaluator';\nimport type * as RDF from '@rdfjs/types';\nimport * as RdfString from 'rdf-string';\n\n/**\n * This is the base class for all aggregators.\n * NOTE: The wildcard count aggregator significantly differs from the others and overloads parts of this class.\n */\nexport abstract class AggregateEvaluator {\n private errorOccurred = false;\n\n protected readonly variableValues: Set<string>;\n\n protected readonly superTypeProvider: ISuperTypeProvider;\n protected readonly termTransformer: Eval.TermTransformer;\n\n protected constructor(\n protected readonly evaluator: IExpressionEvaluator,\n protected readonly distinct: boolean,\n private readonly throwError = false,\n ) {\n this.errorOccurred = false;\n this.superTypeProvider = evaluator.context.getSafe(KeysExpressionEvaluator.superTypeProvider);\n this.termTransformer = new Eval.TermTransformer(this.superTypeProvider);\n\n this.variableValues = new Set();\n }\n\n protected abstract putTerm(term: RDF.Term): void;\n protected abstract termResult(): RDF.Term | undefined;\n\n public emptyValueTerm(): RDF.Term | undefined {\n return undefined;\n }\n\n /**\n * The spec says to throw an error when a set function is called on an empty\n * set (unless explicitly mentioned otherwise like COUNT).\n * However, aggregate error handling says to not bind the result in case of an\n * error. So to simplify logic in the caller, we return undefined by default.\n */\n public emptyValue(): RDF.Term | undefined {\n const val = this.emptyValueTerm();\n if (val === undefined && this.throwError) {\n throw new Eval.EmptyAggregateError();\n }\n return val;\n }\n\n /**\n * Base implementation of putBindings, that evaluates to a term and then calls putTerm.\n * The WildcardCountAggregator will completely discard this implementation.\n * @param bindings\n */\n public async putBindings(bindings: RDF.Bindings): Promise<void> {\n if (this.errorOccurred) {\n return;\n }\n try {\n const term = await this.evaluator.evaluate(bindings);\n if (!term || this.errorOccurred) {\n return;\n }\n\n // Handle DISTINCT before putting the term\n if (!this.distinct || !this.variableValues.has(RdfString.termToString(term))) {\n this.putTerm(term);\n if (this.distinct) {\n this.variableValues.add(RdfString.termToString(term));\n }\n }\n } catch (error: unknown) {\n this.safeThrow(error);\n }\n }\n\n public async result(): Promise<RDF.Term | undefined> {\n if (this.errorOccurred) {\n return undefined;\n }\n return this.termResult();\n }\n\n private safeThrow(err: unknown): void {\n if (this.throwError) {\n throw err;\n } else {\n this.errorOccurred = true;\n }\n }\n\n protected termToNumericOrError(term: RDF.Term): Eval.NumericLiteral {\n if (term.termType !== 'Literal') {\n throw new Error(`Term with value ${term.value} has type ${term.termType} and is not a numeric literal`);\n } else if (\n !Eval.isSubTypeOf(term.datatype.value, Eval.TypeAlias.SPARQL_NUMERIC, this.superTypeProvider)) {\n throw new Error(`Term datatype ${term.datatype.value} with value ${term.value} has type ${term.termType} and is not a numeric literal`);\n }\n return <Eval.NumericLiteral> this.termTransformer.transformLiteral(term);\n }\n}\n"]}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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("./ActorBindingsAggregatorFactory"), exports);
|
|
18
|
+
__exportStar(require("./AggregateEvaluator"), exports);
|
|
19
|
+
//# 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,mEAAiD;AACjD,uDAAqC","sourcesContent":["export * from './ActorBindingsAggregatorFactory';\nexport * from './AggregateEvaluator';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@comunica/bus-bindings-aggregator-factory",
|
|
3
|
+
"version": "3.2.4-alpha.47.0",
|
|
4
|
+
"description": "A comunica actor for creating Binding-Aggregators.",
|
|
5
|
+
"lsd:module": true,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://comunica.dev/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/comunica/comunica.git",
|
|
11
|
+
"directory": "packages/bus-bindings-aggregator-factory"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/comunica/comunica/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"comunica",
|
|
18
|
+
"bus",
|
|
19
|
+
"bindings-aggregator-factory"
|
|
20
|
+
],
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"main": "lib/index.js",
|
|
23
|
+
"typings": "lib/index",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"components",
|
|
29
|
+
"lib/**/*.d.ts",
|
|
30
|
+
"lib/**/*.js",
|
|
31
|
+
"lib/**/*.js.map"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "npm run build:ts && npm run build:components",
|
|
35
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
36
|
+
"build:components": "componentsjs-generator"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@comunica/bus-expression-evaluator-factory": "3.2.4-alpha.47.0",
|
|
40
|
+
"@comunica/context-entries": "3.2.4-alpha.47.0",
|
|
41
|
+
"@comunica/core": "3.2.4-alpha.47.0",
|
|
42
|
+
"@comunica/types": "3.2.4-alpha.47.0",
|
|
43
|
+
"@comunica/utils-expression-evaluator": "3.2.4-alpha.47.0",
|
|
44
|
+
"@rdfjs/types": "*",
|
|
45
|
+
"rdf-string": "^1.6.3",
|
|
46
|
+
"sparqlalgebrajs": "^4.2.0"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "85bd4c5cf07dfc293ebbc3a1416b70e2db8bfc48"
|
|
49
|
+
}
|