@comunica/actor-query-operation-source 3.0.1-alpha.43.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/ActorQueryOperationSource.jsonld +145 -0
- package/components/components.jsonld +11 -0
- package/components/context.jsonld +35 -0
- package/lib/ActorQueryOperationSource.d.ts +12 -0
- package/lib/ActorQueryOperationSource.js +72 -0
- package/lib/ActorQueryOperationSource.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 +48 -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 Source Query Operation Actor
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@comunica/actor-query-operation-source)
|
|
4
|
+
|
|
5
|
+
A [Query Operation](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation) actor
|
|
6
|
+
that delegates operations annotated with a query source towards that source.
|
|
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-source
|
|
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-source/^1.0.0/components/context.jsonld"
|
|
27
|
+
],
|
|
28
|
+
"actors": [
|
|
29
|
+
...
|
|
30
|
+
{
|
|
31
|
+
"@id": "urn:comunica:default:query-operation/actors#source",
|
|
32
|
+
"@type": "ActorQueryOperationSource"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Config Parameters
|
|
39
|
+
|
|
40
|
+
TODO: fill in parameters (this section can be removed if there are none)
|
|
41
|
+
|
|
42
|
+
* `someParam`: Description of the param
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-source/^3.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^3.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^3.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-query-operation-source",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorQueryOperationSource",
|
|
13
|
+
"extends": [
|
|
14
|
+
"cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation"
|
|
15
|
+
],
|
|
16
|
+
"comment": "A comunica Source Query Operation Actor.",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_name",
|
|
20
|
+
"range": "xsd:string",
|
|
21
|
+
"default": {
|
|
22
|
+
"@id": "rdf:subject"
|
|
23
|
+
},
|
|
24
|
+
"comment": "The name for this actor."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_bus",
|
|
28
|
+
"range": {
|
|
29
|
+
"@type": "ParameterRangeGenericComponent",
|
|
30
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
31
|
+
"genericTypeInstances": [
|
|
32
|
+
{
|
|
33
|
+
"@type": "ParameterRangeGenericComponent",
|
|
34
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
35
|
+
"genericTypeInstances": [
|
|
36
|
+
{
|
|
37
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
38
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
42
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
46
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
52
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
56
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
60
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"default": {
|
|
65
|
+
"@id": "cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus",
|
|
66
|
+
"@type": "cbqo:components/BusQueryOperation.jsonld#BusQueryOperation"
|
|
67
|
+
},
|
|
68
|
+
"comment": "The bus this actor subscribes to."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_beforeActors",
|
|
72
|
+
"range": {
|
|
73
|
+
"@type": "ParameterRangeUnion",
|
|
74
|
+
"parameterRangeElements": [
|
|
75
|
+
{
|
|
76
|
+
"@type": "ParameterRangeArray",
|
|
77
|
+
"parameterRangeValue": {
|
|
78
|
+
"@type": "ParameterRangeGenericComponent",
|
|
79
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
80
|
+
"genericTypeInstances": [
|
|
81
|
+
{
|
|
82
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
83
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
87
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
91
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"@type": "ParameterRangeUndefined"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"memberFields": [
|
|
105
|
+
{
|
|
106
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource__member_constructor",
|
|
107
|
+
"memberFieldName": "constructor"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource__member_test",
|
|
111
|
+
"memberFieldName": "test"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource__member_run",
|
|
115
|
+
"memberFieldName": "run"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"constructorArguments": [
|
|
119
|
+
{
|
|
120
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args__constructorArgument",
|
|
121
|
+
"fields": [
|
|
122
|
+
{
|
|
123
|
+
"keyRaw": "name",
|
|
124
|
+
"value": {
|
|
125
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_name"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"keyRaw": "bus",
|
|
130
|
+
"value": {
|
|
131
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_bus"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"keyRaw": "beforeActors",
|
|
136
|
+
"value": {
|
|
137
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_beforeActors"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-source/^3.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@comunica/actor-query-operation-source",
|
|
6
|
+
"@type": "Module",
|
|
7
|
+
"requireName": "@comunica/actor-query-operation-source",
|
|
8
|
+
"import": [
|
|
9
|
+
"caqos:components/ActorQueryOperationSource.jsonld"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^5.0.0/components/context.jsonld",
|
|
4
|
+
{
|
|
5
|
+
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
+
"caqos": "npmd:@comunica/actor-query-operation-source/^3.0.0/",
|
|
7
|
+
"ActorQueryOperationSource": {
|
|
8
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_name": {
|
|
12
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_name"
|
|
13
|
+
},
|
|
14
|
+
"args_bus": {
|
|
15
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_bus"
|
|
16
|
+
},
|
|
17
|
+
"args_beforeActors": {
|
|
18
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_beforeActors",
|
|
19
|
+
"@container": "@list"
|
|
20
|
+
},
|
|
21
|
+
"name": {
|
|
22
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_name"
|
|
23
|
+
},
|
|
24
|
+
"bus": {
|
|
25
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_bus"
|
|
26
|
+
},
|
|
27
|
+
"beforeActors": {
|
|
28
|
+
"@id": "caqos:components/ActorQueryOperationSource.jsonld#ActorQueryOperationSource_args_beforeActors",
|
|
29
|
+
"@container": "@list"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IActionQueryOperation, IActorQueryOperationArgs } from '@comunica/bus-query-operation';
|
|
2
|
+
import { ActorQueryOperation } from '@comunica/bus-query-operation';
|
|
3
|
+
import type { IActorTest } from '@comunica/core';
|
|
4
|
+
import type { IQueryOperationResult } from '@comunica/types';
|
|
5
|
+
/**
|
|
6
|
+
* A comunica Source Query Operation Actor.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ActorQueryOperationSource extends ActorQueryOperation {
|
|
9
|
+
constructor(args: IActorQueryOperationArgs);
|
|
10
|
+
test(action: IActionQueryOperation): Promise<IActorTest>;
|
|
11
|
+
run(action: IActionQueryOperation): Promise<IQueryOperationResult>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActorQueryOperationSource = void 0;
|
|
4
|
+
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
5
|
+
const context_entries_1 = require("@comunica/context-entries");
|
|
6
|
+
const metadata_1 = require("@comunica/metadata");
|
|
7
|
+
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
8
|
+
/**
|
|
9
|
+
* A comunica Source Query Operation Actor.
|
|
10
|
+
*/
|
|
11
|
+
class ActorQueryOperationSource extends bus_query_operation_1.ActorQueryOperation {
|
|
12
|
+
constructor(args) {
|
|
13
|
+
super(args);
|
|
14
|
+
}
|
|
15
|
+
async test(action) {
|
|
16
|
+
if (!bus_query_operation_1.ActorQueryOperation.getOperationSource(action.operation)) {
|
|
17
|
+
throw new Error(`Actor ${this.name} requires an operation with source annotation.`);
|
|
18
|
+
}
|
|
19
|
+
return { httpRequests: 1 };
|
|
20
|
+
}
|
|
21
|
+
async run(action) {
|
|
22
|
+
// Log to physical plan
|
|
23
|
+
const physicalQueryPlanLogger = action.context
|
|
24
|
+
.get(context_entries_1.KeysInitQuery.physicalQueryPlanLogger);
|
|
25
|
+
if (physicalQueryPlanLogger) {
|
|
26
|
+
physicalQueryPlanLogger.logOperation(action.operation.type, undefined, action.operation, action.context.get(context_entries_1.KeysInitQuery.physicalQueryPlanNode), this.name, {});
|
|
27
|
+
action.context = action.context.set(context_entries_1.KeysInitQuery.physicalQueryPlanNode, action.operation);
|
|
28
|
+
}
|
|
29
|
+
const sourceWrapper = bus_query_operation_1.ActorQueryOperation.getOperationSource(action.operation);
|
|
30
|
+
const mergedContext = sourceWrapper.context ? action.context.merge(sourceWrapper.context) : action.context;
|
|
31
|
+
switch (action.operation.type) {
|
|
32
|
+
case sparqlalgebrajs_1.Algebra.types.CONSTRUCT: {
|
|
33
|
+
const quadStream = sourceWrapper.source.queryQuads(action.operation, mergedContext);
|
|
34
|
+
const metadata = (0, metadata_1.getMetadataQuads)(quadStream);
|
|
35
|
+
return {
|
|
36
|
+
type: 'quads',
|
|
37
|
+
quadStream,
|
|
38
|
+
metadata,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
case sparqlalgebrajs_1.Algebra.types.ASK:
|
|
42
|
+
return {
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
execute: () => sourceWrapper.source.queryBoolean(action.operation, mergedContext),
|
|
45
|
+
};
|
|
46
|
+
case sparqlalgebrajs_1.Algebra.types.COMPOSITE_UPDATE:
|
|
47
|
+
case sparqlalgebrajs_1.Algebra.types.DELETE_INSERT:
|
|
48
|
+
case sparqlalgebrajs_1.Algebra.types.LOAD:
|
|
49
|
+
case sparqlalgebrajs_1.Algebra.types.CLEAR:
|
|
50
|
+
case sparqlalgebrajs_1.Algebra.types.CREATE:
|
|
51
|
+
case sparqlalgebrajs_1.Algebra.types.DROP:
|
|
52
|
+
case sparqlalgebrajs_1.Algebra.types.ADD:
|
|
53
|
+
case sparqlalgebrajs_1.Algebra.types.MOVE:
|
|
54
|
+
case sparqlalgebrajs_1.Algebra.types.COPY:
|
|
55
|
+
return {
|
|
56
|
+
type: 'void',
|
|
57
|
+
execute: () => sourceWrapper.source.queryVoid(action.operation, mergedContext),
|
|
58
|
+
};
|
|
59
|
+
default: {
|
|
60
|
+
const bindingsStream = sourceWrapper.source.queryBindings(action.operation, mergedContext);
|
|
61
|
+
const metadata = (0, metadata_1.getMetadataBindings)(bindingsStream);
|
|
62
|
+
return {
|
|
63
|
+
type: 'bindings',
|
|
64
|
+
bindingsStream,
|
|
65
|
+
metadata,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.ActorQueryOperationSource = ActorQueryOperationSource;
|
|
72
|
+
//# sourceMappingURL=ActorQueryOperationSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationSource.js","sourceRoot":"","sources":["ActorQueryOperationSource.ts"],"names":[],"mappings":"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","sourcesContent":["import type { IActionQueryOperation, IActorQueryOperationArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperation } from '@comunica/bus-query-operation';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorTest } from '@comunica/core';\nimport { getMetadataBindings, getMetadataQuads } from '@comunica/metadata';\nimport type {\n IPhysicalQueryPlanLogger,\n IQueryOperationResult,\n IQuerySourceWrapper,\n} from '@comunica/types';\nimport { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica Source Query Operation Actor.\n */\nexport class ActorQueryOperationSource extends ActorQueryOperation {\n public constructor(args: IActorQueryOperationArgs) {\n super(args);\n }\n\n public async test(action: IActionQueryOperation): Promise<IActorTest> {\n if (!ActorQueryOperation.getOperationSource(action.operation)) {\n throw new Error(`Actor ${this.name} requires an operation with source annotation.`);\n }\n return { httpRequests: 1 };\n }\n\n public async run(action: IActionQueryOperation): Promise<IQueryOperationResult> {\n // Log to physical plan\n const physicalQueryPlanLogger: IPhysicalQueryPlanLogger | undefined = action.context\n .get(KeysInitQuery.physicalQueryPlanLogger);\n if (physicalQueryPlanLogger) {\n physicalQueryPlanLogger.logOperation(\n action.operation.type,\n undefined,\n action.operation,\n action.context.get(KeysInitQuery.physicalQueryPlanNode),\n this.name,\n {},\n );\n action.context = action.context.set(KeysInitQuery.physicalQueryPlanNode, action.operation);\n }\n\n const sourceWrapper: IQuerySourceWrapper = ActorQueryOperation.getOperationSource(action.operation)!;\n const mergedContext = sourceWrapper.context ? action.context.merge(sourceWrapper.context) : action.context;\n\n switch (action.operation.type) {\n case Algebra.types.CONSTRUCT: {\n const quadStream = sourceWrapper.source.queryQuads(action.operation, mergedContext);\n const metadata = getMetadataQuads(quadStream);\n return {\n type: 'quads',\n quadStream,\n metadata,\n };\n }\n case Algebra.types.ASK:\n return {\n type: 'boolean',\n execute: () => sourceWrapper.source.queryBoolean(<Algebra.Ask>action.operation, mergedContext),\n };\n case Algebra.types.COMPOSITE_UPDATE:\n case Algebra.types.DELETE_INSERT:\n case Algebra.types.LOAD:\n case Algebra.types.CLEAR:\n case Algebra.types.CREATE:\n case Algebra.types.DROP:\n case Algebra.types.ADD:\n case Algebra.types.MOVE:\n case Algebra.types.COPY:\n return {\n type: 'void',\n execute: () => sourceWrapper.source.queryVoid(<Algebra.Update>action.operation, mergedContext),\n };\n default: {\n const bindingsStream = sourceWrapper.source.queryBindings(action.operation, mergedContext);\n const metadata = getMetadataBindings(bindingsStream);\n return {\n type: 'bindings',\n bindingsStream,\n metadata,\n };\n }\n }\n }\n}\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActorQueryOperationSource';
|
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("./ActorQueryOperationSource"), 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,8DAA4C","sourcesContent":["export * from './ActorQueryOperationSource';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@comunica/actor-query-operation-source",
|
|
3
|
+
"version": "3.0.1-alpha.43.0",
|
|
4
|
+
"description": "A source query-operation actor",
|
|
5
|
+
"lsd:module": true,
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"typings": "lib/index",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/comunica/comunica.git",
|
|
11
|
+
"directory": "packages/actor-query-operation-source"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"keywords": [
|
|
18
|
+
"comunica",
|
|
19
|
+
"actor",
|
|
20
|
+
"query-operation",
|
|
21
|
+
"source"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/comunica/comunica/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://comunica.dev/",
|
|
28
|
+
"files": [
|
|
29
|
+
"components",
|
|
30
|
+
"lib/**/*.d.ts",
|
|
31
|
+
"lib/**/*.js",
|
|
32
|
+
"lib/**/*.js.map"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@comunica/bus-query-operation": "3.0.1-alpha.43.0",
|
|
36
|
+
"@comunica/context-entries": "3.0.1-alpha.43.0",
|
|
37
|
+
"@comunica/core": "3.0.1-alpha.43.0",
|
|
38
|
+
"@comunica/metadata": "3.0.1-alpha.43.0",
|
|
39
|
+
"@comunica/types": "3.0.1-alpha.43.0",
|
|
40
|
+
"sparqlalgebrajs": "^4.3.3"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "npm run build:ts && npm run build:components",
|
|
44
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
45
|
+
"build:components": "componentsjs-generator"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "d11e44cf07d4699f9d2c51d5851b5ed443de1997"
|
|
48
|
+
}
|