@comunica/actor-query-operation-from-quad 1.21.1 → 2.0.1-alpha.6.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 +4 -4
- package/components/ActorQueryOperationFromQuad.jsonld +160 -0
- package/components/components.jsonld +5 -3
- package/components/context.jsonld +34 -5
- package/lib/ActorQueryOperationFromQuad.d.ts +6 -6
- package/lib/ActorQueryOperationFromQuad.js +39 -26
- package/lib/index.d.ts +1 -0
- package/{index.js → lib/index.js} +1 -1
- package/package.json +15 -38
- package/components/Actor/QueryOperation/FromQuad.jsonld +0 -21
- package/index.d.ts +0 -1
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
CHANGED
|
@@ -23,14 +23,14 @@ After installing, this package can be added to your engine's configuration as fo
|
|
|
23
23
|
{
|
|
24
24
|
"@context": [
|
|
25
25
|
...
|
|
26
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^
|
|
26
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^2.0.0/components/context.jsonld"
|
|
27
27
|
],
|
|
28
28
|
"actors": [
|
|
29
29
|
...
|
|
30
30
|
{
|
|
31
|
-
"@id": "
|
|
31
|
+
"@id": "urn:comunica:default:query-operation/actors#from",
|
|
32
32
|
"@type": "ActorQueryOperationFromQuad",
|
|
33
|
-
"
|
|
33
|
+
"mediatorQueryOperation": { "@id": "urn:comunica:default:query-operation/mediators#main" }
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
}
|
|
@@ -38,4 +38,4 @@ After installing, this package can be added to your engine's configuration as fo
|
|
|
38
38
|
|
|
39
39
|
### Config Parameters
|
|
40
40
|
|
|
41
|
-
* `
|
|
41
|
+
* `mediatorQueryOperation`: A mediator over the [Query Operation bus](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation).
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^2.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^2.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-query-operation-from-quad",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorQueryOperationFromQuad",
|
|
13
|
+
"extends": [
|
|
14
|
+
{
|
|
15
|
+
"@type": "GenericComponentExtension",
|
|
16
|
+
"component": "cbqo:components/ActorQueryOperationTypedMediated.jsonld#ActorQueryOperationTypedMediated",
|
|
17
|
+
"genericTypeInstances": [
|
|
18
|
+
"urn:npm:sparqlalgebrajs:From"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"comment": "A comunica From Query Operation Actor.",
|
|
23
|
+
"parameters": [
|
|
24
|
+
{
|
|
25
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_mediatorQueryOperation",
|
|
26
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_name",
|
|
30
|
+
"range": "xsd:string",
|
|
31
|
+
"default": {
|
|
32
|
+
"@id": "rdf:subject"
|
|
33
|
+
},
|
|
34
|
+
"comment": "The name for this actor."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_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/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
52
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
56
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
62
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
66
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
70
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"default": {
|
|
75
|
+
"@id": "cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus",
|
|
76
|
+
"@type": "cc:components/Bus.jsonld#Bus"
|
|
77
|
+
},
|
|
78
|
+
"comment": "The bus this actor subscribes to."
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_beforeActors",
|
|
82
|
+
"range": {
|
|
83
|
+
"@type": "ParameterRangeUnion",
|
|
84
|
+
"parameterRangeElements": [
|
|
85
|
+
{
|
|
86
|
+
"@type": "ParameterRangeArray",
|
|
87
|
+
"parameterRangeValue": {
|
|
88
|
+
"@type": "ParameterRangeGenericComponent",
|
|
89
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
90
|
+
"genericTypeInstances": [
|
|
91
|
+
{
|
|
92
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
93
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
97
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
101
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"@type": "ParameterRangeUndefined"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"memberKeys": [
|
|
115
|
+
"FACTORY",
|
|
116
|
+
"ALGEBRA_TYPES",
|
|
117
|
+
"constructor",
|
|
118
|
+
"copyOperation",
|
|
119
|
+
"applyOperationDefaultGraph",
|
|
120
|
+
"applyOperationNamedGraph",
|
|
121
|
+
"joinOperations",
|
|
122
|
+
"unionOperations",
|
|
123
|
+
"createOperation",
|
|
124
|
+
"testOperation",
|
|
125
|
+
"runOperation"
|
|
126
|
+
],
|
|
127
|
+
"constructorArguments": [
|
|
128
|
+
{
|
|
129
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args__constructorArgument",
|
|
130
|
+
"fields": [
|
|
131
|
+
{
|
|
132
|
+
"keyRaw": "mediatorQueryOperation",
|
|
133
|
+
"value": {
|
|
134
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_mediatorQueryOperation"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"keyRaw": "name",
|
|
139
|
+
"value": {
|
|
140
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_name"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"keyRaw": "bus",
|
|
145
|
+
"value": {
|
|
146
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_bus"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"keyRaw": "beforeActors",
|
|
151
|
+
"value": {
|
|
152
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_beforeActors"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@context":
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^2.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
3
5
|
"@id": "npmd:@comunica/actor-query-operation-from-quad",
|
|
4
6
|
"@type": "Module",
|
|
5
7
|
"requireName": "@comunica/actor-query-operation-from-quad",
|
|
6
8
|
"import": [
|
|
7
|
-
"
|
|
9
|
+
"caqofq:components/ActorQueryOperationFromQuad.jsonld"
|
|
8
10
|
]
|
|
9
|
-
}
|
|
11
|
+
}
|
|
@@ -3,10 +3,39 @@
|
|
|
3
3
|
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld",
|
|
4
4
|
{
|
|
5
5
|
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"caqofq": "npmd:@comunica/actor-query-operation-from-quad/^2.0.0/",
|
|
7
|
+
"ActorQueryOperationFromQuad": {
|
|
8
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_mediatorQueryOperation": {
|
|
12
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_mediatorQueryOperation"
|
|
13
|
+
},
|
|
14
|
+
"args_name": {
|
|
15
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_name"
|
|
16
|
+
},
|
|
17
|
+
"args_bus": {
|
|
18
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_bus"
|
|
19
|
+
},
|
|
20
|
+
"args_beforeActors": {
|
|
21
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_beforeActors",
|
|
22
|
+
"@container": "@list"
|
|
23
|
+
},
|
|
24
|
+
"mediatorQueryOperation": {
|
|
25
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_mediatorQueryOperation"
|
|
26
|
+
},
|
|
27
|
+
"name": {
|
|
28
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_name"
|
|
29
|
+
},
|
|
30
|
+
"bus": {
|
|
31
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_bus"
|
|
32
|
+
},
|
|
33
|
+
"beforeActors": {
|
|
34
|
+
"@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad_args_beforeActors",
|
|
35
|
+
"@container": "@list"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
10
39
|
}
|
|
11
40
|
]
|
|
12
|
-
}
|
|
41
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';
|
|
2
2
|
import { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type * as RDF from '
|
|
3
|
+
import type { IActorTest } from '@comunica/core';
|
|
4
|
+
import type { IActionContext, IQueryOperationResult } from '@comunica/types';
|
|
5
|
+
import type * as RDF from '@rdfjs/types';
|
|
6
6
|
import { Algebra } from 'sparqlalgebrajs';
|
|
7
7
|
/**
|
|
8
8
|
* A comunica From Query Operation Actor.
|
|
@@ -34,7 +34,7 @@ export declare class ActorQueryOperationFromQuad extends ActorQueryOperationType
|
|
|
34
34
|
* @param {RDF.Term[]} defaultGraphs Default graph terms.
|
|
35
35
|
* @return {Operation} A new operation.
|
|
36
36
|
*/
|
|
37
|
-
static applyOperationNamedGraph(operation: Algebra.Operation, namedGraphs: RDF.
|
|
37
|
+
static applyOperationNamedGraph(operation: Algebra.Operation, namedGraphs: RDF.NamedNode[], defaultGraphs: RDF.Term[]): Algebra.Operation;
|
|
38
38
|
/**
|
|
39
39
|
* Transform the given array of operations into a join operation.
|
|
40
40
|
* @param {Operation[]} operations An array of operations, must contain at least one operation.
|
|
@@ -60,6 +60,6 @@ export declare class ActorQueryOperationFromQuad extends ActorQueryOperationType
|
|
|
60
60
|
* @return {Operation} The transformed operation.
|
|
61
61
|
*/
|
|
62
62
|
static createOperation(pattern: Algebra.From): Algebra.Operation;
|
|
63
|
-
testOperation(
|
|
64
|
-
runOperation(
|
|
63
|
+
testOperation(operation: Algebra.From, context: IActionContext): Promise<IActorTest>;
|
|
64
|
+
runOperation(operationOriginal: Algebra.From, context: IActionContext): Promise<IQueryOperationResult>;
|
|
65
65
|
}
|
|
@@ -19,7 +19,8 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
19
19
|
static copyOperation(operation, recursiveCb) {
|
|
20
20
|
const copiedOperation = {};
|
|
21
21
|
for (const key of Object.keys(operation)) {
|
|
22
|
-
if (Array.isArray(operation[key])) {
|
|
22
|
+
if (Array.isArray(operation[key]) && key !== 'template') {
|
|
23
|
+
// We exclude the 'template' entry, as we don't want to modify the template value of construct operations
|
|
23
24
|
if (key === 'variables') {
|
|
24
25
|
copiedOperation[key] = operation[key];
|
|
25
26
|
}
|
|
@@ -45,7 +46,9 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
45
46
|
*/
|
|
46
47
|
static applyOperationDefaultGraph(operation, defaultGraphs) {
|
|
47
48
|
// If the operation is a BGP or Path, change the graph.
|
|
48
|
-
if ((operation.type === 'bgp' && operation.patterns.length > 0) ||
|
|
49
|
+
if ((operation.type === 'bgp' && operation.patterns.length > 0) ||
|
|
50
|
+
operation.type === 'path' ||
|
|
51
|
+
operation.type === 'pattern') {
|
|
49
52
|
if (operation.type === 'bgp') {
|
|
50
53
|
return ActorQueryOperationFromQuad.joinOperations(operation.patterns.map((pattern) => {
|
|
51
54
|
if (pattern.graph.termType !== 'DefaultGraph') {
|
|
@@ -59,9 +62,15 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
59
62
|
if (operation.graph.termType !== 'DefaultGraph') {
|
|
60
63
|
return operation;
|
|
61
64
|
}
|
|
62
|
-
const paths = defaultGraphs.map((graph) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
const paths = defaultGraphs.map((graph) => {
|
|
66
|
+
if (operation.type === 'path') {
|
|
67
|
+
return ActorQueryOperationFromQuad.FACTORY
|
|
68
|
+
.createPath(operation.subject, operation.predicate, operation.object, graph);
|
|
69
|
+
}
|
|
70
|
+
return ActorQueryOperationFromQuad.FACTORY
|
|
71
|
+
.createPattern(operation.subject, operation.predicate, operation.object, graph);
|
|
72
|
+
});
|
|
73
|
+
return ActorQueryOperationFromQuad.unionOperations(paths);
|
|
65
74
|
}
|
|
66
75
|
return ActorQueryOperationFromQuad.copyOperation(operation, (subOperation) => this.applyOperationDefaultGraph(subOperation, defaultGraphs));
|
|
67
76
|
}
|
|
@@ -75,12 +84,14 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
75
84
|
*/
|
|
76
85
|
static applyOperationNamedGraph(operation, namedGraphs, defaultGraphs) {
|
|
77
86
|
// If the operation is a BGP or Path, change the graph.
|
|
78
|
-
if ((operation.type === 'bgp' && operation.patterns.length > 0) ||
|
|
87
|
+
if ((operation.type === 'bgp' && operation.patterns.length > 0) ||
|
|
88
|
+
operation.type === 'path' ||
|
|
89
|
+
operation.type === 'pattern') {
|
|
79
90
|
const patternGraph = operation.type === 'bgp' ? operation.patterns[0].graph : operation.graph;
|
|
80
91
|
if (patternGraph.termType === 'DefaultGraph') {
|
|
81
92
|
// SPARQL spec (8.2) describes that when FROM NAMED's are used without a FROM, the default graph must be empty.
|
|
82
93
|
// The FROMs are transformed before this step to a named node, so this will not apply to this case anymore.
|
|
83
|
-
return { type:
|
|
94
|
+
return { type: sparqlalgebrajs_1.Algebra.types.BGP, patterns: [] };
|
|
84
95
|
}
|
|
85
96
|
if (patternGraph.termType === 'Variable') {
|
|
86
97
|
if (namedGraphs.length === 1) {
|
|
@@ -90,13 +101,21 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
90
101
|
bindings[`?${patternGraph.value}`] = graph;
|
|
91
102
|
const values = ActorQueryOperationFromQuad.FACTORY
|
|
92
103
|
.createValues([patternGraph], [bindings]);
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
let pattern;
|
|
105
|
+
if (operation.type === 'bgp') {
|
|
106
|
+
pattern = ActorQueryOperationFromQuad.FACTORY
|
|
95
107
|
.createBgp(operation.patterns.map((pat) => ActorQueryOperationFromQuad.FACTORY
|
|
96
|
-
.createPattern(pat.subject, pat.predicate, pat.object, graph)))
|
|
97
|
-
|
|
108
|
+
.createPattern(pat.subject, pat.predicate, pat.object, graph)));
|
|
109
|
+
}
|
|
110
|
+
else if (operation.type === 'path') {
|
|
111
|
+
pattern = ActorQueryOperationFromQuad.FACTORY
|
|
98
112
|
.createPath(operation.subject, operation.predicate, operation.object, graph);
|
|
99
|
-
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
pattern = ActorQueryOperationFromQuad.FACTORY
|
|
116
|
+
.createPattern(operation.subject, operation.predicate, operation.object, graph);
|
|
117
|
+
}
|
|
118
|
+
return ActorQueryOperationFromQuad.FACTORY.createJoin([values, pattern]);
|
|
100
119
|
}
|
|
101
120
|
// If the pattern graph is a variable, take the union of the pattern applied to each available named graph
|
|
102
121
|
return ActorQueryOperationFromQuad.unionOperations(namedGraphs.map((graph) => ActorQueryOperationFromQuad.applyOperationNamedGraph(operation, [graph], defaultGraphs)));
|
|
@@ -108,7 +127,7 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
108
127
|
return operation;
|
|
109
128
|
}
|
|
110
129
|
// No-op if the pattern's graph was not selected in a FROM NAMED.
|
|
111
|
-
return { type:
|
|
130
|
+
return { type: sparqlalgebrajs_1.Algebra.types.BGP, patterns: [] };
|
|
112
131
|
}
|
|
113
132
|
return ActorQueryOperationFromQuad.copyOperation(operation, (subOperation) => this.applyOperationNamedGraph(subOperation, namedGraphs, defaultGraphs));
|
|
114
133
|
}
|
|
@@ -121,11 +140,8 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
121
140
|
if (operations.length === 1) {
|
|
122
141
|
return operations[0];
|
|
123
142
|
}
|
|
124
|
-
if (operations.length
|
|
125
|
-
return ActorQueryOperationFromQuad.FACTORY.createJoin(operations
|
|
126
|
-
}
|
|
127
|
-
if (operations.length > 2) {
|
|
128
|
-
return ActorQueryOperationFromQuad.FACTORY.createJoin(operations.shift(), this.joinOperations(operations));
|
|
143
|
+
if (operations.length > 1) {
|
|
144
|
+
return ActorQueryOperationFromQuad.FACTORY.createJoin(operations);
|
|
129
145
|
}
|
|
130
146
|
throw new Error('A join can only be applied on at least one operation');
|
|
131
147
|
}
|
|
@@ -138,11 +154,8 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
138
154
|
if (operations.length === 1) {
|
|
139
155
|
return operations[0];
|
|
140
156
|
}
|
|
141
|
-
if (operations.length
|
|
142
|
-
return ActorQueryOperationFromQuad.FACTORY.createUnion(operations
|
|
143
|
-
}
|
|
144
|
-
if (operations.length > 2) {
|
|
145
|
-
return ActorQueryOperationFromQuad.FACTORY.createUnion(operations.shift(), this.unionOperations(operations));
|
|
157
|
+
if (operations.length > 1) {
|
|
158
|
+
return ActorQueryOperationFromQuad.FACTORY.createUnion(operations);
|
|
146
159
|
}
|
|
147
160
|
throw new Error('A union can only be applied on at least one operation');
|
|
148
161
|
}
|
|
@@ -168,11 +181,11 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
|
|
|
168
181
|
}
|
|
169
182
|
return operation;
|
|
170
183
|
}
|
|
171
|
-
async testOperation(
|
|
184
|
+
async testOperation(operation, context) {
|
|
172
185
|
return true;
|
|
173
186
|
}
|
|
174
|
-
async runOperation(
|
|
175
|
-
const operation = ActorQueryOperationFromQuad.createOperation(
|
|
187
|
+
async runOperation(operationOriginal, context) {
|
|
188
|
+
const operation = ActorQueryOperationFromQuad.createOperation(operationOriginal);
|
|
176
189
|
return this.mediatorQueryOperation.mediate({ operation, context });
|
|
177
190
|
}
|
|
178
191
|
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActorQueryOperationFromQuad';
|
|
@@ -10,5 +10,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
13
|
+
__exportStar(require("./ActorQueryOperationFromQuad"), exports);
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-operation-from-quad",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.1-alpha.6.0",
|
|
4
4
|
"description": "A from query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"typings": "index",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"typings": "lib/index",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/comunica/comunica.git",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
+
"sideEffects": false,
|
|
16
17
|
"keywords": [
|
|
17
18
|
"comunica",
|
|
18
19
|
"actor",
|
|
@@ -27,43 +28,19 @@
|
|
|
27
28
|
"files": [
|
|
28
29
|
"components",
|
|
29
30
|
"lib/**/*.d.ts",
|
|
30
|
-
"lib/**/*.js"
|
|
31
|
-
"index.d.ts",
|
|
32
|
-
"index.js"
|
|
31
|
+
"lib/**/*.js"
|
|
33
32
|
],
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@comunica/
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"@comunica/bus-query-operation": "^1.0.0",
|
|
41
|
-
"@comunica/core": "^1.0.0"
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@comunica/bus-query-operation": "^1.21.1",
|
|
45
|
-
"@comunica/core": "^1.21.1"
|
|
46
|
-
},
|
|
47
|
-
"jest": {
|
|
48
|
-
"globals": {
|
|
49
|
-
"ts-jest": {
|
|
50
|
-
"tsConfig": "../../tsconfig.json"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"transform": {
|
|
54
|
-
"^.+\\.ts$": "ts-jest"
|
|
55
|
-
},
|
|
56
|
-
"testRegex": "(/test/.*|(\\.|/)(test|spec))\\.ts$",
|
|
57
|
-
"moduleFileExtensions": [
|
|
58
|
-
"ts",
|
|
59
|
-
"js"
|
|
60
|
-
],
|
|
61
|
-
"collectCoverage": true
|
|
34
|
+
"@comunica/bus-query-operation": "2.0.1-alpha.6.0",
|
|
35
|
+
"@comunica/core": "2.0.1-alpha.6.0",
|
|
36
|
+
"@comunica/types": "2.0.1-alpha.6.0",
|
|
37
|
+
"@rdfjs/types": "*",
|
|
38
|
+
"sparqlalgebrajs": "^4.0.0"
|
|
62
39
|
},
|
|
63
40
|
"scripts": {
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"build": "
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
"build": "npm run build:ts && npm run build:components",
|
|
42
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
43
|
+
"build:components": "componentsjs-generator"
|
|
44
|
+
},
|
|
45
|
+
"gitHead": "bbf46a068e635256495a40e784a4691b22e88bd3"
|
|
69
46
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^1.0.0/components/context.jsonld",
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^1.0.0/components/context.jsonld"
|
|
5
|
-
],
|
|
6
|
-
"@id": "npmd:@comunica/actor-query-operation-from-quad",
|
|
7
|
-
"components": [
|
|
8
|
-
{
|
|
9
|
-
"@id": "caqof:Actor/QueryOperation/FromQuad",
|
|
10
|
-
"@type": "Class",
|
|
11
|
-
"extends": "cbqo:Actor/QueryOperationTypedMediated",
|
|
12
|
-
"requireElement": "ActorQueryOperationFromQuad",
|
|
13
|
-
"comment": "A comunica From Query Operation Actor that interprets FROM and FROM NAMED targets as graph elements in quads.",
|
|
14
|
-
"constructorArguments": [
|
|
15
|
-
{
|
|
16
|
-
"extends": "cbqo:Actor/QueryOperationTypedMediated/constructorArgumentsObject"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib/ActorQueryOperationFromQuad';
|