@comunica/actor-query-operation-project 1.21.1 → 2.0.1-alpha.6.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 CHANGED
@@ -22,14 +22,14 @@ After installing, this package can be added to your engine's configuration as fo
22
22
  {
23
23
  "@context": [
24
24
  ...
25
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-project/^1.0.0/components/context.jsonld"
25
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-project/^2.0.0/components/context.jsonld"
26
26
  ],
27
27
  "actors": [
28
28
  ...
29
29
  {
30
- "@id": "config-sets:sparql-queryoperators.json#myProjectQueryOperator",
30
+ "@id": "urn:comunica:default:query-operation/actors#project",
31
31
  "@type": "ActorQueryOperationProject",
32
- "cbqo:mediatorQueryOperation": { "@id": "config-sets:sparql-queryoperators.json#mediatorQueryOperation" }
32
+ "mediatorQueryOperation": { "@id": "urn:comunica:default:query-operation/mediators#main" }
33
33
  }
34
34
  ]
35
35
  }
@@ -37,4 +37,4 @@ After installing, this package can be added to your engine's configuration as fo
37
37
 
38
38
  ### Config Parameters
39
39
 
40
- * `cbqo:mediatorQueryOperation`: A mediator over the [Query Operation bus](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation).
40
+ * `mediatorQueryOperation`: A mediator over the [Query Operation bus](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation).
@@ -0,0 +1,152 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-project/^2.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^2.0.0/components/context.jsonld"
6
+ ],
7
+ "@id": "npmd:@comunica/actor-query-operation-project",
8
+ "components": [
9
+ {
10
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject",
11
+ "@type": "Class",
12
+ "requireElement": "ActorQueryOperationProject",
13
+ "extends": [
14
+ {
15
+ "@type": "GenericComponentExtension",
16
+ "component": "cbqo:components/ActorQueryOperationTypedMediated.jsonld#ActorQueryOperationTypedMediated",
17
+ "genericTypeInstances": [
18
+ "urn:npm:sparqlalgebrajs:Project"
19
+ ]
20
+ }
21
+ ],
22
+ "comment": "A comunica Project Query Operation Actor.",
23
+ "parameters": [
24
+ {
25
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_mediatorQueryOperation",
26
+ "range": "cc:components/Mediator.jsonld#Mediator"
27
+ },
28
+ {
29
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_name",
30
+ "range": "xsd:string",
31
+ "default": {
32
+ "@id": "rdf:subject"
33
+ },
34
+ "comment": "The name for this actor."
35
+ },
36
+ {
37
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_bus",
38
+ "range": {
39
+ "@type": "ParameterRangeGenericComponent",
40
+ "component": "cc:components/Bus.jsonld#Bus",
41
+ "genericTypeInstances": [
42
+ {
43
+ "@type": "ParameterRangeGenericComponent",
44
+ "component": "cc:components/Actor.jsonld#Actor",
45
+ "genericTypeInstances": [
46
+ {
47
+ "@type": "ParameterRangeGenericTypeReference",
48
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
49
+ },
50
+ {
51
+ "@type": "ParameterRangeGenericTypeReference",
52
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
53
+ },
54
+ {
55
+ "@type": "ParameterRangeGenericTypeReference",
56
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "@type": "ParameterRangeGenericTypeReference",
62
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
63
+ },
64
+ {
65
+ "@type": "ParameterRangeGenericTypeReference",
66
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
67
+ },
68
+ {
69
+ "@type": "ParameterRangeGenericTypeReference",
70
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
71
+ }
72
+ ]
73
+ },
74
+ "default": {
75
+ "@id": "cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus",
76
+ "@type": "cc:components/Bus.jsonld#Bus"
77
+ },
78
+ "comment": "The bus this actor subscribes to."
79
+ },
80
+ {
81
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_beforeActors",
82
+ "range": {
83
+ "@type": "ParameterRangeUnion",
84
+ "parameterRangeElements": [
85
+ {
86
+ "@type": "ParameterRangeArray",
87
+ "parameterRangeValue": {
88
+ "@type": "ParameterRangeGenericComponent",
89
+ "component": "cc:components/Actor.jsonld#Actor",
90
+ "genericTypeInstances": [
91
+ {
92
+ "@type": "ParameterRangeGenericTypeReference",
93
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
94
+ },
95
+ {
96
+ "@type": "ParameterRangeGenericTypeReference",
97
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
98
+ },
99
+ {
100
+ "@type": "ParameterRangeGenericTypeReference",
101
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
102
+ }
103
+ ]
104
+ }
105
+ },
106
+ {
107
+ "@type": "ParameterRangeUndefined"
108
+ }
109
+ ]
110
+ },
111
+ "comment": "Actor that must be registered in the bus before this actor."
112
+ }
113
+ ],
114
+ "memberKeys": [
115
+ "constructor",
116
+ "testOperation",
117
+ "runOperation"
118
+ ],
119
+ "constructorArguments": [
120
+ {
121
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args__constructorArgument",
122
+ "fields": [
123
+ {
124
+ "keyRaw": "mediatorQueryOperation",
125
+ "value": {
126
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_mediatorQueryOperation"
127
+ }
128
+ },
129
+ {
130
+ "keyRaw": "name",
131
+ "value": {
132
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_name"
133
+ }
134
+ },
135
+ {
136
+ "keyRaw": "bus",
137
+ "value": {
138
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_bus"
139
+ }
140
+ },
141
+ {
142
+ "keyRaw": "beforeActors",
143
+ "value": {
144
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_beforeActors"
145
+ }
146
+ }
147
+ ]
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ }
@@ -1,9 +1,11 @@
1
1
  {
2
- "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-project/^1.0.0/components/context.jsonld",
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-project/^2.0.0/components/context.jsonld"
4
+ ],
3
5
  "@id": "npmd:@comunica/actor-query-operation-project",
4
6
  "@type": "Module",
5
7
  "requireName": "@comunica/actor-query-operation-project",
6
8
  "import": [
7
- "files-caqop:components/Actor/QueryOperation/Project.jsonld"
9
+ "caqop:components/ActorQueryOperationProject.jsonld"
8
10
  ]
9
- }
11
+ }
@@ -3,10 +3,39 @@
3
3
  "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld",
4
4
  {
5
5
  "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
- "caqop": "npmd:@comunica/actor-query-operation-project/",
7
- "files-caqop": "caqop:^1.0.0/",
8
-
9
- "ActorQueryOperationProject": "caqop:Actor/QueryOperation/Project"
6
+ "caqop": "npmd:@comunica/actor-query-operation-project/^2.0.0/",
7
+ "ActorQueryOperationProject": {
8
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject",
9
+ "@prefix": true,
10
+ "@context": {
11
+ "args_mediatorQueryOperation": {
12
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_mediatorQueryOperation"
13
+ },
14
+ "args_name": {
15
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_name"
16
+ },
17
+ "args_bus": {
18
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_bus"
19
+ },
20
+ "args_beforeActors": {
21
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_beforeActors",
22
+ "@container": "@list"
23
+ },
24
+ "mediatorQueryOperation": {
25
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_mediatorQueryOperation"
26
+ },
27
+ "name": {
28
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_name"
29
+ },
30
+ "bus": {
31
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_bus"
32
+ },
33
+ "beforeActors": {
34
+ "@id": "caqop:components/ActorQueryOperationProject.jsonld#ActorQueryOperationProject_args_beforeActors",
35
+ "@container": "@list"
36
+ }
37
+ }
38
+ }
10
39
  }
11
40
  ]
12
- }
41
+ }
@@ -1,13 +1,13 @@
1
1
  import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';
