@comunica/actor-query-operation-path-zero-or-more 1.22.0 → 2.0.1-alpha.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/LICENSE.txt +2 -2
- package/README.md +4 -4
- package/components/ActorQueryOperationPathZeroOrMore.jsonld +152 -0
- package/components/components.jsonld +5 -3
- package/components/context.jsonld +34 -5
- package/lib/ActorQueryOperationPathZeroOrMore.d.ts +2 -3
- package/lib/ActorQueryOperationPathZeroOrMore.js +52 -38
- package/lib/index.d.ts +1 -0
- package/{index.js → lib/index.js} +1 -1
- package/package.json +15 -39
- package/components/Actor/QueryOperation/PathZeroOrMore.jsonld +0 -22
- package/index.d.ts +0 -1
package/LICENSE.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright © 2017–
|
|
4
|
-
Ghent University – imec, Belgium
|
|
3
|
+
Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
|
|
4
|
+
Comunica Association and Ghent University – imec, Belgium
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -22,14 +22,14 @@ 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-more/^
|
|
25
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-more/^2.0.0/components/context.jsonld"
|
|
26
26
|
],
|
|
27
27
|
"actors": [
|
|
28
28
|
...
|
|
29
29
|
{
|
|
30
|
-
"@id": "
|
|
30
|
+
"@id": "urn:comunica:default:query-operation/actors#path-zero-or-more",
|
|
31
31
|
"@type": "ActorQueryOperationPathZeroOrMore",
|
|
32
|
-
"
|
|
32
|
+
"mediatorQueryOperation": { "@id": "urn:comunica:default:query-operation/mediators#main" }
|
|
33
33
|
}
|
|
34
34
|
]
|
|
35
35
|
}
|
|
@@ -37,4 +37,4 @@ After installing, this package can be added to your engine's configuration as fo
|
|
|
37
37
|
|
|
38
38
|
### Config Parameters
|
|
39
39
|
|
|
40
|
-
* `
|
|
40
|
+
* `mediatorQueryOperation`: A mediator over the [Query Operation bus](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation).
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-more/^2.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^2.0.0/components/context.jsonld",
|
|
6
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^2.0.0/components/context.jsonld"
|
|
7
|
+
],
|
|
8
|
+
"@id": "npmd:@comunica/actor-query-operation-path-zero-or-more",
|
|
9
|
+
"components": [
|
|
10
|
+
{
|
|
11
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore",
|
|
12
|
+
"@type": "Class",
|
|
13
|
+
"requireElement": "ActorQueryOperationPathZeroOrMore",
|
|
14
|
+
"extends": [
|
|
15
|
+
"caap:components/ActorAbstractPath.jsonld#ActorAbstractPath"
|
|
16
|
+
],
|
|
17
|
+
"comment": "A comunica Path ZeroOrMore Query Operation Actor.",
|
|
18
|
+
"parameters": [
|
|
19
|
+
{
|
|
20
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_mediatorQueryOperation",
|
|
21
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_name",
|
|
25
|
+
"range": "xsd:string",
|
|
26
|
+
"default": {
|
|
27
|
+
"@id": "rdf:subject"
|
|
28
|
+
},
|
|
29
|
+
"comment": "The name for this actor."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_bus",
|
|
33
|
+
"range": {
|
|
34
|
+
"@type": "ParameterRangeGenericComponent",
|
|
35
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
36
|
+
"genericTypeInstances": [
|
|
37
|
+
{
|
|
38
|
+
"@type": "ParameterRangeGenericComponent",
|
|
39
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
40
|
+
"genericTypeInstances": [
|
|
41
|
+
{
|
|
42
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
43
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
47
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
51
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
57
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
61
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
65
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"default": {
|
|
70
|
+
"@id": "cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus",
|
|
71
|
+
"@type": "cc:components/Bus.jsonld#Bus"
|
|
72
|
+
},
|
|
73
|
+
"comment": "The bus this actor subscribes to."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_beforeActors",
|
|
77
|
+
"range": {
|
|
78
|
+
"@type": "ParameterRangeUnion",
|
|
79
|
+
"parameterRangeElements": [
|
|
80
|
+
{
|
|
81
|
+
"@type": "ParameterRangeArray",
|
|
82
|
+
"parameterRangeValue": {
|
|
83
|
+
"@type": "ParameterRangeGenericComponent",
|
|
84
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
85
|
+
"genericTypeInstances": [
|
|
86
|
+
{
|
|
87
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
88
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
92
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
96
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"@type": "ParameterRangeUndefined"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"memberFields": [
|
|
110
|
+
{
|
|
111
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore__member_constructor",
|
|
112
|
+
"memberFieldName": "constructor"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore__member_runOperation",
|
|
116
|
+
"memberFieldName": "runOperation"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"constructorArguments": [
|
|
120
|
+
{
|
|
121
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args__constructorArgument",
|
|
122
|
+
"fields": [
|
|
123
|
+
{
|
|
124
|
+
"keyRaw": "mediatorQueryOperation",
|
|
125
|
+
"value": {
|
|
126
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_mediatorQueryOperation"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"keyRaw": "name",
|
|
131
|
+
"value": {
|
|
132
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_name"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"keyRaw": "bus",
|
|
137
|
+
"value": {
|
|
138
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_bus"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"keyRaw": "beforeActors",
|
|
143
|
+
"value": {
|
|
144
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_beforeActors"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@context":
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-more/^2.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
3
5
|
"@id": "npmd:@comunica/actor-query-operation-path-zero-or-more",
|
|
4
6
|
"@type": "Module",
|
|
5
7
|
"requireName": "@comunica/actor-query-operation-path-zero-or-more",
|
|
6
8
|
"import": [
|
|
7
|
-
"
|
|
9
|
+
"caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld"
|
|
8
10
|
]
|
|
9
|
-
}
|
|
11
|
+
}
|
|
@@ -3,10 +3,39 @@
|
|
|
3
3
|
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld",
|
|
4
4
|
{
|
|
5
5
|
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
-
"caqopzom": "npmd:@comunica/actor-query-operation-path-zero-or-more/",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"caqopzom": "npmd:@comunica/actor-query-operation-path-zero-or-more/^2.0.0/",
|
|
7
|
+
"ActorQueryOperationPathZeroOrMore": {
|
|
8
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_mediatorQueryOperation": {
|
|
12
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_mediatorQueryOperation"
|
|
13
|
+
},
|
|
14
|
+
"args_name": {
|
|
15
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_name"
|
|
16
|
+
},
|
|
17
|
+
"args_bus": {
|
|
18
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_bus"
|
|
19
|
+
},
|
|
20
|
+
"args_beforeActors": {
|
|
21
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_beforeActors",
|
|
22
|
+
"@container": "@list"
|
|
23
|
+
},
|
|
24
|
+
"mediatorQueryOperation": {
|
|
25
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_mediatorQueryOperation"
|
|
26
|
+
},
|
|
27
|
+
"name": {
|
|
28
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_name"
|
|
29
|
+
},
|
|
30
|
+
"bus": {
|
|
31
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_bus"
|
|
32
|
+
},
|
|
33
|
+
"beforeActors": {
|
|
34
|
+
"@id": "caqopzom:components/ActorQueryOperationPathZeroOrMore.jsonld#ActorQueryOperationPathZeroOrMore_args_beforeActors",
|
|
35
|
+
"@container": "@list"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
10
39
|
}
|
|
11
40
|
]
|
|
12
|
-
}
|
|
41
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ActorAbstractPath } from '@comunica/actor-abstract-path';
|
|
2
2
|
import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';
|
|
3
|
-
import type {
|
|
4
|
-
import type { IActorQueryOperationOutputBindings } from '@comunica/types';
|
|
3
|
+
import type { IQueryOperationResult, IActionContext } from '@comunica/types';
|
|
5
4
|
import { Algebra } from 'sparqlalgebrajs';
|
|
6
5
|
/**
|
|
7
6
|
* A comunica Path ZeroOrMore Query Operation Actor.
|
|
8
7
|
*/
|
|
9
8
|
export declare class ActorQueryOperationPathZeroOrMore extends ActorAbstractPath {
|
|
10
9
|
constructor(args: IActorQueryOperationTypedMediatedArgs);
|
|
11
|
-
runOperation(
|
|
10
|
+
runOperation(operation: Algebra.Path, context: IActionContext): Promise<IQueryOperationResult>;
|
|
12
11
|
}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorQueryOperationPathZeroOrMore = void 0;
|
|
4
4
|
const actor_abstract_path_1 = require("@comunica/actor-abstract-path");
|
|
5
|
+
const bindings_factory_1 = require("@comunica/bindings-factory");
|
|
5
6
|
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
6
7
|
const asynciterator_1 = require("asynciterator");
|
|
7
8
|
const rdf_string_1 = require("rdf-string");
|
|
8
9
|
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
10
|
+
const BF = new bindings_factory_1.BindingsFactory();
|
|
9
11
|
/**
|
|
10
12
|
* A comunica Path ZeroOrMore Query Operation Actor.
|
|
11
13
|
*/
|
|
@@ -13,35 +15,37 @@ class ActorQueryOperationPathZeroOrMore extends actor_abstract_path_1.ActorAbstr
|
|
|
13
15
|
constructor(args) {
|
|
14
16
|
super(args, sparqlalgebrajs_1.Algebra.types.ZERO_OR_MORE_PATH);
|
|
15
17
|
}
|
|
16
|
-
async runOperation(
|
|
17
|
-
const distinct = await this.isPathArbitraryLengthDistinct(context,
|
|
18
|
+
async runOperation(operation, context) {
|
|
19
|
+
const distinct = await this.isPathArbitraryLengthDistinct(context, operation);
|
|
18
20
|
if (distinct.operation) {
|
|
19
21
|
return distinct.operation;
|
|
20
22
|
}
|
|
21
23
|
context = distinct.context;
|
|
22
|
-
const predicate =
|
|
23
|
-
const sVar =
|
|
24
|
-
const oVar =
|
|
25
|
-
|
|
26
|
-
if (sVar && oVar) {
|
|
24
|
+
const predicate = operation.predicate;
|
|
25
|
+
const sVar = operation.subject.termType === 'Variable';
|
|
26
|
+
const oVar = operation.object.termType === 'Variable';
|
|
27
|
+
if (operation.subject.termType === 'Variable' && operation.object.termType === 'Variable') {
|
|
27
28
|
// Query ?s ?p ?o, to get all possible namedNodes in de the db
|
|
28
|
-
const predVar = this.generateVariable(
|
|
29
|
-
const single = actor_abstract_path_1.ActorAbstractPath.FACTORY
|
|
29
|
+
const predVar = this.generateVariable(operation);
|
|
30
|
+
const single = actor_abstract_path_1.ActorAbstractPath.FACTORY
|
|
31
|
+
.createPattern(operation.subject, predVar, operation.object, operation.graph);
|
|
30
32
|
const results = bus_query_operation_1.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({ context, operation: single }));
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
+
const subjectVar = operation.subject;
|
|
34
|
+
const objectVar = operation.object;
|
|
33
35
|
// Set with all namedNodes we have already started a predicate* search from
|
|
34
36
|
const entities = new Set();
|
|
35
37
|
const termHashes = {};
|
|
36
38
|
const bindingsStream = new asynciterator_1.MultiTransformIterator(results.bindingsStream, {
|
|
37
39
|
multiTransform: (bindings) => {
|
|
38
40
|
// Get the subject and object of the triples (?s ?p ?o) and extract graph if it was a variable
|
|
39
|
-
const subject = bindings.get(
|
|
40
|
-
const object = bindings.get(
|
|
41
|
-
const graph =
|
|
41
|
+
const subject = bindings.get(subjectVar);
|
|
42
|
+
const object = bindings.get(objectVar);
|
|
43
|
+
const graph = operation.graph.termType === 'Variable' ?
|
|
44
|
+
bindings.get(operation.graph) :
|
|
45
|
+
operation.graph;
|
|
42
46
|
// Make a hash of namedNode + graph to remember from where we already started a search
|
|
43
|
-
const subjectGraphHash = rdf_string_1.termToString(subject) + rdf_string_1.termToString(graph);
|
|
44
|
-
const objectGraphHash = rdf_string_1.termToString(object) + rdf_string_1.termToString(graph);
|
|
47
|
+
const subjectGraphHash = (0, rdf_string_1.termToString)(subject) + (0, rdf_string_1.termToString)(graph);
|
|
48
|
+
const objectGraphHash = (0, rdf_string_1.termToString)(object) + (0, rdf_string_1.termToString)(graph);
|
|
45
49
|
return new asynciterator_1.TransformIterator(async () => {
|
|
46
50
|
// If no new namedNodes in this triple, return nothing
|
|
47
51
|
if (entities.has(subjectGraphHash) && entities.has(objectGraphHash)) {
|
|
@@ -53,18 +57,18 @@ class ActorQueryOperationPathZeroOrMore extends actor_abstract_path_1.ActorAbstr
|
|
|
53
57
|
// If not started from this namedNode (subject in triple) in this graph, start a search
|
|
54
58
|
if (!entities.has(subjectGraphHash)) {
|
|
55
59
|
entities.add(subjectGraphHash);
|
|
56
|
-
await this.getSubjectAndObjectBindingsPredicateStar(
|
|
60
|
+
await this.getSubjectAndObjectBindingsPredicateStar(subjectVar, objectVar, subject, subject, predicate.path, graph, context, termHashes, {}, it, counter);
|
|
57
61
|
}
|
|
58
62
|
// If not started from this namedNode (object in triple) in this graph, start a search
|
|
59
63
|
if (!entities.has(objectGraphHash)) {
|
|
60
64
|
entities.add(objectGraphHash);
|
|
61
|
-
await this.getSubjectAndObjectBindingsPredicateStar(
|
|
65
|
+
await this.getSubjectAndObjectBindingsPredicateStar(subjectVar, objectVar, object, object, predicate.path, graph, context, termHashes, {}, it, counter);
|
|
62
66
|
}
|
|
63
67
|
return it.transform({
|
|
64
68
|
transform(item, next, push) {
|
|
65
69
|
// If the graph was a variable, fill in it's binding (we got it from the ?s ?p ?o binding)
|
|
66
|
-
if (
|
|
67
|
-
item = item.set(
|
|
70
|
+
if (operation.graph.termType === 'Variable') {
|
|
71
|
+
item = item.set(operation.graph, graph);
|
|
68
72
|
}
|
|
69
73
|
push(item);
|
|
70
74
|
next();
|
|
@@ -73,21 +77,25 @@ class ActorQueryOperationPathZeroOrMore extends actor_abstract_path_1.ActorAbstr
|
|
|
73
77
|
});
|
|
74
78
|
},
|
|
75
79
|
});
|
|
76
|
-
const variables =
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
return {
|
|
80
|
+
const variables = operation.graph.termType === 'Variable' ?
|
|
81
|
+
[subjectVar, operation.object, operation.graph] :
|
|
82
|
+
[subjectVar, operation.object];
|
|
83
|
+
return {
|
|
84
|
+
type: 'bindings',
|
|
85
|
+
bindingsStream,
|
|
86
|
+
metadata: async () => ({ ...await results.metadata(), variables }),
|
|
87
|
+
};
|
|
80
88
|
}
|
|
81
89
|
if (!sVar && !oVar) {
|
|
82
90
|
const variable = this.generateVariable();
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
filter: item => item.get(
|
|
91
|
+
const starEval = await this.getObjectsPredicateStarEval(operation.subject, variable, predicate.path, operation.graph, context);
|
|
92
|
+
const bindingsStream = starEval.bindingsStream.transform({
|
|
93
|
+
filter: item => operation.object.equals(item.get(variable)),
|
|
86
94
|
transform(item, next, push) {
|
|
87
95
|
// Return graph binding if graph was a variable, otherwise empty binding
|
|
88
|
-
const binding =
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
const binding = operation.graph.termType === 'Variable' ?
|
|
97
|
+
BF.bindings([[operation.graph, item.get(operation.graph)]]) :
|
|
98
|
+
BF.bindings();
|
|
91
99
|
push(binding);
|
|
92
100
|
next();
|
|
93
101
|
},
|
|
@@ -95,23 +103,29 @@ class ActorQueryOperationPathZeroOrMore extends actor_abstract_path_1.ActorAbstr
|
|
|
95
103
|
return {
|
|
96
104
|
type: 'bindings',
|
|
97
105
|
bindingsStream,
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
metadata: async () => ({
|
|
107
|
+
...await starEval.metadata(),
|
|
108
|
+
variables: operation.graph.termType === 'Variable' ? [operation.graph] : [],
|
|
109
|
+
}),
|
|
100
110
|
};
|
|
101
111
|
}
|
|
102
112
|
// If (sVar || oVar)
|
|
103
|
-
const subject = sVar ?
|
|
104
|
-
const value = (sVar ?
|
|
113
|
+
const subject = sVar ? operation.object : operation.subject;
|
|
114
|
+
const value = (sVar ? operation.subject : operation.object);
|
|
105
115
|
const pred = sVar ? actor_abstract_path_1.ActorAbstractPath.FACTORY.createInv(predicate.path) : predicate.path;
|
|
106
|
-
const
|
|
107
|
-
|
|
116
|
+
const starEval = await this.getObjectsPredicateStarEval(subject, value, pred, operation.graph, context);
|
|
117
|
+
const bindingsStream = starEval.bindingsStream.transform({
|
|
108
118
|
transform(item, next, push) {
|
|
109
119
|
push(item);
|
|
110
120
|
next();
|
|
111
121
|
},
|
|
112
122
|
});
|
|
113
|
-
const variables =
|
|
114
|
-
return {
|
|
123
|
+
const variables = operation.graph.termType === 'Variable' ? [value, operation.graph] : [value];
|
|
124
|
+
return {
|
|
125
|
+
type: 'bindings',
|
|
126
|
+
bindingsStream,
|
|
127
|
+
metadata: async () => ({ ...await starEval.metadata(), variables }),
|
|
128
|
+
};
|
|
115
129
|
}
|
|
116
130
|
}
|
|
117
131
|
exports.ActorQueryOperationPathZeroOrMore = ActorQueryOperationPathZeroOrMore;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActorQueryOperationPathZeroOrMore';
|
|
@@ -10,5 +10,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
13
|
+
__exportStar(require("./ActorQueryOperationPathZeroOrMore"), exports);
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-operation-path-zero-or-more",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.1-alpha.5.0",
|
|
4
4
|
"description": "A path-zero-or-more query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"typings": "index",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"typings": "lib/index",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/comunica/comunica.git",
|
|
@@ -27,46 +27,22 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"components",
|
|
29
29
|
"lib/**/*.d.ts",
|
|
30
|
-
"lib/**/*.js"
|
|
31
|
-
"index.d.ts",
|
|
32
|
-
"index.js"
|
|
30
|
+
"lib/**/*.js"
|
|
33
31
|
],
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"@comunica/bus-query-operation": "^1.2.0",
|
|
36
|
-
"@comunica/core": "^1.2.0"
|
|
37
|
-
},
|
|
38
32
|
"dependencies": {
|
|
39
|
-
"@comunica/actor-abstract-path": "
|
|
40
|
-
"@comunica/
|
|
41
|
-
"
|
|
33
|
+
"@comunica/actor-abstract-path": "2.0.1-alpha.5.0",
|
|
34
|
+
"@comunica/bindings-factory": "2.0.1-alpha.5.0",
|
|
35
|
+
"@comunica/bus-query-operation": "2.0.1-alpha.5.0",
|
|
36
|
+
"@comunica/core": "2.0.1-alpha.5.0",
|
|
37
|
+
"@comunica/types": "2.0.1-alpha.5.0",
|
|
38
|
+
"asynciterator": "^3.2.1",
|
|
42
39
|
"rdf-string": "^1.5.0",
|
|
43
|
-
"sparqlalgebrajs": "^
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@comunica/bus-query-operation": "^1.22.0",
|
|
47
|
-
"@comunica/core": "^1.22.0"
|
|
48
|
-
},
|
|
49
|
-
"jest": {
|
|
50
|
-
"globals": {
|
|
51
|
-
"ts-jest": {
|
|
52
|
-
"tsConfig": "../../tsconfig.json"
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"transform": {
|
|
56
|
-
"^.+\\.ts$": "ts-jest"
|
|
57
|
-
},
|
|
58
|
-
"testRegex": "(/test/.*|(\\.|/)(test|spec))\\.ts$",
|
|
59
|
-
"moduleFileExtensions": [
|
|
60
|
-
"ts",
|
|
61
|
-
"js"
|
|
62
|
-
],
|
|
63
|
-
"collectCoverage": true
|
|
40
|
+
"sparqlalgebrajs": "^4.0.0"
|
|
64
41
|
},
|
|
65
42
|
"scripts": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"build": "
|
|
69
|
-
"validate": "npm ls"
|
|
43
|
+
"build": "npm run build:ts && npm run build:components",
|
|
44
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
45
|
+
"build:components": "componentsjs-generator"
|
|
70
46
|
},
|
|
71
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e2ae2e9e924bf0656df60cc99774f7e560d47695"
|
|
72
48
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-path-zero-or-more/^1.0.0/components/context.jsonld",
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^1.0.0/components/context.jsonld",
|
|
5
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-path/^1.0.0/components/context.jsonld"
|
|
6
|
-
],
|
|
7
|
-
"@id": "npmd:@comunica/actor-query-operation-path-zero-or-more",
|
|
8
|
-
"components": [
|
|
9
|
-
{
|
|
10
|
-
"@id": "caqopzom:Actor/QueryOperation/PathZeroOrMore",
|
|
11
|
-
"@type": "Class",
|
|
12
|
-
"extends": "caap:Actor/AbstractPath",
|
|
13
|
-
"requireElement": "ActorQueryOperationPathZeroOrMore",
|
|
14
|
-
"comment": "A comunica Path ZeroOrMore Query Operation Actor.",
|
|
15
|
-
"constructorArguments": [
|
|
16
|
-
{
|
|
17
|
-
"extends": "cbqo:Actor/QueryOperationTypedMediated/constructorArgumentsObject"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib/ActorQueryOperationPathZeroOrMore';
|