@comunica/actor-query-operation-reduced-hash 4.4.1 → 4.4.2-alpha.49.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/ActorQueryOperationReducedHash.jsonld +11 -1
- package/components/components.jsonld +0 -0
- package/components/context.jsonld +0 -0
- package/lib/ActorQueryOperationReducedHash.d.ts +1 -1
- package/lib/ActorQueryOperationReducedHash.js +2 -1
- package/lib/ActorQueryOperationReducedHash.js.map +1 -1
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/index.js.map +0 -0
- package/package.json +9 -9
|
@@ -15,7 +15,17 @@
|
|
|
15
15
|
"@type": "GenericComponentExtension",
|
|
16
16
|
"component": "cbqo:components/ActorQueryOperationTypedMediated.jsonld#ActorQueryOperationTypedMediated",
|
|
17
17
|
"genericTypeInstances": [
|
|
18
|
-
|
|
18
|
+
{
|
|
19
|
+
"@type": "ParameterRangeIntersection",
|
|
20
|
+
"parameterRangeElements": [
|
|
21
|
+
{
|
|
22
|
+
"@type": "ParameterRangeWildcard"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"@type": "ParameterRangeWildcard"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
19
29
|
]
|
|
20
30
|
}
|
|
21
31
|
],
|
|
File without changes
|
|
File without changes
|
|
@@ -3,8 +3,8 @@ import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-
|
|
|
3
3
|
import { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';
|
|
4
4
|
import type { IActorTest, TestResult } from '@comunica/core';
|
|
5
5
|
import type { Bindings, IActionContext, IQueryOperationResult } from '@comunica/types';
|
|
6
|
+
import { Algebra } from '@comunica/utils-algebra';
|
|
6
7
|
import type * as RDF from '@rdfjs/types';
|
|
7
|
-
import type { Algebra } from 'sparqlalgebrajs';
|
|
8
8
|
/**
|
|
9
9
|
* A comunica Reduced Hash Query Operation Actor.
|
|
10
10
|
*/
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ActorQueryOperationReducedHash = void 0;
|
|
4
4
|
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
5
5
|
const core_1 = require("@comunica/core");
|
|
6
|
+
const utils_algebra_1 = require("@comunica/utils-algebra");
|
|
6
7
|
const utils_query_operation_1 = require("@comunica/utils-query-operation");
|
|
7
8
|
const lru_cache_1 = require("lru-cache");
|
|
8
9
|
/**
|
|
@@ -10,7 +11,7 @@ const lru_cache_1 = require("lru-cache");
|
|
|
10
11
|
*/
|
|
11
12
|
class ActorQueryOperationReducedHash extends bus_query_operation_1.ActorQueryOperationTypedMediated {
|
|
12
13
|
constructor(args) {
|
|
13
|
-
super(args,
|
|
14
|
+
super(args, utils_algebra_1.Algebra.Types.REDUCED);
|
|
14
15
|
}
|
|
15
16
|
async testOperation(_operation, _context) {
|
|
16
17
|
return (0, core_1.passTestVoid)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryOperationReducedHash.js","sourceRoot":"","sources":["ActorQueryOperationReducedHash.ts"],"names":[],"mappings":";;;AAEA,uEAAiF;AAEjF,yCAA8C;AAQ9C,2EAAkE;AAElE,yCAAqC;
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationReducedHash.js","sourceRoot":"","sources":["ActorQueryOperationReducedHash.ts"],"names":[],"mappings":";;;AAEA,uEAAiF;AAEjF,yCAA8C;AAQ9C,2DAAkD;AAClD,2EAAkE;AAElE,yCAAqC;AAErC;;GAEG;AACH,MAAa,8BAA+B,SAAQ,sDAAiD;IAInG,YAAmB,IAAyC;QAC1D,KAAK,CAAC,IAAI,EAAE,uBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAA2B,EAAE,QAAwB;QAC9E,OAAO,IAAA,mBAAY,GAAE,CAAC;IACxB,CA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type { MediatorHashBindings } from '@comunica/bus-hash-bindings';\nimport type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type {\n Bindings,\n BindingsStream,\n IActionContext,\n IQueryOperationResult,\n IQueryOperationResultBindings,\n} from '@comunica/types';\nimport { Algebra } from '@comunica/utils-algebra';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\nimport { LRUCache } from 'lru-cache';\n\n/**\n * A comunica Reduced Hash Query Operation Actor.\n */\nexport class ActorQueryOperationReducedHash extends ActorQueryOperationTypedMediated<Algebra.Reduced> {\n public readonly mediatorHashBindings: MediatorHashBindings;\n public readonly cacheSize: number;\n\n public constructor(args: IActorQueryOperationReducedHashArgs) {\n super(args, Algebra.Types.REDUCED);\n }\n\n public async testOperation(_operation: Algebra.Reduced, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(operation: Algebra.Reduced, context: IActionContext): Promise<IQueryOperationResult> {\n const output: IQueryOperationResultBindings = getSafeBindings(\n await this.mediatorQueryOperation.mediate({ operation: operation.input, context }),\n );\n const variables = (await output.metadata()).variables.map(v => v.variable);\n const bindingsStream: BindingsStream = output.bindingsStream.filter(await this.newHashFilter(context, variables));\n return {\n type: 'bindings',\n bindingsStream,\n metadata: output.metadata,\n };\n }\n\n /**\n * Create a new distinct filter function.\n * This will maintain an internal hash datastructure so that every bindings object only returns true once.\n * @param context The action context.\n * @param variables The variables to take into account while hashing.\n * @return {(bindings: Bindings) => boolean} A distinct filter for bindings.\n */\n public async newHashFilter(\n context: IActionContext,\n variables: RDF.Variable[],\n ): Promise<(bindings: Bindings) => boolean> {\n const { hashFunction } = await this.mediatorHashBindings.mediate({ context });\n const hashes = new LRUCache<number, boolean>({ max: this.cacheSize });\n return (bindings: Bindings) => {\n const hash: number = hashFunction(bindings, variables);\n if (hashes.has(hash)) {\n return false;\n }\n hashes.set(hash, true);\n return true;\n };\n }\n}\n\nexport interface IActorQueryOperationReducedHashArgs extends IActorQueryOperationTypedMediatedArgs {\n mediatorHashBindings: MediatorHashBindings;\n /**\n * @range {integer}\n * @default {100}\n */\n cacheSize: number;\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-reduced-hash",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2-alpha.49.0",
|
|
4
4
|
"description": "A reduced-hash query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"build:components": "componentsjs-generator"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@comunica/bus-hash-bindings": "
|
|
45
|
-
"@comunica/bus-query-operation": "
|
|
46
|
-
"@comunica/core": "
|
|
47
|
-
"@comunica/types": "
|
|
48
|
-
"@comunica/utils-
|
|
44
|
+
"@comunica/bus-hash-bindings": "4.4.2-alpha.49.0",
|
|
45
|
+
"@comunica/bus-query-operation": "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",
|
|
49
|
+
"@comunica/utils-query-operation": "4.4.2-alpha.49.0",
|
|
49
50
|
"@rdfjs/types": "*",
|
|
50
|
-
"lru-cache": "^10.0.0"
|
|
51
|
-
"sparqlalgebrajs": "^4.3.8"
|
|
51
|
+
"lru-cache": "^10.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "ef6f96cfd8faf7c37955bb7e0fe9f6fc6a994bdf"
|
|
54
54
|
}
|