2
2
  import { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';
3
- import type { ActionContext, IActorTest } from '@comunica/core';
4
- import type { IActorQueryOperationOutputBindings } from '@comunica/types';
3
+ import type { IActorTest } from '@comunica/core';
4
+ import type { IActionContext, IQueryOperationResult } from '@comunica/types';
5
5
  import type { Algebra } from 'sparqlalgebrajs';
6
6
  /**
7
7
  * A comunica Project Query Operation Actor.
8
8
  */
9
9
  export declare class ActorQueryOperationProject extends ActorQueryOperationTypedMediated<Algebra.Project> {
10
10
  constructor(args: IActorQueryOperationTypedMediatedArgs);
11
- testOperation(pattern: Algebra.Project, context: ActionContext): Promise<IActorTest>;
12
- runOperation(pattern: Algebra.Project, context: ActionContext): Promise<IActorQueryOperationOutputBindings>;
11
+ testOperation(operation: Algebra.Project, context: IActionContext): Promise<IActorTest>;
12
+ runOperation(operation: Algebra.Project, context: IActionContext): Promise<IQueryOperationResult>;
13
13
  }
@@ -4,7 +4,6 @@ exports.ActorQueryOperationProject = void 0;
4
4
  const bus_query_operation_1 = require("@comunica/bus-query-operation");
5
5
  const data_factory_1 = require("@comunica/data-factory");
6
6
  const rdf_data_factory_1 = require("rdf-data-factory");
7
- const rdf_string_1 = require("rdf-string");
8
7
  const DF = new rdf_data_factory_1.DataFactory();
9
8
  /**
10
9
  * A comunica Project Query Operation Actor.
@@ -13,19 +12,22 @@ class ActorQueryOperationProject extends bus_query_operation_1.ActorQueryOperati
13
12
  constructor(args) {
14
13
  super(args, 'project');
15
14
  }
16
- async testOperation(pattern, context) {
15
+ async testOperation(operation, context) {
17
16
  return true;
18
17
  }
19
- async runOperation(pattern, context) {
18
+ async runOperation(operation, context) {
20
19
  // Resolve the input
21
- const output = bus_query_operation_1.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({ operation: pattern.input, context }));
20
+ const output = bus_query_operation_1.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({ operation: operation.input, context }));
22
21
  // Find all variables that should be deleted from the input stream.
23
- const variables = pattern.variables.map(x => rdf_string_1.termToString(x));
24
- const deleteVariables = output.variables.filter(variable => !variables.includes(variable));
22
+ const outputMetadata = await output.metadata();
23
+ const variables = operation.variables;
24
+ const deleteVariables = outputMetadata.variables
25
+ .filter(variable => !variables.some(subVariable => variable.value === subVariable.value));
25
26
  // Error if there are variables that are not bound in the input stream.
26
- const missingVariables = variables.filter(variable => !output.variables.includes(variable));
27
+ const missingVariables = variables
28
+ .filter(variable => !outputMetadata.variables.some(subVariable => variable.value === subVariable.value));
27
29
  if (missingVariables.length > 0) {
28
- throw new Error(`Variables '${missingVariables}' are used in the projection result, but are not assigned.`);
30
+ throw new Error(`Variables '${missingVariables.map(variable => `?${variable.value}`)}' are used in the projection result, but are not assigned.`);
29
31
  }
30
32
  // Make sure the project variables are the only variables that are present in the bindings.
31
33
  let bindingsStream = deleteVariables.length === 0 ?
@@ -64,9 +66,7 @@ class ActorQueryOperationProject extends bus_query_operation_1.ActorQueryOperati
64
66
  return {
65
67
  type: 'bindings',
66
68
  bindingsStream,
67
- metadata: output.metadata,
68
- variables,
69
- canContainUndefs: output.canContainUndefs,
69
+ metadata: async () => ({ ...outputMetadata, variables }),
70
70
  };
71
71
  }
72
72
  }
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './ActorQueryOperationProject';
@@ -10,5 +10,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./lib/ActorQueryOperationProject"), exports);
13
+ __exportStar(require("./ActorQueryOperationProject"), exports);
14
14
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-project",
3
- "version": "1.21.1",
3
+ "version": "2.0.1-alpha.6.0",
4
4
  "description": "A project query-operation actor",
5
5
  "lsd:module": true,
6
- "main": "index.js",
7
- "typings": "index",
6
+ "main": "lib/index.js",
7
+ "typings": "lib/index",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/comunica/comunica.git",
@@ -13,6 +13,7 @@
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
+ "sideEffects": false,
16
17
  "keywords": [
17
18
  "comunica",
18
19
  "actor",
@@ -27,45 +28,20 @@
27
28
  "files": [
28
29
  "components",
29
30
  "lib/**/*.d.ts",
30
- "lib/**/*.js",
31
- "index.d.ts",
32
- "index.js"
31
+ "lib/**/*.js"
33
32
  ],
