@comunica/actor-query-process-annotate-source-binding 3.2.1 → 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/components/ActorQueryProcessAnnotateSourceBinding.jsonld +32 -0
- package/components/context.jsonld +6 -0
- package/lib/ActorQueryProcessAnnotateSourceBinding.d.ts +2 -2
- package/lib/ActorQueryProcessAnnotateSourceBinding.js +4 -4
- package/lib/ActorQueryProcessAnnotateSourceBinding.js.map +1 -1
- package/package.json +11 -7
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
{
|
|
50
50
|
"@type": "ParameterRangeGenericTypeReference",
|
|
51
51
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
55
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
52
56
|
}
|
|
53
57
|
]
|
|
54
58
|
},
|
|
@@ -63,6 +67,10 @@
|
|
|
63
67
|
{
|
|
64
68
|
"@type": "ParameterRangeGenericTypeReference",
|
|
65
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"
|
|
66
74
|
}
|
|
67
75
|
]
|
|
68
76
|
},
|
|
@@ -72,6 +80,20 @@
|
|
|
72
80
|
},
|
|
73
81
|
"comment": "The bus this actor subscribes to."
|
|
74
82
|
},
|
|
83
|
+
{
|
|
84
|
+
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_busFailMessage",
|
|
85
|
+
"range": {
|
|
86
|
+
"@type": "ParameterRangeUnion",
|
|
87
|
+
"parameterRangeElements": [
|
|
88
|
+
"xsd:string",
|
|
89
|
+
{
|
|
90
|
+
"@type": "ParameterRangeUndefined"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"default": "Query processing failed: none of the configured actor were process to the query \"${action.query}\"",
|
|
95
|
+
"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}\""
|
|
96
|
+
},
|
|
75
97
|
{
|
|
76
98
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_beforeActors",
|
|
77
99
|
"range": {
|
|
@@ -94,6 +116,10 @@
|
|
|
94
116
|
{
|
|
95
117
|
"@type": "ParameterRangeGenericTypeReference",
|
|
96
118
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
122
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
97
123
|
}
|
|
98
124
|
]
|
|
99
125
|
}
|
|
@@ -155,6 +181,12 @@
|
|
|
155
181
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_bus"
|
|
156
182
|
}
|
|
157
183
|
},
|
|
184
|
+
{
|
|
185
|
+
"keyRaw": "busFailMessage",
|
|
186
|
+
"value": {
|
|
187
|
+
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_busFailMessage"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
158
190
|
{
|
|
159
191
|
"keyRaw": "beforeActors",
|
|
160
192
|
"value": {
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"args_bus": {
|
|
18
18
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_bus"
|
|
19
19
|
},
|
|
20
|
+
"args_busFailMessage": {
|
|
21
|
+
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_busFailMessage"
|
|
22
|
+
},
|
|
20
23
|
"args_beforeActors": {
|
|
21
24
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_beforeActors",
|
|
22
25
|
"@container": "@list"
|
|
@@ -30,6 +33,9 @@
|
|
|
30
33
|
"bus": {
|
|
31
34
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_bus"
|
|
32
35
|
},
|
|
36
|
+
"busFailMessage": {
|
|
37
|
+
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_busFailMessage"
|
|
38
|
+
},
|
|
33
39
|
"beforeActors": {
|
|
34
40
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_beforeActors",
|
|
35
41
|
"@container": "@list"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IActionQueryProcess, IActorQueryProcessOutput, IActorQueryProcessArgs, MediatorQueryProcess } from '@comunica/bus-query-process';
|
|
2
2
|
import { ActorQueryProcess } from '@comunica/bus-query-process';
|
|
3
|
-
import type { IActorTest } from '@comunica/core';
|
|
3
|
+
import type { IActorTest, TestResult } from '@comunica/core';
|
|
4
4
|
import { ActionContextKey } from '@comunica/core';
|
|
5
5
|
import type { BindingsStream } from '@comunica/types';
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ export declare class ActorQueryProcessAnnotateSourceBinding extends ActorQueryPr
|
|
|
10
10
|
private readonly dataFactory;
|
|
11
11
|
readonly mediatorQueryProcess: MediatorQueryProcess;
|
|
12
12
|
constructor(args: IActorQueryProcessAnnotateSourceBindingArgs);
|
|
13
|
-
test(action: IActionQueryProcess): Promise<IActorTest
|
|
13
|
+
test(action: IActionQueryProcess): Promise<TestResult<IActorTest>>;
|
|
14
14
|
run(action: IActionQueryProcess): Promise<IActorQueryProcessOutput>;
|
|
15
15
|
addSourcesToBindings(iterator: BindingsStream): BindingsStream;
|
|
16
16
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KEY_CONTEXT_WRAPPED = exports.ActorQueryProcessAnnotateSourceBinding = void 0;
|
|
4
|
-
const bindings_factory_1 = require("@comunica/bindings-factory");
|
|
5
4
|
const bus_query_process_1 = require("@comunica/bus-query-process");
|
|
6
5
|
const context_entries_1 = require("@comunica/context-entries");
|
|
7
6
|
const core_1 = require("@comunica/core");
|
|
7
|
+
const utils_bindings_factory_1 = require("@comunica/utils-bindings-factory");
|
|
8
8
|
const rdf_data_factory_1 = require("rdf-data-factory");
|
|
9
9
|
/**
|
|
10
10
|
* A comunica Annotate Source Binding Query Process Actor.
|
|
@@ -16,9 +16,9 @@ class ActorQueryProcessAnnotateSourceBinding extends bus_query_process_1.ActorQu
|
|
|
16
16
|
}
|
|
17
17
|
async test(action) {
|
|
18
18
|
if (action.context.get(exports.KEY_CONTEXT_WRAPPED)) {
|
|
19
|
-
|
|
19
|
+
return (0, core_1.failTest)('Unable to query process multiple times');
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return (0, core_1.passTestVoid)();
|
|
22
22
|
}
|
|
23
23
|
async run(action) {
|
|
24
24
|
const context = action.context.set(exports.KEY_CONTEXT_WRAPPED, true);
|
|
@@ -33,7 +33,7 @@ class ActorQueryProcessAnnotateSourceBinding extends bus_query_process_1.ActorQu
|
|
|
33
33
|
}
|
|
34
34
|
addSourcesToBindings(iterator) {
|
|
35
35
|
const ret = iterator.map((bindings) => {
|
|
36
|
-
if (bindings instanceof
|
|
36
|
+
if (bindings instanceof utils_bindings_factory_1.Bindings) {
|
|
37
37
|
// Get sources from bindings context. If no sources are found, this should produce binding with empty literal
|
|
38
38
|
const source = bindings.getContextEntry(context_entries_1.KeysMergeBindingsContext.sourcesBinding);
|
|
39
39
|
const sourceAsLiteral = this.dataFactory.literal(JSON.stringify(source ?? []));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryProcessAnnotateSourceBinding.js","sourceRoot":"","sources":["ActorQueryProcessAnnotateSourceBinding.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ActorQueryProcessAnnotateSourceBinding.js","sourceRoot":"","sources":["ActorQueryProcessAnnotateSourceBinding.ts"],"names":[],"mappings":";;;AAMA,mEAAgE;AAChE,+DAAqE;AAErE,yCAA0E;AAE1E,6EAA4D;AAE5D,uDAA+C;AAE/C;;GAEG;AACH,MAAa,sCAAuC,SAAQ,qCAAiB;IAI3E,YAAmB,IAAiD;QAClE,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,WAAW,GAAG,IAAI,8BAAW,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAA2B;QAC3C,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2BAAmB,CAAC,EAAE,CAAC;YAC5C,OAAO,IAAA,eAAQ,EAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QACD,OA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,\n IActorQueryProcessArgs,\n MediatorQueryProcess,\n} from '@comunica/bus-query-process';\nimport { ActorQueryProcess } from '@comunica/bus-query-process';\nimport { KeysMergeBindingsContext } from '@comunica/context-entries';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { failTest, passTestVoid, ActionContextKey } from '@comunica/core';\nimport type { BindingsStream } from '@comunica/types';\nimport { Bindings } from '@comunica/utils-bindings-factory';\nimport type * as RDF from '@rdfjs/types';\nimport { DataFactory } from 'rdf-data-factory';\n\n/**\n * A comunica Annotate Source Binding Query Process Actor.\n */\nexport class ActorQueryProcessAnnotateSourceBinding extends ActorQueryProcess {\n private readonly dataFactory: RDF.DataFactory;\n public readonly mediatorQueryProcess: MediatorQueryProcess;\n\n public constructor(args: IActorQueryProcessAnnotateSourceBindingArgs) {\n super(args);\n this.dataFactory = new DataFactory();\n }\n\n public async test(action: IActionQueryProcess): Promise<TestResult<IActorTest>> {\n if (action.context.get(KEY_CONTEXT_WRAPPED)) {\n return failTest('Unable to query process multiple times');\n }\n return passTestVoid();\n }\n\n public async run(action: IActionQueryProcess): Promise<IActorQueryProcessOutput> {\n const context = action.context.set(KEY_CONTEXT_WRAPPED, true);\n action.context = context;\n\n // Run all query processing steps in sequence\n const output = await this.mediatorQueryProcess.mediate(action);\n // Currently this only supports adding source provenance to bindings\n if (output.result.type === 'bindings') {\n output.result.bindingsStream = this.addSourcesToBindings(output.result.bindingsStream);\n }\n return output;\n }\n\n public addSourcesToBindings(iterator: BindingsStream): BindingsStream {\n const ret = iterator.map((bindings) => {\n if (bindings instanceof Bindings) {\n // Get sources from bindings context. If no sources are found, this should produce binding with empty literal\n const source = <string []> bindings.getContextEntry(KeysMergeBindingsContext.sourcesBinding);\n const sourceAsLiteral = this.dataFactory.literal(JSON.stringify(source ?? []));\n bindings = bindings.set('_source', sourceAsLiteral);\n }\n return bindings;\n });\n\n return ret;\n }\n}\n\nexport interface IActorQueryProcessAnnotateSourceBindingArgs extends IActorQueryProcessArgs {\n /**\n * The query process mediator so we can call our wrapped actor\n */\n mediatorQueryProcess: MediatorQueryProcess;\n}\n\nexport const KEY_CONTEXT_WRAPPED = new ActionContextKey<boolean>(\n '@comunica/actor-query-process-annotate-source-binding:wrapped',\n);\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-process-annotate-source-binding",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4-alpha.47.0",
|
|
4
4
|
"description": "A annotate-source-binding 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,12 +41,12 @@
|
|
|
37
41
|
"build:components": "componentsjs-generator"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {
|
|
40
|
-
"@comunica/
|
|
41
|
-
"@comunica/
|
|
42
|
-
"@comunica/
|
|
43
|
-
"@comunica/
|
|
44
|
-
"@comunica/
|
|
44
|
+
"@comunica/bus-query-process": "3.2.4-alpha.47.0",
|
|
45
|
+
"@comunica/context-entries": "3.2.4-alpha.47.0",
|
|
46
|
+
"@comunica/core": "3.2.4-alpha.47.0",
|
|
47
|
+
"@comunica/types": "3.2.4-alpha.47.0",
|
|
48
|
+
"@comunica/utils-bindings-factory": "3.2.4-alpha.47.0",
|
|
45
49
|
"rdf-data-factory": "^1.1.2"
|
|
46
50
|
},
|
|
47
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "85bd4c5cf07dfc293ebbc3a1416b70e2db8bfc48"
|
|
48
52
|
}
|