@comunica/actor-query-operation-construct 4.4.2-alpha.49.0 → 4.5.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/components/ActorQueryOperationConstruct.jsonld +1 -11
- package/components/components.jsonld +0 -0
- package/components/context.jsonld +0 -0
- package/lib/ActorQueryOperationConstruct.d.ts +1 -1
- package/lib/ActorQueryOperationConstruct.js +3 -4
- package/lib/ActorQueryOperationConstruct.js.map +1 -1
- package/lib/BindingsToQuadsIterator.d.ts +0 -0
- package/lib/BindingsToQuadsIterator.js +0 -0
- package/lib/BindingsToQuadsIterator.js.map +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/index.js.map +0 -0
- package/package.json +10 -10
|
@@ -15,17 +15,7 @@
|
|
|
15
15
|
"@type": "GenericComponentExtension",
|
|
16
16
|
"component": "cbqo:components/ActorQueryOperationTypedMediated.jsonld#ActorQueryOperationTypedMediated",
|
|
17
17
|
"genericTypeInstances": [
|
|
18
|
-
|
|
19
|
-
"@type": "ParameterRangeIntersection",
|
|
20
|
-
"parameterRangeElements": [
|
|
21
|
-
{
|
|
22
|
-
"@type": "ParameterRangeWildcard"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"@type": "ParameterRangeWildcard"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
18
|
+
"urn:npm:sparqlalgebrajs:Construct"
|
|
29
19
|
]
|
|
30
20
|
}
|
|
31
21
|
],
|
|
File without changes
|
|
File without changes
|
|
@@ -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 } from '@comunica/utils-algebra';
|
|
6
5
|
import type * as RDF from '@rdfjs/types';
|
|
6
|
+
import { Algebra } from 'sparqlalgebrajs';
|
|
7
7
|
/**
|
|
8
8
|
* A comunica Construct Query Operation Actor.
|
|
9
9
|
*/
|
|
@@ -4,16 +4,16 @@ exports.ActorQueryOperationConstruct = 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 utils_algebra_1 = require("@comunica/utils-algebra");
|
|
8
7
|
const utils_query_operation_1 = require("@comunica/utils-query-operation");
|
|
9
8
|
const rdf_terms_1 = require("rdf-terms");
|
|
9
|
+
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
10
10
|
const BindingsToQuadsIterator_1 = require("./BindingsToQuadsIterator");
|
|
11
11
|
/**
|
|
12
12
|
* A comunica Construct Query Operation Actor.
|
|
13
13
|
*/
|
|
14
14
|
class ActorQueryOperationConstruct extends bus_query_operation_1.ActorQueryOperationTypedMediated {
|
|
15
15
|
constructor(args) {
|
|
16
|
-
super(args,
|
|
16
|
+
super(args, 'construct');
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Find all variables in a list of triple patterns.
|
|
@@ -29,10 +29,9 @@ class ActorQueryOperationConstruct extends bus_query_operation_1.ActorQueryOpera
|
|
|
29
29
|
}
|
|
30
30
|
async runOperation(operationOriginal, context) {
|
|
31
31
|
const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
|
|
32
|
-
const algebraFactory = new utils_algebra_1.AlgebraFactory(dataFactory);
|
|
33
32
|
// Apply a projection on our CONSTRUCT variables first, as the query may contain other variables as well.
|
|
34
33
|
const variables = ActorQueryOperationConstruct.getVariables(operationOriginal.template);
|
|
35
|
-
const operation =
|
|
34
|
+
const operation = { type: sparqlalgebrajs_1.Algebra.types.PROJECT, input: operationOriginal.input, variables };
|
|
36
35
|
// Evaluate the input query
|
|
37
36
|
const output = (0, utils_query_operation_1.getSafeBindings)(await this.mediatorQueryOperation.mediate({ operation, context }));
|
|
38
37
|
// Construct triples using the result based on the pattern.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryOperationConstruct.js","sourceRoot":"","sources":["ActorQueryOperationConstruct.ts"],"names":[],"mappings":";;;AACA,uEAEuC;AACvC,+DAA0D;AAE1D,yCAA8C;AAQ9C,
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationConstruct.js","sourceRoot":"","sources":["ActorQueryOperationConstruct.ts"],"names":[],"mappings":";;;AACA,uEAEuC;AACvC,+DAA0D;AAE1D,yCAA8C;AAQ9C,2EAAkE;AAGlE,yCAAoE;AACpE,qDAA0C;AAC1C,uEAAoE;AAEpE;;GAEG;AACH,MAAa,4BAA6B,SAAQ,sDAAmD;IACnG,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,QAAwB;QACjD,OAAO,IAAA,qBAAS,EAAmB,EAAG,CAAC,MAAM;aAC1C,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAA,wBAAY,EAAC,IAAA,0BAAc,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAA6B,EAAE,QAAwB;QAChF,OAAO,IAAA,mBAAY,GAAE,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,iBAAoC,EAAE,OAAuB;QAErF,MAAM,WAAW,GAAwB,OAAO,CAAC,OAAO,CAAC,+BAAa,CAAC,WAAW,CAAC,CAAC;QAEpF,yGAAyG;QACzG,MAAM,SAAS,GAAmB,4BAA4B,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACxG,MAAM,SAAS,GAAsB,EAAE,IAAI,EAAE,yBAAO,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC;QAEhH,2BAA2B;QAC3B,MAAM,MAAM,GAAkC,IAAA,uCAAe,EAC3D,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAClE,CAAC;QAEF,2DAA2D;QAC3D,oEAAoE;QACpE,MAAM,UAAU,GAA4B,IAAI,iDAAuB,CACrE,WAAW,EACX,iBAAiB,CAAC,QAAQ,EAC1B,MAAM,CAAC,cAAc,CACtB,CAAC;QAEF,iEAAiE;QACjE,MAAM,QAAQ,GAAmC,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACrF,GAAG,IAAI;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;gBAC3B,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,iBAAiB,CAAC,QAAQ,CAAC,MAAM;aAClE;YACD,eAAe,EAAE,SAAS;SAC3B,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,QAAQ;YACR,UAAU;YACV,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;CACF;AAzDD,oEAyDC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport {\n ActorQueryOperationTypedMediated,\n} 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 {\n IQueryOperationResultBindings,\n IActionContext,\n IQueryOperationResult,\n MetadataQuads,\n ComunicaDataFactory,\n} from '@comunica/types';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\nimport { getTermsNested, getVariables, uniqTerms } from 'rdf-terms';\nimport { Algebra } from 'sparqlalgebrajs';\nimport { BindingsToQuadsIterator } from './BindingsToQuadsIterator';\n\n/**\n * A comunica Construct Query Operation Actor.\n */\nexport class ActorQueryOperationConstruct extends ActorQueryOperationTypedMediated<Algebra.Construct> {\n public constructor(args: IActorQueryOperationTypedMediatedArgs) {\n super(args, 'construct');\n }\n\n /**\n * Find all variables in a list of triple patterns.\n * @param {Algebra.Pattern[]} patterns An array of triple patterns.\n * @return {RDF.Variable[]} The variables in the triple patterns.\n */\n public static getVariables(patterns: RDF.BaseQuad[]): RDF.Variable[] {\n return uniqTerms((<RDF.Variable[]> []).concat\n .apply([], patterns.map(pattern => getVariables(getTermsNested(pattern)))));\n }\n\n public async testOperation(_operation: Algebra.Construct, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(operationOriginal: Algebra.Construct, context: IActionContext):\n Promise<IQueryOperationResult> {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n\n // Apply a projection on our CONSTRUCT variables first, as the query may contain other variables as well.\n const variables: RDF.Variable[] = ActorQueryOperationConstruct.getVariables(operationOriginal.template);\n const operation: Algebra.Operation = { type: Algebra.types.PROJECT, input: operationOriginal.input, variables };\n\n // Evaluate the input query\n const output: IQueryOperationResultBindings = getSafeBindings(\n await this.mediatorQueryOperation.mediate({ operation, context }),\n );\n\n // Construct triples using the result based on the pattern.\n // If it's a DESCRIBE query don't apply the blank node localisation.\n const quadStream: AsyncIterator<RDF.Quad> = new BindingsToQuadsIterator(\n dataFactory,\n operationOriginal.template,\n output.bindingsStream,\n );\n\n // Let the final metadata contain the estimated number of triples\n const metadata: (() => Promise<MetadataQuads>) = () => output.metadata().then(meta => ({\n ...meta,\n order: undefined,\n cardinality: {\n type: meta.cardinality.type,\n value: meta.cardinality.value * operationOriginal.template.length,\n },\n availableOrders: undefined,\n }));\n\n return {\n metadata,\n quadStream,\n type: 'quads',\n };\n }\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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-construct",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "A construct 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/bus-query-operation": "4.
|
|
45
|
-
"@comunica/context-entries": "4.
|
|
46
|
-
"@comunica/core": "4.
|
|
47
|
-
"@comunica/types": "4.
|
|
48
|
-
"@comunica/utils-
|
|
49
|
-
"@comunica/utils-query-operation": "4.4.2-alpha.49.0",
|
|
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
|
+
"@comunica/utils-query-operation": "^4.5.0",
|
|
50
49
|
"@rdfjs/types": "*",
|
|
51
|
-
"asynciterator": "^3.
|
|
52
|
-
"rdf-terms": "^
|
|
50
|
+
"asynciterator": "^3.9.0",
|
|
51
|
+
"rdf-terms": "^1.11.0",
|
|
52
|
+
"sparqlalgebrajs": "^5.0.2"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2bcd98c387a021fc5c08d375793c205ca3d1bf0d"
|
|
55
55
|
}
|