@comunica/actor-query-operation-path-seq 3.3.0 → 4.0.1

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/README.md CHANGED
@@ -22,7 +22,7 @@ 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-seq/^3.0.0/components/context.jsonld"
25
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-seq/^4.0.0/components/context.jsonld"
26
26
  ],
27
27
  "actors": [
28
28
  ...
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-seq/^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-operation/^3.0.0/components/context.jsonld",
6
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^3.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-seq/^4.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^4.0.0/components/context.jsonld",
6
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^4.0.0/components/context.jsonld"
7
7
  ],
8
8
  "@id": "npmd:@comunica/actor-query-operation-path-seq",
9
9
  "components": [
@@ -45,29 +45,37 @@
45
45
  "genericTypeInstances": [
46
46
  {
47
47
  "@type": "ParameterRangeGenericTypeReference",
48
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
48
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
49
49
  },
50
50
  {
51
51
  "@type": "ParameterRangeGenericTypeReference",
52
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
52
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
53
53
  },
54
54
  {
55
55
  "@type": "ParameterRangeGenericTypeReference",
56
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
56
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
57
+ },
58
+ {
59
+ "@type": "ParameterRangeGenericTypeReference",
60
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
57
61
  }
58
62
  ]
59
63
  },
60
64
  {
61
65
  "@type": "ParameterRangeGenericTypeReference",
62
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
66
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
67
+ },
68
+ {
69
+ "@type": "ParameterRangeGenericTypeReference",
70
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
63
71
  },
64
72
  {
65
73
  "@type": "ParameterRangeGenericTypeReference",
66
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
74
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
67
75
  },
68
76
  {
69
77
  "@type": "ParameterRangeGenericTypeReference",
70
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
78
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
71
79
  }
72
80
  ]
73
81
  },
@@ -77,6 +85,20 @@
77
85
  },
78
86
  "comment": "The bus this actor subscribes to."
79
87
  },
88
+ {
89
+ "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_busFailMessage",
90
+ "range": {
91
+ "@type": "ParameterRangeUnion",
92
+ "parameterRangeElements": [
93
+ "xsd:string",
94
+ {
95
+ "@type": "ParameterRangeUndefined"
96
+ }
97
+ ]
98
+ },
99
+ "default": "Query operation processing failed: none of the configured actors were able to handle the operation type ${action.operation.type}",
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
+ },
80
102
  {
81
103
  "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_beforeActors",
82
104
  "range": {
@@ -90,15 +112,19 @@
90
112
  "genericTypeInstances": [
91
113
  {
92
114
  "@type": "ParameterRangeGenericTypeReference",
93
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
115
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
94
116
  },
95
117
  {
96
118
  "@type": "ParameterRangeGenericTypeReference",
97
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
119
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
98
120
  },
99
121
  {
100
122
  "@type": "ParameterRangeGenericTypeReference",
101
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
123
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
124
+ },
125
+ {
126
+ "@type": "ParameterRangeGenericTypeReference",
127
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
102
128
  }
103
129
  ]
104
130
  }
@@ -154,6 +180,12 @@
154
180
  "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_bus"
155
181
  }
156
182
  },
183
+ {
184
+ "keyRaw": "busFailMessage",
185
+ "value": {
186
+ "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_busFailMessage"
187
+ }
188
+ },
157
189
  {
158
190
  "keyRaw": "beforeActors",
159
191
  "value": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-seq/^3.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-seq/^4.0.0/components/context.jsonld"
4
4
  ],
5
5
  "@id": "npmd:@comunica/actor-query-operation-path-seq",
6
6
  "@type": "Module",
@@ -3,7 +3,7 @@
3
3
  "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