34
- "peerDependencies": {
35
- "@comunica/bus-query-operation": "^1.0.0",
36
- "@comunica/core": "^1.0.0"
37
- },
38
33
  "dependencies": {
39
- "@comunica/data-factory": "^1.21.1",
40
- "@comunica/types": "^1.21.1",
34
+ "@comunica/bus-query-operation": "2.0.1-alpha.6.0",
35
+ "@comunica/core": "2.0.1-alpha.6.0",
36
+ "@comunica/data-factory": "2.0.1-alpha.6.0",
37
+ "@comunica/types": "2.0.1-alpha.6.0",
41
38
  "rdf-data-factory": "^1.0.3",
42
- "rdf-string": "^1.5.0",
43
- "sparqlalgebrajs": "^2.5.5"
44
- },
45
- "devDependencies": {
46
- "@comunica/bus-query-operation": "^1.21.1",
47
- "@comunica/core": "^1.21.1"
48
- },
49
- "jest": {
50
- "globals": {
51
- "ts-jest": {
52
- "tsConfig": "../../tsconfig.json"
53
- }
54
- },
55
- "transform": {
56
- "^.+\\.ts$": "ts-jest"
57
- },
58
- "testRegex": "(/test/.*|(\\.|/)(test|spec))\\.ts$",
59
- "moduleFileExtensions": [
60
- "ts",
61
- "js"
62
- ],
63
- "collectCoverage": true
39
+ "sparqlalgebrajs": "^4.0.0"
64
40
  },
