@comunica/actor-query-operation-distinct-identity 4.3.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 +22 -0
- package/README.md +41 -0
- package/components/ActorQueryOperationDistinctIdentity.jsonld +211 -0
- package/components/components.jsonld +11 -0
- package/components/context.jsonld +52 -0
- package/lib/ActorQueryOperationDistinctIdentity.d.ts +29 -0
- package/lib/ActorQueryOperationDistinctIdentity.js +67 -0
- package/lib/ActorQueryOperationDistinctIdentity.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/package.json +54 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
|
|
4
|
+
Comunica Association and Ghent University – imec, Belgium
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Comunica Distinct Identity Query Operation Actor
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@comunica/actor-query-operation-distinct-identity)
|
|
4
|
+
|
|
5
|
+
A [Query Operation](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation) actor that handles [SPARQL `DISTINCT`](https://www.w3.org/TR/sparql11-query/#sparqlDistinct) operations
|
|
6
|
+
by maintaining a identity-based cache of infinite size.
|
|
7
|
+
|
|
8
|
+
This module is part of the [Comunica framework](https://github.com/comunica/comunica),
|
|
9
|
+
and should only be used by [developers that want to build their own query engine](https://comunica.dev/docs/modify/).
|
|
10
|
+
|
|
11
|
+
[Click here if you just want to query with Comunica](https://comunica.dev/docs/query/).
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ yarn add @comunica/actor-query-operation-distinct-identity
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configure
|
|
20
|
+
|
|
21
|
+
After installing, this package can be added to your engine's configuration as follows:
|
|
22
|
+
```text
|
|
23
|
+
{
|
|
24
|
+
"@context": [
|
|
25
|
+
...
|
|
26
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-distinct-identity/^4.0.0/components/context.jsonld"
|
|
27
|
+
],
|
|
28
|
+
"actors": [
|
|
29
|
+
...
|
|
30
|
+
{
|
|
31
|
+
"@id": "urn:comunica:default:query-operation/actors#distinct",
|
|
32
|
+
"@type": "ActorQueryOperationDistinctIdentity",
|
|
33
|
+
"mediatorQueryOperation": { "@id": "#mediatorQueryOperation" },
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Config Parameters
|
|
40
|
+
|
|
41
|
+
* `mediatorQueryOperation`: A mediator over the [Query Operation bus](https://github.com/comunica/comunica/tree/master/packages/bus-query-operation).
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-distinct-identity/^4.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^4.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-query-operation-distinct-identity",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorQueryOperationDistinctIdentity",
|
|
13
|
+
"extends": [
|
|
14
|
+
{
|
|
15
|
+
"@type": "GenericComponentExtension",
|
|
16
|
+
"component": "cbqo:components/ActorQueryOperationTypedMediated.jsonld#ActorQueryOperationTypedMediated",
|
|
17
|
+
"genericTypeInstances": [
|
|
18
|
+
"urn:npm:sparqlalgebrajs:Distinct"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"comment": "A comunica Distinct Identity Query Operation Actor.",
|
|
23
|
+
"parameters": [
|
|
24
|
+
{
|
|
25
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_mediatorQueryOperation",
|
|
26
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_name",
|
|
30
|
+
"range": "xsd:string",
|
|
31
|
+
"default": {
|
|
32
|
+
"@id": "rdf:subject"
|
|
33
|
+
},
|
|
34
|
+
"comment": "The name for this actor."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_bus",
|
|
38
|
+
"range": {
|
|
39
|
+
"@type": "ParameterRangeGenericComponent",
|
|
40
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
41
|
+
"genericTypeInstances": [
|
|
42
|
+
{
|
|
43
|
+
"@type": "ParameterRangeGenericComponent",
|
|
44
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
45
|
+
"genericTypeInstances": [
|
|
46
|
+
{
|
|
47
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
48
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
52
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
56
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
60
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
66
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
70
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
74
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
78
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"default": {
|
|
83
|
+
"@id": "cbqo:components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus",
|
|
84
|
+
"@type": "cbqo:components/BusQueryOperation.jsonld#BusQueryOperation"
|
|
85
|
+
},
|
|
86
|
+
"comment": "The bus this actor subscribes to."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_busFailMessage",
|
|
90
|
+
"range": {
|
|
91
|
+
"@type": "ParameterRangeUnion",
|
|
92
|
+
"parameterRangeElements": [
|
|
93
|
+
"xsd:string",
|
|
94
|
+
{
|
|
95
|
+
"@type": "ParameterRangeUndefined"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"default": "Query operation processing failed: none of the configured actors were able to handle the operation type ${action.operation.type}",
|
|
100
|
+
"comment": "The message that will be configured in the bus for reporting failures. This message may be a template string that contains references to the executed `action`. For example, the following templated string is allowed: \"RDF dereferencing failed: no actors could handle ${action.handle.mediaType}\""
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_beforeActors",
|
|
104
|
+
"range": {
|
|
105
|
+
"@type": "ParameterRangeUnion",
|
|
106
|
+
"parameterRangeElements": [
|
|
107
|
+
{
|
|
108
|
+
"@type": "ParameterRangeArray",
|
|
109
|
+
"parameterRangeValue": {
|
|
110
|
+
"@type": "ParameterRangeGenericComponent",
|
|
111
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
112
|
+
"genericTypeInstances": [
|
|
113
|
+
{
|
|
114
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
115
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
119
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
123
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
127
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"@type": "ParameterRangeUndefined"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"memberFields": [
|
|
141
|
+
{
|
|
142
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity__member_constructor",
|
|
143
|
+
"memberFieldName": "constructor"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity__member_testOperation",
|
|
147
|
+
"memberFieldName": "testOperation"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity__member_runOperation",
|
|
151
|
+
"memberFieldName": "runOperation"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity__member_newIdentityFilter",
|
|
155
|
+
"memberFieldName": "newIdentityFilter"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity__member_newIdentityFilterQuads",
|
|
159
|
+
"memberFieldName": "newIdentityFilterQuads"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"constructorArguments": [
|
|
163
|
+
{
|
|
164
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args__constructorArgument",
|
|
165
|
+
"fields": [
|
|
166
|
+
{
|
|
167
|
+
"keyRaw": "mediatorQueryOperation",
|
|
168
|
+
"value": {
|
|
169
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_mediatorQueryOperation"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"keyRaw": "name",
|
|
174
|
+
"value": {
|
|
175
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_name"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"keyRaw": "bus",
|
|
180
|
+
"value": {
|
|
181
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_bus"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"keyRaw": "busFailMessage",
|
|
186
|
+
"value": {
|
|
187
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_busFailMessage"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"keyRaw": "beforeActors",
|
|
192
|
+
"value": {
|
|
193
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_beforeActors"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#IActorQueryOperationDistinctIdentityArgs",
|
|
202
|
+
"@type": "AbstractClass",
|
|
203
|
+
"requireElement": "IActorQueryOperationDistinctIdentityArgs",
|
|
204
|
+
"extends": [
|
|
205
|
+
"cbqo:components/ActorQueryOperationTypedMediated.jsonld#IActorQueryOperationTypedMediatedArgs"
|
|
206
|
+
],
|
|
207
|
+
"parameters": [],
|
|
208
|
+
"constructorArguments": []
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-distinct-identity/^4.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@comunica/actor-query-operation-distinct-identity",
|
|
6
|
+
"@type": "Module",
|
|
7
|
+
"requireName": "@comunica/actor-query-operation-distinct-identity",
|
|
8
|
+
"import": [
|
|
9
|
+
"caqodi:components/ActorQueryOperationDistinctIdentity.jsonld"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
|
|
4
|
+
{
|
|
5
|
+
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
+
"caqodi": "npmd:@comunica/actor-query-operation-distinct-identity/^4.0.0/",
|
|
7
|
+
"ActorQueryOperationDistinctIdentity": {
|
|
8
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_mediatorQueryOperation": {
|
|
12
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_mediatorQueryOperation"
|
|
13
|
+
},
|
|
14
|
+
"args_name": {
|
|
15
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_name"
|
|
16
|
+
},
|
|
17
|
+
"args_bus": {
|
|
18
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_bus"
|
|
19
|
+
},
|
|
20
|
+
"args_busFailMessage": {
|
|
21
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_busFailMessage"
|
|
22
|
+
},
|
|
23
|
+
"args_beforeActors": {
|
|
24
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_beforeActors",
|
|
25
|
+
"@container": "@list"
|
|
26
|
+
},
|
|
27
|
+
"mediatorQueryOperation": {
|
|
28
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_mediatorQueryOperation"
|
|
29
|
+
},
|
|
30
|
+
"name": {
|
|
31
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_name"
|
|
32
|
+
},
|
|
33
|
+
"bus": {
|
|
34
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_bus"
|
|
35
|
+
},
|
|
36
|
+
"busFailMessage": {
|
|
37
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_busFailMessage"
|
|
38
|
+
},
|
|
39
|
+
"beforeActors": {
|
|
40
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#ActorQueryOperationDistinctIdentity_args_beforeActors",
|
|
41
|
+
"@container": "@list"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"IActorQueryOperationDistinctIdentityArgs": {
|
|
46
|
+
"@id": "caqodi:components/ActorQueryOperationDistinctIdentity.jsonld#IActorQueryOperationDistinctIdentityArgs",
|
|
47
|
+
"@prefix": true,
|
|
48
|
+
"@context": {}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';
|
|
2
|
+
import { ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';
|
|
3
|
+
import type { IActorTest, TestResult } from '@comunica/core';
|
|
4
|
+
import type { Bindings, IActionContext, IQueryOperationResult } from '@comunica/types';
|
|
5
|
+
import type * as RDF from '@rdfjs/types';
|
|
6
|
+
import type { Algebra } from 'sparqlalgebrajs';
|
|
7
|
+
/**
|
|
8
|
+
* A comunica Distinct Identity Query Operation Actor.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ActorQueryOperationDistinctIdentity extends ActorQueryOperationTypedMediated<Algebra.Distinct> {
|
|
11
|
+
constructor(args: IActorQueryOperationDistinctIdentityArgs);
|
|
12
|
+
testOperation(_operation: Algebra.Distinct, _context: IActionContext): Promise<TestResult<IActorTest>>;
|
|
13
|
+
runOperation(operation: Algebra.Distinct, context: IActionContext): Promise<IQueryOperationResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new distinct filter function.
|
|
16
|
+
* This will maintain an internal Identity datastructure so that every bindings object only returns true once.
|
|
17
|
+
* @param variables The variables to take into account while hashing.
|
|
18
|
+
* @return {(bindings: Bindings) => boolean} A distinct filter for bindings.
|
|
19
|
+
*/
|
|
20
|
+
newIdentityFilter(variables: RDF.Variable[]): Promise<(bindings: Bindings) => boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new distinct filter function to Identity quads.
|
|
23
|
+
* This will maintain an internal Identity datastructure so that every quad object only returns true once.
|
|
24
|
+
* @return {(quad: RDF.Quad) => boolean} A distinct filter for quads.
|
|
25
|
+
*/
|
|
26
|
+
newIdentityFilterQuads(): Promise<(quad: RDF.Quad) => boolean>;
|
|
27
|
+
}
|
|
28
|
+
export interface IActorQueryOperationDistinctIdentityArgs extends IActorQueryOperationTypedMediatedArgs {
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActorQueryOperationDistinctIdentity = void 0;
|
|
4
|
+
const bus_query_operation_1 = require("@comunica/bus-query-operation");
|
|
5
|
+
const core_1 = require("@comunica/core");
|
|
6
|
+
const utils_query_operation_1 = require("@comunica/utils-query-operation");
|
|
7
|
+
const RdfString = require("rdf-string");
|
|
8
|
+
/**
|
|
9
|
+
* A comunica Distinct Identity Query Operation Actor.
|
|
10
|
+
*/
|
|
11
|
+
class ActorQueryOperationDistinctIdentity extends bus_query_operation_1.ActorQueryOperationTypedMediated {
|
|
12
|
+
constructor(args) {
|
|
13
|
+
super(args, 'distinct');
|
|
14
|
+
}
|
|
15
|
+
async testOperation(_operation, _context) {
|
|
16
|
+
return (0, core_1.passTestVoid)();
|
|
17
|
+
}
|
|
18
|
+
async runOperation(operation, context) {
|
|
19
|
+
const output = await this.mediatorQueryOperation.mediate({ operation: operation.input, context });
|
|
20
|
+
if (output.type === 'quads') {
|
|
21
|
+
const outputQuads = (0, utils_query_operation_1.getSafeQuads)(output);
|
|
22
|
+
const quadStream = outputQuads.quadStream
|
|
23
|
+
.filter(await this.newIdentityFilterQuads());
|
|
24
|
+
return {
|
|
25
|
+
type: 'quads',
|
|
26
|
+
quadStream,
|
|
27
|
+
metadata: outputQuads.metadata,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const outputBindings = (0, utils_query_operation_1.getSafeBindings)(output);
|
|
31
|
+
const variables = (await outputBindings.metadata()).variables.map(v => v.variable);
|
|
32
|
+
const bindingsStream = outputBindings.bindingsStream
|
|
33
|
+
.filter(await this.newIdentityFilter(variables));
|
|
34
|
+
return {
|
|
35
|
+
type: 'bindings',
|
|
36
|
+
bindingsStream,
|
|
37
|
+
metadata: outputBindings.metadata,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a new distinct filter function.
|
|
42
|
+
* This will maintain an internal Identity datastructure so that every bindings object only returns true once.
|
|
43
|
+
* @param variables The variables to take into account while hashing.
|
|
44
|
+
* @return {(bindings: Bindings) => boolean} A distinct filter for bindings.
|
|
45
|
+
*/
|
|
46
|
+
async newIdentityFilter(variables) {
|
|
47
|
+
const identities = {};
|
|
48
|
+
return (bindings) => {
|
|
49
|
+
const identity = variables.map(v => RdfString.termToString(bindings.get(v))).join('-');
|
|
50
|
+
return !(identity in identities) && (identities[identity] = true);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create a new distinct filter function to Identity quads.
|
|
55
|
+
* This will maintain an internal Identity datastructure so that every quad object only returns true once.
|
|
56
|
+
* @return {(quad: RDF.Quad) => boolean} A distinct filter for quads.
|
|
57
|
+
*/
|
|
58
|
+
async newIdentityFilterQuads() {
|
|
59
|
+
const identities = {};
|
|
60
|
+
return (quad) => {
|
|
61
|
+
const identity = Object.values(RdfString.quadToStringQuad(quad)).join(' ');
|
|
62
|
+
return !(identity in identities) && (identities[identity] = true);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.ActorQueryOperationDistinctIdentity = ActorQueryOperationDistinctIdentity;
|
|
67
|
+
//# sourceMappingURL=ActorQueryOperationDistinctIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationDistinctIdentity.js","sourceRoot":"","sources":["ActorQueryOperationDistinctIdentity.ts"],"names":[],"mappings":";;;AACA,uEAEuC;AAEvC,yCAA8C;AAS9C,2EAAgF;AAGhF,wCAAwC;AAGxC;;GAEG;AACH,MAAa,mCAAoC,SAAQ,sDAAkD;IACzG,YAAmB,IAA8C;QAC/D,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAA4B,EAAE,QAAwB;QAC/E,OAAO,IAAA,mBAAY,GAAE,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,SAA2B,EAAE,OAAuB;QAC5E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAElG,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,MAAM,WAAW,GAA+B,IAAA,oCAAY,EAC1D,MAAM,CACP,CAAC;YAEF,MAAM,UAAU,GAA4B,WAAW,CAAC,UAAU;iBAC/D,MAAM,CAAC,MAAM,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;YAC/C,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,UAAU;gBACV,QAAQ,EAAE,WAAW,CAAC,QAAQ;aAC/B,CAAC;QACJ,CAAC;QAED,MAAM,cAAc,GAAkC,IAAA,uCAAe,EACnE,MAAM,CACP,CAAC;QAEF,MAAM,SAAS,GAAG,CAAC,MAAM,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACnF,MAAM,cAAc,GAAmB,cAAc,CAAC,cAAc;aACjE,MAAM,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACnD,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,cAAc;YACd,QAAQ,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/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActorQueryOperationDistinctIdentity';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ActorQueryOperationDistinctIdentity"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wEAAsD","sourcesContent":["export * from './ActorQueryOperationDistinctIdentity';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@comunica/actor-query-operation-distinct-identity",
|
|
3
|
+
"version": "4.3.0",
|
|
4
|
+
"description": "A distinct-identity query-operation actor",
|
|
5
|
+
"lsd:module": true,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"funding": {
|
|
8
|
+
"type": "opencollective",
|
|
9
|
+
"url": "https://opencollective.com/comunica-association"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://comunica.dev/",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/comunica/comunica.git",
|
|
15
|
+
"directory": "packages/actor-query-operation-distinct-identity"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/comunica/comunica/issues"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"comunica",
|
|
22
|
+
"actor",
|
|
23
|
+
"query-operation",
|
|
24
|
+
"distinct-hash"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"main": "lib/index.js",
|
|
28
|
+
"typings": "lib/index",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"components",
|
|
34
|
+
"lib/**/*.d.ts",
|
|
35
|
+
"lib/**/*.js",
|
|
36
|
+
"lib/**/*.js.map"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "yarn run build:ts && yarn run build:components",
|
|
40
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
41
|
+
"build:components": "componentsjs-generator"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@comunica/bus-query-operation": "^4.2.0",
|
|
45
|
+
"@comunica/core": "^4.2.0",
|
|
46
|
+
"@comunica/types": "^4.2.0",
|
|
47
|
+
"@comunica/utils-query-operation": "^4.2.0",
|
|
48
|
+
"@rdfjs/types": "*",
|
|
49
|
+
"asynciterator": "^3.9.0",
|
|
50
|
+
"rdf-string": "^2.0.1",
|
|
51
|
+
"sparqlalgebrajs": "^4.3.8"
|
|
52
|
+
},
|
|
53
|
+
"gitHead": "1e53e7a688be2bdb428a8c46e45f7a3c5c64a2aa"
|
|
54
|
+
}
|