@comunica/actor-query-operation-path-zero-or-one 4.5.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 +1 -1
- package/components/ActorQueryOperationPathZeroOrOne.jsonld +16 -16
- package/components/components.jsonld +1 -1
- package/components/context.jsonld +1 -1
- package/lib/ActorQueryOperationPathZeroOrOne.d.ts +1 -1
- package/lib/ActorQueryOperationPathZeroOrOne.js +5 -3
- package/lib/ActorQueryOperationPathZeroOrOne.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 +12 -12
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ After installing, this package can be added to your engine's configuration as fo
|
|
|
22
22
|
{
|
|
23
23
|
"@context": [
|
|
24
24
|
...
|
|
25
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-one/^
|
|
25
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-one/^5.0.0/components/context.jsonld"
|
|
26
26
|
],
|
|
27
27
|
"actors": [
|
|
28
28
|
...
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-one/^
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^
|
|
5
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^
|
|
6
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-one/^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
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^5.0.0/components/context.jsonld"
|
|
7
7
|
],
|
|
8
8
|
"@id": "npmd:@comunica/actor-query-operation-path-zero-or-one",
|
|
9
9
|
"components": [
|
|
@@ -45,37 +45,37 @@
|
|
|
45
45
|
"genericTypeInstances": [
|
|
46
46
|
{
|
|
47
47
|
"@type": "ParameterRangeGenericTypeReference",
|
|
48
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
48
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"@type": "ParameterRangeGenericTypeReference",
|
|
52
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
52
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"@type": "ParameterRangeGenericTypeReference",
|
|
56
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
56
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"@type": "ParameterRangeGenericTypeReference",
|
|
60
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
60
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
61
61
|
}
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
"@type": "ParameterRangeGenericTypeReference",
|
|
66
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
66
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"@type": "ParameterRangeGenericTypeReference",
|
|
70
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
70
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
"@type": "ParameterRangeGenericTypeReference",
|
|
74
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
74
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
"@type": "ParameterRangeGenericTypeReference",
|
|
78
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
78
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
79
79
|
}
|
|
80
80
|
]
|
|
81
81
|
},
|
|
@@ -112,19 +112,19 @@
|
|
|
112
112
|
"genericTypeInstances": [
|
|
113
113
|
{
|
|
114
114
|
"@type": "ParameterRangeGenericTypeReference",
|
|
115
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
115
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
"@type": "ParameterRangeGenericTypeReference",
|
|
119
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
119
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
122
|
"@type": "ParameterRangeGenericTypeReference",
|
|
123
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
123
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
"@type": "ParameterRangeGenericTypeReference",
|
|
127
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
127
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
128
128
|
}
|
|
129
129
|
]
|
|
130
130
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-one/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-one/^5.0.0/components/context.jsonld"
|
|
4
4
|
],
|
|
5
5
|
"@id": "npmd:@comunica/actor-query-operation-path-zero-or-one",
|
|
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
|
-
"caqopzoo": "npmd:@comunica/actor-query-operation-path-zero-or-one/^
|
|
6
|
+
"caqopzoo": "npmd:@comunica/actor-query-operation-path-zero-or-one/^5.0.0/",
|
|
7
7
|
"ActorQueryOperationPathZeroOrOne": {
|
|
8
8
|
"@id": "caqopzoo:components/ActorQueryOperationPathZeroOrOne.jsonld#ActorQueryOperationPathZeroOrOne",
|
|
9
9
|
"@prefix": true,
|
|
@@ -2,7 +2,7 @@ import { ActorAbstractPath } from '@comunica/actor-abstract-path';
|
|
|
2
2
|
import type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';
|
|
3
3
|
import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';
|
|
4
4
|
import type { IQueryOperationResult, IActionContext } from '@comunica/types';
|
|
5
|
-
import { Algebra } from '
|
|
5
|
+
import { Algebra } from '@comunica/utils-algebra';
|
|
6
6
|
/**
|
|
7
7
|
* A comunica Path ZeroOrOne Query Operation Actor.
|
|
8
8
|
*/
|
|
@@ -3,21 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ActorQueryOperationPathZeroOrOne = void 0;
|
|
4
4
|
const actor_abstract_path_1 = require("@comunica/actor-abstract-path");
|
|
5
5
|
const context_entries_1 = require("@comunica/context-entries");
|
|
6
|
+
const utils_algebra_1 = require("@comunica/utils-algebra");
|
|
6
7
|
const utils_bindings_factory_1 = require("@comunica/utils-bindings-factory");
|
|
7
8
|
const utils_metadata_1 = require("@comunica/utils-metadata");
|
|
8
9
|
const utils_query_operation_1 = require("@comunica/utils-query-operation");
|
|
9
10
|
const asynciterator_1 = require("asynciterator");
|
|
10
|
-
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
11
11
|
/**
|
|
12
12
|
* A comunica Path ZeroOrOne Query Operation Actor.
|
|
13
13
|
*/
|
|
14
14
|
class ActorQueryOperationPathZeroOrOne extends actor_abstract_path_1.ActorAbstractPath {
|
|
15
|
+
mediatorMergeBindingsContext;
|
|
15
16
|
constructor(args) {
|
|
16
|
-
super(args,
|
|
17
|
+
super(args, utils_algebra_1.Algebra.Types.ZERO_OR_ONE_PATH);
|
|
18
|
+
this.mediatorMergeBindingsContext = args.mediatorMergeBindingsContext;
|
|
17
19
|
}
|
|
18
20
|
async runOperation(operation, context) {
|
|
19
21
|
const dataFactory = context.getSafe(context_entries_1.KeysInitQuery.dataFactory);
|
|
20
|
-
const algebraFactory = new
|
|
22
|
+
const algebraFactory = new utils_algebra_1.AlgebraFactory(dataFactory);
|
|
21
23
|
const bindingsFactory = await utils_bindings_factory_1.BindingsFactory.create(this.mediatorMergeBindingsContext, context, dataFactory);
|
|
22
24
|
const predicate = operation.predicate;
|
|
23
25
|
const sources = this.getPathSources(predicate);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryOperationPathZeroOrOne.js","sourceRoot":"","sources":["ActorQueryOperationPathZeroOrOne.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAGlE,+DAA0D;AAS1D,6EAAmE;AACnE,6DAAmE;AACnE,2EAAkE;AAElE,iDAGuB;
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationPathZeroOrOne.js","sourceRoot":"","sources":["ActorQueryOperationPathZeroOrOne.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAGlE,+DAA0D;AAS1D,2DAAkE;AAClE,6EAAmE;AACnE,6DAAmE;AACnE,2EAAkE;AAElE,iDAGuB;AAEvB;;GAEG;AACH,MAAa,gCAAiC,SAAQ,uCAAiB;IACrD,4BAA4B,CAA+B;IAE3E,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,uBAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC5C,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,4BAA4B,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,SAAuB,EACvB,OAAuB;QAEvB,MAAM,WAAW,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AE,KAAK,EAAE,CAAC,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,sFAAsF;YACtF,IAAI,SAAS,CAAC,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;gBAC9C,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAE,CAAC,CAAC,CAAC,CAAC;YAClF,CAAC;YACD,IAAI,SAAS,CAAC,MAAM,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;gBAC7C,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAE,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAE,CAAC,CAAC,CAAC,CAAC;YAClF,CAAC;YAED,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,QAAQ,GAAG,KAAK,IAA8B,EAAE;YACpD,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;YACnD,OAAO;gBACL,GAAG,aAAa;gBAChB,WAAW,EAAE;oBACX,GAAG,aAAa,CAAC,WAAW;oBAC5B,0DAA0D;oBAC1D,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC;iBAC3C;aACF,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,cAAc;YACd,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AAtGD,4EAsGC","sourcesContent":["import { ActorAbstractPath } from '@comunica/actor-abstract-path';\nimport type { MediatorMergeBindingsContext } from '@comunica/bus-merge-bindings-context';\nimport type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type {\n Bindings,\n IQueryOperationResult,\n IActionContext,\n BindingsStream,\n ComunicaDataFactory,\n MetadataBindings,\n} from '@comunica/types';\nimport { Algebra, AlgebraFactory } from '@comunica/utils-algebra';\nimport { BindingsFactory } from '@comunica/utils-bindings-factory';\nimport { MetadataValidationState } from '@comunica/utils-metadata';\nimport { getSafeBindings } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\nimport {\n SingletonIterator,\n UnionIterator,\n} from 'asynciterator';\n\n/**\n * A comunica Path ZeroOrOne Query Operation Actor.\n */\nexport class ActorQueryOperationPathZeroOrOne extends ActorAbstractPath {\n public readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext;\n\n public constructor(args: IActorQueryOperationPathZeroOrOneArgs) {\n super(args, Algebra.Types.ZERO_OR_ONE_PATH);\n this.mediatorMergeBindingsContext = args.mediatorMergeBindingsContext;\n }\n\n public async runOperation(\n operation: Algebra.Path,\n context: IActionContext,\n ): Promise<IQueryOperationResult> {\n const dataFactory: ComunicaDataFactory = context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new AlgebraFactory(dataFactory);\n const bindingsFactory = await BindingsFactory.create(this.mediatorMergeBindingsContext, context, dataFactory);\n const predicate = <Algebra.ZeroOrOnePath> operation.predicate;\n const sources = this.getPathSources(predicate);\n\n const extra: Bindings[] = [];\n\n // Both subject and object non-variables\n if (operation.subject.termType !== 'Variable' &&\n operation.object.termType !== 'Variable' &&\n operation.subject.equals(operation.object)) {\n return {\n type: 'bindings',\n bindingsStream: new SingletonIterator<RDF.Bindings>(bindingsFactory.bindings()),\n metadata: () => Promise.resolve({\n state: new MetadataValidationState(),\n cardinality: { type: 'exact', value: 1 },\n variables: [],\n }),\n };\n }\n\n // Check if we require a distinct path operation\n const distinct = await this.isPathArbitraryLengthDistinct(algebraFactory, context, operation);\n if (distinct.operation) {\n return distinct.operation;\n }\n context = distinct.context;\n\n // Create an operator that resolve to the \"One\" part\n const bindingsOne = getSafeBindings(await this.mediatorQueryOperation.mediate({\n context,\n operation: algebraFactory.createPath(operation.subject, predicate.path, operation.object, operation.graph),\n }));\n\n // Determine the bindings stream based on the variable-ness of subject and object\n let bindingsStream: BindingsStream;\n if (operation.subject.termType === 'Variable' && operation.object.termType === 'Variable') {\n // Both subject and object are variables\n // To determine the \"Zero\" part, we\n // query ?s ?p ?o. FILTER ?s = ?0, to get all possible namedNodes in de the db\n const varP = this.generateVariable(dataFactory, operation);\n const bindingsZero = getSafeBindings(\n await this.mediatorQueryOperation.mediate({\n context,\n operation: algebraFactory.createFilter(\n this.assignPatternSources(algebraFactory, algebraFactory\n .createPattern(operation.subject, varP, operation.object, operation.graph), sources),\n algebraFactory.createOperatorExpression('=', [\n algebraFactory.createTermExpression(operation.subject),\n algebraFactory.createTermExpression(operation.object),\n ]),\n ),\n }),\n ).bindingsStream.map(bindings => bindings.delete(varP));\n bindingsStream = new UnionIterator([\n bindingsZero,\n bindingsOne.bindingsStream,\n ], { autoStart: false });\n } else {\n // If subject or object is not a variable, then determining the \"Zero\" part is simple.\n if (operation.subject.termType === 'Variable') {\n extra.push(bindingsFactory.bindings([[ operation.subject, operation.object ]]));\n }\n if (operation.object.termType === 'Variable') {\n extra.push(bindingsFactory.bindings([[ operation.object, operation.subject ]]));\n }\n\n bindingsStream = bindingsOne.bindingsStream.prepend(extra);\n }\n\n const metadata = async(): Promise<MetadataBindings> => {\n const innerMetadata = await bindingsOne.metadata();\n return {\n ...innerMetadata,\n cardinality: {\n ...innerMetadata.cardinality,\n // Add one to cardinality because we allow *ZERO* or more.\n value: innerMetadata.cardinality.value + 1,\n },\n };\n };\n\n return {\n type: 'bindings',\n bindingsStream,\n metadata,\n };\n }\n}\nexport interface IActorQueryOperationPathZeroOrOneArgs extends IActorQueryOperationTypedMediatedArgs {\n /**\n * A mediator for creating binding context merge handlers\n */\n mediatorMergeBindingsContext: MediatorMergeBindingsContext;\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-path-zero-or-one",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "A path-zero-or-one query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"build:components": "componentsjs-generator"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@comunica/actor-abstract-path": "^
|
|
45
|
-
"@comunica/bus-merge-bindings-context": "^
|
|
46
|
-
"@comunica/bus-query-operation": "^
|
|
47
|
-
"@comunica/context-entries": "^
|
|
48
|
-
"@comunica/types": "^
|
|
49
|
-
"@comunica/utils-
|
|
50
|
-
"@comunica/utils-
|
|
51
|
-
"@comunica/utils-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
44
|
+
"@comunica/actor-abstract-path": "^5.0.0",
|
|
45
|
+
"@comunica/bus-merge-bindings-context": "^5.0.0",
|
|
46
|
+
"@comunica/bus-query-operation": "^5.0.0",
|
|
47
|
+
"@comunica/context-entries": "^5.0.0",
|
|
48
|
+
"@comunica/types": "^5.0.0",
|
|
49
|
+
"@comunica/utils-algebra": "^5.0.0",
|
|
50
|
+
"@comunica/utils-bindings-factory": "^5.0.0",
|
|
51
|
+
"@comunica/utils-metadata": "^5.0.0",
|
|
52
|
+
"@comunica/utils-query-operation": "^5.0.0",
|
|
53
|
+
"asynciterator": "^3.10.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "0b1756fdb9bef014133432489627c1bd71779bd0"
|
|
56
56
|
}
|