@comunica/actor-function-factory-expression-bnode 3.2.4-alpha.47.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 +35 -0
- package/components/ActorFunctionFactoryExpressionBnode.jsonld +172 -0
- package/components/components.jsonld +11 -0
- package/components/context.jsonld +41 -0
- package/lib/ActorFunctionFactoryExpressionBnode.d.ts +11 -0
- package/lib/ActorFunctionFactoryExpressionBnode.js +23 -0
- package/lib/ActorFunctionFactoryExpressionBnode.js.map +1 -0
- package/lib/ExpressionFunctionBnode.d.ts +19 -0
- package/lib/ExpressionFunctionBnode.js +49 -0
- package/lib/ExpressionFunctionBnode.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 +47 -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,35 @@
|
|
|
1
|
+
# Comunica Expression Function Bnode Function Factory Actor
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@comunica/actor-function-factory-expression-bnode)
|
|
4
|
+
|
|
5
|
+
A comunica Expression Function Bnode Function Factory Actor.
|
|
6
|
+
|
|
7
|
+
This module is part of the [Comunica framework](https://github.com/comunica/comunica),
|
|
8
|
+
and should only be used by [developers that want to build their own query engine](https://comunica.dev/docs/modify/).
|
|
9
|
+
|
|
10
|
+
[Click here if you just want to query with Comunica](https://comunica.dev/docs/query/).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
$ yarn add @comunica/actor-function-factory-expression-bnode
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Configure
|
|
19
|
+
|
|
20
|
+
After installing, this package can be added to your engine's configuration as follows:
|
|
21
|
+
```text
|
|
22
|
+
{
|
|
23
|
+
"@context": [
|
|
24
|
+
...
|
|
25
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-bnode/^3.0.0/components/context.jsonld"
|
|
26
|
+
],
|
|
27
|
+
"actors": [
|
|
28
|
+
...
|
|
29
|
+
{
|
|
30
|
+
"@id": "urn:comunica:default:function-factory/actors#expression-function-bnode",
|
|
31
|
+
"@type": "ActorFunctionFactoryExpressionBnode"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
```
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-bnode/^3.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-function-factory/^3.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^3.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-function-factory-expression-bnode",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorFunctionFactoryExpressionBnode",
|
|
13
|
+
"extends": [
|
|
14
|
+
"cbff:components/ActorFunctionFactoryDedicated.jsonld#ActorFunctionFactoryDedicated"
|
|
15
|
+
],
|
|
16
|
+
"comment": "A comunica ExpressionFunctionBnode Function Factory Actor.",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_name",
|
|
20
|
+
"range": "xsd:string",
|
|
21
|
+
"default": {
|
|
22
|
+
"@id": "rdf:subject"
|
|
23
|
+
},
|
|
24
|
+
"comment": "The name for this actor."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_bus",
|
|
28
|
+
"range": {
|
|
29
|
+
"@type": "ParameterRangeGenericComponent",
|
|
30
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
31
|
+
"genericTypeInstances": [
|
|
32
|
+
{
|
|
33
|
+
"@type": "ParameterRangeGenericComponent",
|
|
34
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
35
|
+
"genericTypeInstances": [
|
|
36
|
+
{
|
|
37
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
38
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
42
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
46
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
50
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
56
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
60
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
64
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
68
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"default": {
|
|
73
|
+
"@id": "cbff:components/ActorFunctionFactory.jsonld#ActorFunctionFactory_default_bus",
|
|
74
|
+
"@type": "cbff:components/BusFunctionFactory.jsonld#BusFunctionFactory"
|
|
75
|
+
},
|
|
76
|
+
"comment": "The bus this actor subscribes to."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_busFailMessage",
|
|
80
|
+
"range": {
|
|
81
|
+
"@type": "ParameterRangeUnion",
|
|
82
|
+
"parameterRangeElements": [
|
|
83
|
+
"xsd:string",
|
|
84
|
+
{
|
|
85
|
+
"@type": "ParameterRangeUndefined"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"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}\""
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_beforeActors",
|
|
93
|
+
"range": {
|
|
94
|
+
"@type": "ParameterRangeUnion",
|
|
95
|
+
"parameterRangeElements": [
|
|
96
|
+
{
|
|
97
|
+
"@type": "ParameterRangeArray",
|
|
98
|
+
"parameterRangeValue": {
|
|
99
|
+
"@type": "ParameterRangeGenericComponent",
|
|
100
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
101
|
+
"genericTypeInstances": [
|
|
102
|
+
{
|
|
103
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
104
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
108
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
112
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
116
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"@type": "ParameterRangeUndefined"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"memberFields": [
|
|
130
|
+
{
|
|
131
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode__member_constructor",
|
|
132
|
+
"memberFieldName": "constructor"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode__member_run",
|
|
136
|
+
"memberFieldName": "run"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"constructorArguments": [
|
|
140
|
+
{
|
|
141
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args__constructorArgument",
|
|
142
|
+
"fields": [
|
|
143
|
+
{
|
|
144
|
+
"keyRaw": "name",
|
|
145
|
+
"value": {
|
|
146
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_name"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"keyRaw": "bus",
|
|
151
|
+
"value": {
|
|
152
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_bus"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"keyRaw": "busFailMessage",
|
|
157
|
+
"value": {
|
|
158
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_busFailMessage"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"keyRaw": "beforeActors",
|
|
163
|
+
"value": {
|
|
164
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_beforeActors"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-bnode/^3.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@comunica/actor-function-factory-expression-bnode",
|
|
6
|
+
"@type": "Module",
|
|
7
|
+
"requireName": "@comunica/actor-function-factory-expression-bnode",
|
|
8
|
+
"import": [
|
|
9
|
+
"caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
"caffeb": "npmd:@comunica/actor-function-factory-expression-bnode/^3.0.0/",
|
|
7
|
+
"ActorFunctionFactoryExpressionBnode": {
|
|
8
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_name": {
|
|
12
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_name"
|
|
13
|
+
},
|
|
14
|
+
"args_bus": {
|
|
15
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_bus"
|
|
16
|
+
},
|
|
17
|
+
"args_busFailMessage": {
|
|
18
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_busFailMessage"
|
|
19
|
+
},
|
|
20
|
+
"args_beforeActors": {
|
|
21
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_beforeActors",
|
|
22
|
+
"@container": "@list"
|
|
23
|
+
},
|
|
24
|
+
"name": {
|
|
25
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_name"
|
|
26
|
+
},
|
|
27
|
+
"bus": {
|
|
28
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_bus"
|
|
29
|
+
},
|
|
30
|
+
"busFailMessage": {
|
|
31
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_busFailMessage"
|
|
32
|
+
},
|
|
33
|
+
"beforeActors": {
|
|
34
|
+
"@id": "caffeb:components/ActorFunctionFactoryExpressionBnode.jsonld#ActorFunctionFactoryExpressionBnode_args_beforeActors",
|
|
35
|
+
"@container": "@list"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IActionFunctionFactory, IActorFunctionFactoryArgs, IActorFunctionFactoryOutput, IActorFunctionFactoryOutputTerm } from '@comunica/bus-function-factory';
|
|
2
|
+
import { ActorFunctionFactoryDedicated } from '@comunica/bus-function-factory';
|
|
3
|
+
/**
|
|
4
|
+
* A comunica ExpressionFunctionBnode Function Factory Actor.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ActorFunctionFactoryExpressionBnode extends ActorFunctionFactoryDedicated {
|
|
7
|
+
constructor(args: IActorFunctionFactoryArgs);
|
|
8
|
+
run<T extends IActionFunctionFactory>(_: T): Promise<T extends {
|
|
9
|
+
requireTermExpression: true;
|
|
10
|
+
} ? IActorFunctionFactoryOutputTerm : IActorFunctionFactoryOutput>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActorFunctionFactoryExpressionBnode = void 0;
|
|
4
|
+
const bus_function_factory_1 = require("@comunica/bus-function-factory");
|
|
5
|
+
const utils_expression_evaluator_1 = require("@comunica/utils-expression-evaluator");
|
|
6
|
+
const ExpressionFunctionBnode_1 = require("./ExpressionFunctionBnode");
|
|
7
|
+
/**
|
|
8
|
+
* A comunica ExpressionFunctionBnode Function Factory Actor.
|
|
9
|
+
*/
|
|
10
|
+
class ActorFunctionFactoryExpressionBnode extends bus_function_factory_1.ActorFunctionFactoryDedicated {
|
|
11
|
+
constructor(args) {
|
|
12
|
+
super({
|
|
13
|
+
...args,
|
|
14
|
+
functionNames: [utils_expression_evaluator_1.SparqlOperator.BNODE],
|
|
15
|
+
termFunction: false,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async run(_) {
|
|
19
|
+
return new ExpressionFunctionBnode_1.ExpressionFunctionBnode();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ActorFunctionFactoryExpressionBnode = ActorFunctionFactoryExpressionBnode;
|
|
23
|
+
//# sourceMappingURL=ActorFunctionFactoryExpressionBnode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActorFunctionFactoryExpressionBnode.js","sourceRoot":"","sources":["ActorFunctionFactoryExpressionBnode.ts"],"names":[],"mappings":";;;AAOA,yEAEwC;AAExC,qFAAsE;AACtE,uEAAoE;AAEpE;;GAEG;AACH,MAAa,mCAAoC,SAAQ,oDAA6B;IACpF,YAAmB,IAA+B;QAChD,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,aAAa,EAAE,CAAE,2CAAc,CAAC,KAAK,CAAE;YACvC,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,GAAG,CAAmC,CAAI;QAErD,OAIE,IAAI,iDAAuB,EAAE,CAAC;IAClC,CAAC;CACF;AAjBD,kFAiBC","sourcesContent":["import type {\n IActionFunctionFactory,\n IActorFunctionFactoryArgs,\n IActorFunctionFactoryOutput,\n IActorFunctionFactoryOutputTerm,\n IExpressionFunction,\n} from '@comunica/bus-function-factory';\nimport {\n ActorFunctionFactoryDedicated,\n} from '@comunica/bus-function-factory';\n\nimport { SparqlOperator } from '@comunica/utils-expression-evaluator';\nimport { ExpressionFunctionBnode } from './ExpressionFunctionBnode';\n\n/**\n * A comunica ExpressionFunctionBnode Function Factory Actor.\n */\nexport class ActorFunctionFactoryExpressionBnode extends ActorFunctionFactoryDedicated {\n public constructor(args: IActorFunctionFactoryArgs) {\n super({\n ...args,\n functionNames: [ SparqlOperator.BNODE ],\n termFunction: false,\n });\n }\n\n public async run<T extends IActionFunctionFactory>(_: T):\n Promise<T extends { requireTermExpression: true } ? IActorFunctionFactoryOutputTerm : IActorFunctionFactoryOutput> {\n return <T extends { requireTermExpression: true } ?\n IActorFunctionFactoryOutputTerm :\n IActorFunctionFactoryOutput>\n <IExpressionFunction>\n new ExpressionFunctionBnode();\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExpressionFunctionBase } from '@comunica/bus-function-factory';
|
|
2
|
+
import type { Expression } from '@comunica/types';
|
|
3
|
+
/**
|
|
4
|
+
* https://www.w3.org/TR/sparql11-query/#func-bnode
|
|
5
|
+
* id has to be distinct over all id's in dataset
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExpressionFunctionBnode extends ExpressionFunctionBase {
|
|
8
|
+
/**
|
|
9
|
+
* This OverloadTree with the constant function will handle both type promotion and subtype-substitution
|
|
10
|
+
*/
|
|
11
|
+
private static readonly bnodeTree;
|
|
12
|
+
/**
|
|
13
|
+
* A counter that keeps track blank node generated through BNODE() SPARQL
|
|
14
|
+
* expressions.
|
|
15
|
+
*/
|
|
16
|
+
private static bnodeCounter;
|
|
17
|
+
constructor();
|
|
18
|
+
checkArity(args: Expression[]): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpressionFunctionBnode = void 0;
|
|
4
|
+
const bus_function_factory_1 = require("@comunica/bus-function-factory");
|
|
5
|
+
const context_entries_1 = require("@comunica/context-entries");
|
|
6
|
+
const utils_data_factory_1 = require("@comunica/utils-data-factory");
|
|
7
|
+
const utils_expression_evaluator_1 = require("@comunica/utils-expression-evaluator");
|
|
8
|
+
/**
|
|
9
|
+
* https://www.w3.org/TR/sparql11-query/#func-bnode
|
|
10
|
+
* id has to be distinct over all id's in dataset
|
|
11
|
+
*/
|
|
12
|
+
class ExpressionFunctionBnode extends bus_function_factory_1.ExpressionFunctionBase {
|
|
13
|
+
constructor() {
|
|
14
|
+
super({
|
|
15
|
+
arity: Number.POSITIVE_INFINITY,
|
|
16
|
+
operator: utils_expression_evaluator_1.SparqlOperator.BNODE,
|
|
17
|
+
apply: async (context) => {
|
|
18
|
+
const { args, mapping, exprEval } = context;
|
|
19
|
+
const input = args.length === 1 ?
|
|
20
|
+
await exprEval.evaluatorExpressionEvaluation(args[0], mapping) :
|
|
21
|
+
undefined;
|
|
22
|
+
let strInput;
|
|
23
|
+
if (input) {
|
|
24
|
+
const operation = ExpressionFunctionBnode.bnodeTree.search([input], exprEval.context.getSafe(context_entries_1.KeysExpressionEvaluator.superTypeProvider), exprEval.context.getSafe(context_entries_1.KeysInitQuery.functionArgumentsCache));
|
|
25
|
+
if (!operation) {
|
|
26
|
+
throw new utils_expression_evaluator_1.InvalidArgumentTypes(args, utils_expression_evaluator_1.SparqlOperator.BNODE);
|
|
27
|
+
}
|
|
28
|
+
strInput = operation(exprEval)([input]).str();
|
|
29
|
+
}
|
|
30
|
+
const bnode = new utils_data_factory_1.BlankNodeBindingsScoped(strInput ?? `BNODE_${ExpressionFunctionBnode.bnodeCounter++}`);
|
|
31
|
+
return new utils_expression_evaluator_1.BlankNode(bnode);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
checkArity(args) {
|
|
36
|
+
return args.length === 0 || args.length === 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ExpressionFunctionBnode = ExpressionFunctionBnode;
|
|
40
|
+
/**
|
|
41
|
+
* This OverloadTree with the constant function will handle both type promotion and subtype-substitution
|
|
42
|
+
*/
|
|
43
|
+
ExpressionFunctionBnode.bnodeTree = (0, utils_expression_evaluator_1.declare)(utils_expression_evaluator_1.SparqlOperator.BNODE).onString1(() => arg => arg).collect();
|
|
44
|
+
/**
|
|
45
|
+
* A counter that keeps track blank node generated through BNODE() SPARQL
|
|
46
|
+
* expressions.
|
|
47
|
+
*/
|
|
48
|
+
ExpressionFunctionBnode.bnodeCounter = 0;
|
|
49
|
+
//# sourceMappingURL=ExpressionFunctionBnode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpressionFunctionBnode.js","sourceRoot":"","sources":["ExpressionFunctionBnode.ts"],"names":[],"mappings":";;;AAAA,yEAAwE;AACxE,+DAAmF;AAEnF,qEAAuE;AACvE,qFAK8C;AAE9C;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,6CAAsB;IAYjE;QACE,KAAK,CAAC;YACJ,KAAK,EAAE,MAAM,CAAC,iBAAiB;YAC/B,QAAQ,EAAE,2CAAc,CAAC,KAAK;YAC9B,KAAK,EAAE,KAAK,EAAC,OAAqB,EAA2B,EAAE;gBAC7D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;gBAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;oBAC/B,MAAM,QAAQ,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;oBAChE,SAAS,CAAC;gBAEZ,IAAI,QAA4B,CAAC;gBACjC,IAAI,KAAK,EAAE,CAAC;oBACV,MAAM,SAAS,GAAG,uBAAuB,CAAC,SAAS,CAAC,MAAM,CACxD,CAAE,KAAK,CAAE,EACT,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,yCAAuB,CAAC,iBAAiB,CAAC,EACnE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,+BAAa,CAAC,sBAAsB,CAAC,CAC/D,CAAC;oBACF,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,iDAAoB,CAAC,IAAI,EAAE,2CAAc,CAAC,KAAK,CAAC,CAAC;oBAC7D,CAAC;oBACD,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAE,KAAK,CAAE,CAAC,CAAC,GAAG,EAAE,CAAC;gBAClD,CAAC;gBAED,MAAM,KAAK,GAAG,IAAI,4CAAuB,CAAC,QAAQ,IAAI,SAAS,uBAAuB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;gBACzG,OAAO,IAAI,sCAAS,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEe,UAAU,CAAC,IAAkB;QAC3C,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAChD,CAAC;;AA3CH,0DA4CC;AA3CC;;GAEG;AACqB,iCAAS,GAAG,IAAA,oCAAO,EAAC,2CAAc,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;AAExG;;;GAGG;AACY,oCAAY,GAAG,CAAC,CAAC","sourcesContent":["import { ExpressionFunctionBase } from '@comunica/bus-function-factory';\nimport { KeysExpressionEvaluator, KeysInitQuery } from '@comunica/context-entries';\nimport type { Expression, IEvalContext, TermExpression } from '@comunica/types';\nimport { BlankNodeBindingsScoped } from '@comunica/utils-data-factory';\nimport {\n BlankNode,\n declare,\n InvalidArgumentTypes,\n SparqlOperator,\n} from '@comunica/utils-expression-evaluator';\n\n/**\n * https://www.w3.org/TR/sparql11-query/#func-bnode\n * id has to be distinct over all id's in dataset\n */\nexport class ExpressionFunctionBnode extends ExpressionFunctionBase {\n /**\n * This OverloadTree with the constant function will handle both type promotion and subtype-substitution\n */\n private static readonly bnodeTree = declare(SparqlOperator.BNODE).onString1(() => arg => arg).collect();\n\n /**\n * A counter that keeps track blank node generated through BNODE() SPARQL\n * expressions.\n */\n private static bnodeCounter = 0;\n\n public constructor() {\n super({\n arity: Number.POSITIVE_INFINITY,\n operator: SparqlOperator.BNODE,\n apply: async(context: IEvalContext): Promise<TermExpression> => {\n const { args, mapping, exprEval } = context;\n const input = args.length === 1 ?\n await exprEval.evaluatorExpressionEvaluation(args[0], mapping) :\n undefined;\n\n let strInput: string | undefined;\n if (input) {\n const operation = ExpressionFunctionBnode.bnodeTree.search(\n [ input ],\n exprEval.context.getSafe(KeysExpressionEvaluator.superTypeProvider),\n exprEval.context.getSafe(KeysInitQuery.functionArgumentsCache),\n );\n if (!operation) {\n throw new InvalidArgumentTypes(args, SparqlOperator.BNODE);\n }\n strInput = operation(exprEval)([ input ]).str();\n }\n\n const bnode = new BlankNodeBindingsScoped(strInput ?? `BNODE_${ExpressionFunctionBnode.bnodeCounter++}`);\n return new BlankNode(bnode);\n },\n });\n }\n\n public override checkArity(args: Expression[]): boolean {\n return args.length === 0 || args.length === 1;\n }\n}\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActorFunctionFactoryExpressionBnode';
|
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("./ActorFunctionFactoryExpressionBnode"), 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 './ActorFunctionFactoryExpressionBnode';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@comunica/actor-function-factory-expression-bnode",
|
|
3
|
+
"version": "3.2.4-alpha.47.0",
|
|
4
|
+
"description": "A expression-bnode function-factory actor",
|
|
5
|
+
"lsd:module": true,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://comunica.dev/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/comunica/comunica.git",
|
|
11
|
+
"directory": "packages/actor-function-factory-expression-bnode"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/comunica/comunica/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"comunica",
|
|
18
|
+
"actor",
|
|
19
|
+
"function-factory",
|
|
20
|
+
"expression-function-bnode"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"main": "lib/index.js",
|
|
24
|
+
"typings": "lib/index",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"components",
|
|
30
|
+
"lib/**/*.d.ts",
|
|
31
|
+
"lib/**/*.js",
|
|
32
|
+
"lib/**/*.js.map"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "yarn run build:ts && yarn run build:components",
|
|
36
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
37
|
+
"build:components": "componentsjs-generator"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@comunica/bus-function-factory": "3.2.4-alpha.47.0",
|
|
41
|
+
"@comunica/context-entries": "3.2.4-alpha.47.0",
|
|
42
|
+
"@comunica/types": "3.2.4-alpha.47.0",
|
|
43
|
+
"@comunica/utils-data-factory": "3.2.4-alpha.47.0",
|
|
44
|
+
"@comunica/utils-expression-evaluator": "3.2.4-alpha.47.0"
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "85bd4c5cf07dfc293ebbc3a1416b70e2db8bfc48"
|
|
47
|
+
}
|