65
41
  "scripts": {
66
- "test": "node \"../../node_modules/jest/bin/jest.js\" ${1}",
67
- "test-watch": "node \"../../node_modules/jest/bin/jest.js\" ${1} --watch",
68
- "build": "node \"../../node_modules/typescript/bin/tsc\"",
69
- "validate": "npm ls"
70
- }
42
+ "build": "npm run build:ts && npm run build:components",
43
+ "build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
44
+ "build:components": "componentsjs-generator"
45
+ },
46
+ "gitHead": "bbf46a068e635256495a40e784a4691b22e88bd3"
71
47
  }
@@ -1,21 +0,0 @@
1
- {
2
- "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-project/^1.0.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^1.0.0/components/context.jsonld"
5
- ],
6
- "@id": "npmd:@comunica/actor-query-operation-project",
7
- "components": [
8
- {
9
- "@id": "caqop:Actor/QueryOperation/Project",
10
- "@type": "Class",
11
- "extends": "cbqo:Actor/QueryOperationTypedMediated",
12
- "requireElement": "ActorQueryOperationProject",
13
- "comment": "A comunica Project Query Operation Actor.",
14
- "constructorArguments": [
15
- {
16
- "extends": "cbqo:Actor/QueryOperationTypedMediated/constructorArgumentsObject"
17
- }
18
- ]
19
- }
20
- ]
21
- }
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './lib/ActorQueryOperationProject';