@comunica/actor-query-operation-from-quad 4.5.0 → 5.0.2

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
@@ -23,7 +23,7 @@ After installing, this package can be added to your engine's configuration as fo
23
23
  {
24
24
  "@context": [
25
25
  ...
26
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^4.0.0/components/context.jsonld"
26
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^5.0.0/components/context.jsonld"
27
27
  ],
28
28
  "actors": [
29
29
  ...
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^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"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^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
6
  ],
7
7
  "@id": "npmd:@comunica/actor-query-operation-from-quad",
8
8
  "components": [
@@ -15,7 +15,17 @@
15
15
  "@type": "GenericComponentExtension",
16
16
  "component": "cbqo:components/ActorQueryOperationTypedMediated.jsonld#ActorQueryOperationTypedMediated",
17
17
  "genericTypeInstances": [
18
- "urn:npm:sparqlalgebrajs:From"
18
+ {
19
+ "@type": "ParameterRangeIntersection",
20
+ "parameterRangeElements": [
21
+ {
22
+ "@type": "ParameterRangeWildcard"
23
+ },
24
+ {
25
+ "@type": "ParameterRangeWildcard"
26
+ }
27
+ ]
28
+ }
19
29
  ]
20
30
  }
21
31
  ],
@@ -45,37 +55,37 @@
45
55
  "genericTypeInstances": [
46
56
  {
47
57
  "@type": "ParameterRangeGenericTypeReference",
48
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
58
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
49
59
  },
50
60
  {
51
61
  "@type": "ParameterRangeGenericTypeReference",
52
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
62
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
53
63
  },
54
64
  {
55
65
  "@type": "ParameterRangeGenericTypeReference",
56
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
66
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
57
67
  },
58
68
  {
59
69
  "@type": "ParameterRangeGenericTypeReference",
60
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
70
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
61
71
  }
62
72
  ]
63
73
  },
64
74
  {
65
75
  "@type": "ParameterRangeGenericTypeReference",
66
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
76
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
67
77
  },
68
78
  {
69
79
  "@type": "ParameterRangeGenericTypeReference",
70
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
80
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
71
81
  },
72
82
  {
73
83
  "@type": "ParameterRangeGenericTypeReference",
74
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
84
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
75
85
  },
76
86
  {
77
87
  "@type": "ParameterRangeGenericTypeReference",
78
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
88
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
79
89
  }
80
90
  ]
81
91
  },
@@ -112,19 +122,19 @@
112
122
  "genericTypeInstances": [
113
123
  {
114
124
  "@type": "ParameterRangeGenericTypeReference",
115
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
125
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
116
126
  },
117
127
  {
118
128
  "@type": "ParameterRangeGenericTypeReference",
119
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
129
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
120
130
  },
121
131
  {
122
132
  "@type": "ParameterRangeGenericTypeReference",
123
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
133
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
124
134
  },
125
135
  {
126
136
  "@type": "ParameterRangeGenericTypeReference",
127
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
137
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
128
138
  }
129
139
  ]
130
140
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-from-quad/^5.0.0/components/context.jsonld"
4
4
  ],
