@comunica/actor-query-operation-path-one-or-more 4.4.2-alpha.49.0 → 5.0.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/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/^4.0.0/components/context.jsonld"
25
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-one-or-more/^5.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/^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"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-one-or-more/^5.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^5.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^5.0.0/components/context.jsonld",
6
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^5.0.0/components/context.jsonld"
7
7
  ],
8
8
  "@id": "npmd:@comunica/actor-query-operation-path-one-or-more",
9
9
  "components": [
@@ -45,37 +45,37 @@
45
45
  "genericTypeInstances": [
46
46
  {
47
47
  "@type": "ParameterRangeGenericTypeReference",
48
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
48
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
49
49
  },
50
50
  {
51
51
  "@type": "ParameterRangeGenericTypeReference",
52
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
52
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
53
53
  },
54
54
  {
55
55
  "@type": "ParameterRangeGenericTypeReference",
56
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
56
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
57
57
  },
58
58
  {
59
59
  "@type": "ParameterRangeGenericTypeReference",
60
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
60
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
61
61
  }
62
62
  ]
63
63
  },
64
64
  {
65
65
  "@type": "ParameterRangeGenericTypeReference",
66
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
66
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
67
67
  },
68
68
  {
69
69
  "@type": "ParameterRangeGenericTypeReference",
70
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
70
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
71
71
  },
72
72
  {
73
73
  "@type": "ParameterRangeGenericTypeReference",
74
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
74
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
75
75
  },
76
76
  {
77
77
  "@type": "ParameterRangeGenericTypeReference",
78
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
78
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
79
79
  }
80
80
  ]
81
81
  },
@@ -112,19 +112,19 @@
112
112
  "genericTypeInstances": [
113
113
  {
114
114
  "@type": "ParameterRangeGenericTypeReference",
115
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
115
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
116
116
  },
117
117
  {
118
118
  "@type": "ParameterRangeGenericTypeReference",
119
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
119
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
120
120
  },
121
121
  {
122
122
  "@type": "ParameterRangeGenericTypeReference",
123
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
123
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
124
124
  },
125
125
  {
126
126
  "@type": "ParameterRangeGenericTypeReference",
127
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
127
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
128
128
  }
129
129
  ]
