@comunica/actor-query-operation-path-one-or-more 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-one-or-more/^3.0.0/components/context.jsonld"
25
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-one-or-more/^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-one-or-more/^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-one-or-more/^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-one-or-more",
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": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_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": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_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": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_args_bus"
155
181
  }
156
182
  },
183
+ {
184
+ "keyRaw": "busFailMessage",
185
+ "value": {
186
+ "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_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-one-or-more/^3.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-one-or-more/^4.0.0/components/context.jsonld"
4
4
  ],
5
5
  "@id": "npmd:@comunica/actor-query-operation-path-one-or-more",
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
- "caqopoom": "npmd:@comunica/actor-query-operation-path-one-or-more/^3.0.0/",
6
+ "caqopoom": "npmd:@comunica/actor-query-operation-path-one-or-more/^4.0.0/",
7
7
  "ActorQueryOperationPathOneOrMore": {
8
8
  "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore",
9
9
  "@prefix": true,
@@ -20,6 +20,9 @@
20
20
  "args_bus": {
21
21
  "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_args_bus"
22
22
  },
23
+ "args_busFailMessage": {
24
+ "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_args_busFailMessage"
25
+ },
23
26
  "args_beforeActors": {
24
27
  "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_args_beforeActors",
25
28
  "@container": "@list"
@@ -36,6 +39,9 @@
36
39
  "bus": {
37
40
  "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_args_bus"
38
41
  },
42
+ "busFailMessage": {
43
+ "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_args_busFailMessage"
44
+ },
39
45
  "beforeActors": {
40
46
  "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore_args_beforeActors",
41
47
  "@container": "@list"
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActorQueryOperationPathOneOrMore = void 0;
4
4
  const actor_abstract_path_1 = require("@comunica/actor-abstract-path");
5
- const bindings_factory_1 = require("@comunica/bindings-factory");
6
- const bus_query_operation_1 = require("@comunica/bus-query-operation");
5
+ const context_entries_1 = require("@comunica/context-entries");
6
+ const utils_bindings_factory_1 = require("@comunica/utils-bindings-factory");
7
+ const utils_query_operation_1 = require("@comunica/utils-query-operation");
7
8
  const asynciterator_1 = require("asynciterator");
8
9
  const sparqlalgebrajs_1 = require("sparqlalgebrajs");
9
10
  /**
@@ -14,8 +15,10 @@ class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstra
14
15
  super(args, sparqlalgebrajs_1.Algebra.types.ONE_OR_MORE_PATH);
15
16
  }
16
17
  async runOperation(operation, context) {
17
- const bindingsFactory = await bindings_factory_1.BindingsFactory.create(this.mediatorMergeBindingsContext, context);
18
- const distinct = await this.isPathArbitraryLengthDistinct(context, operation);
18
+ const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
19
+ const algebraFactory = new sparqlalgebrajs_1.Factory(dataFactory);
20
+ const bindingsFactory = await utils_bindings_factory_1.BindingsFactory.create(this.mediatorMergeBindingsContext, context, dataFactory);
21
+ const distinct = await this.isPathArbitraryLengthDistinct(algebraFactory, context, operation);
19
22
  if (distinct.operation) {
20
23
  return distinct.operation;
21
24
  }
@@ -23,8 +26,9 @@ class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstra
23
26
  const predicate = operation.predicate;
24
27
  if (operation.subject.termType !== 'Variable' && operation.object.termType === 'Variable') {
25
28
  const objectVar = operation.object;
26
- const starEval = await this.getObjectsPredicateStarEval(operation.subject, predicate.path, objectVar, operation.graph, context, false, bindingsFactory);
27
- const variables = operation.graph.termType === 'Variable' ? [objectVar, operation.graph] : [objectVar];
29
+ const starEval = await this.getObjectsPredicateStarEval(operation.subject, predicate.path, objectVar, operation.graph, context, false, algebraFactory, bindingsFactory);
30
+ const variables = (operation.graph.termType === 'Variable' ? [objectVar, operation.graph] : [objectVar])
31
+ .map(variable => ({ variable, canBeUndef: false }));
28
32
  return {
29
33
  type: 'bindings',
30
34
  bindingsStream: starEval.bindingsStream,
@@ -33,9 +37,8 @@ class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstra
33
37
  }
34
38
  if (operation.subject.termType === 'Variable' && operation.object.termType === 'Variable') {
35
39
  // Get all the results of subjects with same predicate, but once, then fill in first variable for those
36
- const single = actor_abstract_path_1.ActorAbstractPath.FACTORY.createDistinct(actor_abstract_path_1.ActorAbstractPath.FACTORY
37
- .createPath(operation.subject, operation.predicate.path, operation.object, operation.graph));
38
- const results = bus_query_operation_1.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({ context, operation: single }));
40
+ const single = algebraFactory.createDistinct(algebraFactory.createPath(operation.subject, operation.predicate.path, operation.object, operation.graph));
41
+ const results = (0, utils_query_operation_1.getSafeBindings)(await this.mediatorQueryOperation.mediate({ context, operation: single }));
39
42
  const subjectVar = operation.subject;
40
43
  const objectVar = operation.object;
41
44
  const termHashes = {};
@@ -46,7 +49,7 @@ class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstra
46
49
  const graph = operation.graph.termType === 'Variable' ? bindings.get(operation.graph) : operation.graph;
47
50
  return new asynciterator_1.TransformIterator(async () => {
48
51
  const it = new asynciterator_1.BufferedIterator();
49
- await this.getSubjectAndObjectBindingsPredicateStar(subjectVar, objectVar, subject, object, predicate.path, graph, context, termHashes, {}, it, { count: 0 }, bindingsFactory);
52
+ await this.getSubjectAndObjectBindingsPredicateStar(subjectVar, objectVar, subject, object, predicate.path, graph, context, termHashes, {}, it, { count: 0 }, algebraFactory, bindingsFactory);
50
53
  return it.transform({
51
54
  transform(item, next, push) {
52
55
  if (operation.graph.termType === 'Variable') {
@@ -60,9 +63,10 @@ class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstra
60
63
  },
61
64
  autoStart: false,
62
65
  });
63
- const variables = operation.graph.termType === 'Variable' ?
66
+ const variables = (operation.graph.termType === 'Variable' ?
64
67
  [subjectVar, objectVar, operation.graph] :
65
- [subjectVar, objectVar];
68
+ [subjectVar, objectVar])
69
+ .map(variable => ({ variable, canBeUndef: false }));
66
70
  return {
67
71
  type: 'bindings',
68
72
  bindingsStream,
@@ -72,14 +76,14 @@ class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstra
72
76
  if (operation.subject.termType === 'Variable' && operation.object.termType !== 'Variable') {
73
77
  return this.mediatorQueryOperation.mediate({
74
78
  context,
75
- operation: actor_abstract_path_1.ActorAbstractPath.FACTORY.createPath(operation.object, actor_abstract_path_1.ActorAbstractPath.FACTORY.createOneOrMorePath(actor_abstract_path_1.ActorAbstractPath.FACTORY.createInv(predicate.path)), operation.subject, operation.graph),
79
+ operation: algebraFactory.createPath(operation.object, algebraFactory.createOneOrMorePath(algebraFactory.createInv(predicate.path)), operation.subject, operation.graph),
76
80
  });
77
81
  }
78
82
  // If (!sVar && !oVar)
79
- const variable = this.generateVariable();
80
- const results = bus_query_operation_1.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({
83
+ const variable = this.generateVariable(dataFactory);
84
+ const results = (0, utils_query_operation_1.getSafeBindings)(await this.mediatorQueryOperation.mediate({
81
85
  context,
82
- operation: actor_abstract_path_1.ActorAbstractPath.FACTORY.createPath(operation.subject, predicate, variable, operation.graph),
86
+ operation: algebraFactory.createPath(operation.subject, predicate, variable, operation.graph),
83
87
  }));
84
88
  const bindingsStream = results.bindingsStream.transform({
85
89
  filter: item => operation.object.equals(item.get(variable)),
@@ -96,7 +100,8 @@ class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstra
96
100
  bindingsStream,
97
101
  metadata: async () => ({
98
102
  ...await results.metadata(),
99
- variables: operation.graph.termType === 'Variable' ? [operation.graph] : [],
103
+ variables: (operation.graph.termType === 'Variable' ? [operation.graph] : [])
104
+ .map(variable => ({ variable, canBeUndef: false })),
100
105
  }),
101
106
  };
102
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ActorQueryOperationPathOneOrMore.js","sourceRoot":"","sources":["ActorQueryOperationPathOneOrMore.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAClE,iEAA6D;AAG7D,uEAAoE;AAEpE,iDAA4F;AAC5F,qDAA0C;AAE1C;;GAEG;AACH,MAAa,gCAAiC,SAAQ,uCAAiB;IAGrE,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,yBAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,SAAuB,EAAE,OAAuB;QACxE,MAAM,eAAe,GAAG,MAAM,kCAAe,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;QACjG,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC9E,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;YACvB,OAAO,QAAQ,CAAC,SAAS,CAAC;QAC5B,CAAC;QAED,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QAE3B,MAAM,SAAS,GAA2B,SAAS,CAAC,SAAS,CAAC;QAE9D,IAAI,SAAS,CAAC,OAAO,CAAC,QAAQ,KAAK,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC1F,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;YACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,2BAA2B,CACrD,SAAS,CAAC,OAAO,EACjB,SAAS,CAAC,IAAI,EACd,SAAS,EACT,SAAS,CAAC,KAAK,EACf,OAAO,EACP,KAAK,EACL,eAAe,CAChB,CAAC;YACF,MA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AAK,UAAU,CAAC,CAAC;oBACvD,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAE,CAAE,CAAC,CAAC,CAAC,CAAC;oBAC7E,eAAe,CAAC,QAAQ,EAAE,CAAC;gBAC7B,IAAI,CAAC,OAAO,CAAC,CAAC;gBACd,IAAI,EAAE,CAAC;YACT,CAAC;SACF,CAAC,CAAC;QACH,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,cAAc;YACd,QAAQ,EAAE,KAAK,IAAG,EAAE,CAAC,CAAC;gBACpB,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE;gBAC3B,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,CAAE,SAAS,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,EAAE;aAC9E,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AAzID,4EAyIC","sourcesContent":["import { ActorAbstractPath } from '@comunica/actor-abstract-path';\nimport { BindingsFactory } from '@comunica/bindings-factory';\nimport type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';\nimport type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperation } from '@comunica/bus-query-operation';\nimport type { IQueryOperationResultBindings, Bindings, IQueryOperationResult, IActionContext } from '@comunica/types';\nimport { BufferedIterator, MultiTransformIterator, TransformIterator } from 'asynciterator';\nimport { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica Path OneOrMore Query Operation Actor.\n */\nexport class ActorQueryOperationPathOneOrMore extends ActorAbstractPath {\n public readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n\n public constructor(args: IActorQueryOperationPathOneOrMoreArgs) {\n super(args, Algebra.types.ONE_OR_MORE_PATH);\n }\n\n public async runOperation(operation: Algebra.Path, context: IActionContext): Promise<IQueryOperationResult> {\n const bindingsFactory = await BindingsFactory.create(this.mediatorMergeBindingsContext, context);\n const distinct = await this.isPathArbitraryLengthDistinct(context, operation);\n if (distinct.operation) {\n return distinct.operation;\n }\n\n context = distinct.context;\n\n const predicate = <Algebra.OneOrMorePath> operation.predicate;\n\n if (operation.subject.termType !== 'Variable' && operation.object.termType === 'Variable') {\n const objectVar = operation.object;\n const starEval = await this.getObjectsPredicateStarEval(\n operation.subject,\n predicate.path,\n objectVar,\n operation.graph,\n context,\n false,\n bindingsFactory,\n );\n const variables = operation.graph.termType === 'Variable' ? [ objectVar, operation.graph ] : [ objectVar ];\n return {\n type: 'bindings',\n bindingsStream: starEval.bindingsStream,\n metadata: async() => ({ ...await starEval.metadata(), variables }),\n };\n }\n if (operation.subject.termType === 'Variable' && operation.object.termType === 'Variable') {\n // Get all the results of subjects with same predicate, but once, then fill in first variable for those\n const single = ActorAbstractPath.FACTORY.createDistinct(\n ActorAbstractPath.FACTORY\n .createPath(operation.subject, operation.predicate.path, operation.object, operation.graph),\n );\n const results = ActorQueryOperation.getSafeBindings(\n await this.mediatorQueryOperation.mediate({ context, operation: single }),\n );\n const subjectVar = operation.subject;\n const objectVar = operation.object;\n\n const termHashes = {};\n\n const bindingsStream: MultiTransformIterator<Bindings, Bindings> = new MultiTransformIterator(\n results.bindingsStream,\n {\n multiTransform: (bindings: Bindings) => {\n const subject = bindings.get(subjectVar);\n const object = bindings.get(objectVar);\n const graph = operation.graph.termType === 'Variable' ? bindings.get(operation.graph) : operation.graph;\n return new TransformIterator<Bindings>(\n async() => {\n const it = new BufferedIterator<Bindings>();\n await this.getSubjectAndObjectBindingsPredicateStar(\n subjectVar,\n objectVar,\n subject!,\n object!,\n predicate.path,\n graph!,\n context,\n termHashes,\n {},\n it,\n { count: 0 },\n bindingsFactory,\n );\n return it.transform<Bindings>({\n transform(item, next, push) {\n if (operation.graph.termType === 'Variable') {\n item = item.set(operation.graph, graph!);\n }\n push(item);\n next();\n },\n });\n },\n { maxBufferSize: 128 },\n );\n },\n autoStart: false,\n },\n );\n const variables = operation.graph.termType === 'Variable' ?\n [ subjectVar, objectVar, operation.graph ] :\n [ subjectVar, objectVar ];\n return {\n type: 'bindings',\n bindingsStream,\n metadata: async() => ({ ...await results.metadata(), variables }),\n };\n }\n if (operation.subject.termType === 'Variable' && operation.object.termType !== 'Variable') {\n return <Promise<IQueryOperationResultBindings>> this.mediatorQueryOperation.mediate({\n context,\n operation: ActorAbstractPath.FACTORY.createPath(\n operation.object,\n ActorAbstractPath.FACTORY.createOneOrMorePath(\n ActorAbstractPath.FACTORY.createInv(predicate.path),\n ),\n operation.subject,\n operation.graph,\n ),\n });\n }\n // If (!sVar && !oVar)\n const variable = this.generateVariable();\n const results = ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({\n context,\n operation: ActorAbstractPath.FACTORY.createPath(operation.subject, predicate, variable, operation.graph),\n }));\n const bindingsStream = results.bindingsStream.transform<Bindings>({\n filter: item => operation.object.equals(item.get(variable)),\n transform(item, next, push) {\n const binding = operation.graph.termType === 'Variable' ?\n bindingsFactory.bindings([[ operation.graph, item.get(operation.graph)! ]]) :\n bindingsFactory.bindings();\n push(binding);\n next();\n },\n });\n return {\n type: 'bindings',\n bindingsStream,\n metadata: async() => ({\n ...await results.metadata(),\n variables: operation.graph.termType === 'Variable' ? [ operation.graph ] : [],\n }),\n };\n }\n}\n\nexport interface IActorQueryOperationPathOneOrMoreArgs extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for creating binding context merge handlers\n */\n mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n}\n"]}
1
+ {"version":3,"file":"ActorQueryOperationPathOneOrMore.js","sourceRoot":"","sources":["ActorQueryOperationPathOneOrMore.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAGlE,+DAA0D;AAQ1D,6EAAmE;AACnE,2EAAkE;AAClE,iDAA4F;AAC5F,qDAAmD;AAEnD;;GAEG;AACH,MAAa,gCAAiC,SAAQ,uCAAiB;IAGrE,YAA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AC;oBACvD,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAE,CAAE,CAAC,CAAC,CAAC,CAAC;oBAC7E,eAAe,CAAC,QAAQ,EAAE,CAAC;gBAC7B,IAAI,CAAC,OAAO,CAAC,CAAC;gBACd,IAAI,EAAE,CAAC;YACT,CAAC;SACF,CAAC,CAAC;QACH,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,cAAc;YACd,QAAQ,EAAE,KAAK,IAAG,EAAE,CAAC,CAAC;gBACpB,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE;gBAC3B,SAAS,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,CAAE,SAAS,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBAC5E,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;aACtD,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AAlJD,4EAkJC","sourcesContent":["import { ActorAbstractPath } from '@comunica/actor-abstract-path';\nimport type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';\nimport type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type {\n IQueryOperationResultBindings,\n Bindings,\n IQueryOperationResult,\n IActionContext,\n ComunicaDataFactory,\n} from '@comunica/types';\nimport { BindingsFactory } from '@comunica/utils-bindings-factory';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport { BufferedIterator, MultiTransformIterator, TransformIterator } from 'asynciterator';\nimport { Algebra, Factory } from 'sparqlalgebrajs';\n\n/**\n * A comunica Path OneOrMore Query Operation Actor.\n */\nexport class ActorQueryOperationPathOneOrMore extends ActorAbstractPath {\n public readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n\n public constructor(args: IActorQueryOperationPathOneOrMoreArgs) {\n super(args, Algebra.types.ONE_OR_MORE_PATH);\n }\n\n public async runOperation(operation: Algebra.Path, context: IActionContext): Promise<IQueryOperationResult> {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new Factory(dataFactory);\n const bindingsFactory = await BindingsFactory.create(\n this.mediatorMergeBindingsContext,\n context,\n dataFactory,\n );\n\n const distinct = await this.isPathArbitraryLengthDistinct(algebraFactory, context, operation);\n if (distinct.operation) {\n return distinct.operation;\n }\n\n context = distinct.context;\n\n const predicate = <Algebra.OneOrMorePath> operation.predicate;\n\n if (operation.subject.termType !== 'Variable' && operation.object.termType === 'Variable') {\n const objectVar = operation.object;\n const starEval = await this.getObjectsPredicateStarEval(\n operation.subject,\n predicate.path,\n objectVar,\n operation.graph,\n context,\n false,\n algebraFactory,\n bindingsFactory,\n );\n const variables = (operation.graph.termType === 'Variable' ? [ objectVar, operation.graph ] : [ objectVar ])\n .map(variable => ({ variable, canBeUndef: false }));\n return {\n type: 'bindings',\n bindingsStream: starEval.bindingsStream,\n metadata: async() => ({ ...await starEval.metadata(), variables }),\n };\n }\n if (operation.subject.termType === 'Variable' && operation.object.termType === 'Variable') {\n // Get all the results of subjects with same predicate, but once, then fill in first variable for those\n const single = algebraFactory.createDistinct(\n algebraFactory.createPath(operation.subject, operation.predicate.path, operation.object, operation.graph),\n );\n const results = getSafeBindings(\n await this.mediatorQueryOperation.mediate({ context, operation: single }),\n );\n const subjectVar = operation.subject;\n const objectVar = operation.object;\n\n const termHashes = {};\n\n const bindingsStream: MultiTransformIterator<Bindings, Bindings> = new MultiTransformIterator(\n results.bindingsStream,\n {\n multiTransform: (bindings: Bindings) => {\n const subject = bindings.get(subjectVar);\n const object = bindings.get(objectVar);\n const graph = operation.graph.termType === 'Variable' ? bindings.get(operation.graph) : operation.graph;\n return new TransformIterator<Bindings>(\n async() => {\n const it = new BufferedIterator<Bindings>();\n await this.getSubjectAndObjectBindingsPredicateStar(\n subjectVar,\n objectVar,\n subject!,\n object!,\n predicate.path,\n graph!,\n context,\n termHashes,\n {},\n it,\n { count: 0 },\n algebraFactory,\n bindingsFactory,\n );\n return it.transform<Bindings>({\n transform(item, next, push) {\n if (operation.graph.termType === 'Variable') {\n item = item.set(operation.graph, graph!);\n }\n push(item);\n next();\n },\n });\n },\n { maxBufferSize: 128 },\n );\n },\n autoStart: false,\n },\n );\n const variables = (operation.graph.termType === 'Variable' ?\n [ subjectVar, objectVar, operation.graph ] :\n [ subjectVar, objectVar ])\n .map(variable => ({ variable, canBeUndef: false }));\n return {\n type: 'bindings',\n bindingsStream,\n metadata: async() => ({ ...await results.metadata(), variables }),\n };\n }\n if (operation.subject.termType === 'Variable' && operation.object.termType !== 'Variable') {\n return <Promise<IQueryOperationResultBindings>> this.mediatorQueryOperation.mediate({\n context,\n operation: algebraFactory.createPath(\n operation.object,\n algebraFactory.createOneOrMorePath(algebraFactory.createInv(predicate.path)),\n operation.subject,\n operation.graph,\n ),\n });\n }\n // If (!sVar && !oVar)\n const variable = this.generateVariable(dataFactory);\n const results = getSafeBindings(await this.mediatorQueryOperation.mediate({\n context,\n operation: algebraFactory.createPath(operation.subject, predicate, variable, operation.graph),\n }));\n const bindingsStream = results.bindingsStream.transform<Bindings>({\n filter: item => operation.object.equals(item.get(variable)),\n transform(item, next, push) {\n const binding = operation.graph.termType === 'Variable' ?\n bindingsFactory.bindings([[ operation.graph, item.get(operation.graph)! ]]) :\n bindingsFactory.bindings();\n push(binding);\n next();\n },\n });\n return {\n type: 'bindings',\n bindingsStream,\n metadata: async() => ({\n ...await results.metadata(),\n variables: (operation.graph.termType === 'Variable' ? [ operation.graph ] : [])\n .map(variable => ({ variable, canBeUndef: false })),\n }),\n };\n }\n}\n\nexport interface IActorQueryOperationPathOneOrMoreArgs extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for creating binding context merge handlers\n */\n mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n}\n"]}
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-path-one-or-more",
3
- "version": "3.3.0",
3
+ "version": "4.0.1",
4
4
  "description": "A path-one-or-more 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,13 +41,15 @@
37
41
  "build:components": "componentsjs-generator"
38
42
  },
39
43
  "dependencies": {
40
- "@comunica/actor-abstract-path": "^3.3.0",
41
- "@comunica/bindings-factory": "^3.3.0",
42
- "@comunica/bus-merge-bindings-context": "^3.3.0",
43
- "@comunica/bus-query-operation": "^3.3.0",
44
- "@comunica/types": "^3.3.0",
44
+ "@comunica/actor-abstract-path": "^4.0.1",
45
+ "@comunica/bus-merge-bindings-context": "^4.0.1",
46
+ "@comunica/bus-query-operation": "^4.0.1",
47
+ "@comunica/context-entries": "^4.0.1",
48
+ "@comunica/types": "^4.0.1",
49
+ "@comunica/utils-bindings-factory": "^4.0.1",
50
+ "@comunica/utils-query-operation": "^4.0.1",
45
51
  "asynciterator": "^3.9.0",
46
- "sparqlalgebrajs": "^4.3.7"
52
+ "sparqlalgebrajs": "^4.3.8"
47
53
  },
48
- "gitHead": "02bde397d206f1f5a523643a6a604c89e792e2f9"
54
+ "gitHead": "67831ba79e45ea1ced41fe3f83c5d6e8802dbeaa"
49
55
  }