4
4
  {
5
5
  "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
- "caqops": "npmd:@comunica/actor-query-operation-path-seq/^3.0.0/",
6
+ "caqops": "npmd:@comunica/actor-query-operation-path-seq/^4.0.0/",
7
7
  "ActorQueryOperationPathSeq": {
8
8
  "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq",
9
9
  "@prefix": true,
@@ -20,6 +20,9 @@
20
20
  "args_bus": {
21
21
  "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_bus"
22
22
  },
23
+ "args_busFailMessage": {
24
+ "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_busFailMessage"
25
+ },
23
26
  "args_beforeActors": {
24
27
  "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_beforeActors",
25
28
  "@container": "@list"
@@ -36,6 +39,9 @@
36
39
  "bus": {
37
40
  "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_bus"
38
41
  },
42
+ "busFailMessage": {
43
+ "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_busFailMessage"
44
+ },
39
45
  "beforeActors": {
40
46
  "@id": "caqops:components/ActorQueryOperationPathSeq.jsonld#ActorQueryOperationPathSeq_args_beforeActors",
41
47
  "@container": "@list"
@@ -2,7 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActorQueryOperationPathSeq = void 0;
4
4
  const actor_abstract_path_1 = require("@comunica/actor-abstract-path");
5
- const bus_query_operation_1 = require("@comunica/bus-query-operation");
5
+ const context_entries_1 = require("@comunica/context-entries");
6
+ const utils_query_operation_1 = require("@comunica/utils-query-operation");
6
7
  const sparqlalgebrajs_1 = require("sparqlalgebrajs");
7
8
  /**
8
9
  * A comunica Path Seq Query Operation Actor.
@@ -12,13 +13,15 @@ class ActorQueryOperationPathSeq extends actor_abstract_path_1.ActorAbstractPath
12
13
  super(args, sparqlalgebrajs_1.Algebra.types.SEQ);
13
14
  }
14
15
  async runOperation(operationOriginal, context) {
16
+ const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
17
+ const algebraFactory = new sparqlalgebrajs_1.Factory(dataFactory);
15
18
  const predicate = operationOriginal.predicate;
16
19
  let joiner = operationOriginal.subject;
17
20
  const generatedVariableNames = [];
18
21
  const entries = await Promise.all(predicate.input
19
22
  .map((subPredicate, i) => {
20
- const nextJoiner = i === predicate.input.length - 1 ? operationOriginal.object : this.generateVariable(operationOriginal, `b${i}`);
21
- const operation = actor_abstract_path_1.ActorAbstractPath.FACTORY
23
+ const nextJoiner = i === predicate.input.length - 1 ? operationOriginal.object : this.generateVariable(dataFactory, operationOriginal, `b${i}`);
24
+ const operation = algebraFactory
22
25
  .createPath(joiner, subPredicate, nextJoiner, operationOriginal.graph);
23
26
  const output = this.mediatorQueryOperation.mediate({
24
27
  context,
@@ -31,10 +34,10 @@ class ActorQueryOperationPathSeq extends actor_abstract_path_1.ActorAbstractPath
31
34
  return { output, operation };
32
35
  })
33
36
  .map(async ({ output, operation }) => ({
34
- output: bus_query_operation_1.ActorQueryOperation.getSafeBindings(await output),
37
+ output: (0, utils_query_operation_1.getSafeBindings)(await output),
35
38
  operation,
36
39
  })));
37
- const join = bus_query_operation_1.ActorQueryOperation.getSafeBindings(await this.mediatorJoin
40
+ const join = (0, utils_query_operation_1.getSafeBindings)(await this.mediatorJoin
38
41
  .mediate({ type: 'inner', entries, context }));
39
42
  // Remove the generated variable from the bindings
40
43
  const bindingsStream = join.bindingsStream.transform({
@@ -53,7 +56,7 @@ class ActorQueryOperationPathSeq extends actor_abstract_path_1.ActorAbstractPath
53
56
  async metadata() {
54
57
  const joinMetadata = await join.metadata();
55
58
  const variables = joinMetadata.variables.filter(variable => !generatedVariableNames
56
- .some(generatedVariableName => generatedVariableName.value === variable.value));
59
+ .some(generatedVariableName => generatedVariableName.value === variable.variable.value));
57
60
  return { ...joinMetadata, variables };
58
61
  },
59
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ActorQueryOperationPathSeq.js","sourceRoot":"","sources":["ActorQueryOperationPathSeq.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAElE,uEAEuC;AAIvC,qDAA0C;AAE1C;;GAEG;AACH,MAAa,0BAA2B,SAAQ,uCAAiB;IAG/D,YAAmB,IAAiC;QAClD,KAAK,CAAC,IAAI,EAAE,yBAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,iBAA+B,EAC/B,OAAuB;QAEvB,MAAM,SAAS,GAAiB,iBAAiB,CAAC,SAAS,CAAC;QAE5D,IAAI,MAAM,GAAa,iBAAiB,CAAC,OAAO,CAAC;QACjD,MAAM,sBAAsB,GAAmB,EAAE,CAAC;QAClD,MAAM,OAAO,GAAiB,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK;aAC5D,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE;YACvB,MAAM,UAAU,GAAG,CAAC,KAAK,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAgB,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YAClJ,MAAM,SAAS,GAAG,uCAAiB,CAAC,OAAO;iBACxC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;Y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,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,sBAAsB;qBAChF,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBAClF,OAAO,EAAE,GAAG,YAAY,EAAE,SAAS,EAAE,CAAC;YACxC,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AA9DD,gEA8DC","sourcesContent":["import { ActorAbstractPath } from '@comunica/actor-abstract-path';\nimport type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport {\n ActorQueryOperation,\n} from '@comunica/bus-query-operation';\nimport type { MediatorRdfJoin } from '@comunica/bus-rdf-join';\nimport type { Bindings, IActionContext, IQueryOperationResult, IJoinEntry } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica Path Seq Query Operation Actor.\n */\nexport class ActorQueryOperationPathSeq extends ActorAbstractPath {\n public readonly mediatorJoin: MediatorRdfJoin;\n\n public constructor(args: IActorQueryOperationPathSeq) {\n super(args, Algebra.types.SEQ);\n }\n\n public async runOperation(\n operationOriginal: Algebra.Path,\n context: IActionContext,\n ): Promise<IQueryOperationResult> {\n const predicate = <Algebra.Seq> operationOriginal.predicate;\n\n let joiner: RDF.Term = operationOriginal.subject;\n const generatedVariableNames: RDF.Variable[] = [];\n const entries: IJoinEntry[] = await Promise.all(predicate.input\n .map((subPredicate, i) => {\n const nextJoiner = i === predicate.input.length - 1 ? <RDF.Variable> operationOriginal.object : this.generateVariable(operationOriginal, `b${i}`);\n const operation = ActorAbstractPath.FACTORY\n .createPath(joiner, subPredicate, nextJoiner, operationOriginal.graph);\n const output = this.mediatorQueryOperation.mediate({\n context,\n operation,\n });\n\n joiner = nextJoiner;\n if (i < predicate.input.length - 1) {\n generatedVariableNames.push(nextJoiner);\n }\n\n return { output, operation };\n })\n .map(async({ output, operation }) => ({\n output: ActorQueryOperation.getSafeBindings(await output),\n operation,\n })));\n\n const join = ActorQueryOperation.getSafeBindings(await this.mediatorJoin\n .mediate({ type: 'inner', entries, context }));\n // Remove the generated variable from the bindings\n const bindingsStream = join.bindingsStream.transform<Bindings>({\n transform(item, next, push) {\n for (const generatedVariableName of generatedVariableNames) {\n item = item.delete(generatedVariableName);\n }\n push(item);\n next();\n },\n });\n\n // Remove the generated variable from the list of variables\n return {\n type: 'bindings',\n bindingsStream,\n async metadata() {\n const joinMetadata = await join.metadata();\n const variables = joinMetadata.variables.filter(variable => !generatedVariableNames\n .some(generatedVariableName => generatedVariableName.value === variable.value));\n return { ...joinMetadata, variables };\n },\n };\n }\n}\n\nexport interface IActorQueryOperationPathSeq extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for joining Bindings streams\n */\n mediatorJoin: MediatorRdfJoin;\n}\n"]}
1
+ {"version":3,"file":"ActorQueryOperationPathSeq.js","sourceRoot":"","sources":["ActorQueryOperationPathSeq.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAIlE,+DAA0D;AAE1D,2EAAkE;AAElE,qDAAmD;AAEnD;;GAEG;AACH,MAAa,0BAA2B,SAAQ,uCAAiB;IAG/D,YAAmB,IAAiC;QAClD,KAAK,CAAC,IAAI,EAAE,yBAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,iBAA+B,EAC/B,OAAuB;QAEvB,MAAM,WAAW,GAAwB,OAAO,CAAC,OAAO,CAAC,+BAAa,CAAC,WAAW,CAAC,CAAC;QACpF,MAAM,cAAc,GAAG,IAAI,yBAAO,CAAC,WAAW,CAAC,CAAC;QAChD,MAAM,SAAS,GAAiB,iBAAiB,CAAC,SAAS,CAAC;QAE5D,IAAI,MAAM,GAAa,iBAAiB,CAAC,OAAO,CAAC;QACjD,MAAM,sBAAsB,GAAmB,EAAE,CAAC;QAClD,MAAM,OAAO,GAAiB,MAAM,OAAO,CAAC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BACxB,KAAK,MAAM,qBAAqB,IAAI,sBAAsB,EAAE,CAAC;oBAC3D,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;gBAC5C,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,CAAC;gBACX,IAAI,EAAE,CAAC;YACT,CAAC;SACF,CAAC,CAAC;QAEH,2DAA2D;QAC3D,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,cAAc;YACd,KAAK,CAAC,QAAQ;gBACZ,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC3C,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,sBAAsB;qBAChF,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,KAAK,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3F,OAAO,EAAE,GAAG,YAAY,EAAE,SAAS,EAAE,CAAC;YACxC,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AAhED,gEAgEC","sourcesContent":["import { ActorAbstractPath } from '@comunica/actor-abstract-path';\nimport type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\n\nimport type { MediatorRdfJoin } from '@comunica/bus-rdf-join';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { Bindings, IActionContext, IQueryOperationResult, IJoinEntry, ComunicaDataFactory } from '@comunica/types';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\nimport { Algebra, Factory } from 'sparqlalgebrajs';\n\n/**\n * A comunica Path Seq Query Operation Actor.\n */\nexport class ActorQueryOperationPathSeq extends ActorAbstractPath {\n public readonly mediatorJoin: MediatorRdfJoin;\n\n public constructor(args: IActorQueryOperationPathSeq) {\n super(args, Algebra.types.SEQ);\n }\n\n public async runOperation(\n operationOriginal: Algebra.Path,\n context: IActionContext,\n ): Promise<IQueryOperationResult> {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new Factory(dataFactory);\n const predicate = <Algebra.Seq> operationOriginal.predicate;\n\n let joiner: RDF.Term = operationOriginal.subject;\n const generatedVariableNames: RDF.Variable[] = [];\n const entries: IJoinEntry[] = await Promise.all(predicate.input\n .map((subPredicate, i) => {\n const nextJoiner = i === predicate.input.length - 1 ? <RDF.Variable> operationOriginal.object : this.generateVariable(dataFactory, operationOriginal, `b${i}`);\n const operation = algebraFactory\n .createPath(joiner, subPredicate, nextJoiner, operationOriginal.graph);\n const output = this.mediatorQueryOperation.mediate({\n context,\n operation,\n });\n\n joiner = nextJoiner;\n if (i < predicate.input.length - 1) {\n generatedVariableNames.push(nextJoiner);\n }\n\n return { output, operation };\n })\n .map(async({ output, operation }) => ({\n output: getSafeBindings(await output),\n operation,\n })));\n\n const join = getSafeBindings(await this.mediatorJoin\n .mediate({ type: 'inner', entries, context }));\n // Remove the generated variable from the bindings\n const bindingsStream = join.bindingsStream.transform<Bindings>({\n transform(item, next, push) {\n for (const generatedVariableName of generatedVariableNames) {\n item = item.delete(generatedVariableName);\n }\n push(item);\n next();\n },\n });\n\n // Remove the generated variable from the list of variables\n return {\n type: 'bindings',\n bindingsStream,\n async metadata() {\n const joinMetadata = await join.metadata();\n const variables = joinMetadata.variables.filter(variable => !generatedVariableNames\n .some(generatedVariableName => generatedVariableName.value === variable.variable.value));\n return { ...joinMetadata, variables };\n },\n };\n }\n}\n\nexport interface IActorQueryOperationPathSeq extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for joining Bindings streams\n */\n mediatorJoin: MediatorRdfJoin;\n}\n"]}
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-path-seq",
3
- "version": "3.3.0",
3
+ "version": "4.0.1",
4
4
  "description": "A path-seq query-operation actor",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
7
+ "funding": {
8
+ "type": "opencollective",
9
+ "url": "https://opencollective.com/comunica-association"
10
+ },
7
11
  "homepage": "https://comunica.dev/",
8
12
  "repository": {
9
13
  "type": "git",
@@ -37,11 +41,13 @@
37
41
  "build:components": "componentsjs-generator"
38
42
  },
39
43
  "dependencies": {
40
- "@comunica/actor-abstract-path": "^3.3.0",
41
- "@comunica/bus-query-operation": "^3.3.0",
42
- "@comunica/bus-rdf-join": "^3.3.0",
43
- "@comunica/types": "^3.3.0",
44
- "sparqlalgebrajs": "^4.3.7"
44
+ "@comunica/actor-abstract-path": "^4.0.1",
45
+ "@comunica/bus-query-operation": "^4.0.1",
46
+ "@comunica/bus-rdf-join": "^4.0.1",
47
+ "@comunica/context-entries": "^4.0.1",
48
+ "@comunica/types": "^4.0.1",
49
+ "@comunica/utils-query-operation": "^4.0.1",
50
+ "sparqlalgebrajs": "^4.3.8"
45
51
  },
46
- "gitHead": "02bde397d206f1f5a523643a6a604c89e792e2f9"
52
+ "gitHead": "67831ba79e45ea1ced41fe3f83c5d6e8802dbeaa"
47
53
  }