@comunica/actor-query-process-sequential 3.3.0 → 4.0.1
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/components/ActorQueryProcessSequential.jsonld +44 -12
- package/components/components.jsonld +1 -1
- package/components/context.jsonld +7 -1
- package/lib/ActorQueryProcessSequential.d.ts +2 -2
- package/lib/ActorQueryProcessSequential.js +11 -8
- package/lib/ActorQueryProcessSequential.js.map +1 -1
- package/package.json +18 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-process-sequential/^
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^
|
|
5
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-process/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-process-sequential/^4.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-process/^4.0.0/components/context.jsonld"
|
|
6
6
|
],
|
|
7
7
|
"@id": "npmd:@comunica/actor-query-process-sequential",
|
|
8
8
|
"components": [
|
|
@@ -61,29 +61,37 @@
|
|
|
61
61
|
"genericTypeInstances": [
|
|
62
62
|
{
|
|
63
63
|
"@type": "ParameterRangeGenericTypeReference",
|
|
64
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
64
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"@type": "ParameterRangeGenericTypeReference",
|
|
68
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
68
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
"@type": "ParameterRangeGenericTypeReference",
|
|
72
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
72
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
76
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
73
77
|
}
|
|
74
78
|
]
|
|
75
79
|
},
|
|
76
80
|
{
|
|
77
81
|
"@type": "ParameterRangeGenericTypeReference",
|
|
78
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
82
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
86
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
79
87
|
},
|
|
80
88
|
{
|
|
81
89
|
"@type": "ParameterRangeGenericTypeReference",
|
|
82
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
90
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
83
91
|
},
|
|
84
92
|
{
|
|
85
93
|
"@type": "ParameterRangeGenericTypeReference",
|
|
86
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
94
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
87
95
|
}
|
|
88
96
|
]
|
|
89
97
|
},
|
|
@@ -93,6 +101,20 @@
|
|
|
93
101
|
},
|
|
94
102
|
"comment": "The bus this actor subscribes to."
|
|
95
103
|
},
|
|
104
|
+
{
|
|
105
|
+
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_busFailMessage",
|
|
106
|
+
"range": {
|
|
107
|
+
"@type": "ParameterRangeUnion",
|
|
108
|
+
"parameterRangeElements": [
|
|
109
|
+
"xsd:string",
|
|
110
|
+
{
|
|
111
|
+
"@type": "ParameterRangeUndefined"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"default": "Query processing failed: none of the configured actor were process to the query \"${action.query}\"",
|
|
116
|
+
"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}\""
|
|
117
|
+
},
|
|
96
118
|
{
|
|
97
119
|
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_beforeActors",
|
|
98
120
|
"range": {
|
|
@@ -106,15 +128,19 @@
|
|
|
106
128
|
"genericTypeInstances": [
|
|
107
129
|
{
|
|
108
130
|
"@type": "ParameterRangeGenericTypeReference",
|
|
109
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
131
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
110
132
|
},
|
|
111
133
|
{
|
|
112
134
|
"@type": "ParameterRangeGenericTypeReference",
|
|
113
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
135
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
114
136
|
},
|
|
115
137
|
{
|
|
116
138
|
"@type": "ParameterRangeGenericTypeReference",
|
|
117
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
139
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
143
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
118
144
|
}
|
|
119
145
|
]
|
|
120
146
|
}
|
|
@@ -224,6 +250,12 @@
|
|
|
224
250
|
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_bus"
|
|
225
251
|
}
|
|
226
252
|
},
|
|
253
|
+
{
|
|
254
|
+
"keyRaw": "busFailMessage",
|
|
255
|
+
"value": {
|
|
256
|
+
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_busFailMessage"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
227
259
|
{
|
|
228
260
|
"keyRaw": "beforeActors",
|
|
229
261
|
"value": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-process-sequential/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-process-sequential/^4.0.0/components/context.jsonld"
|
|
4
4
|
],
|
|
5
5
|
"@id": "npmd:@comunica/actor-query-process-sequential",
|
|
6
6
|
"@type": "Module",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
|
|
4
4
|
{
|
|
5
5
|
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
-
"caqps": "npmd:@comunica/actor-query-process-sequential/^
|
|
6
|
+
"caqps": "npmd:@comunica/actor-query-process-sequential/^4.0.0/",
|
|
7
7
|
"ActorQueryProcessSequential": {
|
|
8
8
|
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential",
|
|
9
9
|
"@prefix": true,
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"args_bus": {
|
|
30
30
|
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_bus"
|
|
31
31
|
},
|
|
32
|
+
"args_busFailMessage": {
|
|
33
|
+
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_busFailMessage"
|
|
34
|
+
},
|
|
32
35
|
"args_beforeActors": {
|
|
33
36
|
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_beforeActors",
|
|
34
37
|
"@container": "@list"
|
|
@@ -54,6 +57,9 @@
|
|
|
54
57
|
"bus": {
|
|
55
58
|
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_bus"
|
|
56
59
|
},
|
|
60
|
+
"busFailMessage": {
|
|
61
|
+
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_busFailMessage"
|
|
62
|
+
},
|
|
57
63
|
"beforeActors": {
|
|
58
64
|
"@id": "caqps:components/ActorQueryProcessSequential.jsonld#ActorQueryProcessSequential_args_beforeActors",
|
|
59
65
|
"@container": "@list"
|
|
@@ -5,7 +5,7 @@ import type { MediatorQueryOperation } from '@comunica/bus-query-operation';
|
|
|
5
5
|
import type { MediatorQueryParse } from '@comunica/bus-query-parse';
|
|
6
6
|
import type { IActionQueryProcess, IActorQueryProcessOutput, IActorQueryProcessArgs, IQueryProcessSequential, IQueryProcessSequentialOutput } from '@comunica/bus-query-process';
|
|
7
7
|
import { ActorQueryProcess } from '@comunica/bus-query-process';
|
|
8
|
-
import type { IActorTest } from '@comunica/core';
|
|
8
|
+
import type { IActorTest, TestResult } from '@comunica/core';
|
|
9
9
|
import type { IActionContext, IQueryOperationResult, QueryFormatType } from '@comunica/types';
|
|
10
10
|
import type { Algebra } from 'sparqlalgebrajs';
|
|
11
11
|
/**
|
|
@@ -18,7 +18,7 @@ export declare class ActorQueryProcessSequential extends ActorQueryProcess imple
|
|
|
18
18
|
readonly mediatorQueryOperation: MediatorQueryOperation;
|
|
19
19
|
readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;
|
|
20
20
|
constructor(args: IActorQueryProcessSequentialArgs);
|
|
21
|
-
test(action: IActionQueryProcess): Promise<IActorTest
|
|
21
|
+
test(action: IActionQueryProcess): Promise<TestResult<IActorTest>>;
|
|
22
22
|
run(action: IActionQueryProcess): Promise<IActorQueryProcessOutput>;
|
|
23
23
|
parse(query: QueryFormatType, context: IActionContext): Promise<IQueryProcessSequentialOutput>;
|
|
24
24
|
optimize(operation: Algebra.Operation, context: IActionContext): Promise<IQueryProcessSequentialOutput>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorQueryProcessSequential = void 0;
|
|
4
|
-
const bindings_factory_1 = require("@comunica/bindings-factory");
|
|
5
|
-
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
6
4
|
const bus_query_process_1 = require("@comunica/bus-query-process");
|
|
7
5
|
const context_entries_1 = require("@comunica/context-entries");
|
|
8
6
|
const core_1 = require("@comunica/core");
|
|
7
|
+
const utils_bindings_factory_1 = require("@comunica/utils-bindings-factory");
|
|
8
|
+
const utils_query_operation_1 = require("@comunica/utils-query-operation");
|
|
9
|
+
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
9
10
|
/**
|
|
10
11
|
* A comunica Sequential Query Process Actor.
|
|
11
12
|
*/
|
|
@@ -14,10 +15,10 @@ class ActorQueryProcessSequential extends bus_query_process_1.ActorQueryProcess
|
|
|
14
15
|
super(args);
|
|
15
16
|
}
|
|
16
17
|
async test(action) {
|
|
17
|
-
if (action.context.get(context_entries_1.KeysInitQuery.explain)
|
|
18
|
-
|
|
18
|
+
if (action.context.get(context_entries_1.KeysInitQuery.explain) ?? action.context.get(new core_1.ActionContextKey('explain'))) {
|
|
19
|
+
return (0, core_1.failTest)(`${this.name} is not able to explain queries.`);
|
|
19
20
|
}
|
|
20
|
-
return
|
|
21
|
+
return (0, core_1.passTestVoid)();
|
|
21
22
|
}
|
|
22
23
|
async run(action) {
|
|
23
24
|
// Run all query processing steps in sequence
|
|
@@ -48,9 +49,11 @@ class ActorQueryProcessSequential extends bus_query_process_1.ActorQueryProcess
|
|
|
48
49
|
}
|
|
49
50
|
// Apply initial bindings in context
|
|
50
51
|
if (context.has(context_entries_1.KeysInitQuery.initialBindings)) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
|
|
53
|
+
const algebraFactory = new sparqlalgebrajs_1.Factory(dataFactory);
|
|
54
|
+
const bindingsFactory = await utils_bindings_factory_1.BindingsFactory
|
|
55
|
+
.create(this.mediatorMergeBindingsContext, context, dataFactory);
|
|
56
|
+
operation = (0, utils_query_operation_1.materializeOperation)(operation, context.get(context_entries_1.KeysInitQuery.initialBindings), algebraFactory, bindingsFactory);
|
|
54
57
|
// Delete the query string from the context, since our initial query might have changed
|
|
55
58
|
context = context.delete(context_entries_1.KeysInitQuery.queryString);
|
|
56
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryProcessSequential.js","sourceRoot":"","sources":["ActorQueryProcessSequential.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ActorQueryProcessSequential.js","sourceRoot":"","sources":["ActorQueryProcessSequential.ts"],"names":[],"mappings":"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","sourcesContent":["import type { MediatorContextPreprocess } from '@comunica/bus-context-preprocess';\nimport type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';\nimport type { MediatorOptimizeQueryOperation } from '@comunica/bus-optimize-query-operation';\nimport type { MediatorQueryOperation } from '@comunica/bus-query-operation';\nimport type { MediatorQueryParse } from '@comunica/bus-query-parse';\nimport type {\n IActionQueryProcess,\n IActorQueryProcessOutput,\n IActorQueryProcessArgs,\n IQueryProcessSequential,\n IQueryProcessSequentialOutput,\n} from '@comunica/bus-query-process';\nimport {\n ActorQueryProcess,\n} from '@comunica/bus-query-process';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { failTest, passTestVoid, ActionContextKey } from '@comunica/core';\nimport type {\n ComunicaDataFactory,\n IActionContext,\n IQueryOperationResult,\n QueryFormatType,\n} from '@comunica/types';\nimport { BindingsFactory } from '@comunica/utils-bindings-factory';\nimport { materializeOperation } from '@comunica/utils-query-operation';\n\nimport type * as RDF from '@rdfjs/types';\nimport type { Algebra } from 'sparqlalgebrajs';\nimport { Factory } from 'sparqlalgebrajs';\n\n/**\n * A comunica Sequential Query Process Actor.\n */\nexport class ActorQueryProcessSequential extends ActorQueryProcess implements IQueryProcessSequential {\n public readonly mediatorContextPreprocess: MediatorContextPreprocess;\n public readonly mediatorQueryParse: MediatorQueryParse;\n public readonly mediatorOptimizeQueryOperation: MediatorOptimizeQueryOperation;\n public readonly mediatorQueryOperation: MediatorQueryOperation;\n public readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n\n public constructor(args: IActorQueryProcessSequentialArgs) {\n super(args);\n }\n\n public async test(action: IActionQueryProcess): Promise<TestResult<IActorTest>> {\n if (action.context.get(KeysInitQuery.explain) ?? action.context.get(new ActionContextKey('explain'))) {\n return failTest(`${this.name} is not able to explain queries.`);\n }\n return passTestVoid();\n }\n\n public async run(action: IActionQueryProcess): Promise<IActorQueryProcessOutput> {\n // Run all query processing steps in sequence\n let { operation, context } = await this.parse(action.query, action.context);\n ({ operation, context } = await this.optimize(operation, context));\n const output = await this.evaluate(operation, context);\n\n return { result: output };\n }\n\n public async parse(query: QueryFormatType, context: IActionContext): Promise<IQueryProcessSequentialOutput> {\n // Pre-processing the context\n context = (await this.mediatorContextPreprocess.mediate({ context, initialize: true })).context;\n\n // Parse query\n let operation: Algebra.Operation;\n if (typeof query === 'string') {\n // Save the original query string in the context\n context = context.set(KeysInitQuery.queryString, query);\n\n const baseIRI: string | undefined = context.get(KeysInitQuery.baseIRI);\n const queryFormat: RDF.QueryFormat = context.get(KeysInitQuery.queryFormat)!;\n const queryParseOutput = await this.mediatorQueryParse.mediate({ context, query, queryFormat, baseIRI });\n operation = queryParseOutput.operation;\n // Update the baseIRI in the context if the query modified it.\n if (queryParseOutput.baseIRI) {\n context = context.set(KeysInitQuery.baseIRI, queryParseOutput.baseIRI);\n }\n } else {\n operation = query;\n }\n\n // Apply initial bindings in context\n if (context.has(KeysInitQuery.initialBindings)) {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new Factory(dataFactory);\n const bindingsFactory = await BindingsFactory\n .create(this.mediatorMergeBindingsContext, context, dataFactory);\n operation = materializeOperation(\n operation,\n context.get(KeysInitQuery.initialBindings)!,\n algebraFactory,\n bindingsFactory,\n );\n\n // Delete the query string from the context, since our initial query might have changed\n context = context.delete(KeysInitQuery.queryString);\n }\n\n return { operation, context };\n }\n\n public async optimize(operation: Algebra.Operation, context: IActionContext): Promise<IQueryProcessSequentialOutput> {\n // Save initial query in context\n context = context.set(KeysInitQuery.query, operation);\n\n ({ operation, context } = await this.mediatorOptimizeQueryOperation.mediate({ context, operation }));\n\n // Save original query in context\n context = context.set(KeysInitQuery.query, operation);\n\n return { operation, context };\n }\n\n public async evaluate(operation: Algebra.Operation, context: IActionContext): Promise<IQueryOperationResult> {\n const output = await this.mediatorQueryOperation.mediate({ context, operation });\n output.context = context;\n return output;\n }\n}\n\nexport interface IActorQueryProcessSequentialArgs extends IActorQueryProcessArgs {\n /**\n * The context processing combinator\n */\n mediatorContextPreprocess: MediatorContextPreprocess;\n /**\n * The query parse mediator\n */\n mediatorQueryParse: MediatorQueryParse;\n /**\n * The query operation optimize mediator\n */\n mediatorOptimizeQueryOperation: MediatorOptimizeQueryOperation;\n /**\n * The query operation mediator\n */\n mediatorQueryOperation: MediatorQueryOperation;\n /**\n * A mediator for creating binding context merge handlers\n */\n mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-process-sequential",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "A sequential query-process actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"funding": {
|
|
8
|
+
"type": "opencollective",
|
|
9
|
+
"url": "https://opencollective.com/comunica-association"
|
|
10
|
+
},
|
|
7
11
|
"homepage": "https://comunica.dev/",
|
|
8
12
|
"repository": {
|
|
9
13
|
"type": "git",
|
|
@@ -37,18 +41,19 @@
|
|
|
37
41
|
"build:components": "componentsjs-generator"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {
|
|
40
|
-
"@comunica/
|
|
41
|
-
"@comunica/bus-context
|
|
42
|
-
"@comunica/bus-
|
|
43
|
-
"@comunica/bus-
|
|
44
|
-
"@comunica/bus-query-
|
|
45
|
-
"@comunica/bus-query-
|
|
46
|
-
"@comunica/
|
|
47
|
-
"@comunica/
|
|
48
|
-
"@comunica/
|
|
49
|
-
"@comunica/
|
|
44
|
+
"@comunica/bus-context-preprocess": "^4.0.1",
|
|
45
|
+
"@comunica/bus-merge-bindings-context": "^4.0.1",
|
|
46
|
+
"@comunica/bus-optimize-query-operation": "^4.0.1",
|
|
47
|
+
"@comunica/bus-query-operation": "^4.0.1",
|
|
48
|
+
"@comunica/bus-query-parse": "^4.0.1",
|
|
49
|
+
"@comunica/bus-query-process": "^4.0.1",
|
|
50
|
+
"@comunica/context-entries": "^4.0.1",
|
|
51
|
+
"@comunica/core": "^4.0.1",
|
|
52
|
+
"@comunica/types": "^4.0.1",
|
|
53
|
+
"@comunica/utils-bindings-factory": "^4.0.1",
|
|
54
|
+
"@comunica/utils-query-operation": "^4.0.1",
|
|
50
55
|
"@rdfjs/types": "*",
|
|
51
|
-
"sparqlalgebrajs": "^4.3.
|
|
56
|
+
"sparqlalgebrajs": "^4.3.8"
|
|
52
57
|
},
|
|
53
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "67831ba79e45ea1ced41fe3f83c5d6e8802dbeaa"
|
|
54
59
|
}
|