@comunica/actor-query-operation-path-alt 1.22.0 → 2.0.1-alpha.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright © 2017–2018 Ruben Taelman, Joachim Van Herwegen
4
- Ghent University – imec, Belgium
3
+ Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
4
+ Comunica Association and Ghent University – imec, Belgium
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
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-path-alt/^1.0.0/components/context.jsonld"
25
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-alt/^2.0.0/components/context.jsonld"
26
26
  ],
27
27
  "actors": [
28
28
  ...
29
29
  {
30
- "@id": "config-sets:sparql-queryoperator-path.json#myAltPathOperator",
30
+ "@id": "myAltPathOperator",
31
31
  "@type": "ActorQueryOperationPathAlt",
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-path-alt/^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
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^2.0.0/components/context.jsonld"
7
+ ],
8
+ "@id": "npmd:@comunica/actor-query-operation-path-alt",
9
+ "components": [
10
+ {
11
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt",
12
+ "@type": "Class",
13
+ "requireElement": "ActorQueryOperationPathAlt",
14
+ "extends": [
15
+ "caap:components/ActorAbstractPath.jsonld#ActorAbstractPath"
16
+ ],
17
+ "comment": "A comunica Path Alt Query Operation Actor.",
18
+ "parameters": [
19
+ {
20
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_mediatorQueryOperation",
21
+ "range": "cc:components/Mediator.jsonld#Mediator"
22
+ },
23
+ {
24
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_name",
25
+ "range": "xsd:string",
26
+ "default": {
27
+ "@id": "rdf:subject"
28
+ },
29
+ "comment": "The name for this actor."
30
+ },
31
+ {
32
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_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/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
44
+ },
45
+ {
46
+ "@type": "ParameterRangeGenericTypeReference",
47
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
48
+ },
49
+ {
50
+ "@type": "ParameterRangeGenericTypeReference",
51
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ "@type": "ParameterRangeGenericTypeReference",
57
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
58
+ },
59
+ {
60
+ "@type": "ParameterRangeGenericTypeReference",
61
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
62
+ },
63
+ {
64
+ "@type": "ParameterRangeGenericTypeReference",
65
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
66
+ }
67
+ ]
68
+ },
69
+ "default": {
70
+ "@id": "cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus",
71
+ "@type": "cc:components/Bus.jsonld#Bus"
72
+ },
73
+ "comment": "The bus this actor subscribes to."
74
+ },
75
+ {
76
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_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/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
89
+ },
90
+ {
91
+ "@type": "ParameterRangeGenericTypeReference",
92
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
93
+ },
94
+ {
95
+ "@type": "ParameterRangeGenericTypeReference",
96
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.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": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt__member_constructor",
112
+ "memberFieldName": "constructor"
113
+ },
114
+ {
115
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt__member_runOperation",
116
+ "memberFieldName": "runOperation"
117
+ }
118
+ ],
119
+ "constructorArguments": [
120
+ {
121
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args__constructorArgument",
122
+ "fields": [
123
+ {
124
+ "keyRaw": "mediatorQueryOperation",
125
+ "value": {
126
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_mediatorQueryOperation"
127
+ }
128
+ },
129
+ {
130
+ "keyRaw": "name",
131
+ "value": {
132
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_name"
133
+ }
134
+ },
135
+ {
136
+ "keyRaw": "bus",
137
+ "value": {
138
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_bus"
139
+ }
140
+ },
141
+ {
142
+ "keyRaw": "beforeActors",
143
+ "value": {
144
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_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-path-alt/^1.0.0/components/context.jsonld",
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-alt/^2.0.0/components/context.jsonld"
4
+ ],
3
5
  "@id": "npmd:@comunica/actor-query-operation-path-alt",
4
6
  "@type": "Module",
5
7
  "requireName": "@comunica/actor-query-operation-path-alt",
6
8
  "import": [
7
- "files-caqopa:components/Actor/QueryOperation/PathAlt.jsonld"
9
+ "caqopa:components/ActorQueryOperationPathAlt.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
- "caqopa": "npmd:@comunica/actor-query-operation-path-alt/",
7
- "files-caqopa": "caqopa:^1.0.0/",
8
-
9
- "ActorQueryOperationPathAlt": "caqopa:Actor/QueryOperation/PathAlt"
6
+ "caqopa": "npmd:@comunica/actor-query-operation-path-alt/^2.0.0/",
7
+ "ActorQueryOperationPathAlt": {
8
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt",
9
+ "@prefix": true,
10
+ "@context": {
11
+ "args_mediatorQueryOperation": {
12
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_mediatorQueryOperation"
13
+ },
14
+ "args_name": {
15
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_name"
16
+ },
17
+ "args_bus": {
18
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_bus"
19
+ },
20
+ "args_beforeActors": {
21
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_beforeActors",
22
+ "@container": "@list"
23
+ },
24
+ "mediatorQueryOperation": {
25
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_mediatorQueryOperation"
26
+ },
27
+ "name": {
28
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_name"
29
+ },
30
+ "bus": {
31
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_bus"
32
+ },
33
+ "beforeActors": {
34
+ "@id": "caqopa:components/ActorQueryOperationPathAlt.jsonld#ActorQueryOperationPathAlt_args_beforeActors",
35
+ "@container": "@list"
36
+ }
37
+ }
38
+ }
10
39
  }
11
40
  ]
12
- }
41
+ }
@@ -1,12 +1,11 @@
1
1
  import { ActorAbstractPath } from '@comunica/actor-abstract-path';
2
2
  import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';
3
- import type { ActionContext } from '@comunica/core';
4
- import type { IActorQueryOperationOutputBindings } from '@comunica/types';
3
+ import type { IQueryOperationResult, IActionContext } from '@comunica/types';
5
4
  import { Algebra } from 'sparqlalgebrajs';
6
5
  /**
7
6
  * A comunica Path Alt Query Operation Actor.
8
7
  */
9
8
  export declare class ActorQueryOperationPathAlt extends ActorAbstractPath {
10
9
  constructor(args: IActorQueryOperationTypedMediatedArgs);
11
- runOperation(path: Algebra.Path, context: ActionContext): Promise<IActorQueryOperationOutputBindings>;
10
+ runOperation(operation: Algebra.Path, context: IActionContext): Promise<IQueryOperationResult>;
12
11
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActorQueryOperationPathAlt = void 0;
4
4
  const actor_abstract_path_1 = require("@comunica/actor-abstract-path");
5
+ const actor_query_operation_union_1 = require("@comunica/actor-query-operation-union");
5
6
  const bus_query_operation_1 = require("@comunica/bus-query-operation");
6
7
  const asynciterator_1 = require("asynciterator");
7
8
  const sparqlalgebrajs_1 = require("sparqlalgebrajs");
@@ -12,22 +13,23 @@ class ActorQueryOperationPathAlt extends actor_abstract_path_1.ActorAbstractPath
12
13
  constructor(args) {
13
14
  super(args, sparqlalgebrajs_1.Algebra.types.ALT);
14
15
  }
15
- async runOperation(path, context) {
16
- const predicate = path.predicate;
17
- const subOperations = (await Promise.all([
18
- this.mediatorQueryOperation.mediate({
19
- context,
20
- operation: actor_abstract_path_1.ActorAbstractPath.FACTORY.createPath(path.subject, predicate.left, path.object, path.graph),
21
- }),
22
- this.mediatorQueryOperation.mediate({
23
- context,
24
- operation: actor_abstract_path_1.ActorAbstractPath.FACTORY.createPath(path.subject, predicate.right, path.object, path.graph),
25
- }),
26
- ])).map(op => bus_query_operation_1.ActorQueryOperation.getSafeBindings(op));
16
+ async runOperation(operation, context) {
17
+ const predicate = operation.predicate;
18
+ const subOperations = (await Promise.all(predicate.input
19
+ .map(subPredicate => this.mediatorQueryOperation.mediate({
20
+ context,
21
+ operation: actor_abstract_path_1.ActorAbstractPath.FACTORY
22
+ .createPath(operation.subject, subPredicate, operation.object, operation.graph),
23
+ }))))
24
+ .map(bus_query_operation_1.ActorQueryOperation.getSafeBindings);
27
25
  const bindingsStream = new asynciterator_1.UnionIterator(subOperations.map(op => op.bindingsStream), { autoStart: false });
28
- const variables = [].concat
29
- .apply([], subOperations.map(op => op.variables));
30
- return { type: 'bindings', bindingsStream, variables: [...new Set(variables)], canContainUndefs: false };
26
+ const metadata = () => Promise.all(subOperations.map(output => output.metadata()))
27
+ .then(subMeta => actor_query_operation_union_1.ActorQueryOperationUnion.unionMetadata(subMeta, true));
28
+ return {
29
+ type: 'bindings',
30
+ bindingsStream,
31
+ metadata,
32
+ };
31
33
  }
32
34
  }
33
35
  exports.ActorQueryOperationPathAlt = ActorQueryOperationPathAlt;
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './ActorQueryOperationPathAlt';
@@ -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/ActorQueryOperationPathAlt"), exports);
13
+ __exportStar(require("./ActorQueryOperationPathAlt"), exports);
14
14
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-path-alt",
3
- "version": "1.22.0",
3
+ "version": "2.0.1-alpha.5.0",
4
4
  "description": "A path-alt 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",
@@ -27,45 +27,21 @@
27
27
  "files": [
28
28
  "components",
29
29
  "lib/**/*.d.ts",
30
- "lib/**/*.js",
31
- "index.d.ts",
32
- "index.js"
30
+ "lib/**/*.js"
33
31
  ],
34
- "peerDependencies": {
35
- "@comunica/bus-query-operation": "^1.2.0",
36
- "@comunica/core": "^1.2.0"
37
- },
38
32
  "dependencies": {
39
- "@comunica/actor-abstract-path": "^1.22.0",
40
- "@comunica/types": "^1.22.0",
41
- "asynciterator": "^3.2.0",
42
- "sparqlalgebrajs": "^3.0.0"
43
- },
44
- "devDependencies": {
45
- "@comunica/bus-query-operation": "^1.22.0",
46
- "@comunica/core": "^1.22.0"
47
- },
48
- "jest": {
49
- "globals": {
50
- "ts-jest": {
51
- "tsConfig": "../../tsconfig.json"
52
- }
53
- },
54
- "transform": {
55
- "^.+\\.ts$": "ts-jest"
56
- },
57
- "testRegex": "(/test/.*|(\\.|/)(test|spec))\\.ts$",
58
- "moduleFileExtensions": [
59
- "ts",
60
- "js"
61
- ],
62
- "collectCoverage": true
33
+ "@comunica/actor-abstract-path": "2.0.1-alpha.5.0",
34
+ "@comunica/actor-query-operation-union": "2.0.1-alpha.5.0",
35
+ "@comunica/bus-query-operation": "2.0.1-alpha.5.0",
36
+ "@comunica/core": "2.0.1-alpha.5.0",
37
+ "@comunica/types": "2.0.1-alpha.5.0",
38
+ "asynciterator": "^3.2.1",
39
+ "sparqlalgebrajs": "^4.0.0"
63
40
  },
64
41
  "scripts": {
65
- "test": "node \"../../node_modules/jest/bin/jest.js\" ${1}",
66
- "test-watch": "node \"../../node_modules/jest/bin/jest.js\" ${1} --watch",
67
- "build": "node \"../../node_modules/typescript/bin/tsc\"",
68
- "validate": "npm ls"
42
+ "build": "npm run build:ts && npm run build:components",
43
+ "build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
44
+ "build:components": "componentsjs-generator"
69
45
  },
70
- "gitHead": "0a249ba341022eb2f1b9922fcf549a9564671d9f"
46
+ "gitHead": "e2ae2e9e924bf0656df60cc99774f7e560d47695"
71
47
  }
@@ -1,22 +0,0 @@
1
- {
2
- "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-alt/^1.0.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^1.0.0/components/context.jsonld",
5
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^1.0.0/components/context.jsonld"
6
- ],
7
- "@id": "npmd:@comunica/actor-query-operation-path-alt",
8
- "components": [
9
- {
10
- "@id": "caqopa:Actor/QueryOperation/PathAlt",
11
- "@type": "Class",
12
- "extends": "caap:Actor/AbstractPath",
13
- "requireElement": "ActorQueryOperationPathAlt",
14
- "comment": "A comunica Path Alt Query Operation Actor.",
15
- "constructorArguments": [
16
- {
17
- "extends": "cbqo:Actor/QueryOperationTypedMediated/constructorArgumentsObject"
18
- }
19
- ]
20
- }
21
- ]
22
- }
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './lib/ActorQueryOperationPathAlt';