@comunica/actor-query-operation-from-quad 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
@@ -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": [
@@ -55,37 +55,37 @@
55
55
  "genericTypeInstances": [
56
56
  {
57
57
  "@type": "ParameterRangeGenericTypeReference",
58
- "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"
59
59
  },
60
60
  {
61
61
  "@type": "ParameterRangeGenericTypeReference",
62
- "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"
63
63
  },
64
64
  {
65
65
  "@type": "ParameterRangeGenericTypeReference",
66
- "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"
67
67
  },
68
68
  {
69
69
  "@type": "ParameterRangeGenericTypeReference",
70
- "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"
71
71
  }
72
72
  ]
73
73
  },
74
74
  {
75
75
  "@type": "ParameterRangeGenericTypeReference",
76
- "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"
77
77
  },
78
78
  {
79
79
  "@type": "ParameterRangeGenericTypeReference",
80
- "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"
81
81
  },
82
82
  {
83
83
  "@type": "ParameterRangeGenericTypeReference",
84
- "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"
85
85
  },
86
86
  {
87
87
  "@type": "ParameterRangeGenericTypeReference",
88
- "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"
89
89
  }
90
90
  ]
91
91
  },
@@ -122,19 +122,19 @@
122
122
  "genericTypeInstances": [
123
123
  {
124
124
  "@type": "ParameterRangeGenericTypeReference",
125
- "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"
126
126
  },
127
127
  {
128
128
  "@type": "ParameterRangeGenericTypeReference",
129
- "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"
130
130
  },
131
131
  {
132
132
  "@type": "ParameterRangeGenericTypeReference",
133
- "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"
134
134
  },
135
135
  {
136
136
  "@type": "ParameterRangeGenericTypeReference",
137
- "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"
138
138
  }
139
139
  ]
140
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,
@@ -9,6 +9,7 @@ const utils_algebra_1 = require("@comunica/utils-algebra");
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
14
  super(args, utils_algebra_1.Algebra.Types.FROM);
14
15
  }
@@ -206,5 +207,4 @@ class ActorQueryOperationFromQuad extends bus_query_operation_1.ActorQueryOperat
206
207
  }
207
208
  }
208
209
  exports.ActorQueryOperationFromQuad = ActorQueryOperationFromQuad;
209
- ActorQueryOperationFromQuad.ALGEBRA_TYPES = Object.keys(utils_algebra_1.Algebra.Types).map(key => utils_algebra_1.Algebra.Types[key]);
210
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;AAE9C,2DAAoF;AAGpF;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sDAA8C;IAG7F,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,uBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CACzB,SAA4B,EAC5B,WAAmE;QAEnE,MAAM,eAAe,GAA4B,EAAE,CAAC;QACpD,KAAK,MAAM,CAAE,GAAG,EAAE,KAAK,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACvD,MAAM,SAAS,GAA4B,GAAG,CAAC;YAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC/C,yGAAyG;gBACzG,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;oBACxB,eAAe,CAAC,SAAS,CAAC,GAAS,KAAK,CAAC;gBAC3C,CAAC;qBAAM,CAAC;oBACN,eAAe,CAAC,SAAS,CAAC,GAAS,KAAK,CAAC,GAAG,CAAC,W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CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3D,SAAS,GAAG,2BAA2B;iBACpC,wBAAwB,CAAC,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,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,8BAAc,CAAC,WAAW,CAAC,CAAC;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;AAtPyB,yCAAa,GAAa,MAAM,CAAC,IAAI,CAAC,uBAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAQ,uBAAO,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 { 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"]}
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,CAAC,GAAG,CAAC,CAAC,CAAC;IAEpH,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,uBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CACzB,SAA4B,EAC5B,WAAmE;QAEnE,MAAM,eAAe,GAA4B,EAAE,CAAC;QACpD,KAAK,MAAM,CAAE,GAAG,EAAE,KAAK,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACvD,MAAM,SAAS,GAA4B,GAAG,CAAC;YAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC/C,yGAAyG;gBACzG,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;oBACxB,eAAe,CAAC,SAAS,CAAC,GAAS,KAAK,CAAC;gBAC3C,CAAC;qBAAM,CAAC;oBACN,eAAe,CAAC,SAAS,CAAC,GAAS,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;iBAAM,IAAI,2BAA2B,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CA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SAAS,GAAG,2BAA2B;iBACpC,wBAAwB,CAAC,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,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,8BAAc,CAAC,WAAW,CAAC,CAAC;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-from-quad",
3
- "version": "4.4.2-alpha.49.0",
3
+ "version": "5.0.0",
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.4.2-alpha.49.0",
45
- "@comunica/context-entries": "4.4.2-alpha.49.0",
46
- "@comunica/core": "4.4.2-alpha.49.0",
47
- "@comunica/types": "4.4.2-alpha.49.0",
48
- "@comunica/utils-algebra": "4.4.2-alpha.49.0",
44
+ "@comunica/bus-query-operation": "^5.0.0",
45
+ "@comunica/context-entries": "^5.0.0",
46
+ "@comunica/core": "^5.0.0",
47
+ "@comunica/types": "^5.0.0",
48
+ "@comunica/utils-algebra": "^5.0.0",
49
49
  "@rdfjs/types": "*"
50
50
  },
51
- "gitHead": "ef6f96cfd8faf7c37955bb7e0fe9f6fc6a994bdf"
51
+ "gitHead": "0b1756fdb9bef014133432489627c1bd71779bd0"
52
52
  }