@comunica/actor-query-process-annotate-source-binding 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.
- package/components/ActorQueryProcessAnnotateSourceBinding.jsonld +0 -32
- package/components/context.jsonld +0 -6
- package/lib/ActorQueryProcessAnnotateSourceBinding.d.ts +2 -2
- package/lib/ActorQueryProcessAnnotateSourceBinding.js +4 -4
- package/lib/ActorQueryProcessAnnotateSourceBinding.js.map +1 -1
- package/package.json +7 -11
|
@@ -49,10 +49,6 @@
|
|
|
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"
|
|
56
52
|
}
|
|
57
53
|
]
|
|
58
54
|
},
|
|
@@ -67,10 +63,6 @@
|
|
|
67
63
|
{
|
|
68
64
|
"@type": "ParameterRangeGenericTypeReference",
|
|
69
65
|
"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"
|
|
74
66
|
}
|
|
75
67
|
]
|
|
76
68
|
},
|
|
@@ -80,20 +72,6 @@
|
|
|
80
72
|
},
|
|
81
73
|
"comment": "The bus this actor subscribes to."
|
|
82
74
|
},
|
|
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
|
-
},
|
|
97
75
|
{
|
|
98
76
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_beforeActors",
|
|
99
77
|
"range": {
|
|
@@ -116,10 +94,6 @@
|
|
|
116
94
|
{
|
|
117
95
|
"@type": "ParameterRangeGenericTypeReference",
|
|
118
96
|
"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"
|
|
123
97
|
}
|
|
124
98
|
]
|
|
125
99
|
}
|
|
@@ -181,12 +155,6 @@
|
|
|
181
155
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_bus"
|
|
182
156
|
}
|
|
183
157
|
},
|
|
184
|
-
{
|
|
185
|
-
"keyRaw": "busFailMessage",
|
|
186
|
-
"value": {
|
|
187
|
-
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_busFailMessage"
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
158
|
{
|
|
191
159
|
"keyRaw": "beforeActors",
|
|
192
160
|
"value": {
|
|
@@ -17,9 +17,6 @@
|
|
|
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
|
-
},
|
|
23
20
|
"args_beforeActors": {
|
|
24
21
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_beforeActors",
|
|
25
22
|
"@container": "@list"
|
|
@@ -33,9 +30,6 @@
|
|
|
33
30
|
"bus": {
|
|
34
31
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_bus"
|
|
35
32
|
},
|
|
36
|
-
"busFailMessage": {
|
|
37
|
-
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_busFailMessage"
|
|
38
|
-
},
|
|
39
33
|
"beforeActors": {
|
|
40
34
|
"@id": "caqpasb:components/ActorQueryProcessAnnotateSourceBinding.jsonld#ActorQueryProcessAnnotateSourceBinding_args_beforeActors",
|
|
41
35
|
"@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
|
|
3
|
+
import type { IActorTest } 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<
|
|
13
|
+
test(action: IActionQueryProcess): Promise<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");
|
|
4
5
|
const bus_query_process_1 = require("@comunica/bus-query-process");
|
|
5
6
|
const context_entries_1 = require("@comunica/context-entries");
|
|
6
7
|
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
|
+
throw new Error('Unable to query process multiple times');
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return true;
|
|
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 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":";;;AAAA,iEAAsD;AAOtD,mEAAgE;AAChE,+DAAqE;AAErE,yCAAkD;AAGlD,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,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAA2B;QAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2BAAmB,EAAE,IAAI,CAAC,CAAC;QAC9D,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QAEzB,6CAA6C;QAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/D,oEAAoE;QACpE,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACtC,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,oBAAoB,CAAC,QAAwB;QAClD,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACpC,IAAI,QAAQ,YAAY,2BAAQ,EAAE,CAAC;gBACjC,6GAA6G;gBAC7G,MAAM,MAAM,GAAe,QAAQ,CAAC,eAAe,CAAC,0CAAwB,CAAC,cAAc,CAAC,CAAC;gBAC7F,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC/E,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;YACtD,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA1CD,wFA0CC;AASY,QAAA,mBAAmB,GAAG,IAAI,uBAAgB,CACrD,+DAA+D,CAChE,CAAC","sourcesContent":["import { Bindings } from '@comunica/bindings-factory';\nimport type {\n IActionQueryProcess,\n IActorQueryProcessOutput,\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 } from '@comunica/core';\nimport { ActionContextKey } from '@comunica/core';\nimport type { BindingsStream } from '@comunica/types';\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<IActorTest> {\n if (action.context.get(KEY_CONTEXT_WRAPPED)) {\n throw new Error('Unable to query process multiple times');\n }\n return true;\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,13 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-process-annotate-source-binding",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.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
|
-
},
|
|
11
7
|
"homepage": "https://comunica.dev/",
|
|
12
8
|
"repository": {
|
|
13
9
|
"type": "git",
|
|
@@ -41,12 +37,12 @@
|
|
|
41
37
|
"build:components": "componentsjs-generator"
|
|
42
38
|
},
|
|
43
39
|
"dependencies": {
|
|
44
|
-
"@comunica/
|
|
45
|
-
"@comunica/
|
|
46
|
-
"@comunica/
|
|
47
|
-
"@comunica/
|
|
48
|
-
"@comunica/
|
|
40
|
+
"@comunica/bindings-factory": "^3.3.0",
|
|
41
|
+
"@comunica/bus-query-process": "^3.3.0",
|
|
42
|
+
"@comunica/context-entries": "^3.3.0",
|
|
43
|
+
"@comunica/core": "^3.3.0",
|
|
44
|
+
"@comunica/types": "^3.3.0",
|
|
49
45
|
"rdf-data-factory": "^1.1.2"
|
|
50
46
|
},
|
|
51
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "02bde397d206f1f5a523643a6a604c89e792e2f9"
|
|
52
48
|
}
|