@comunica/actor-query-source-identify-rdfjs 3.0.1-alpha.43.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/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
4
+ Comunica Association and Ghent University – imec, Belgium
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Comunica RDFJS Query Source Identify Actor
2
+
3
+ [![npm version](https://badge.fury.io/js/%40comunica%2Factor-query-source-identify-rdfjs.svg)](https://www.npmjs.com/package/@comunica/actor-query-source-identify-rdfjs)
4
+
5
+ A [Query Source Identify](https://github.com/comunica/comunica/tree/master/packages/bus-query-source-identify) actor that handles [RDF/JS Sources](https://comunica.dev/docs/query/advanced/rdfjs_querying/).
6
+
7
+ This module is part of the [Comunica framework](https://github.com/comunica/comunica),
8
+ and should only be used by [developers that want to build their own query engine](https://comunica.dev/docs/modify/).
9
+
10
+ [Click here if you just want to query with Comunica](https://comunica.dev/docs/query/).
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ $ yarn add @comunica/actor-query-source-identify-rdfjs
16
+ ```
17
+
18
+ ## Configure
19
+
20
+ After installing, this package can be added to your engine's configuration as follows:
21
+ ```text
22
+ {
23
+ "@context": [
24
+ ...
25
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-source-identify-rdfjs/^1.0.0/components/context.jsonld"
26
+ ],
27
+ "actors": [
28
+ ...
29
+ {
30
+ "@id": "urn:comunica:default:query-source-identify/actors#rdfjs",
31
+ "@type": "ActorQuerySourceIdentifyRdfJs",
32
+ "mediatorMergeBindingsContext": { "@id": "urn:comunica:default:merge-bindings-context/mediators#main" }
33
+ }
34
+ ]
35
+ }
36
+ ```
37
+
38
+ ### Config Parameters
39
+
40
+ * `mediatorMergeBindingsContext`: A mediator over the [Merge Bindings Context bus](https://github.com/comunica/comunica/tree/master/packages/bus-merge-bindings-context).
@@ -0,0 +1,174 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-source-identify-rdfjs/^3.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^3.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-source-identify/^3.0.0/components/context.jsonld"
6
+ ],
7
+ "@id": "npmd:@comunica/actor-query-source-identify-rdfjs",
8
+ "components": [
9
+ {
10
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs",
11
+ "@type": "Class",
12
+ "requireElement": "ActorQuerySourceIdentifyRdfJs",
13
+ "extends": [
14
+ "cbqsi:components/ActorQuerySourceIdentify.jsonld#ActorQuerySourceIdentify"
15
+ ],
16
+ "comment": "A comunica RDFJS Query Source Identify Actor.",
17
+ "parameters": [
18
+ {
19
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_mediatorMergeBindingsContext",
20
+ "range": "cc:components/Mediator.jsonld#Mediator",
21
+ "comment": "A mediator for creating binding context merge handlers"
22
+ },
23
+ {
24
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_name",
25
+ "range": "xsd:string",
26
+ "default": {
27
+ "@id": "rdf:subject"
28
+ },
29
+ "comment": "The name for this actor."
30
+ },
31
+ {
32
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_bus",
33
+ "range": {
34
+ "@type": "ParameterRangeGenericComponent",
35
+ "component": "cc:components/Bus.jsonld#Bus",
36
+ "genericTypeInstances": [
37
+ {
38
+ "@type": "ParameterRangeGenericComponent",
39
+ "component": "cc:components/Actor.jsonld#Actor",
40
+ "genericTypeInstances": [
41
+ {
42
+ "@type": "ParameterRangeGenericTypeReference",
43
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
44
+ },
45
+ {
46
+ "@type": "ParameterRangeGenericTypeReference",
47
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
48
+ },
49
+ {
50
+ "@type": "ParameterRangeGenericTypeReference",
51
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ "@type": "ParameterRangeGenericTypeReference",
57
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
58
+ },
59
+ {
60
+ "@type": "ParameterRangeGenericTypeReference",
61
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
62
+ },
63
+ {
64
+ "@type": "ParameterRangeGenericTypeReference",
65
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
66
+ }
67
+ ]
68
+ },
69
+ "default": {
70
+ "@id": "cbqsi:components/ActorQuerySourceIdentify.jsonld#ActorQuerySourceIdentify_default_bus",
71
+ "@type": "cc:components/Bus.jsonld#Bus"
72
+ },
73
+ "comment": "The bus this actor subscribes to."
74
+ },
75
+ {
76
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_beforeActors",
77
+ "range": {
78
+ "@type": "ParameterRangeUnion",
79
+ "parameterRangeElements": [
80
+ {
81
+ "@type": "ParameterRangeArray",
82
+ "parameterRangeValue": {
83
+ "@type": "ParameterRangeGenericComponent",
84
+ "component": "cc:components/Actor.jsonld#Actor",
85
+ "genericTypeInstances": [
86
+ {
87
+ "@type": "ParameterRangeGenericTypeReference",
88
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
89
+ },
90
+ {
91
+ "@type": "ParameterRangeGenericTypeReference",
92
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
93
+ },
94
+ {
95
+ "@type": "ParameterRangeGenericTypeReference",
96
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
97
+ }
98
+ ]
99
+ }
100
+ },
101
+ {
102
+ "@type": "ParameterRangeUndefined"
103
+ }
104
+ ]
105
+ },
106
+ "comment": "Actor that must be registered in the bus before this actor."
107
+ }
108
+ ],
109
+ "memberFields": [
110
+ {
111
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs__member_mediatorMergeBindingsContext",
112
+ "memberFieldName": "mediatorMergeBindingsContext",
113
+ "range": "cc:components/Mediator.jsonld#Mediator"
114
+ },
115
+ {
116
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs__member_constructor",
117
+ "memberFieldName": "constructor"
118
+ },
119
+ {
120
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs__member_test",
121
+ "memberFieldName": "test"
122
+ },
123
+ {
124
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs__member_run",
125
+ "memberFieldName": "run"
126
+ }
127
+ ],
128
+ "constructorArguments": [
129
+ {
130
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args__constructorArgument",
131
+ "fields": [
132
+ {
133
+ "keyRaw": "mediatorMergeBindingsContext",
134
+ "value": {
135
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_mediatorMergeBindingsContext"
136
+ }
137
+ },
138
+ {
139
+ "keyRaw": "name",
140
+ "value": {
141
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_name"
142
+ }
143
+ },
144
+ {
145
+ "keyRaw": "bus",
146
+ "value": {
147
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_bus"
148
+ }
149
+ },
150
+ {
151
+ "keyRaw": "beforeActors",
152
+ "value": {
153
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_beforeActors"
154
+ }
155
+ }
156
+ ]
157
+ }
158
+ ]
159
+ },
160
+ {
161
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#IActorQuerySourceIdentifyRdfJsArgs",
162
+ "@type": "AbstractClass",
163
+ "requireElement": "IActorQuerySourceIdentifyRdfJsArgs",
164
+ "parameters": [],
165
+ "memberFields": [
166
+ {
167
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#IActorQuerySourceIdentifyRdfJsArgs__member_mediatorMergeBindingsContext",
168
+ "memberFieldName": "mediatorMergeBindingsContext"
169
+ }
170
+ ],
171
+ "constructorArguments": []
172
+ }
173
+ ]
174
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-source-identify-rdfjs/^3.0.0/components/context.jsonld"
4
+ ],
5
+ "@id": "npmd:@comunica/actor-query-source-identify-rdfjs",
6
+ "components": [
7
+ {
8
+ "@id": "caqsir:components/IRdfJsSourceExtended.jsonld#IRdfJsSourceExtended",
9
+ "@type": "AbstractClass",
10
+ "requireElement": "IRdfJsSourceExtended",
11
+ "parameters": [],
12
+ "memberFields": [
13
+ {
14
+ "@id": "caqsir:components/IRdfJsSourceExtended.jsonld#IRdfJsSourceExtended__member_features",
15
+ "memberFieldName": "features"
16
+ },
17
+ {
18
+ "@id": "caqsir:components/IRdfJsSourceExtended.jsonld#IRdfJsSourceExtended__member_countQuads",
19
+ "memberFieldName": "countQuads"
20
+ }
21
+ ],
22
+ "constructorArguments": []
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-source-identify-rdfjs/^3.0.0/components/context.jsonld"
4
+ ],
5
+ "@id": "npmd:@comunica/actor-query-source-identify-rdfjs",
6
+ "components": [
7
+ {
8
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs",
9
+ "@type": "Class",
10
+ "requireElement": "QuerySourceRdfJs",
11
+ "parameters": [
12
+ {
13
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs_source",
14
+ "range": "urn:npm:@rdfjs/types:Source"
15
+ },
16
+ {
17
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs_bindingsFactory",
18
+ "range": "urn:npm:@comunica/bindings-factory:BindingsFactory"
19
+ }
20
+ ],
21
+ "memberFields": [
22
+ {
23
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_SELECTOR_SHAPE",
24
+ "memberFieldName": "SELECTOR_SHAPE",
25
+ "range": {
26
+ "@type": "ParameterRangeWildcard"
27
+ }
28
+ },
29
+ {
30
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_referenceValue",
31
+ "memberFieldName": "referenceValue",
32
+ "range": {
33
+ "@type": "ParameterRangeUnion",
34
+ "parameterRangeElements": [
35
+ "xsd:string",
36
+ "urn:npm:@rdfjs/types:Source"
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_source",
42
+ "memberFieldName": "source",
43
+ "range": "caqsir:components/IRdfJsSourceExtended.jsonld#IRdfJsSourceExtended"
44
+ },
45
+ {
46
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_bindingsFactory",
47
+ "memberFieldName": "bindingsFactory"
48
+ },
49
+ {
50
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_constructor",
51
+ "memberFieldName": "constructor"
52
+ },
53
+ {
54
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_nullifyVariables",
55
+ "memberFieldName": "nullifyVariables"
56
+ },
57
+ {
58
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_hasDuplicateVariables",
59
+ "memberFieldName": "hasDuplicateVariables"
60
+ },
61
+ {
62
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_getSelectorShape",
63
+ "memberFieldName": "getSelectorShape"
64
+ },
65
+ {
66
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_queryBindings",
67
+ "memberFieldName": "queryBindings"
68
+ },
69
+ {
70
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_setMetadata",
71
+ "memberFieldName": "setMetadata"
72
+ },
73
+ {
74
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_queryQuads",
75
+ "memberFieldName": "queryQuads"
76
+ },
77
+ {
78
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_queryBoolean",
79
+ "memberFieldName": "queryBoolean"
80
+ },
81
+ {
82
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_queryVoid",
83
+ "memberFieldName": "queryVoid"
84
+ },
85
+ {
86
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs__member_toString",
87
+ "memberFieldName": "toString"
88
+ }
89
+ ],
90
+ "constructorArguments": [
91
+ {
92
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs_source"
93
+ },
94
+ {
95
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs_bindingsFactory"
96
+ }
97
+ ]
98
+ }
99
+ ]
100
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-source-identify-rdfjs/^3.0.0/components/context.jsonld"
4
+ ],
5
+ "@id": "npmd:@comunica/actor-query-source-identify-rdfjs",
6
+ "@type": "Module",
7
+ "requireName": "@comunica/actor-query-source-identify-rdfjs",
8
+ "import": [
9
+ "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld",
10
+ "caqsir:components/IRdfJsSourceExtended.jsonld",
11
+ "caqsir:components/QuerySourceRdfJs.jsonld"
12
+ ]
13
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^5.0.0/components/context.jsonld",
4
+ {
5
+ "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
+ "caqsir": "npmd:@comunica/actor-query-source-identify-rdfjs/^3.0.0/",
7
+ "ActorQuerySourceIdentifyRdfJs": {
8
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs",
9
+ "@prefix": true,
10
+ "@context": {
11
+ "args_mediatorMergeBindingsContext": {
12
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_mediatorMergeBindingsContext"
13
+ },
14
+ "args_name": {
15
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_name"
16
+ },
17
+ "args_bus": {
18
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_bus"
19
+ },
20
+ "args_beforeActors": {
21
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_beforeActors",
22
+ "@container": "@list"
23
+ },
24
+ "mediatorMergeBindingsContext": {
25
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_mediatorMergeBindingsContext"
26
+ },
27
+ "name": {
28
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_name"
29
+ },
30
+ "bus": {
31
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_bus"
32
+ },
33
+ "beforeActors": {
34
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#ActorQuerySourceIdentifyRdfJs_args_beforeActors",
35
+ "@container": "@list"
36
+ }
37
+ }
38
+ },
39
+ "IActorQuerySourceIdentifyRdfJsArgs": {
40
+ "@id": "caqsir:components/ActorQuerySourceIdentifyRdfJs.jsonld#IActorQuerySourceIdentifyRdfJsArgs",
41
+ "@prefix": true,
42
+ "@context": {}
43
+ },
44
+ "IRdfJsSourceExtended": {
45
+ "@id": "caqsir:components/IRdfJsSourceExtended.jsonld#IRdfJsSourceExtended",
46
+ "@prefix": true,
47
+ "@context": {}
48
+ },
49
+ "QuerySourceRdfJs": {
50
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs",
51
+ "@prefix": true,
52
+ "@context": {
53
+ "source": {
54
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs_source"
55
+ },
56
+ "bindingsFactory": {
57
+ "@id": "caqsir:components/QuerySourceRdfJs.jsonld#QuerySourceRdfJs_bindingsFactory"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ ]
63
+ }
@@ -0,0 +1,19 @@
1
+ import type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';
2
+ import type { IActionQuerySourceIdentify, IActorQuerySourceIdentifyOutput, IActorQuerySourceIdentifyArgs } from '@comunica/bus-query-source-identify';
3
+ import { ActorQuerySourceIdentify } from '@comunica/bus-query-source-identify';
4
+ import type { IActorTest } from '@comunica/core';
5
+ /**
6
+ * A comunica RDFJS Query Source Identify Actor.
7
+ */
8
+ export declare class ActorQuerySourceIdentifyRdfJs extends ActorQuerySourceIdentify {
9
+ readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;
10
+ constructor(args: IActorQuerySourceIdentifyRdfJsArgs);
11
+ test(action: IActionQuerySourceIdentify): Promise<IActorTest>;
12
+ run(action: IActionQuerySourceIdentify): Promise<IActorQuerySourceIdentifyOutput>;
13
+ }
14
+ export interface IActorQuerySourceIdentifyRdfJsArgs extends IActorQuerySourceIdentifyArgs {
15
+ /**
16
+ * A mediator for creating binding context merge handlers
17
+ */
18
+ mediatorMergeBindingsContext: MediatorMergeBindingsContext;
19
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActorQuerySourceIdentifyRdfJs = void 0;
4
+ const bindings_factory_1 = require("@comunica/bindings-factory");
5
+ const bus_query_source_identify_1 = require("@comunica/bus-query-source-identify");
6
+ const core_1 = require("@comunica/core");
7
+ const QuerySourceRdfJs_1 = require("./QuerySourceRdfJs");
8
+ /**
9
+ * A comunica RDFJS Query Source Identify Actor.
10
+ */
11
+ class ActorQuerySourceIdentifyRdfJs extends bus_query_source_identify_1.ActorQuerySourceIdentify {
12
+ constructor(args) {
13
+ super(args);
14
+ }
15
+ async test(action) {
16
+ const source = action.querySourceUnidentified;
17
+ if (source.type !== undefined && source.type !== 'rdfjs') {
18
+ throw new Error(`${this.name} requires a single query source with rdfjs type to be present in the context.`);
19
+ }
20
+ if (typeof source.value === 'string' || !('match' in source.value)) {
21
+ throw new Error(`${this.name} received an invalid rdfjs query source.`);
22
+ }
23
+ return true;
24
+ }
25
+ async run(action) {
26
+ return {
27
+ querySource: {
28
+ source: new QuerySourceRdfJs_1.QuerySourceRdfJs(action.querySourceUnidentified.value, await bindings_factory_1.BindingsFactory.create(this.mediatorMergeBindingsContext, action.context)),
29
+ context: action.querySourceUnidentified.context || new core_1.ActionContext(),
30
+ },
31
+ };
32
+ }
33
+ }
34
+ exports.ActorQuerySourceIdentifyRdfJs = ActorQuerySourceIdentifyRdfJs;
35
+ //# sourceMappingURL=ActorQuerySourceIdentifyRdfJs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActorQuerySourceIdentifyRdfJs.js","sourceRoot":"","sources":["ActorQuerySourceIdentifyRdfJs.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAI7D,mFAA+E;AAE/E,yCAA+C;AAE/C,yDAAsD;AAEtD;;GAEG;AACH,MAAa,6BAA8B,SAAQ,oDAAwB;IAGzE,YAAmB,IAAwC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAAkC;QAClD,MAAM,MAAM,GAAG,MAAM,CAAC,uBAAuB,CAAC;QAC9C,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;YACxD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,+EAA+E,CAAC,CAAC;SAC9G;QACD,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;YAClE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,0CAA0C,CAAC,CAAC;SACzE;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAAkC;QACjD,OAAO;YACL,WAAW,EAAE;gBACX,MAAM,EAAE,IAAI,mCAAgB,CACb,MAAM,CAAC,uBAAuB,CAAC,KAAK,EACjD,MAAM,kCAAe,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,MAAM,CAAC,OAAO,CAAC,CAChF;gBACD,OAAO,EAAE,MAAM,CAAC,uBAAuB,CAAC,OAAO,IAAI,IAAI,oBAAa,EAAE;aACvE;SACF,CAAC;IACJ,CAAC;CACF;AA7BD,sEA6BC","sourcesContent":["import { BindingsFactory } from '@comunica/bindings-factory';\nimport type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';\nimport type { IActionQuerySourceIdentify, IActorQuerySourceIdentifyOutput,\n IActorQuerySourceIdentifyArgs } from '@comunica/bus-query-source-identify';\nimport { ActorQuerySourceIdentify } from '@comunica/bus-query-source-identify';\nimport type { IActorTest } from '@comunica/core';\nimport { ActionContext } from '@comunica/core';\nimport type * as RDF from '@rdfjs/types';\nimport { QuerySourceRdfJs } from './QuerySourceRdfJs';\n\n/**\n * A comunica RDFJS Query Source Identify Actor.\n */\nexport class ActorQuerySourceIdentifyRdfJs extends ActorQuerySourceIdentify {\n public readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n\n public constructor(args: IActorQuerySourceIdentifyRdfJsArgs) {\n super(args);\n }\n\n public async test(action: IActionQuerySourceIdentify): Promise<IActorTest> {\n const source = action.querySourceUnidentified;\n if (source.type !== undefined && source.type !== 'rdfjs') {\n throw new Error(`${this.name} requires a single query source with rdfjs type to be present in the context.`);\n }\n if (typeof source.value === 'string' || !('match' in source.value)) {\n throw new Error(`${this.name} received an invalid rdfjs query source.`);\n }\n return true;\n }\n\n public async run(action: IActionQuerySourceIdentify): Promise<IActorQuerySourceIdentifyOutput> {\n return {\n querySource: {\n source: new QuerySourceRdfJs(\n <RDF.Source> action.querySourceUnidentified.value,\n await BindingsFactory.create(this.mediatorMergeBindingsContext, action.context),\n ),\n context: action.querySourceUnidentified.context || new ActionContext(),\n },\n };\n }\n}\n\nexport interface IActorQuerySourceIdentifyRdfJsArgs extends IActorQuerySourceIdentifyArgs {\n /**\n * A mediator for creating binding context merge handlers\n */\n mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type * as RDF from '@rdfjs/types';
2
+ export interface IRdfJsSourceExtended extends RDF.Source {
3
+ /**
4
+ * A record indicating supported features of this source.
5
+ */
6
+ features?: {
7
+ /**
8
+ * If true, this source supports passing quad patterns with quoted quad patterns in the `match` method.
9
+ * If false (or if `features` is `undefined`), such quoted quad patterns can not be passed,
10
+ * and must be replaced by `undefined` and filtered by the caller afterwards.
11
+ */
12
+ quotedTripleFiltering?: boolean;
13
+ };
14
+ /**
15
+ * Return an estimated count of the number of quads matching the given pattern.
16
+ *
17
+ * The better the estimate, the better the query engine will be able to optimize the query.
18
+ *
19
+ * @param subject An optional subject.
20
+ * @param predicate An optional predicate.
21
+ * @param object An optional object.
22
+ * @param graph An optional graph.
23
+ */
24
+ countQuads?: (subject?: RDF.Term, predicate?: RDF.Term, object?: RDF.Term, graph?: RDF.Term) => Promise<number> | number;
25
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IRdfJsSourceExtended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRdfJsSourceExtended.js","sourceRoot":"","sources":["IRdfJsSourceExtended.ts"],"names":[],"mappings":"","sourcesContent":["import type * as RDF from '@rdfjs/types';\n\nexport interface IRdfJsSourceExtended extends RDF.Source {\n /**\n * A record indicating supported features of this source.\n */\n features?: {\n /**\n * If true, this source supports passing quad patterns with quoted quad patterns in the `match` method.\n * If false (or if `features` is `undefined`), such quoted quad patterns can not be passed,\n * and must be replaced by `undefined` and filtered by the caller afterwards.\n */\n quotedTripleFiltering?: boolean;\n };\n\n /**\n * Return an estimated count of the number of quads matching the given pattern.\n *\n * The better the estimate, the better the query engine will be able to optimize the query.\n *\n * @param subject An optional subject.\n * @param predicate An optional predicate.\n * @param object An optional object.\n * @param graph An optional graph.\n */\n countQuads?: (\n subject?: RDF.Term,\n predicate?: RDF.Term,\n object?: RDF.Term,\n graph?: RDF.Term,\n ) => Promise<number> | number;\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { BindingsFactory } from '@comunica/bindings-factory';
2
+ import type { IQuerySource, BindingsStream, IActionContext, FragmentSelectorShape } from '@comunica/types';
3
+ import type * as RDF from '@rdfjs/types';
4
+ import { AsyncIterator } from 'asynciterator';
5
+ import type { Algebra } from 'sparqlalgebrajs';
6
+ import type { IRdfJsSourceExtended } from './IRdfJsSourceExtended';
7
+ export declare class QuerySourceRdfJs implements IQuerySource {
8
+ protected static readonly SELECTOR_SHAPE: FragmentSelectorShape;
9
+ referenceValue: string | RDF.Source;
10
+ protected readonly source: IRdfJsSourceExtended;
11
+ private readonly bindingsFactory;
12
+ constructor(source: RDF.Source, bindingsFactory: BindingsFactory);
13
+ static nullifyVariables(term: RDF.Term | undefined, quotedTripleFiltering: boolean): RDF.Term | undefined;
14
+ static hasDuplicateVariables(pattern: RDF.BaseQuad): boolean;
15
+ getSelectorShape(): Promise<FragmentSelectorShape>;
16
+ queryBindings(operation: Algebra.Operation, context: IActionContext): BindingsStream;
17
+ protected setMetadata(it: AsyncIterator<RDF.Quad>, operation: Algebra.Pattern): Promise<void>;
18
+ queryQuads(operation: Algebra.Construct, context: IActionContext): AsyncIterator<RDF.Quad>;
19
+ queryBoolean(operation: Algebra.Ask, context: IActionContext): Promise<boolean>;
20
+ queryVoid(operation: Algebra.Update, context: IActionContext): Promise<void>;
21
+ toString(): string;
22
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuerySourceRdfJs = void 0;
4
+ const bus_query_source_identify_1 = require("@comunica/bus-query-source-identify");
5
+ const context_entries_1 = require("@comunica/context-entries");
6
+ const metadata_1 = require("@comunica/metadata");
7
+ const asynciterator_1 = require("asynciterator");
8
+ const rdf_data_factory_1 = require("rdf-data-factory");
9
+ const rdf_terms_1 = require("rdf-terms");
10
+ const sparqlalgebrajs_1 = require("sparqlalgebrajs");
11
+ const AF = new sparqlalgebrajs_1.Factory();
12
+ const DF = new rdf_data_factory_1.DataFactory();
13
+ class QuerySourceRdfJs {
14
+ constructor(source, bindingsFactory) {
15
+ this.source = source;
16
+ this.referenceValue = source;
17
+ this.bindingsFactory = bindingsFactory;
18
+ }
19
+ static nullifyVariables(term, quotedTripleFiltering) {
20
+ return !term || term.termType === 'Variable' || (!quotedTripleFiltering &&
21
+ term.termType === 'Quad' && (0, rdf_terms_1.someTermsNested)(term, value => value.termType === 'Variable')) ?
22
+ undefined :
23
+ term;
24
+ }
25
+ static hasDuplicateVariables(pattern) {
26
+ const variables = (0, rdf_terms_1.filterTermsNested)(pattern, term => term.termType === 'Variable');
27
+ return variables.length > 1 && (0, rdf_terms_1.uniqTerms)(variables).length < variables.length;
28
+ }
29
+ async getSelectorShape() {
30
+ return QuerySourceRdfJs.SELECTOR_SHAPE;
31
+ }
32
+ queryBindings(operation, context) {
33
+ if (operation.type !== 'pattern') {
34
+ throw new Error(`Attempted to pass non-pattern operation '${operation.type}' to QuerySourceRdfJs`);
35
+ }
36
+ // Check if the source supports quoted triple filtering
37
+ const quotedTripleFiltering = Boolean(this.source.features?.quotedTripleFiltering);
38
+ // Create an async iterator from the matched quad stream
39
+ const rawStream = this.source.match(QuerySourceRdfJs.nullifyVariables(operation.subject, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.predicate, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.object, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.graph, quotedTripleFiltering));
40
+ let it = rawStream instanceof asynciterator_1.AsyncIterator ?
41
+ rawStream :
42
+ (0, asynciterator_1.wrap)(rawStream, { autoStart: false });
43
+ // Perform post-match-filtering if the source does not support quoted triple filtering.
44
+ if (!quotedTripleFiltering) {
45
+ it = (0, bus_query_source_identify_1.filterMatchingQuotedQuads)(operation, it);
46
+ }
47
+ // Determine metadata
48
+ if (!it.getProperty('metadata')) {
49
+ this.setMetadata(it, operation)
50
+ .catch(error => it.destroy(error));
51
+ }
52
+ return (0, bus_query_source_identify_1.quadsToBindings)(it, operation, this.bindingsFactory, Boolean(context.get(context_entries_1.KeysQueryOperation.unionDefaultGraph)));
53
+ }
54
+ async setMetadata(it, operation) {
55
+ // Check if the source supports quoted triple filtering
56
+ const quotedTripleFiltering = Boolean(this.source.features?.quotedTripleFiltering);
57
+ let cardinality;
58
+ if (this.source.countQuads) {
59
+ // If the source provides a dedicated method for determining cardinality, use that.
60
+ cardinality = await this.source.countQuads(QuerySourceRdfJs.nullifyVariables(operation.subject, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.predicate, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.object, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.graph, quotedTripleFiltering));
61
+ }
62
+ else {
63
+ // Otherwise, fallback to a sub-optimal alternative where we just call match again to count the quads.
64
+ // WARNING: we can NOT reuse the original data stream here,
65
+ // because we may lose data elements due to things happening async.
66
+ let i = 0;
67
+ cardinality = await new Promise((resolve, reject) => {
68
+ const matches = this.source.match(QuerySourceRdfJs.nullifyVariables(operation.subject, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.predicate, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.object, quotedTripleFiltering), QuerySourceRdfJs.nullifyVariables(operation.graph, quotedTripleFiltering));
69
+ matches.on('error', reject);
70
+ matches.on('end', () => resolve(i));
71
+ matches.on('data', () => i++);
72
+ });
73
+ }
74
+ // If `match` would require filtering afterwards, our count will be an over-estimate.
75
+ const wouldRequirePostFiltering = (!quotedTripleFiltering &&
76
+ (0, rdf_terms_1.someTerms)(operation, term => term.termType === 'Quad')) ||
77
+ QuerySourceRdfJs.hasDuplicateVariables(operation);
78
+ it.setProperty('metadata', {
79
+ state: new metadata_1.MetadataValidationState(),
80
+ cardinality: { type: wouldRequirePostFiltering ? 'estimate' : 'exact', value: cardinality },
81
+ canContainUndefs: false,
82
+ });
83
+ }
84
+ queryQuads(operation, context) {
85
+ throw new Error('queryQuads is not implemented in QuerySourceQpf');
86
+ }
87
+ queryBoolean(operation, context) {
88
+ throw new Error('queryBoolean is not implemented in QuerySourceQpf');
89
+ }
90
+ queryVoid(operation, context) {
91
+ throw new Error('queryVoid is not implemented in QuerySourceQpf');
92
+ }
93
+ toString() {
94
+ return `QuerySourceRdfJs(${this.source.constructor.name})`;
95
+ }
96
+ }
97
+ exports.QuerySourceRdfJs = QuerySourceRdfJs;
98
+ QuerySourceRdfJs.SELECTOR_SHAPE = {
99
+ type: 'operation',
100
+ operation: {
101
+ operationType: 'pattern',
102
+ pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')),
103
+ },
104
+ variablesOptional: [
105
+ DF.variable('s'),
106
+ DF.variable('p'),
107
+ DF.variable('o'),
108
+ ],
109
+ };
110
+ //# sourceMappingURL=QuerySourceRdfJs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuerySourceRdfJs.js","sourceRoot":"","sources":["QuerySourceRdfJs.ts"],"names":[],"mappings":";;;AACA,mFAAiG;AACjG,+DAA+D;AAC/D,iDAA6D;AAG7D,iDAAyE;AACzE,uDAA+C;AAC/C,yCAAqF;AAErF,qDAA0C;AAG1C,MAAM,EAAE,GAAG,IAAI,yBAAO,EAAE,CAAC;AACzB,MAAM,EAAE,GAAG,IAAI,8BAAW,EAAgB,CAAC;AAE3C,MAAa,gBAAgB;IAkB3B,YAAmB,MAAkB,EAAE,eAAgC;QACrE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,IAA0B,EAAE,qBAA8B;QACvF,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU,IAAI,CAAC,CAAC,qBAAqB;YACrE,IAAI,CAAC,QAAQ,KAAK,MAAM,IAAI,IAAA,2BAAe,EAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;YAC5F,SAAS,CAAC,CAAC;YACX,IAAI,CAAC;IACT,CAAC;IAEM,MAAM,CAAC,qBAAqB,CAAC,OAAqB;QACvD,MAAM,SAAS,GAAG,IAAA,6BAAiB,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,IA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CAAC;IAEM,SAAS,CAAC,SAAyB,EAAE,OAAuB;QACjE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAEM,QAAQ;QACb,OAAO,oBAAoB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC;IAC7D,CAAC;;AA1IH,4CA2IC;AA1I2B,+BAAc,GAA0B;IAChE,IAAI,EAAE,WAAW;IACjB,SAAS,EAAE;QACT,aAAa,EAAE,SAAS;QACxB,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;KAChF;IACD,iBAAiB,EAAE;QACjB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;QAChB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;QAChB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;KACjB;CACF,CAAC","sourcesContent":["import type { BindingsFactory } from '@comunica/bindings-factory';\nimport { filterMatchingQuotedQuads, quadsToBindings } from '@comunica/bus-query-source-identify';\nimport { KeysQueryOperation } from '@comunica/context-entries';\nimport { MetadataValidationState } from '@comunica/metadata';\nimport type { IQuerySource, BindingsStream, IActionContext, FragmentSelectorShape } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport { AsyncIterator, wrap as wrapAsyncIterator } from 'asynciterator';\nimport { DataFactory } from 'rdf-data-factory';\nimport { someTermsNested, filterTermsNested, someTerms, uniqTerms } from 'rdf-terms';\nimport type { Algebra } from 'sparqlalgebrajs';\nimport { Factory } from 'sparqlalgebrajs';\nimport type { IRdfJsSourceExtended } from './IRdfJsSourceExtended';\n\nconst AF = new Factory();\nconst DF = new DataFactory<RDF.BaseQuad>();\n\nexport class QuerySourceRdfJs implements IQuerySource {\n protected static readonly SELECTOR_SHAPE: FragmentSelectorShape = {\n type: 'operation',\n operation: {\n operationType: 'pattern',\n pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')),\n },\n variablesOptional: [\n DF.variable('s'),\n DF.variable('p'),\n DF.variable('o'),\n ],\n };\n\n public referenceValue: string | RDF.Source;\n protected readonly source: IRdfJsSourceExtended;\n private readonly bindingsFactory: BindingsFactory;\n\n public constructor(source: RDF.Source, bindingsFactory: BindingsFactory) {\n this.source = source;\n this.referenceValue = source;\n this.bindingsFactory = bindingsFactory;\n }\n\n public static nullifyVariables(term: RDF.Term | undefined, quotedTripleFiltering: boolean): RDF.Term | undefined {\n return !term || term.termType === 'Variable' || (!quotedTripleFiltering &&\n term.termType === 'Quad' && someTermsNested(term, value => value.termType === 'Variable')) ?\n undefined :\n term;\n }\n\n public static hasDuplicateVariables(pattern: RDF.BaseQuad): boolean {\n const variables = filterTermsNested(pattern, term => term.termType === 'Variable');\n return variables.length > 1 && uniqTerms(variables).length < variables.length;\n }\n\n public async getSelectorShape(): Promise<FragmentSelectorShape> {\n return QuerySourceRdfJs.SELECTOR_SHAPE;\n }\n\n public queryBindings(operation: Algebra.Operation, context: IActionContext): BindingsStream {\n if (operation.type !== 'pattern') {\n throw new Error(`Attempted to pass non-pattern operation '${operation.type}' to QuerySourceRdfJs`);\n }\n\n // Check if the source supports quoted triple filtering\n const quotedTripleFiltering = Boolean(this.source.features?.quotedTripleFiltering);\n\n // Create an async iterator from the matched quad stream\n const rawStream = this.source.match(\n QuerySourceRdfJs.nullifyVariables(operation.subject, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.predicate, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.object, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.graph, quotedTripleFiltering),\n );\n let it: AsyncIterator<RDF.Quad> = rawStream instanceof AsyncIterator ?\n rawStream :\n wrapAsyncIterator<RDF.Quad>(rawStream, { autoStart: false });\n\n // Perform post-match-filtering if the source does not support quoted triple filtering.\n if (!quotedTripleFiltering) {\n it = filterMatchingQuotedQuads(operation, it);\n }\n\n // Determine metadata\n if (!it.getProperty('metadata')) {\n this.setMetadata(it, operation)\n .catch(error => it.destroy(error));\n }\n\n return quadsToBindings(\n it,\n operation,\n this.bindingsFactory,\n Boolean(context.get(KeysQueryOperation.unionDefaultGraph)),\n );\n }\n\n protected async setMetadata(\n it: AsyncIterator<RDF.Quad>,\n operation: Algebra.Pattern,\n ): Promise<void> {\n // Check if the source supports quoted triple filtering\n const quotedTripleFiltering = Boolean(this.source.features?.quotedTripleFiltering);\n\n let cardinality: number;\n if (this.source.countQuads) {\n // If the source provides a dedicated method for determining cardinality, use that.\n cardinality = await this.source.countQuads(\n QuerySourceRdfJs.nullifyVariables(operation.subject, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.predicate, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.object, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.graph, quotedTripleFiltering),\n );\n } else {\n // Otherwise, fallback to a sub-optimal alternative where we just call match again to count the quads.\n // WARNING: we can NOT reuse the original data stream here,\n // because we may lose data elements due to things happening async.\n let i = 0;\n cardinality = await new Promise((resolve, reject) => {\n const matches = this.source.match(\n QuerySourceRdfJs.nullifyVariables(operation.subject, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.predicate, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.object, quotedTripleFiltering),\n QuerySourceRdfJs.nullifyVariables(operation.graph, quotedTripleFiltering),\n );\n matches.on('error', reject);\n matches.on('end', () => resolve(i));\n matches.on('data', () => i++);\n });\n }\n\n // If `match` would require filtering afterwards, our count will be an over-estimate.\n const wouldRequirePostFiltering = (!quotedTripleFiltering &&\n someTerms(operation, term => term.termType === 'Quad')) ||\n QuerySourceRdfJs.hasDuplicateVariables(operation);\n\n it.setProperty('metadata', {\n state: new MetadataValidationState(),\n cardinality: { type: wouldRequirePostFiltering ? 'estimate' : 'exact', value: cardinality },\n canContainUndefs: false,\n });\n }\n\n public queryQuads(operation: Algebra.Construct, context: IActionContext): AsyncIterator<RDF.Quad> {\n throw new Error('queryQuads is not implemented in QuerySourceQpf');\n }\n\n public queryBoolean(operation: Algebra.Ask, context: IActionContext): Promise<boolean> {\n throw new Error('queryBoolean is not implemented in QuerySourceQpf');\n }\n\n public queryVoid(operation: Algebra.Update, context: IActionContext): Promise<void> {\n throw new Error('queryVoid is not implemented in QuerySourceQpf');\n }\n\n public toString(): string {\n return `QuerySourceRdfJs(${this.source.constructor.name})`;\n }\n}\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './ActorQuerySourceIdentifyRdfJs';
2
+ export * from './IRdfJsSourceExtended';
3
+ export * from './QuerySourceRdfJs';
package/lib/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ActorQuerySourceIdentifyRdfJs"), exports);
18
+ __exportStar(require("./IRdfJsSourceExtended"), exports);
19
+ __exportStar(require("./QuerySourceRdfJs"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD;AAChD,yDAAuC;AACvC,qDAAmC","sourcesContent":["export * from './ActorQuerySourceIdentifyRdfJs';\nexport * from './IRdfJsSourceExtended';\nexport * from './QuerySourceRdfJs';\n"]}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@comunica/actor-query-source-identify-rdfjs",
3
+ "version": "3.0.1-alpha.43.0",
4
+ "description": "A rdfjs query-source-identify actor",
5
+ "lsd:module": true,
6
+ "main": "lib/index.js",
7
+ "typings": "lib/index",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/comunica/comunica.git",
11
+ "directory": "packages/actor-query-source-identify-rdfjs"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "sideEffects": false,
17
+ "keywords": [
18
+ "comunica",
19
+ "actor",
20
+ "query-source-identify",
21
+ "rdfjs"
22
+ ],
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/comunica/comunica/issues"
26
+ },
27
+ "homepage": "https://comunica.dev/",
28
+ "files": [
29
+ "components",
30
+ "lib/**/*.d.ts",
31
+ "lib/**/*.js",
32
+ "lib/**/*.js.map"
33
+ ],
34
+ "dependencies": {
35
+ "@comunica/bindings-factory": "3.0.1-alpha.43.0",
36
+ "@comunica/bus-merge-bindings-context": "3.0.1-alpha.43.0",
37
+ "@comunica/bus-query-source-identify": "3.0.1-alpha.43.0",
38
+ "@comunica/context-entries": "3.0.1-alpha.43.0",
39
+ "@comunica/core": "3.0.1-alpha.43.0",
40
+ "@comunica/metadata": "3.0.1-alpha.43.0",
41
+ "@comunica/types": "3.0.1-alpha.43.0",
42
+ "@rdfjs/types": "*",
43
+ "asynciterator": "^3.8.1",
44
+ "rdf-data-factory": "^1.1.1",
45
+ "rdf-terms": "^1.11.0",
46
+ "sparqlalgebrajs": "^4.3.3"
47
+ },
48
+ "scripts": {
49
+ "build": "npm run build:ts && npm run build:components",
50
+ "build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
51
+ "build:components": "componentsjs-generator"
52
+ },
53
+ "gitHead": "d11e44cf07d4699f9d2c51d5851b5ed443de1997"
54
+ }