@comunica/actor-query-operation-distinct-identity 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.
|
@@ -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:Distinct"
|
|
29
19
|
]
|
|
30
20
|
}
|
|
31
21
|
],
|
|
@@ -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 { Bindings, IActionContext, IQueryOperationResult } from '@comunica/types';
|
|
5
|
-
import type { Algebra } from '@comunica/utils-algebra';
|
|
6
5
|
import type * as RDF from '@rdfjs/types';
|
|
6
|
+
import type { Algebra } from 'sparqlalgebrajs';
|
|
7
7
|
/**
|
|
8
8
|
* A comunica Distinct Identity Query Operation Actor.
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryOperationDistinctIdentity.js","sourceRoot":"","sources":["ActorQueryOperationDistinctIdentity.ts"],"names":[],"mappings":";;;AACA,uEAEuC;AAEvC,yCAA8C;
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationDistinctIdentity.js","sourceRoot":"","sources":["ActorQueryOperationDist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AAQ,EAAE,cAAc,CAAC,QAAQ;SAClC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB,CAC5B,SAAyB;QAEzB,MAAM,UAAU,GAA4B,EAAE,CAAC;QAC/C,OAAO,CAAC,QAAkB,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAW,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC/F,OAAO,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACpE,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,sBAAsB;QACjC,MAAM,UAAU,GAA4B,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAc,EAAE,EAAE;YACxB,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3E,OAAO,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACpE,CAAC,CAAC;IACJ,CAAC;CACF;AApED,kFAoEC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport {\n ActorQueryOperationTypedMediated,\n} 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 IQueryOperationResultQuads,\n} from '@comunica/types';\nimport { getSafeBindings, getSafeQuads } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\nimport * as RdfString from 'rdf-string';\nimport type { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica Distinct Identity Query Operation Actor.\n */\nexport class ActorQueryOperationDistinctIdentity extends ActorQueryOperationTypedMediated<Algebra.Distinct> {\n public constructor(args: IActorQueryOperationDistinctIdentityArgs) {\n super(args, 'distinct');\n }\n\n public async testOperation(_operation: Algebra.Distinct, _context: IActionContext): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async runOperation(operation: Algebra.Distinct, context: IActionContext): Promise<IQueryOperationResult> {\n const output = await this.mediatorQueryOperation.mediate({ operation: operation.input, context });\n\n if (output.type === 'quads') {\n const outputQuads: IQueryOperationResultQuads = getSafeQuads(\n output,\n );\n\n const quadStream: AsyncIterator<RDF.Quad> = outputQuads.quadStream\n .filter(await this.newIdentityFilterQuads());\n return {\n type: 'quads',\n quadStream,\n metadata: outputQuads.metadata,\n };\n }\n\n const outputBindings: IQueryOperationResultBindings = getSafeBindings(\n output,\n );\n\n const variables = (await outputBindings.metadata()).variables.map(v => v.variable);\n const bindingsStream: BindingsStream = outputBindings.bindingsStream\n .filter(await this.newIdentityFilter(variables));\n return {\n type: 'bindings',\n bindingsStream,\n metadata: outputBindings.metadata,\n };\n }\n\n /**\n * Create a new distinct filter function.\n * This will maintain an internal Identity datastructure so that every bindings object only returns true once.\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 newIdentityFilter(\n variables: RDF.Variable[],\n ): Promise<(bindings: Bindings) => boolean> {\n const identities: Record<string, boolean> = {};\n return (bindings: Bindings) => {\n const identity: string = variables.map(v => RdfString.termToString(bindings.get(v))).join('-');\n return !(identity in identities) && (identities[identity] = true);\n };\n }\n\n /**\n * Create a new distinct filter function to Identity quads.\n * This will maintain an internal Identity datastructure so that every quad object only returns true once.\n * @return {(quad: RDF.Quad) => boolean} A distinct filter for quads.\n */\n public async newIdentityFilterQuads(): Promise<(quad: RDF.Quad) => boolean> {\n const identities: Record<string, boolean> = {};\n return (quad: RDF.Quad) => {\n const identity = Object.values(RdfString.quadToStringQuad(quad)).join(' ');\n return !(identity in identities) && (identities[identity] = true);\n };\n }\n}\n\nexport interface IActorQueryOperationDistinctIdentityArgs extends IActorQueryOperationTypedMediatedArgs {\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-operation-distinct-identity",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "A distinct-identity 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-query-operation": "4.
|
|
45
|
-
"@comunica/core": "4.
|
|
46
|
-
"@comunica/types": "4.
|
|
47
|
-
"@comunica/utils-
|
|
48
|
-
"@comunica/utils-query-operation": "4.4.2-alpha.49.0",
|
|
44
|
+
"@comunica/bus-query-operation": "^4.5.0",
|
|
45
|
+
"@comunica/core": "^4.5.0",
|
|
46
|
+
"@comunica/types": "^4.5.0",
|
|
47
|
+
"@comunica/utils-query-operation": "^4.5.0",
|
|
49
48
|
"@rdfjs/types": "*",
|
|
50
|
-
"asynciterator": "^3.
|
|
51
|
-
"rdf-string": "^2.0.1"
|
|
49
|
+
"asynciterator": "^3.9.0",
|
|
50
|
+
"rdf-string": "^2.0.1",
|
|
51
|
+
"sparqlalgebrajs": "^5.0.2"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "2bcd98c387a021fc5c08d375793c205ca3d1bf0d"
|
|
54
54
|
}
|