@comunica/actor-query-operation-update-load 3.2.4-alpha.47.0 → 3.3.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.
|
@@ -64,10 +64,6 @@
|
|
|
64
64
|
{
|
|
65
65
|
"@type": "ParameterRangeGenericTypeReference",
|
|
66
66
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
70
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
71
67
|
}
|
|
72
68
|
]
|
|
73
69
|
},
|
|
@@ -82,10 +78,6 @@
|
|
|
82
78
|
{
|
|
83
79
|
"@type": "ParameterRangeGenericTypeReference",
|
|
84
80
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
88
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
89
81
|
}
|
|
90
82
|
]
|
|
91
83
|
},
|
|
@@ -95,20 +87,6 @@
|
|
|
95
87
|
},
|
|
96
88
|
"comment": "The bus this actor subscribes to."
|
|
97
89
|
},
|
|
98
|
-
{
|
|
99
|
-
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_busFailMessage",
|
|
100
|
-
"range": {
|
|
101
|
-
"@type": "ParameterRangeUnion",
|
|
102
|
-
"parameterRangeElements": [
|
|
103
|
-
"xsd:string",
|
|
104
|
-
{
|
|
105
|
-
"@type": "ParameterRangeUndefined"
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
"default": "Query operation processing failed: none of the configured actors were able to handle the operation type ${action.operation.type}",
|
|
110
|
-
"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}\""
|
|
111
|
-
},
|
|
112
90
|
{
|
|
113
91
|
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_beforeActors",
|
|
114
92
|
"range": {
|
|
@@ -131,10 +109,6 @@
|
|
|
131
109
|
{
|
|
132
110
|
"@type": "ParameterRangeGenericTypeReference",
|
|
133
111
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
137
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
138
112
|
}
|
|
139
113
|
]
|
|
140
114
|
}
|
|
@@ -158,6 +132,14 @@
|
|
|
158
132
|
"memberFieldName": "mediatorQuerySourceIdentify",
|
|
159
133
|
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
160
134
|
},
|
|
135
|
+
{
|
|
136
|
+
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad__member_factory",
|
|
137
|
+
"memberFieldName": "factory"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad__member_constructOperation",
|
|
141
|
+
"memberFieldName": "constructOperation"
|
|
142
|
+
},
|
|
161
143
|
{
|
|
162
144
|
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad__member_constructor",
|
|
163
145
|
"memberFieldName": "constructor"
|
|
@@ -205,12 +187,6 @@
|
|
|
205
187
|
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_bus"
|
|
206
188
|
}
|
|
207
189
|
},
|
|
208
|
-
{
|
|
209
|
-
"keyRaw": "busFailMessage",
|
|
210
|
-
"value": {
|
|
211
|
-
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_busFailMessage"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
190
|
{
|
|
215
191
|
"keyRaw": "beforeActors",
|
|
216
192
|
"value": {
|
|
@@ -23,9 +23,6 @@
|
|
|
23
23
|
"args_bus": {
|
|
24
24
|
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_bus"
|
|
25
25
|
},
|
|
26
|
-
"args_busFailMessage": {
|
|
27
|
-
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_busFailMessage"
|
|
28
|
-
},
|
|
29
26
|
"args_beforeActors": {
|
|
30
27
|
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_beforeActors",
|
|
31
28
|
"@container": "@list"
|
|
@@ -45,9 +42,6 @@
|
|
|
45
42
|
"bus": {
|
|
46
43
|
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_bus"
|
|
47
44
|
},
|
|
48
|
-
"busFailMessage": {
|
|
49
|
-
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_busFailMessage"
|
|
50
|
-
},
|
|
51
45
|
"beforeActors": {
|
|
52
46
|
"@id": "caqoul:components/ActorQueryOperationLoad.jsonld#ActorQueryOperationLoad_args_beforeActors",
|
|
53
47
|
"@container": "@list"
|
|
@@ -2,7 +2,7 @@ import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-
|
|
|
2
2
|
import { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';
|
|
3
3
|
import type { MediatorQuerySourceIdentify } from '@comunica/bus-query-source-identify';
|
|
4
4
|
import type { MediatorRdfUpdateQuads } from '@comunica/bus-rdf-update-quads';
|
|
5
|
-
import type { IActorTest
|
|
5
|
+
import type { IActorTest } from '@comunica/core';
|
|
6
6
|
import type { IActionContext, IQueryOperationResult } from '@comunica/types';
|
|
7
7
|
import type { Algebra } from 'sparqlalgebrajs';
|
|
8
8
|
/**
|
|
@@ -12,8 +12,10 @@ import type { Algebra } from 'sparqlalgebrajs';
|
|
|
12
12
|
export declare class ActorQueryOperationLoad extends ActorQueryOperationTypedMediated<Algebra.Load> {
|
|
13
13
|
readonly mediatorUpdateQuads: MediatorRdfUpdateQuads;
|
|
14
14
|
readonly mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;
|
|
15
|
+
private readonly factory;
|
|
16
|
+
private readonly constructOperation;
|
|
15
17
|
constructor(args: IActorQueryOperationLoadArgs);
|
|
16
|
-
testOperation(operation: Algebra.Load, context: IActionContext): Promise<
|
|
18
|
+
testOperation(operation: Algebra.Load, context: IActionContext): Promise<IActorTest>;
|
|
17
19
|
runOperation(operation: Algebra.Load, context: IActionContext): Promise<IQueryOperationResult>;
|
|
18
20
|
}
|
|
19
21
|
export interface IActorQueryOperationLoadArgs extends IActorQueryOperationTypedMediatedArgs {
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ActorQueryOperationLoad = void 0;
|
|
4
4
|
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
5
5
|
const context_entries_1 = require("@comunica/context-entries");
|
|
6
|
-
const
|
|
6
|
+
const rdf_data_factory_1 = require("rdf-data-factory");
|
|
7
7
|
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
8
|
+
const DF = new rdf_data_factory_1.DataFactory();
|
|
8
9
|
/**
|
|
9
10
|
* A [Query Operation](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation) actor
|
|
10
11
|
* that handles SPARQL load operations.
|
|
@@ -12,13 +13,13 @@ const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
|
12
13
|
class ActorQueryOperationLoad extends bus_query_operation_1.ActorQueryOperationTypedMediated {
|
|
13
14
|
constructor(args) {
|
|
14
15
|
super(args, 'load');
|
|
16
|
+
this.factory = new sparqlalgebrajs_1.Factory();
|
|
15
17
|
}
|
|
16
18
|
async testOperation(operation, context) {
|
|
17
|
-
|
|
19
|
+
bus_query_operation_1.ActorQueryOperation.throwOnReadOnly(context);
|
|
20
|
+
return true;
|
|
18
21
|
}
|
|
19
22
|
async runOperation(operation, context) {
|
|
20
|
-
const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
|
|
21
|
-
const algebraFactory = new sparqlalgebrajs_1.Factory(dataFactory);
|
|
22
23
|
// Determine query source
|
|
23
24
|
let subContext = context;
|
|
24
25
|
if (operation.silent) {
|
|
@@ -29,16 +30,14 @@ class ActorQueryOperationLoad extends bus_query_operation_1.ActorQueryOperationT
|
|
|
29
30
|
context: subContext,
|
|
30
31
|
});
|
|
31
32
|
// Create CONSTRUCT query on the given source
|
|
32
|
-
const output =
|
|
33
|
-
operation:
|
|
34
|
-
.createPattern(dataFactory.variable('s'), dataFactory.variable('p'), dataFactory.variable('o'))]),
|
|
33
|
+
const output = ActorQueryOperationLoad.getSafeQuads(await this.mediatorQueryOperation.mediate({
|
|
34
|
+
operation: this.factory.createConstruct(bus_query_operation_1.ActorQueryOperation.assignOperationSource(this.factory.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')), querySource), [this.factory.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o'))]),
|
|
35
35
|
context: subContext,
|
|
36
36
|
}));
|
|
37
37
|
// Determine quad stream to insert
|
|
38
38
|
let quadStream = output.quadStream;
|
|
39
39
|
if (operation.destination) {
|
|
40
|
-
quadStream = quadStream
|
|
41
|
-
.map(quad => dataFactory.quad(quad.subject, quad.predicate, quad.object, operation.destination));
|
|
40
|
+
quadStream = quadStream.map(quad => DF.quad(quad.subject, quad.predicate, quad.object, operation.destination));
|
|
42
41
|
}
|
|
43
42
|
// Insert quad stream
|
|
44
43
|
const { execute } = await this.mediatorUpdateQuads.mediate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryOperationLoad.js","sourceRoot":"","sources":["ActorQueryOperationLoad.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationLoad.js","sourceRoot":"","sources":["ActorQueryOperationLoad.ts"],"names":[],"mappings":";;;AACA,uEAAsG;AAGtG,+DAA0D;AAG1D,uDAA+C;AAE/C,qDAA0C;AAE1C,MAAM,EAAE,GAAG,IAAI,8BAAW,EAAE,CAAC;AAE7B;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,sDAA8C;IAOzF,YAAmB,IAAkC;QACnD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAO,EAAE,CAAC;IAC/B,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,SAAuB,EAAE,OAAuB;QACzE,yCAAmB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,SAAuB,EAAE,OAAuB;QAExE,yBAAyB;QACzB,IAAI,UAAU,GAAG,OAAO,CAAC;QACzB,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACrB,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,+BAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3D,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC;YACrE,uBAAuB,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC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,0DA0DC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperation, ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport type { MediatorQuerySourceIdentify } from '@comunica/bus-query-source-identify';\nimport type { MediatorRdfUpdateQuads } from '@comunica/bus-rdf-update-quads';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorTest } from '@comunica/core';\nimport type { IActionContext, IQueryOperationResult } from '@comunica/types';\nimport { DataFactory } from 'rdf-data-factory';\nimport type { Algebra } from 'sparqlalgebrajs';\nimport { Factory } from 'sparqlalgebrajs';\n\nconst DF = new DataFactory();\n\n/**\n * A [Query Operation](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation) actor\n * that handles SPARQL load operations.\n */\nexport class ActorQueryOperationLoad extends ActorQueryOperationTypedMediated<Algebra.Load> {\n public readonly mediatorUpdateQuads: MediatorRdfUpdateQuads;\n public readonly mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;\n\n private readonly factory: Factory;\n private readonly constructOperation: Algebra.Construct;\n\n public constructor(args: IActorQueryOperationLoadArgs) {\n super(args, 'load');\n this.factory = new Factory();\n }\n\n public async testOperation(operation: Algebra.Load, context: IActionContext): Promise<IActorTest> {\n ActorQueryOperation.throwOnReadOnly(context);\n return true;\n }\n\n public async runOperation(operation: Algebra.Load, context: IActionContext):\n Promise<IQueryOperationResult> {\n // Determine query source\n let subContext = context;\n if (operation.silent) {\n subContext = subContext.set(KeysInitQuery.lenient, true);\n }\n const { querySource } = await this.mediatorQuerySourceIdentify.mediate({\n querySourceUnidentified: { value: operation.source.value },\n context: subContext,\n });\n\n // Create CONSTRUCT query on the given source\n const output = ActorQueryOperationLoad.getSafeQuads(await this.mediatorQueryOperation.mediate({\n operation: this.factory.createConstruct(\n ActorQueryOperation.assignOperationSource(\n this.factory.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')),\n querySource,\n ),\n [ this.factory.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) ],\n ),\n context: subContext,\n }));\n\n // Determine quad stream to insert\n let quadStream = output.quadStream;\n if (operation.destination) {\n quadStream = quadStream.map(quad => DF.quad(quad.subject, quad.predicate, quad.object, operation.destination));\n }\n\n // Insert quad stream\n const { execute } = await this.mediatorUpdateQuads.mediate({\n quadStreamInsert: quadStream,\n context,\n });\n\n return {\n type: 'void',\n execute,\n };\n }\n}\n\nexport interface IActorQueryOperationLoadArgs extends IActorQueryOperationTypedMediatedArgs {\n /**\n * The RDF Update Quads mediator\n */\n mediatorUpdateQuads: MediatorRdfUpdateQuads;\n /**\n * Mediator for identifying load sources.\n */\n mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-operation-update-load",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "A load query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"funding": {
|
|
8
|
-
"type": "opencollective",
|
|
9
|
-
"url": "https://opencollective.com/comunica-association"
|
|
10
|
-
},
|
|
11
7
|
"homepage": "https://comunica.dev/",
|
|
12
8
|
"repository": {
|
|
13
9
|
"type": "git",
|
|
@@ -41,14 +37,14 @@
|
|
|
41
37
|
"build:components": "componentsjs-generator"
|
|
42
38
|
},
|
|
43
39
|
"dependencies": {
|
|
44
|
-
"@comunica/bus-query-operation": "3.
|
|
45
|
-
"@comunica/bus-query-source-identify": "3.
|
|
46
|
-
"@comunica/bus-rdf-update-quads": "3.
|
|
47
|
-
"@comunica/context-entries": "3.
|
|
48
|
-
"@comunica/core": "3.
|
|
49
|
-
"@comunica/types": "3.
|
|
50
|
-
"
|
|
51
|
-
"sparqlalgebrajs": "^4.3.
|
|
40
|
+
"@comunica/bus-query-operation": "^3.3.0",
|
|
41
|
+
"@comunica/bus-query-source-identify": "^3.3.0",
|
|
42
|
+
"@comunica/bus-rdf-update-quads": "^3.3.0",
|
|
43
|
+
"@comunica/context-entries": "^3.3.0",
|
|
44
|
+
"@comunica/core": "^3.3.0",
|
|
45
|
+
"@comunica/types": "^3.3.0",
|
|
46
|
+
"rdf-data-factory": "^1.1.1",
|
|
47
|
+
"sparqlalgebrajs": "^4.3.7"
|
|
52
48
|
},
|
|
53
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "02bde397d206f1f5a523643a6a604c89e792e2f9"
|
|
54
50
|
}
|