5
5
  "@id": "npmd:@comunica/actor-query-operation-from-quad",
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
- "caqofq": "npmd:@comunica/actor-query-operation-from-quad/^4.0.0/",
6
+ "caqofq": "npmd:@comunica/actor-query-operation-from-quad/^5.0.0/",
7
7
  "ActorQueryOperationFromQuad": {
8
8
  "@id": "caqofq:components/ActorQueryOperationFromQuad.jsonld#ActorQueryOperationFromQuad",
9
9
  "@prefix": true,
@@ -2,8 +2,8 @@ import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-
2
2
  import { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';
3
3
  import type { IActorTest, TestResult } from '@comunica/core';
4
4
  import type { IActionContext, IQueryOperationResult } from '@comunica/types';
5
+ import { Algebra, AlgebraFactory } from '@comunica/utils-algebra';
5
6
  import type * as RDF from '@rdfjs/types';
6
- import { Algebra, Factory } from 'sparqlalgebrajs';
7
7
  /**
8
8
  * A comunica From Query Operation Actor.
9
9
  */
@@ -26,7 +26,7 @@ export declare class ActorQueryOperationFromQuad extends ActorQueryOperationType
26
26
  * @param {RDF.Term[]} defaultGraphs Graph terms.
27
27
  * @return {Operation} A new operation.
28
28
  */
29
- static applyOperationDefaultGraph(algebraFactory: Factory, operation: Algebra.Operation, defaultGraphs: RDF.Term[]): Algebra.Operation;
29
+ static applyOperationDefaultGraph(algebraFactory: AlgebraFactory, operation: Algebra.Operation, defaultGraphs: RDF.Term[]): Algebra.Operation;
30
30
  /**
31
31
  * Recursively transform the given operation to use the given graphs as named graph
32
32
  * This will (possibly) create a new operation and not modify the given operation.
@@ -37,7 +37,7 @@ export declare class ActorQueryOperationFromQuad extends ActorQueryOperationType
37
37
  * @param {RDF.Term[]} defaultGraphs Default graph terms.
38
38
  * @return {Operation} A new operation.
39
39
  */
40
- static applyOperationNamedGraph(algebraFactory: Factory, operation: Algebra.Operation, namedGraphs: RDF.NamedNode[], defaultGraphs: RDF.Term[]): Algebra.Operation;
40
+ static applyOperationNamedGraph(algebraFactory: AlgebraFactory, operation: Algebra.Operation, namedGraphs: RDF.NamedNode[], defaultGraphs: RDF.Term[]): Algebra.Operation;
41
41
  /**
42
42
  * Transform the given array of operations into a join operation.
43
43
  * @package
@@ -45,7 +45,7 @@ export declare class ActorQueryOperationFromQuad extends ActorQueryOperationType
45
45
  * @param {Operation[]} operations An array of operations, must contain at least one operation.
46
46
  * @return {Join} A join operation.
47
47
  */
48
- static joinOperations(algebraFactory: Factory, operations: Algebra.Operation[]): Algebra.Operation;
48
+ static joinOperations(algebraFactory: AlgebraFactory, operations: Algebra.Operation[]): Algebra.Operation;
49
49
  /**
50
50
  * Transform the given array of operations into a union operation.
51
51
  * @package
@@ -53,7 +53,7 @@ export declare class ActorQueryOperationFromQuad extends ActorQueryOperationType
53
53
  * @param {Operation[]} operations An array of operations, must contain at least one operation.
54
54
  * @return {Union} A union operation.
55
55
  */
56
- static unionOperations(algebraFactory: Factory, operations: Algebra.Operation[]): Algebra.Operation;
56
+ static unionOperations(algebraFactory: AlgebraFactory, operations: Algebra.Operation[]): Algebra.Operation;
57
57
  /**
58
58
  * Transform an operation based on the default and named graphs in the pattern.
59
59
  *
@@ -68,7 +68,7 @@ export declare class ActorQueryOperationFromQuad extends ActorQueryOperationType
68
68
  * @param {From} pattern A from operation.
69
69
  * @return {Operation} The transformed operation.
70
70
  */
71
- static createOperation(algebraFactory: Factory, pattern: Algebra.From): Algebra.Operation;
71
+ static createOperation(algebraFactory: AlgebraFactory, pattern: Algebra.From): Algebra.Operation;
72
72
  testOperation(_operation: Algebra.From, _context: IActionContext): Promise<TestResult<IActorTest>>;
73
73
  runOperation(operationOriginal: Algebra.From, context: IActionContext): Promise<IQueryOperationResult>;
74
74
  }
@@ -4,13 +4,14 @@ exports.ActorQueryOperationFromQuad = void 0;
4
4
  const bus_query_operation_1 = require("@comunica/bus-query-operation");
5
5
  const context_entries_1 = require("@comunica/context-entries");
6
6
  const core_1 = require("@comunica/core");
7
- const sparqlalgebrajs_1 = require("sparqlalgebrajs");
7
+ const utils_algebra_1 = require("@comunica/utils-algebra");
8
8
  /**
9
9
  * A comunica From Query Operation Actor.
10
10
  */
11
11
  class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperationTypedMediated {
12
+ static ALGEBRA_TYPES = Object.keys(utils_algebra_1.Algebra.Types).map(key => utils_algebra_1.Algebra.Types[key]);
12
13
  constructor(args) {
13
- super(args, 'from');
14
+ super(args, utils_algebra_1.Algebra.Types.FROM);
14
15
  }
15
16
  /**
16
17
  * Create a deep copy of the given operation.
@@ -20,21 +21,22 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
20
21
  */
21
22
  static copyOperation(operation, recursiveCb) {
22
23
  const copiedOperation = {};
23
- for (const key of Object.keys(operation)) {
24
- if (Array.isArray(operation[key]) && key !== 'template') {
24
+ for (const [key, value] of Object.entries(operation)) {
25
+ const castedKey = key;
26
+ if (Array.isArray(value) && key !== 'template') {
25
27
  // We exclude the 'template' entry, as we don't want to modify the template value of construct operations
26
28
  if (key === 'variables') {
27
- copiedOperation[key] = operation[key];
29
+ copiedOperation[castedKey] = value;
28
30
  }
29
31
  else {
30
- copiedOperation[key] = operation[key].map(recursiveCb);
32
+ copiedOperation[castedKey] = value.map(recursiveCb);
31
33
  }
32
34
  }
33
- else if (ActorQueryOperationFromQuad.ALGEBRA_TYPES.includes(operation[key].type)) {
34
- copiedOperation[key] = recursiveCb(operation[key]);
35
+ else if (ActorQueryOperationFromQuad.ALGEBRA_TYPES.includes(value.type)) {
36
+ copiedOperation[castedKey] = recursiveCb(value);
35
37
  }
36
38
  else {
37
- copiedOperation[key] = operation[key];
39
+ copiedOperation[castedKey] = value;
38
40
  }
39
41
  }
40
42
  return copiedOperation;
@@ -50,10 +52,9 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
50
52
  */
51
53
  static applyOperationDefaultGraph(algebraFactory, operation, defaultGraphs) {
52
54
  // If the operation is a BGP or Path, change the graph.
53
- if ((operation.type === 'bgp' && operation.patterns.length > 0) ||
54
- operation.type === 'path' ||
55
- operation.type === 'pattern') {
56
- if (operation.type === 'bgp') {
55
+ if (((0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.BGP) && operation.patterns.length > 0) ||
56
+ (0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.PATH) || (0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.PATTERN)) {
57
+ if ((0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.BGP)) {
57
58
  return ActorQueryOperationFromQuad
58
59
  .joinOperations(algebraFactory, operation.patterns.map((pattern) => {
59
60
  if (pattern.graph.termType !== 'DefaultGraph') {
@@ -68,7 +69,7 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
68
69
  return operation;
69
70
  }
70
71
  const paths = defaultGraphs.map((graph) => {
71
- if (operation.type === 'path') {
72
+ if ((0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.PATH)) {
72
73
  return algebraFactory
73
74
  .createPath(operation.subject, operation.predicate, operation.object, graph);
74
75
  }
@@ -77,7 +78,7 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
77
78
  });
78
79
  return ActorQueryOperationFromQuad.unionOperations(algebraFactory, paths);
79
80
  }
80
- return ActorQueryOperationFromQuad.copyOperation(operation, (subOperation) => this.applyOperationDefaultGraph(algebraFactory, subOperation, defaultGraphs));
81
+ return ActorQueryOperationFromQuad.copyOperation(operation, subOperation => this.applyOperationDefaultGraph(algebraFactory, subOperation, defaultGraphs));
81
82
  }
82
83
  /**
83
84
  * Recursively transform the given operation to use the given graphs as named graph
@@ -91,21 +92,20 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
91
92
  */
92
93
  static applyOperationNamedGraph(algebraFactory, operation, namedGraphs, defaultGraphs) {
93
94
  // If the operation is a BGP or Path, change the graph.
94
- if ((operation.type === 'bgp' && operation.patterns.length > 0) ||
95
- operation.type === 'path' ||
96
- operation.type === 'pattern') {
95
+ if (((0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.BGP) && operation.patterns.length > 0) ||
96
+ (0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.PATH) || (0, utils_algebra_1.isKnownOperation)(operation, utils_algebra_1.Algebra.Types.PATTERN)) {
97
97
  const patternGraph = operation.type === 'bgp' ? operation.patterns[0].graph : operation.graph;
98
98
  if (patternGraph.termType === 'DefaultGraph') {
99
99
  // SPARQL spec (8.2) describes that when FROM NAMED's are used without a FROM, the default graph must be empty.
100
100
  // The FROMs are transformed before this step to a named node, so this will not apply to this case anymore.
101
- return { type: sparqlalgebrajs_1.Algebra.types.BGP, patterns: [] };
101
+ return algebraFactory.createBgp([]);
102
102
  }
103
103
  if (patternGraph.termType === 'Variable') {
104
104
  if (namedGraphs.length === 1) {
105
105
  const graph = namedGraphs[0];
106
106
  // If the pattern graph is a variable, replace the graph and bind the variable using VALUES
107
107
  const bindings = {};
108
- bindings[`?${patternGraph.value}`] = graph;
108
+ bindings[patternGraph.value] = graph;
109
109
  const values = algebraFactory
110
110
  .createValues([patternGraph], [bindings]);
111
111
  let pattern;
@@ -134,7 +134,7 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
134
134
  return operation;
135
135
  }
136
136
  // No-op if the pattern's graph was not selected in a FROM NAMED.
137
- return { type: sparqlalgebrajs_1.Algebra.types.BGP, patterns: [] };
137
+ return algebraFactory.createBgp([]);
138
138
  }
139
139
  return ActorQueryOperationFromQuad.copyOperation(operation, (subOperation) => this
140
140
  .applyOperationNamedGraph(algebraFactory, subOperation, namedGraphs, defaultGraphs));
@@ -201,11 +201,10 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
201
201
  }
202
202
  async runOperation(operationOriginal, context) {
203
203
  const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
204
- const algebraFactory = new sparqlalgebrajs_1.Factory(dataFactory);
204
+ const algebraFactory = new utils_algebra_1.AlgebraFactory(dataFactory);
205
205
  const operation = ActorQueryOperationFromQuad.createOperation(algebraFactory, operationOriginal);
206
206
  return this.mediatorQueryOperation.mediate({ operation, context });
207
207
  }
208
208
  }
209
209
  exports.ActorQueryOperationFromQuad = ActorQueryOperationFromQuad;
210
- ActorQueryOperationFromQuad.ALGEBRA_TYPES = Object.keys(sparqlalgebrajs_1.Algebra.types).map(key => sparqlalgebrajs_1.Algebra.types[key]);
211
210
  //# sourceMappingURL=ActorQueryOperationFromQuad.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActorQueryOperationFromQuad.js","sourceRoot":"","sources":["ActorQueryOperationFromQuad.ts"],"names":[],"mappings":";;;AACA,uEAAiF;AACjF,+DAA0D;AAE1D,yCAA8C;AAG9C,qDAAmD;AAEnD;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sDAA8C;IAG7F,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CACzB,SAA4B,EAC5B,WAAmE;QAEnE,MAAM,eAAe,GAA4B,EAAE,CAAC;QACpD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;gBACxD,yGAAyG;gBACzG,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;oBACxB,eAAe,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;gBACxC,CAAC;qBAAM,CAAC;oBACN,eAAe,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;iBAAM,IAAI,2BAA2B,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC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,aAAa,CAAC,UAAwB,EAAE,QAAwB;QAC3E,OAAO,IAAA,mBAAY,GAAE,CAAC;IACxB,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;QAEhD,MAAM,SAAS,GAAsB,2BAA2B,CAAC,eAAe,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;QACpH,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;;AAvPH,kEAwPC;AAvPyB,yCAAa,GAAa,MAAM,CAAC,IAAI,CAAC,yBAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAQ,yBAAO,CAAC,KAAM,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { ComunicaDataFactory, IActionContext, IQueryOperationResult } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport { Algebra, Factory } from 'sparqlalgebrajs';\n\n/**\n * A comunica From Query Operation Actor.\n */\nexport class ActorQueryOperationFromQuad extends ActorQueryOperationTypedMediated<Algebra.From> {\n private static readonly ALGEBRA_TYPES: string[] = Object.keys(Algebra.types).map(key => (<any> Algebra.types)[key]);\n\n public constructor(args: IActorQueryOperationTypedMediatedArgs) {\n super(args, 'from');\n }\n\n /**\n * Create a deep copy of the given operation.\n * @param {Operation} operation An operation.\n * @param {(subOperation: Operation) => Operation} recursiveCb A callback for recursive operation calls.\n * @return {Operation} The copied operation.\n */\n public static copyOperation(\n operation: Algebra.Operation,\n recursiveCb: (subOperation: Algebra.Operation) => Algebra.Operation,\n ): Algebra.Operation {\n const copiedOperation: Algebra.Operation = <any> {};\n for (const key of Object.keys(operation)) {\n if (Array.isArray(operation[key]) && key !== 'template') {\n // We exclude the 'template' entry, as we don't want to modify the template value of construct operations\n if (key === 'variables') {\n copiedOperation[key] = operation[key];\n } else {\n copiedOperation[key] = operation[key].map(recursiveCb);\n }\n } else if (ActorQueryOperationFromQuad.ALGEBRA_TYPES.includes(operation[key].type)) {\n copiedOperation[key] = recursiveCb(operation[key]);\n } else {\n copiedOperation[key] = operation[key];\n }\n }\n return copiedOperation;\n }\n\n /**\n * Recursively transform the given operation to use the given graphs as default graph\n * This will (possibly) create a new operation and not modify the given operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation} operation An operation.\n * @param {RDF.Term[]} defaultGraphs Graph terms.\n * @return {Operation} A new operation.\n */\n public static applyOperationDefaultGraph(\n algebraFactory: Factory,\n operation: Algebra.Operation,\n defaultGraphs: RDF.Term[],\n ): Algebra.Operation {\n // If the operation is a BGP or Path, change the graph.\n if ((operation.type === 'bgp' && operation.patterns.length > 0) ||\n operation.type === 'path' ||\n operation.type === 'pattern') {\n if (operation.type === 'bgp') {\n return ActorQueryOperationFromQuad\n .joinOperations(algebraFactory, operation.patterns.map((pattern: Algebra.Pattern) => {\n if (pattern.graph.termType !== 'DefaultGraph') {\n return algebraFactory.createBgp([ pattern ]);\n }\n const bgps = defaultGraphs.map((graph: RDF.Term) =>\n algebraFactory.createBgp([ Object.assign(\n algebraFactory\n .createPattern(pattern.subject, pattern.predicate, pattern.object, graph),\n { metadata: pattern.metadata },\n ) ]));\n return ActorQueryOperationFromQuad.unionOperations(algebraFactory, bgps);\n }));\n }\n if (operation.graph.termType !== 'DefaultGraph') {\n return operation;\n }\n const paths = defaultGraphs.map(\n (graph: RDF.Term) => {\n if (operation.type === 'path') {\n return algebraFactory\n .createPath(operation.subject, operation.predicate, operation.object, graph);\n }\n return Object.assign(algebraFactory\n .createPattern(\n operation.subject,\n operation.predicate,\n operation.object,\n graph,\n ), { metadata: operation.metadata });\n },\n );\n return ActorQueryOperationFromQuad.unionOperations(algebraFactory, paths);\n }\n\n return ActorQueryOperationFromQuad.copyOperation(\n operation,\n (subOperation: Algebra.Operation) => this.applyOperationDefaultGraph(algebraFactory, subOperation, defaultGraphs),\n );\n }\n\n /**\n * Recursively transform the given operation to use the given graphs as named graph\n * This will (possibly) create a new operation and not modify the given operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation} operation An operation.\n * @param {RDF.Term[]} namedGraphs Graph terms.\n * @param {RDF.Term[]} defaultGraphs Default graph terms.\n * @return {Operation} A new operation.\n */\n public static applyOperationNamedGraph(\n algebraFactory: Factory,\n operation: Algebra.Operation,\n namedGraphs: RDF.NamedNode[],\n defaultGraphs: RDF.Term[],\n ): Algebra.Operation {\n // If the operation is a BGP or Path, change the graph.\n if ((operation.type === 'bgp' && operation.patterns.length > 0) ||\n operation.type === 'path' ||\n operation.type === 'pattern') {\n const patternGraph: RDF.Term = operation.type === 'bgp' ? operation.patterns[0].graph : operation.graph;\n if (patternGraph.termType === 'DefaultGraph') {\n // SPARQL spec (8.2) describes that when FROM NAMED's are used without a FROM, the default graph must be empty.\n // The FROMs are transformed before this step to a named node, so this will not apply to this case anymore.\n return { type: Algebra.types.BGP, patterns: []};\n }\n if (patternGraph.termType === 'Variable') {\n if (namedGraphs.length === 1) {\n const graph: RDF.NamedNode = namedGraphs[0];\n // If the pattern graph is a variable, replace the graph and bind the variable using VALUES\n const bindings: Record<string, RDF.Literal | RDF.NamedNode> = {};\n bindings[`?${patternGraph.value}`] = graph;\n const values: Algebra.Values = algebraFactory\n .createValues([ patternGraph ], [ bindings ]);\n\n let pattern: Algebra.Operation;\n if (operation.type === 'bgp') {\n pattern = algebraFactory\n .createBgp(operation.patterns.map((pat: Algebra.Pattern) => algebraFactory\n .createPattern(pat.subject, pat.predicate, pat.object, graph)));\n } else if (operation.type === 'path') {\n pattern = algebraFactory\n .createPath(operation.subject, operation.predicate, operation.object, graph);\n } else {\n pattern = algebraFactory\n .createPattern(operation.subject, operation.predicate, operation.object, graph);\n }\n\n return algebraFactory.createJoin([ values, pattern ]);\n }\n // If the pattern graph is a variable, take the union of the pattern applied to each available named graph\n return ActorQueryOperationFromQuad.unionOperations(algebraFactory, namedGraphs.map(\n (graph: RDF.NamedNode) => ActorQueryOperationFromQuad.applyOperationNamedGraph(\n algebraFactory,\n operation,\n [ graph ],\n defaultGraphs,\n ),\n ));\n }\n // The pattern's graph is defined (including the default graphs)\n const isNamedGraphAvailable: boolean = [ ...namedGraphs, ...defaultGraphs ].some(\n (namedGraph: RDF.Term) => namedGraph.equals(patternGraph),\n );\n if (isNamedGraphAvailable) {\n // Return the pattern as-is if the pattern's graph was selected in a FROM NAMED\n return operation;\n }\n // No-op if the pattern's graph was not selected in a FROM NAMED.\n return { type: Algebra.types.BGP, patterns: []};\n }\n\n return ActorQueryOperationFromQuad.copyOperation(\n operation,\n (subOperation: Algebra.Operation) => this\n .applyOperationNamedGraph(algebraFactory, subOperation, namedGraphs, defaultGraphs),\n );\n }\n\n /**\n * Transform the given array of operations into a join operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation[]} operations An array of operations, must contain at least one operation.\n * @return {Join} A join operation.\n */\n public static joinOperations(algebraFactory: Factory, operations: Algebra.Operation[]): Algebra.Operation {\n if (operations.length === 1) {\n return operations[0];\n }\n if (operations.length > 1) {\n return algebraFactory.createJoin(operations);\n }\n throw new Error('A join can only be applied on at least one operation');\n }\n\n /**\n * Transform the given array of operations into a union operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation[]} operations An array of operations, must contain at least one operation.\n * @return {Union} A union operation.\n */\n public static unionOperations(algebraFactory: Factory, operations: Algebra.Operation[]): Algebra.Operation {\n if (operations.length === 1) {\n return operations[0];\n }\n if (operations.length > 1) {\n return algebraFactory.createUnion(operations);\n }\n throw new Error('A union can only be applied on at least one operation');\n }\n\n /**\n * Transform an operation based on the default and named graphs in the pattern.\n *\n * FROM sets the default graph.\n * If multiple are available, take the union of the operation for all of them at quad-pattern level.\n *\n * FROM NAMED indicates which named graphs are available.\n * This will rewrite the query so that only triples from the given named graphs can be selected.\n *\n * @package\n * @param algebraFactory The algebra factory.\n * @param {From} pattern A from operation.\n * @return {Operation} The transformed operation.\n */\n public static createOperation(algebraFactory: Factory, pattern: Algebra.From): Algebra.Operation {\n let operation: Algebra.Operation = pattern.input;\n if (pattern.default.length > 0) {\n operation = ActorQueryOperationFromQuad.applyOperationDefaultGraph(algebraFactory, operation, pattern.default);\n }\n if (pattern.named.length > 0 || pattern.default.length > 0) {\n operation = ActorQueryOperationFromQuad\n .applyOperationNamedGraph(algebraFactory, operation, pattern.named, pattern.default);\n }\n return operation;\n }\n\n public async testOperation(_operation: Algebra.From, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(\n operationOriginal: Algebra.From,\n context: IActionContext,\n ): Promise<IQueryOperationResult> {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new Factory(dataFactory);\n\n const operation: Algebra.Operation = ActorQueryOperationFromQuad.createOperation(algebraFactory, operationOriginal);\n return this.mediatorQueryOperation.mediate({ operation, context });\n }\n}\n"]}
1
+ {"version":3,"file":"ActorQueryOperationFromQuad.js","sourceRoot":"","sources":["ActorQueryOperationFromQuad.ts"],"names":[],"mappings":";;;AACA,uEAAiF;AACjF,+DAA0D;AAE1D,yCAA8C;AAE9C,2DAAoF;AAGpF;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sDAA8C;IACrF,MAAM,CAAU,aAAa,GAAa,MAAM,CAAC,IAAI,CAAC,uBAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAQ,uBAAO,CAAC,KAAM,C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;QAEvD,MAAM,SAAS,GAAsB,2BAA2B,CAAC,eAAe,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;QACpH,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;;AAtPH,kEAuPC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { ComunicaDataFactory, IActionContext, IQueryOperationResult } from '@comunica/types';\nimport { Algebra, AlgebraFactory, isKnownOperation } from '@comunica/utils-algebra';\nimport type * as RDF from '@rdfjs/types';\n\n/**\n * A comunica From Query Operation Actor.\n */\nexport class ActorQueryOperationFromQuad extends ActorQueryOperationTypedMediated<Algebra.From> {\n private static readonly ALGEBRA_TYPES: string[] = Object.keys(Algebra.Types).map(key => (<any> Algebra.Types)[key]);\n\n public constructor(args: IActorQueryOperationTypedMediatedArgs) {\n super(args, Algebra.Types.FROM);\n }\n\n /**\n * Create a deep copy of the given operation.\n * @param {Operation} operation An operation.\n * @param {(subOperation: Operation) => Operation} recursiveCb A callback for recursive operation calls.\n * @return {Operation} The copied operation.\n */\n public static copyOperation(\n operation: Algebra.Operation,\n recursiveCb: (subOperation: Algebra.Operation) => Algebra.Operation,\n ): Algebra.Operation {\n const copiedOperation: Algebra.Operation = <any> {};\n for (const [ key, value ] of Object.entries(operation)) {\n const castedKey = <keyof typeof operation> key;\n if (Array.isArray(value) && key !== 'template') {\n // We exclude the 'template' entry, as we don't want to modify the template value of construct operations\n if (key === 'variables') {\n copiedOperation[castedKey] = <any> value;\n } else {\n copiedOperation[castedKey] = <any> value.map(recursiveCb);\n }\n } else if (ActorQueryOperationFromQuad.ALGEBRA_TYPES.includes(value.type)) {\n copiedOperation[castedKey] = <any> recursiveCb(value);\n } else {\n copiedOperation[castedKey] = value;\n }\n }\n return copiedOperation;\n }\n\n /**\n * Recursively transform the given operation to use the given graphs as default graph\n * This will (possibly) create a new operation and not modify the given operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation} operation An operation.\n * @param {RDF.Term[]} defaultGraphs Graph terms.\n * @return {Operation} A new operation.\n */\n public static applyOperationDefaultGraph(\n algebraFactory: AlgebraFactory,\n operation: Algebra.Operation,\n defaultGraphs: RDF.Term[],\n ): Algebra.Operation {\n // If the operation is a BGP or Path, change the graph.\n if ((isKnownOperation(operation, Algebra.Types.BGP) && operation.patterns.length > 0) ||\n isKnownOperation(operation, Algebra.Types.PATH) || isKnownOperation(operation, Algebra.Types.PATTERN)) {\n if (isKnownOperation(operation, Algebra.Types.BGP)) {\n return ActorQueryOperationFromQuad\n .joinOperations(algebraFactory, operation.patterns.map((pattern) => {\n if (pattern.graph.termType !== 'DefaultGraph') {\n return algebraFactory.createBgp([ pattern ]);\n }\n const bgps = defaultGraphs.map((graph: RDF.Term) =>\n algebraFactory.createBgp([ Object.assign(\n algebraFactory\n .createPattern(pattern.subject, pattern.predicate, pattern.object, graph),\n { metadata: pattern.metadata },\n ) ]));\n return ActorQueryOperationFromQuad.unionOperations(algebraFactory, bgps);\n }));\n }\n if (operation.graph.termType !== 'DefaultGraph') {\n return operation;\n }\n const paths = defaultGraphs.map(\n (graph: RDF.Term) => {\n if (isKnownOperation(operation, Algebra.Types.PATH)) {\n return algebraFactory\n .createPath(operation.subject, operation.predicate, operation.object, graph);\n }\n return Object.assign(algebraFactory\n .createPattern(\n operation.subject,\n operation.predicate,\n operation.object,\n graph,\n ), { metadata: operation.metadata });\n },\n );\n return ActorQueryOperationFromQuad.unionOperations(algebraFactory, paths);\n }\n\n return ActorQueryOperationFromQuad.copyOperation(\n operation,\n subOperation => this.applyOperationDefaultGraph(algebraFactory, subOperation, defaultGraphs),\n );\n }\n\n /**\n * Recursively transform the given operation to use the given graphs as named graph\n * This will (possibly) create a new operation and not modify the given operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation} operation An operation.\n * @param {RDF.Term[]} namedGraphs Graph terms.\n * @param {RDF.Term[]} defaultGraphs Default graph terms.\n * @return {Operation} A new operation.\n */\n public static applyOperationNamedGraph(\n algebraFactory: AlgebraFactory,\n operation: Algebra.Operation,\n namedGraphs: RDF.NamedNode[],\n defaultGraphs: RDF.Term[],\n ): Algebra.Operation {\n // If the operation is a BGP or Path, change the graph.\n if ((isKnownOperation(operation, Algebra.Types.BGP) && operation.patterns.length > 0) ||\n isKnownOperation(operation, Algebra.Types.PATH) || isKnownOperation(operation, Algebra.Types.PATTERN)) {\n const patternGraph: RDF.Term = operation.type === 'bgp' ? operation.patterns[0].graph : operation.graph;\n if (patternGraph.termType === 'DefaultGraph') {\n // SPARQL spec (8.2) describes that when FROM NAMED's are used without a FROM, the default graph must be empty.\n // The FROMs are transformed before this step to a named node, so this will not apply to this case anymore.\n return algebraFactory.createBgp([]);\n }\n if (patternGraph.termType === 'Variable') {\n if (namedGraphs.length === 1) {\n const graph: RDF.NamedNode = namedGraphs[0];\n // If the pattern graph is a variable, replace the graph and bind the variable using VALUES\n const bindings: Record<string, RDF.Literal | RDF.NamedNode> = {};\n bindings[patternGraph.value] = graph;\n const values: Algebra.Values = algebraFactory\n .createValues([ patternGraph ], [ bindings ]);\n\n let pattern: Algebra.Operation;\n if (operation.type === 'bgp') {\n pattern = algebraFactory\n .createBgp(operation.patterns.map((pat: Algebra.Pattern) => algebraFactory\n .createPattern(pat.subject, pat.predicate, pat.object, graph)));\n } else if (operation.type === 'path') {\n pattern = algebraFactory\n .createPath(operation.subject, operation.predicate, operation.object, graph);\n } else {\n pattern = algebraFactory\n .createPattern(operation.subject, operation.predicate, operation.object, graph);\n }\n\n return algebraFactory.createJoin([ values, pattern ]);\n }\n // If the pattern graph is a variable, take the union of the pattern applied to each available named graph\n return ActorQueryOperationFromQuad.unionOperations(algebraFactory, namedGraphs.map(\n (graph: RDF.NamedNode) => ActorQueryOperationFromQuad.applyOperationNamedGraph(\n algebraFactory,\n operation,\n [ graph ],\n defaultGraphs,\n ),\n ));\n }\n // The pattern's graph is defined (including the default graphs)\n const isNamedGraphAvailable: boolean = [ ...namedGraphs, ...defaultGraphs ].some(\n (namedGraph: RDF.Term) => namedGraph.equals(patternGraph),\n );\n if (isNamedGraphAvailable) {\n // Return the pattern as-is if the pattern's graph was selected in a FROM NAMED\n return operation;\n }\n // No-op if the pattern's graph was not selected in a FROM NAMED.\n return algebraFactory.createBgp([]);\n }\n\n return ActorQueryOperationFromQuad.copyOperation(\n operation,\n (subOperation: Algebra.Operation) => this\n .applyOperationNamedGraph(algebraFactory, subOperation, namedGraphs, defaultGraphs),\n );\n }\n\n /**\n * Transform the given array of operations into a join operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation[]} operations An array of operations, must contain at least one operation.\n * @return {Join} A join operation.\n */\n public static joinOperations(algebraFactory: AlgebraFactory, operations: Algebra.Operation[]): Algebra.Operation {\n if (operations.length === 1) {\n return operations[0];\n }\n if (operations.length > 1) {\n return algebraFactory.createJoin(operations);\n }\n throw new Error('A join can only be applied on at least one operation');\n }\n\n /**\n * Transform the given array of operations into a union operation.\n * @package\n * @param algebraFactory The algebra factory.\n * @param {Operation[]} operations An array of operations, must contain at least one operation.\n * @return {Union} A union operation.\n */\n public static unionOperations(algebraFactory: AlgebraFactory, operations: Algebra.Operation[]): Algebra.Operation {\n if (operations.length === 1) {\n return operations[0];\n }\n if (operations.length > 1) {\n return algebraFactory.createUnion(operations);\n }\n throw new Error('A union can only be applied on at least one operation');\n }\n\n /**\n * Transform an operation based on the default and named graphs in the pattern.\n *\n * FROM sets the default graph.\n * If multiple are available, take the union of the operation for all of them at quad-pattern level.\n *\n * FROM NAMED indicates which named graphs are available.\n * This will rewrite the query so that only triples from the given named graphs can be selected.\n *\n * @package\n * @param algebraFactory The algebra factory.\n * @param {From} pattern A from operation.\n * @return {Operation} The transformed operation.\n */\n public static createOperation(algebraFactory: AlgebraFactory, pattern: Algebra.From): Algebra.Operation {\n let operation: Algebra.Operation = pattern.input;\n if (pattern.default.length > 0) {\n operation = ActorQueryOperationFromQuad.applyOperationDefaultGraph(algebraFactory, operation, pattern.default);\n }\n if (pattern.named.length > 0 || pattern.default.length > 0) {\n operation = ActorQueryOperationFromQuad\n .applyOperationNamedGraph(algebraFactory, operation, pattern.named, pattern.default);\n }\n return operation;\n }\n\n public async testOperation(_operation: Algebra.From, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(\n operationOriginal: Algebra.From,\n context: IActionContext,\n ): Promise<IQueryOperationResult> {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new AlgebraFactory(dataFactory);\n\n const operation: Algebra.Operation = ActorQueryOperationFromQuad.createOperation(algebraFactory, operationOriginal);\n return this.mediatorQueryOperation.mediate({ operation, context });\n }\n}\n"]}
package/lib/index.d.ts CHANGED
File without changes
package/lib/index.js CHANGED
File without changes
package/lib/index.js.map CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-from-quad",
3
- "version": "4.5.0",
3
+ "version": "5.0.2",
4
4
  "description": "A from query-operation actor",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -41,12 +41,12 @@
41
41
  "build:components": "componentsjs-generator"
42
42
  },
43
43
  "dependencies": {
44
- "@comunica/bus-query-operation": "^4.5.0",
45
- "@comunica/context-entries": "^4.5.0",
46
- "@comunica/core": "^4.5.0",
47
- "@comunica/types": "^4.5.0",
48
- "@rdfjs/types": "*",
49
- "sparqlalgebrajs": "^5.0.2"
44
+ "@comunica/bus-query-operation": "^5.0.2",
45
+ "@comunica/context-entries": "^5.0.2",
46
+ "@comunica/core": "^5.0.2",
47
+ "@comunica/types": "^5.0.0",
48
+ "@comunica/utils-algebra": "^5.0.0",
49
+ "@rdfjs/types": "*"
50
50
  },
51
- "gitHead": "2bcd98c387a021fc5c08d375793c205ca3d1bf0d"
51
+ "gitHead": "3b29f914010fd2fc56682a0ceff962ef6ff24f32"
52
52
  }