@comunica/actor-query-operation-leftjoin 3.0.1-alpha.45.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -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-leftjoin/^3.0.0/components/context.jsonld"
|
|
26
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-leftjoin/^3.0.0/components/context.jsonld"
|
|
27
27
|
],
|
|
28
28
|
"actors": [
|
|
29
29
|
...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
|
|
4
4
|
{
|
|
5
5
|
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
6
|
"caqol": "npmd:@comunica/actor-query-operation-leftjoin/^3.0.0/",
|
|
@@ -12,7 +12,7 @@ export declare class ActorQueryOperationLeftJoin extends ActorQueryOperationType
|
|
|
12
12
|
readonly mediatorJoin: MediatorRdfJoin;
|
|
13
13
|
readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;
|
|
14
14
|
constructor(args: IActorQueryOperationLeftJoinArgs);
|
|
15
|
-
testOperation(
|
|
15
|
+
testOperation(_operation: Algebra.LeftJoin, _context: IActionContext): Promise<IActorTest>;
|
|
16
16
|
runOperation(operationOriginal: Algebra.LeftJoin, context: IActionContext): Promise<IQueryOperationResult>;
|
|
17
17
|
}
|
|
18
18
|
export interface IActorQueryOperationLeftJoinArgs extends IActorQueryOperationTypedMediatedArgs {
|
|
@@ -11,7 +11,7 @@ class ActorQueryOperationLeftJoin extends bus_query_operation_1.ActorQueryOperat
|
|
|
11
11
|
constructor(args) {
|
|
12
12
|
super(args, 'leftjoin');
|
|
13
13
|
}
|
|
14
|
-
async testOperation(
|
|
14
|
+
async testOperation(_operation, _context) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
17
|
async runOperation(operationOriginal, context) {
|
|
@@ -36,6 +36,7 @@ class ActorQueryOperationLeftJoin extends bus_query_operation_1.ActorQueryOperat
|
|
|
36
36
|
const bindingsStream = joined.bindingsStream
|
|
37
37
|
.transform({
|
|
38
38
|
autoStart: false,
|
|
39
|
+
// eslint-disable-next-line ts/no-misused-promises
|
|
39
40
|
transform: async (bindings, done, push) => {
|
|
40
41
|
// If variables of the right-hand entry are missing, we skip expression evaluation
|
|
41
42
|
if (!expressionVariables.every(variable => bindings.has(variable.value))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryOperationLeftJoin.js","sourceRoot":"","sources":["ActorQueryOperationLeftJoin.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,uEAAsG;AAGtG,yEAAmF;AAInF;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sDAAkD;IAIjG,YAAmB,IAAsC;QACvD,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationLeftJoin.js","sourceRoot":"","sources":["ActorQueryOperationLeftJoin.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,uEAAsG;AAGtG,yEAAmF;AAInF;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sDAAkD;IAIjG,YAAmB,IAAsC;QACvD,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAA4B,EAAE,QAAwB;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAA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SAAS,CAAC;gBACT,SAAS,EAAE,KAAK;gBAChB,kDAAkD;gBAClD,SAAS,EAAE,KAAK,EAAC,QAAkB,EAAE,IAAgB,EAAE,IAA8B,EAAE,EAAE;oBACvF,kFAAkF;oBAClF,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;wBACzE,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACf,OAAO,IAAI,EAAE,CAAC;oBAChB,CAAC;oBAED,IAAI,CAAC;wBACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;wBACvD,IAAI,MAAM,EAAE,CAAC;4BACX,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACjB,CAAC;oBACH,CAAC;oBAAC,OAAO,KAAc,EAAE,CAAC;wBACxB,mCAAmC;wBACnC,mEAAmE;wBACnE,gGAAgG;wBAChG,gFAAgF;wBAChF,IAAI,IAAA,wCAAiB,EAAQ,KAAK,CAAC,EAAE,CAAC;4BACpC,qGAAqG;4BACrG,+FAA+F;4BAC/F,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,iCAAiC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;wBACxF,CAAC;6BAAM,CAAC;4BACN,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;wBACtC,CAAC;oBACH,CAAC;oBACD,IAAI,EAAE,CAAC;gBACT,CAAC;aACF,CAAC,CAAC;YACL,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;QACzC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3ED,kEA2EC","sourcesContent":["import { BindingsFactory } from '@comunica/bindings-factory';\nimport type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';\nimport type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperation, ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport type { MediatorRdfJoin } from '@comunica/bus-rdf-join';\nimport type { IActorTest } from '@comunica/core';\nimport { AsyncEvaluator, isExpressionError } from '@comunica/expression-evaluator';\nimport type { IQueryOperationResult, Bindings, IActionContext, IJoinEntry } from '@comunica/types';\nimport type { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica LeftJoin Query Operation Actor.\n */\nexport class ActorQueryOperationLeftJoin extends ActorQueryOperationTypedMediated<Algebra.LeftJoin> {\n public readonly mediatorJoin: MediatorRdfJoin;\n public readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n\n public constructor(args: IActorQueryOperationLeftJoinArgs) {\n super(args, 'leftjoin');\n }\n\n public async testOperation(_operation: Algebra.LeftJoin, _context: IActionContext): Promise<IActorTest> {\n return true;\n }\n\n public async runOperation(operationOriginal: Algebra.LeftJoin, context: IActionContext):\n Promise<IQueryOperationResult> {\n // Delegate to join bus\n const entries: IJoinEntry[] = (await Promise.all(operationOriginal.input\n .map(async subOperation => ({\n output: await this.mediatorQueryOperation.mediate({ operation: subOperation, context }),\n operation: subOperation,\n }))))\n .map(({ output, operation }) => ({\n output: ActorQueryOperation.getSafeBindings(output),\n operation,\n }));\n const joined = await this.mediatorJoin.mediate({ type: 'optional', entries, context });\n\n // If the pattern contains an expression, filter the resulting stream\n if (operationOriginal.expression) {\n const rightMetadata = await entries[1].output.metadata();\n const expressionVariables = rightMetadata.variables;\n\n const bindingsFactory = await BindingsFactory.create(this.mediatorMergeBindingsContext, context);\n const config = { ...ActorQueryOperation.getAsyncExpressionContext(\n context,\n this.mediatorQueryOperation,\n bindingsFactory,\n ) };\n const evaluator = new AsyncEvaluator(operationOriginal.expression, config);\n const bindingsStream = joined.bindingsStream\n .transform({\n autoStart: false,\n // eslint-disable-next-line ts/no-misused-promises\n transform: async(bindings: Bindings, done: () => void, push: (item: Bindings) => void) => {\n // If variables of the right-hand entry are missing, we skip expression evaluation\n if (!expressionVariables.every(variable => bindings.has(variable.value))) {\n push(bindings);\n return done();\n }\n\n try {\n const result = await evaluator.evaluateAsEBV(bindings);\n if (result) {\n push(bindings);\n }\n } catch (error: unknown) {\n // We ignore all Expression errors.\n // Other errors (likely programming mistakes) are still propagated.\n // Left Join is defined in terms of Filter (https://www.w3.org/TR/sparql11-query/#defn_algJoin),\n // and Filter requires this (https://www.w3.org/TR/sparql11-query/#expressions).\n if (isExpressionError(<Error>error)) {\n // In many cases, this is a user error, where the user should manually cast the variable to a string.\n // In order to help users debug this, we should report these errors via the logger as warnings.\n this.logWarn(context, 'Error occurred while filtering.', () => ({ error, bindings }));\n } else {\n bindingsStream.emit('error', error);\n }\n }\n done();\n },\n });\n joined.bindingsStream = bindingsStream;\n }\n\n return joined;\n }\n}\n\nexport interface IActorQueryOperationLeftJoinArgs extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for joining Bindings streams\n */\n mediatorJoin: MediatorRdfJoin;\n /**\n * A mediator for creating binding context merge handlers\n */\n mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-operation-leftjoin",
|
|
3
|
-
"version": "3.0.1
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A leftjoin query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://comunica.dev/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/comunica/comunica.git",
|
|
11
11
|
"directory": "packages/actor-query-operation-leftjoin"
|
|
12
12
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/comunica/comunica/issues"
|
|
15
15
|
},
|
|
16
|
-
"sideEffects": false,
|
|
17
16
|
"keywords": [
|
|
18
17
|
"comunica",
|
|
19
18
|
"actor",
|
|
20
19
|
"query-operation",
|
|
21
20
|
"leftjoin"
|
|
22
21
|
],
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"main": "lib/index.js",
|
|
24
|
+
"typings": "lib/index",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
26
27
|
},
|
|
27
|
-
"homepage": "https://comunica.dev/",
|
|
28
28
|
"files": [
|
|
29
29
|
"components",
|
|
30
30
|
"lib/**/*.d.ts",
|
|
31
31
|
"lib/**/*.js",
|
|
32
32
|
"lib/**/*.js.map"
|
|
33
33
|
],
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@comunica/bindings-factory": "3.0.1-alpha.45.0",
|
|
36
|
-
"@comunica/bus-merge-bindings-context": "3.0.1-alpha.45.0",
|
|
37
|
-
"@comunica/bus-query-operation": "3.0.1-alpha.45.0",
|
|
38
|
-
"@comunica/bus-rdf-join": "3.0.1-alpha.45.0",
|
|
39
|
-
"@comunica/core": "3.0.1-alpha.45.0",
|
|
40
|
-
"@comunica/expression-evaluator": "3.0.1-alpha.45.0",
|
|
41
|
-
"@comunica/types": "3.0.1-alpha.45.0",
|
|
42
|
-
"sparqlalgebrajs": "^4.3.3"
|
|
43
|
-
},
|
|
44
34
|
"scripts": {
|
|
45
35
|
"build": "npm run build:ts && npm run build:components",
|
|
46
36
|
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
47
37
|
"build:components": "componentsjs-generator"
|
|
48
38
|
},
|
|
49
|
-
"
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@comunica/bindings-factory": "^3.0.1",
|
|
41
|
+
"@comunica/bus-merge-bindings-context": "^3.0.1",
|
|
42
|
+
"@comunica/bus-query-operation": "^3.0.1",
|
|
43
|
+
"@comunica/bus-rdf-join": "^3.0.1",
|
|
44
|
+
"@comunica/core": "^3.0.1",
|
|
45
|
+
"@comunica/expression-evaluator": "^3.0.1",
|
|
46
|
+
"@comunica/types": "^3.0.1",
|
|
47
|
+
"sparqlalgebrajs": "^4.3.3"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "9c0b537cd927d29590c287fe882185d88a65461b"
|
|
50
50
|
}
|