@comunica/actor-query-source-identify-serialized 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/ActorQuerySourceIdentifySerialized.jsonld +0 -32
- package/components/context.jsonld +0 -6
- package/lib/ActorQuerySourceIdentifySerialized.d.ts +2 -2
- package/lib/ActorQuerySourceIdentifySerialized.js +2 -3
- package/lib/ActorQuerySourceIdentifySerialized.js.map +1 -1
- package/package.json +6 -10
|
@@ -54,10 +54,6 @@
|
|
|
54
54
|
{
|
|
55
55
|
"@type": "ParameterRangeGenericTypeReference",
|
|
56
56
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
60
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
61
57
|
}
|
|
62
58
|
]
|
|
63
59
|
},
|
|
@@ -72,10 +68,6 @@
|
|
|
72
68
|
{
|
|
73
69
|
"@type": "ParameterRangeGenericTypeReference",
|
|
74
70
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
78
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
79
71
|
}
|
|
80
72
|
]
|
|
81
73
|
},
|
|
@@ -85,20 +77,6 @@
|
|
|
85
77
|
},
|
|
86
78
|
"comment": "The bus this actor subscribes to."
|
|
87
79
|
},
|
|
88
|
-
{
|
|
89
|
-
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_busFailMessage",
|
|
90
|
-
"range": {
|
|
91
|
-
"@type": "ParameterRangeUnion",
|
|
92
|
-
"parameterRangeElements": [
|
|
93
|
-
"xsd:string",
|
|
94
|
-
{
|
|
95
|
-
"@type": "ParameterRangeUndefined"
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
"default": "Query source identification failed: none of the configured actors were able to identify ${action.querySourceUnidentified.value}",
|
|
100
|
-
"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}\""
|
|
101
|
-
},
|
|
102
80
|
{
|
|
103
81
|
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_beforeActors",
|
|
104
82
|
"range": {
|
|
@@ -121,10 +99,6 @@
|
|
|
121
99
|
{
|
|
122
100
|
"@type": "ParameterRangeGenericTypeReference",
|
|
123
101
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"@type": "ParameterRangeGenericTypeReference",
|
|
127
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
128
102
|
}
|
|
129
103
|
]
|
|
130
104
|
}
|
|
@@ -202,12 +176,6 @@
|
|
|
202
176
|
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_bus"
|
|
203
177
|
}
|
|
204
178
|
},
|
|
205
|
-
{
|
|
206
|
-
"keyRaw": "busFailMessage",
|
|
207
|
-
"value": {
|
|
208
|
-
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_busFailMessage"
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
179
|
{
|
|
212
180
|
"keyRaw": "beforeActors",
|
|
213
181
|
"value": {
|
|
@@ -20,9 +20,6 @@
|
|
|
20
20
|
"args_bus": {
|
|
21
21
|
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_bus"
|
|
22
22
|
},
|
|
23
|
-
"args_busFailMessage": {
|
|
24
|
-
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_busFailMessage"
|
|
25
|
-
},
|
|
26
23
|
"args_beforeActors": {
|
|
27
24
|
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_beforeActors",
|
|
28
25
|
"@container": "@list"
|
|
@@ -39,9 +36,6 @@
|
|
|
39
36
|
"bus": {
|
|
40
37
|
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_bus"
|
|
41
38
|
},
|
|
42
|
-
"busFailMessage": {
|
|
43
|
-
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_busFailMessage"
|
|
44
|
-
},
|
|
45
39
|
"beforeActors": {
|
|
46
40
|
"@id": "caqsis:components/ActorQuerySourceIdentifySerialized.jsonld#ActorQuerySourceIdentifySerialized_args_beforeActors",
|
|
47
41
|
"@container": "@list"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IActionQuerySourceIdentify, IActorQuerySourceIdentifyOutput, IActorQuerySourceIdentifyArgs, MediatorQuerySourceIdentify } from '@comunica/bus-query-source-identify';
|
|
2
2
|
import { ActorQuerySourceIdentify } from '@comunica/bus-query-source-identify';
|
|
3
3
|
import type { MediatorRdfParseHandle } from '@comunica/bus-rdf-parse';
|
|
4
|
-
import type { IActorTest
|
|
4
|
+
import type { IActorTest } from '@comunica/core';
|
|
5
5
|
import type { IQuerySourceSerialized, IActionContext } from '@comunica/types';
|
|
6
6
|
import type * as RDF from '@rdfjs/types';
|
|
7
7
|
/**
|
|
@@ -12,7 +12,7 @@ export declare class ActorQuerySourceIdentifySerialized extends ActorQuerySource
|
|
|
12
12
|
readonly mediatorRdfParse: MediatorRdfParseHandle;
|
|
13
13
|
readonly mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;
|
|
14
14
|
constructor(args: IActorQuerySourceIdentifySerializedArgs);
|
|
15
|
-
test(action: IActionQuerySourceIdentify): Promise<
|
|
15
|
+
test(action: IActionQuerySourceIdentify): Promise<IActorTest>;
|
|
16
16
|
run(action: IActionQuerySourceIdentify): Promise<IActorQuerySourceIdentifyOutput>;
|
|
17
17
|
/**
|
|
18
18
|
* Parses the string data source through the RDF parse bus, returning the RDF source.
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorQuerySourceIdentifySerialized = void 0;
|
|
4
4
|
const bus_query_source_identify_1 = require("@comunica/bus-query-source-identify");
|
|
5
|
-
const core_1 = require("@comunica/core");
|
|
6
5
|
const rdf_store_stream_1 = require("rdf-store-stream");
|
|
7
6
|
const readable_stream_1 = require("readable-stream");
|
|
8
7
|
/**
|
|
@@ -14,9 +13,9 @@ class ActorQuerySourceIdentifySerialized extends bus_query_source_identify_1.Act
|
|
|
14
13
|
}
|
|
15
14
|
async test(action) {
|
|
16
15
|
if (!this.isStringSource(action.querySourceUnidentified)) {
|
|
17
|
-
|
|
16
|
+
throw new Error(`${this.name} requires a single query source with serialized type to be present in the context.`);
|
|
18
17
|
}
|
|
19
|
-
return
|
|
18
|
+
return true;
|
|
20
19
|
}
|
|
21
20
|
async run(action) {
|
|
22
21
|
// Delegate source identification to the same bus again, by converting the string into an RDF/JS source
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQuerySourceIdentifySerialized.js","sourceRoot":"","sources":["ActorQuerySourceIdentifySerialized.ts"],"names":[],"mappings":";;;AAMA,mFAA+E;
|
|
1
|
+
{"version":3,"file":"ActorQuerySourceIdentifySerialized.js","sourceRoot":"","sources":["ActorQuerySourceIdentifySerialized.ts"],"names":[],"mappings":";;;AAMA,mFAA+E;AAS/E,uDAA+C;AAC/C,qDAA2C;AAE3C;;GAEG;AACH,MAAa,kCAAmC,SAAQ,oDAAwB;IAI9E,YAAmB,IAA6C;QAC9D,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAAkC;QAClD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,oFAAoF,CAAC,CAAC;QACpH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAAkC;QACjD,uGAAuG;QACvG,OAAO,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC;YACpD,uBAAuB,EAAE;gBACvB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAA2B,MAAM,CAAC,uBAAuB,CAAC;gBACvG,OAAO,EAAE,MAAM,CAAC,uBAAuB,CAAC,OAAO;aAChD;YACD,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,YAAY,CAAC,OAAuB,EAAE,MAA8B;QAClF,MAAM,UAAU,GAAG,IAAI,0BAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,0BAA0B;QAC1B,UAAU,CAAC,KAAK,GAAG,GAAG,EAAE;YACtB,aAAa;QACf,CAAC,CAAC;QACF,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtB,MAAM,WAAW,GAA0B;YACzC,OAAO;YACP,MAAM,EAAE;gBACN,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,UAAU;gBAChB,OAAO;aACR;YACD,eAAe,EAAE,MAAM,CAAC,SAAS;SAClC,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACrE,OAAO,MAAM,IAAA,8BAAW,EAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IAEO,cAAc,CAAC,MAAuC;QAC5D,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,CAAC,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,EAAE,CAAC;gBACxC,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,WAAW,IAAI,MAAM,CAAC;QAC/B,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC;IACtC,CAAC;CACF;AAjED,gFAiEC","sourcesContent":["import type {\n IActionQuerySourceIdentify,\n IActorQuerySourceIdentifyOutput,\n IActorQuerySourceIdentifyArgs,\n MediatorQuerySourceIdentify,\n} from '@comunica/bus-query-source-identify';\nimport { ActorQuerySourceIdentify } from '@comunica/bus-query-source-identify';\nimport type { IActionRdfParseHandle, MediatorRdfParseHandle } from '@comunica/bus-rdf-parse';\nimport type { IActorTest } from '@comunica/core';\nimport type {\n IQuerySourceSerialized,\n QuerySourceUnidentifiedExpanded,\n IActionContext,\n} from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport { storeStream } from 'rdf-store-stream';\nimport { Readable } from 'readable-stream';\n\n/**\n * A comunica Serialized Query Source Identify Actor.\n */\nexport class ActorQuerySourceIdentifySerialized extends ActorQuerySourceIdentify {\n public readonly cacheSize: number;\n public readonly mediatorRdfParse: MediatorRdfParseHandle;\n public readonly mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;\n public constructor(args: IActorQuerySourceIdentifySerializedArgs) {\n super(args);\n }\n\n public async test(action: IActionQuerySourceIdentify): Promise<IActorTest> {\n if (!this.isStringSource(action.querySourceUnidentified)) {\n throw new Error(`${this.name} requires a single query source with serialized type to be present in the context.`);\n }\n return true;\n }\n\n public async run(action: IActionQuerySourceIdentify): Promise<IActorQuerySourceIdentifyOutput> {\n // Delegate source identification to the same bus again, by converting the string into an RDF/JS source\n return await this.mediatorQuerySourceIdentify.mediate({\n querySourceUnidentified: {\n type: 'rdfjs',\n value: await this.getRdfSource(action.context, <IQuerySourceSerialized> action.querySourceUnidentified),\n context: action.querySourceUnidentified.context,\n },\n context: action.context,\n });\n }\n\n /**\n * Parses the string data source through the RDF parse bus, returning the RDF source.\n * @param context The run action context\n * @param source The source from the run action context\n * @returns Parsed RDF source that can be passed to quad pattern resolve mediator as an RDF/JS source\n */\n protected async getRdfSource(context: IActionContext, source: IQuerySourceSerialized): Promise<RDF.Source> {\n const textStream = new Readable({ objectMode: true });\n /* istanbul ignore next */\n textStream._read = () => {\n // Do nothing\n };\n textStream.push(source.value);\n textStream.push(null);\n\n const parseAction: IActionRdfParseHandle = {\n context,\n handle: {\n metadata: { baseIRI: source.baseIRI },\n data: textStream,\n context,\n },\n handleMediaType: source.mediaType,\n };\n\n const parseResult = await this.mediatorRdfParse.mediate(parseAction);\n return await storeStream(parseResult.handle.data);\n }\n\n private isStringSource(source: QuerySourceUnidentifiedExpanded): source is IQuerySourceSerialized {\n if (!('type' in source)) {\n if (!(typeof source.value === 'string')) {\n return false;\n }\n return 'mediaType' in source;\n }\n return source.type === 'serialized';\n }\n}\n\nexport interface IActorQuerySourceIdentifySerializedArgs extends IActorQuerySourceIdentifyArgs {\n /**\n * The quad pattern parser mediator.\n */\n mediatorRdfParse: MediatorRdfParseHandle;\n /**\n * The query source identify mediator.\n */\n mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-source-identify-serialized",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "A serialized query-source-identify 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,13 +37,13 @@
|
|
|
41
37
|
"build:components": "componentsjs-generator"
|
|
42
38
|
},
|
|
43
39
|
"dependencies": {
|
|
44
|
-
"@comunica/bus-query-source-identify": "3.
|
|
45
|
-
"@comunica/bus-rdf-parse": "3.
|
|
46
|
-
"@comunica/core": "3.
|
|
47
|
-
"@comunica/types": "3.
|
|
40
|
+
"@comunica/bus-query-source-identify": "^3.3.0",
|
|
41
|
+
"@comunica/bus-rdf-parse": "^3.3.0",
|
|
42
|
+
"@comunica/core": "^3.3.0",
|
|
43
|
+
"@comunica/types": "^3.3.0",
|
|
48
44
|
"@rdfjs/types": "*",
|
|
49
45
|
"rdf-store-stream": "^2.0.0",
|
|
50
46
|
"readable-stream": "^4.2.0"
|
|
51
47
|
},
|
|
52
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "02bde397d206f1f5a523643a6a604c89e792e2f9"
|
|
53
49
|
}
|