130
130
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-one-or-more/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-one-or-more/^5.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/^4.0.0/",
6
+ "caqopoom": "npmd:@comunica/actor-query-operation-path-one-or-more/^5.0.0/",
7
7
  "ActorQueryOperationPathOneOrMore": {
8
8
  "@id": "caqopoom:components/ActorQueryOperationPathOneOrMore.jsonld#ActorQueryOperationPathOneOrMore",
9
9
  "@prefix": true,
@@ -11,8 +11,10 @@ const asynciterator_1 = require("asynciterator");
11
11
  * A comunica Path OneOrMore Query Operation Actor.
12
12
  */
13
13
  class ActorQueryOperationPathOneOrMore extends actor_abstract_path_1.ActorAbstractPath {
14
+ mediatorMergeBindingsContext;
14
15
  constructor(args) {
15
16
  super(args, utils_algebra_1.Algebra.Types.ONE_OR_MORE_PATH);
17
+ this.mediatorMergeBindingsContext = args.mediatorMergeBindingsContext;
16
18
  }
17
19
  async runOperation(operation, context) {
18
20
  const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
@@ -1 +1 @@
1
- {"version":3,"file":"ActorQueryOperationPathOneOrMore.js","sourceRoot":"","sources":["ActorQueryOperationPathOneOrMore.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAGlE,+DAA0D;AAQ1D,2DAAkE;AAClE,6EAAmE;AACnE,2EAAkE;AAClE,iDAA4F;AAE5F;;GAEG;AACH,MAAa,gCAAiC,SAAQ,uCAAiB;IAGrE,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,uBAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,SAAuB,EAAE,OAAuB;QACxE,MAAM,WAAW,GAAwB,OAAO,CAAC,OAAO,CAAC,+BAAa,CAAC,WAAW,CAAC,CAAC;QACpF,MAAM,cAAc,GAAG,IAAI,8BAAc,CAAC,WAAW,CAAC,CAAC;QACvD,MAAM,eAAe,GAAG,MAAM,wCAAe,CAAC,MAAM,CAClD,IAAI,CAAC,4BAA4B,EACjC,OAAO,EACP,WAAW,CACZ,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAAC,cAAc,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAC9F,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;YACvB,OAAO,QAAQ,CAAC,SAAS,CAA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IC","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 { Algebra, AlgebraFactory } from '@comunica/utils-algebra';\nimport { BindingsFactory } from '@comunica/utils-bindings-factory';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport { BufferedIterator, MultiTransformIterator, TransformIterator } from 'asynciterator';\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 AlgebraFactory(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, 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.map<Bindings>((item) => {\n if (operation.graph.termType === 'Variable') {\n item = item.set(operation.graph, graph!);\n }\n return item;\n });\n },\n { autoStart: false, 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.map<Bindings>((item) => {\n if (operation.object.equals(item.get(variable))) {\n return operation.graph.termType === 'Variable' ?\n bindingsFactory.bindings([[ operation.graph, item.get(operation.graph)! ]]) :\n bindingsFactory.bindings();\n }\n return null;\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"]}
1
+ {"version":3,"file":"ActorQueryOperationPathOneOrMore.js","sourceRoot":"","sources":["ActorQueryOperationPathOneOrMore.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAGlE,+DAA0D;AAQ1D,2DAAkE;AAClE,6EAAmE;AACnE,2EAAkE;AAClE,iDAA4F;AAE5F;;GAEG;AACH,MAAa,gCAAiC,SAAQ,uCAAiB;IACrD,4BAA4B,CAA+B;IAE3E,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,uBAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC5C,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,4BAA4B,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,SAAuB,EAAE,OAAuB;QACxE,MAAM,WAAW,GAAwB,OAAO,CAAC,OAAO,CAAC,+BAAa,CAAC,WAAW,CAAC,CAAC;QACpF,MAAM,cAAc,GAAG,IAAI,8BAAc,CAAC,WAAW,CAAC,CAAC;QACvD,MAAM,eAAe,GAAG,MAAM,wCAAe,CAAC,MAAM,CAClD,IAAI,CAAC,4BAA4B,EACjC,OAAO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C,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;AA9ID,4EA8IC","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 { Algebra, AlgebraFactory } from '@comunica/utils-algebra';\nimport { BindingsFactory } from '@comunica/utils-bindings-factory';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport { BufferedIterator, MultiTransformIterator, TransformIterator } from 'asynciterator';\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 this.mediatorMergeBindingsContext = args.mediatorMergeBindingsContext;\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 AlgebraFactory(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, 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.map<Bindings>((item) => {\n if (operation.graph.termType === 'Variable') {\n item = item.set(operation.graph, graph!);\n }\n return item;\n });\n },\n { autoStart: false, 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.map<Bindings>((item) => {\n if (operation.object.equals(item.get(variable))) {\n return operation.graph.termType === 'Variable' ?\n bindingsFactory.bindings([[ operation.graph, item.get(operation.graph)! ]]) :\n bindingsFactory.bindings();\n }\n return null;\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,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-path-one-or-more",
3
- "version": "4.4.2-alpha.49.0",
3
+ "version": "5.0.0",
4
4
  "description": "A path-one-or-more query-operation actor",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -41,15 +41,15 @@
41
41
  "build:components": "componentsjs-generator"
42
42
  },
43
43
  "dependencies": {
44
- "@comunica/actor-abstract-path": "4.4.2-alpha.49.0",
45
- "@comunica/bus-merge-bindings-context": "4.4.2-alpha.49.0",
46
- "@comunica/bus-query-operation": "4.4.2-alpha.49.0",
47
- "@comunica/context-entries": "4.4.2-alpha.49.0",
48
- "@comunica/types": "4.4.2-alpha.49.0",
49
- "@comunica/utils-algebra": "4.4.2-alpha.49.0",
50
- "@comunica/utils-bindings-factory": "4.4.2-alpha.49.0",
51
- "@comunica/utils-query-operation": "4.4.2-alpha.49.0",
44
+ "@comunica/actor-abstract-path": "^5.0.0",
45
+ "@comunica/bus-merge-bindings-context": "^5.0.0",
46
+ "@comunica/bus-query-operation": "^5.0.0",
47
+ "@comunica/context-entries": "^5.0.0",
48
+ "@comunica/types": "^5.0.0",
49
+ "@comunica/utils-algebra": "^5.0.0",
50
+ "@comunica/utils-bindings-factory": "^5.0.0",
51
+ "@comunica/utils-query-operation": "^5.0.0",
52
52
  "asynciterator": "^3.10.0"
53
53
  },
54
- "gitHead": "ef6f96cfd8faf7c37955bb7e0fe9f6fc6a994bdf"
54
+ "gitHead": "0b1756fdb9bef014133432489627c1bd71779bd0"
55
55
  }