@comunica/actor-query-result-serialize-sparql-csv 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 +22 -0
- package/README.md +35 -0
- package/components/ActorQueryResultSerializeSparqlCsv.jsonld +202 -0
- package/components/ActorSparqlSerializeSparqlCsv.jsonld +190 -0
- package/components/components.jsonld +11 -0
- package/components/context.jsonld +57 -0
- package/lib/ActorQueryResultSerializeSparqlCsv.d.ts +27 -0
- package/lib/ActorQueryResultSerializeSparqlCsv.js +80 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +14 -0
- package/package.json +45 -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 SPARQL CSV Query Result Serialize Actor
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@comunica/actor-query-result-serialize-sparql-csv)
|
|
4
|
+
|
|
5
|
+
A [Query Result Serialize](https://github.com/comunica/comunica/tree/master/packages/bus-query-result-serialize) actor that serializes to [SPARQL/CSV](https://www.w3.org/TR/sparql11-results-csv-tsv/).
|
|
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-query-result-serialize-sparql-csv
|
|
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-query-result-serialize-sparql-csv/^2.0.0/components/context.jsonld"
|
|
26
|
+
],
|
|
27
|
+
"actors": [
|
|
28
|
+
...
|
|
29
|
+
{
|
|
30
|
+
"@id": "urn:comunica:default:query-result-serialize/actors#sparql-csv",
|
|
31
|
+
"@type": "ActorQueryResultSerializeSparqlCsv"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
```
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-result-serialize-sparql-csv/^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-result-serialize/^2.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-query-result-serialize-sparql-csv",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorQueryResultSerializeSparqlCsv",
|
|
13
|
+
"extends": [
|
|
14
|
+
"cbqrs:components/ActorQueryResultSerializeFixedMediaTypes.jsonld#ActorQueryResultSerializeFixedMediaTypes"
|
|
15
|
+
],
|
|
16
|
+
"comment": "A comunica SPARQL CSV Query Result Serialize Actor.",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypePriorities",
|
|
20
|
+
"range": "rdf:JSON",
|
|
21
|
+
"default": {
|
|
22
|
+
"@type": "@json",
|
|
23
|
+
"@value": {
|
|
24
|
+
"text/csv": 0.75
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"comment": "A record of media types, with media type name as key, and its priority as value. Priorities are numbers between [0, 1]."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypeFormats",
|
|
31
|
+
"range": "rdf:JSON",
|
|
32
|
+
"default": {
|
|
33
|
+
"@type": "@json",
|
|
34
|
+
"@value": {
|
|
35
|
+
"text/csv": "http://www.w3.org/ns/formats/SPARQL_Results_CSV"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"comment": "A record of media types, with media type name as key, and its format IRI as value."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_priorityScale",
|
|
42
|
+
"range": {
|
|
43
|
+
"@type": "ParameterRangeUnion",
|
|
44
|
+
"parameterRangeElements": [
|
|
45
|
+
"xsd:double",
|
|
46
|
+
{
|
|
47
|
+
"@type": "ParameterRangeUndefined"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"comment": "A multiplier for media type priorities. This can be used for keeping the original media types in place, but scaling all of their scores with a certain value."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_name",
|
|
55
|
+
"range": "xsd:string",
|
|
56
|
+
"default": {
|
|
57
|
+
"@id": "rdf:subject"
|
|
58
|
+
},
|
|
59
|
+
"comment": "The name for this actor."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_bus",
|
|
63
|
+
"range": {
|
|
64
|
+
"@type": "ParameterRangeGenericComponent",
|
|
65
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
66
|
+
"genericTypeInstances": [
|
|
67
|
+
{
|
|
68
|
+
"@type": "ParameterRangeGenericComponent",
|
|
69
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
70
|
+
"genericTypeInstances": [
|
|
71
|
+
{
|
|
72
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
73
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
77
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
81
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
87
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
91
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
95
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"default": {
|
|
100
|
+
"@id": "cbqrs:components/ActorQueryResultSerialize.jsonld#ActorQueryResultSerialize_default_bus",
|
|
101
|
+
"@type": "cc:components/Bus.jsonld#Bus"
|
|
102
|
+
},
|
|
103
|
+
"comment": "The bus this actor subscribes to."
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_beforeActors",
|
|
107
|
+
"range": {
|
|
108
|
+
"@type": "ParameterRangeUnion",
|
|
109
|
+
"parameterRangeElements": [
|
|
110
|
+
{
|
|
111
|
+
"@type": "ParameterRangeArray",
|
|
112
|
+
"parameterRangeValue": {
|
|
113
|
+
"@type": "ParameterRangeGenericComponent",
|
|
114
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
115
|
+
"genericTypeInstances": [
|
|
116
|
+
{
|
|
117
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
118
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
122
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
126
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"@type": "ParameterRangeUndefined"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"memberFields": [
|
|
140
|
+
{
|
|
141
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv__member_constructor",
|
|
142
|
+
"memberFieldName": "constructor"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv__member_bindingToCsvBindings",
|
|
146
|
+
"memberFieldName": "bindingToCsvBindings"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv__member_testHandleChecked",
|
|
150
|
+
"memberFieldName": "testHandleChecked"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv__member_runHandle",
|
|
154
|
+
"memberFieldName": "runHandle"
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"constructorArguments": [
|
|
158
|
+
{
|
|
159
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args__constructorArgument",
|
|
160
|
+
"fields": [
|
|
161
|
+
{
|
|
162
|
+
"keyRaw": "mediaTypePriorities",
|
|
163
|
+
"value": {
|
|
164
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypePriorities"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"keyRaw": "mediaTypeFormats",
|
|
169
|
+
"value": {
|
|
170
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypeFormats"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"keyRaw": "priorityScale",
|
|
175
|
+
"value": {
|
|
176
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_priorityScale"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"keyRaw": "name",
|
|
181
|
+
"value": {
|
|
182
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_name"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"keyRaw": "bus",
|
|
187
|
+
"value": {
|
|
188
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_bus"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"keyRaw": "beforeActors",
|
|
193
|
+
"value": {
|
|
194
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_beforeActors"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-result-serialize-sparql-csv/^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-result-serialize/^2.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-query-result-serialize-sparql-csv",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorQueryResultSerializeSparqlCsv",
|
|
13
|
+
"extends": [
|
|
14
|
+
"cbss:components/ActorQueryResultSerializeFixedMediaTypes.jsonld#ActorQueryResultSerializeFixedMediaTypes"
|
|
15
|
+
],
|
|
16
|
+
"comment": "A comunica SPARQL CSV Query Result Serialize Actor.",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypePriorities",
|
|
20
|
+
"range": "rdf:JSON",
|
|
21
|
+
"default": {
|
|
22
|
+
"@type": "@json",
|
|
23
|
+
"@value": {
|
|
24
|
+
"text/csv": 0.75
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"comment": "A record of media types, with media type name as key, and its priority as value. Priorities are numbers between [0, 1]."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypeFormats",
|
|
31
|
+
"range": "rdf:JSON",
|
|
32
|
+
"default": {
|
|
33
|
+
"@type": "@json",
|
|
34
|
+
"@value": {
|
|
35
|
+
"text/csv": "http://www.w3.org/ns/formats/SPARQL_Results_CSV"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"comment": "A record of media types, with media type name as key, and its format IRI as value."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_priorityScale",
|
|
42
|
+
"range": {
|
|
43
|
+
"@type": "ParameterRangeUnion",
|
|
44
|
+
"parameterRangeElements": [
|
|
45
|
+
"xsd:double",
|
|
46
|
+
{
|
|
47
|
+
"@type": "ParameterRangeUndefined"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"comment": "A multiplier for media type priorities. This can be used for keeping the original media types in place, but scaling all of their scores with a certain value."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_name",
|
|
55
|
+
"range": "xsd:string",
|
|
56
|
+
"default": {
|
|
57
|
+
"@id": "rdf:subject"
|
|
58
|
+
},
|
|
59
|
+
"comment": "The name for this actor."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_bus",
|
|
63
|
+
"range": {
|
|
64
|
+
"@type": "ParameterRangeGenericComponent",
|
|
65
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
66
|
+
"genericTypeInstances": [
|
|
67
|
+
{
|
|
68
|
+
"@type": "ParameterRangeGenericComponent",
|
|
69
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
70
|
+
"genericTypeInstances": [
|
|
71
|
+
{
|
|
72
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
73
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
77
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
81
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
87
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
91
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
95
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"default": {
|
|
100
|
+
"@id": "cbss:components/ActorQueryResultSerialize.jsonld#ActorQueryResultSerialize_default_bus",
|
|
101
|
+
"@type": "cc:components/Bus.jsonld#Bus"
|
|
102
|
+
},
|
|
103
|
+
"comment": "The bus this actor subscribes to."
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_beforeActors",
|
|
107
|
+
"range": {
|
|
108
|
+
"@type": "ParameterRangeUnion",
|
|
109
|
+
"parameterRangeElements": [
|
|
110
|
+
{
|
|
111
|
+
"@type": "ParameterRangeArray",
|
|
112
|
+
"parameterRangeValue": {
|
|
113
|
+
"@type": "ParameterRangeGenericComponent",
|
|
114
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
115
|
+
"genericTypeInstances": [
|
|
116
|
+
{
|
|
117
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
118
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
122
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
126
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"@type": "ParameterRangeUndefined"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"memberKeys": [
|
|
140
|
+
"constructor",
|
|
141
|
+
"bindingToCsvBindings",
|
|
142
|
+
"testHandleChecked",
|
|
143
|
+
"runHandle"
|
|
144
|
+
],
|
|
145
|
+
"constructorArguments": [
|
|
146
|
+
{
|
|
147
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args__constructorArgument",
|
|
148
|
+
"fields": [
|
|
149
|
+
{
|
|
150
|
+
"keyRaw": "mediaTypePriorities",
|
|
151
|
+
"value": {
|
|
152
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypePriorities"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"keyRaw": "mediaTypeFormats",
|
|
157
|
+
"value": {
|
|
158
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypeFormats"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"keyRaw": "priorityScale",
|
|
163
|
+
"value": {
|
|
164
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_priorityScale"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"keyRaw": "name",
|
|
169
|
+
"value": {
|
|
170
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_name"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"keyRaw": "bus",
|
|
175
|
+
"value": {
|
|
176
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_bus"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"keyRaw": "beforeActors",
|
|
181
|
+
"value": {
|
|
182
|
+
"@id": "casssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_beforeActors"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-result-serialize-sparql-csv/^2.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@comunica/actor-query-result-serialize-sparql-csv",
|
|
6
|
+
"@type": "Module",
|
|
7
|
+
"requireName": "@comunica/actor-query-result-serialize-sparql-csv",
|
|
8
|
+
"import": [
|
|
9
|
+
"caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld",
|
|
4
|
+
{
|
|
5
|
+
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
+
"caqrssc": "npmd:@comunica/actor-query-result-serialize-sparql-csv/^2.0.0/",
|
|
7
|
+
"ActorQueryResultSerializeSparqlCsv": {
|
|
8
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_mediaTypePriorities": {
|
|
12
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypePriorities",
|
|
13
|
+
"@type": "@json"
|
|
14
|
+
},
|
|
15
|
+
"args_mediaTypeFormats": {
|
|
16
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypeFormats",
|
|
17
|
+
"@type": "@json"
|
|
18
|
+
},
|
|
19
|
+
"args_priorityScale": {
|
|
20
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_priorityScale"
|
|
21
|
+
},
|
|
22
|
+
"args_name": {
|
|
23
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_name"
|
|
24
|
+
},
|
|
25
|
+
"args_bus": {
|
|
26
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_bus"
|
|
27
|
+
},
|
|
28
|
+
"args_beforeActors": {
|
|
29
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_beforeActors",
|
|
30
|
+
"@container": "@list"
|
|
31
|
+
},
|
|
32
|
+
"mediaTypePriorities": {
|
|
33
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypePriorities",
|
|
34
|
+
"@type": "@json"
|
|
35
|
+
},
|
|
36
|
+
"mediaTypeFormats": {
|
|
37
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_mediaTypeFormats",
|
|
38
|
+
"@type": "@json"
|
|
39
|
+
},
|
|
40
|
+
"priorityScale": {
|
|
41
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_priorityScale"
|
|
42
|
+
},
|
|
43
|
+
"name": {
|
|
44
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_name"
|
|
45
|
+
},
|
|
46
|
+
"bus": {
|
|
47
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_bus"
|
|
48
|
+
},
|
|
49
|
+
"beforeActors": {
|
|
50
|
+
"@id": "caqrssc:components/ActorQueryResultSerializeSparqlCsv.jsonld#ActorQueryResultSerializeSparqlCsv_args_beforeActors",
|
|
51
|
+
"@container": "@list"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IActionSparqlSerialize, IActorQueryResultSerializeFixedMediaTypesArgs, IActorQueryResultSerializeOutput } from '@comunica/bus-query-result-serialize';
|
|
2
|
+
import { ActorQueryResultSerializeFixedMediaTypes } from '@comunica/bus-query-result-serialize';
|
|
3
|
+
import type { IActionContext } from '@comunica/types';
|
|
4
|
+
import type * as RDF from '@rdfjs/types';
|
|
5
|
+
/**
|
|
6
|
+
* A comunica SPARQL CSV Query Result Serialize Actor.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ActorQueryResultSerializeSparqlCsv extends ActorQueryResultSerializeFixedMediaTypes {
|
|
9
|
+
/**
|
|
10
|
+
* @param args -
|
|
11
|
+
* \ @defaultNested {{
|
|
12
|
+
* "text/csv": 0.75
|
|
13
|
+
* }} mediaTypePriorities
|
|
14
|
+
* \ @defaultNested {{
|
|
15
|
+
* "text/csv": "http://www.w3.org/ns/formats/SPARQL_Results_CSV"
|
|
16
|
+
* }} mediaTypeFormats
|
|
17
|
+
*/
|
|
18
|
+
constructor(args: IActorQueryResultSerializeFixedMediaTypesArgs);
|
|
19
|
+
/**
|
|
20
|
+
* Converts an RDF term to its CSV representation.
|
|
21
|
+
* @param {RDF.Term} value An RDF term.
|
|
22
|
+
* @return {string} A string representation of the given value.
|
|
23
|
+
*/
|
|
24
|
+
static bindingToCsvBindings(value?: RDF.Term): string;
|
|
25
|
+
testHandleChecked(action: IActionSparqlSerialize, context: IActionContext): Promise<boolean>;
|
|
26
|
+
runHandle(action: IActionSparqlSerialize, mediaType: string | undefined, context: IActionContext): Promise<IActorQueryResultSerializeOutput>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActorQueryResultSerializeSparqlCsv = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
const bus_query_result_serialize_1 = require("@comunica/bus-query-result-serialize");
|
|
6
|
+
/**
|
|
7
|
+
* A comunica SPARQL CSV Query Result Serialize Actor.
|
|
8
|
+
*/
|
|
9
|
+
class ActorQueryResultSerializeSparqlCsv extends bus_query_result_serialize_1.ActorQueryResultSerializeFixedMediaTypes {
|
|
10
|
+
/**
|
|
11
|
+
* @param args -
|
|
12
|
+
* \ @defaultNested {{
|
|
13
|
+
* "text/csv": 0.75
|
|
14
|
+
* }} mediaTypePriorities
|
|
15
|
+
* \ @defaultNested {{
|
|
16
|
+
* "text/csv": "http://www.w3.org/ns/formats/SPARQL_Results_CSV"
|
|
17
|
+
* }} mediaTypeFormats
|
|
18
|
+
*/
|
|
19
|
+
constructor(args) {
|
|
20
|
+
super(args);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Converts an RDF term to its CSV representation.
|
|
24
|
+
* @param {RDF.Term} value An RDF term.
|
|
25
|
+
* @return {string} A string representation of the given value.
|
|
26
|
+
*/
|
|
27
|
+
static bindingToCsvBindings(value) {
|
|
28
|
+
if (!value) {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
let stringValue = value.value;
|
|
32
|
+
if (value.termType === 'Literal') {
|
|
33
|
+
// This is a lossy representation, since language and datatype are not encoded in here.
|
|
34
|
+
stringValue = `${stringValue}`;
|
|
35
|
+
}
|
|
36
|
+
else if (value.termType === 'BlankNode') {
|
|
37
|
+
stringValue = `_:${stringValue}`;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
stringValue = `<${stringValue}>`;
|
|
41
|
+
}
|
|
42
|
+
// If a value contains certain characters, put it between double quotes
|
|
43
|
+
if (/[",\n\r]/u.test(stringValue)) {
|
|
44
|
+
// Within quote strings, " is written using a pair of quotation marks "".
|
|
45
|
+
stringValue = `"${stringValue.replace(/"/ug, '""')}"`;
|
|
46
|
+
}
|
|
47
|
+
return stringValue;
|
|
48
|
+
}
|
|
49
|
+
async testHandleChecked(action, context) {
|
|
50
|
+
if (action.type !== 'bindings') {
|
|
51
|
+
throw new Error('This actor can only handle bindings streams.');
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
async runHandle(action, mediaType, context) {
|
|
56
|
+
const bindingsAction = action;
|
|
57
|
+
const data = new stream_1.Readable();
|
|
58
|
+
data._read = () => {
|
|
59
|
+
// Do nothing
|
|
60
|
+
};
|
|
61
|
+
// Write head
|
|
62
|
+
const metadata = await bindingsAction.metadata();
|
|
63
|
+
data.push(`${metadata.variables.map(variable => variable.value).join(',')}\r\n`);
|
|
64
|
+
// Write bindings
|
|
65
|
+
bindingsAction.bindingsStream.on('error', (error) => {
|
|
66
|
+
data.emit('error', error);
|
|
67
|
+
});
|
|
68
|
+
bindingsAction.bindingsStream.on('data', (bindings) => {
|
|
69
|
+
data.push(`${metadata.variables
|
|
70
|
+
.map(key => ActorQueryResultSerializeSparqlCsv.bindingToCsvBindings(bindings.get(key)))
|
|
71
|
+
.join(',')}\r\n`);
|
|
72
|
+
});
|
|
73
|
+
bindingsAction.bindingsStream.on('end', () => {
|
|
74
|
+
data.push(null);
|
|
75
|
+
});
|
|
76
|
+
return { data };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.ActorQueryResultSerializeSparqlCsv = ActorQueryResultSerializeSparqlCsv;
|
|
80
|
+
//# sourceMappingURL=ActorQueryResultSerializeSparqlCsv.js.map
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActorQueryResultSerializeSparqlCsv';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ActorQueryResultSerializeSparqlCsv"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@comunica/actor-query-result-serialize-sparql-csv",
|
|
3
|
+
"version": "2.0.1-alpha.5.0",
|
|
4
|
+
"description": "A sparql-csv query-result-serialize actor",
|
|
5
|
+
"lsd:module": true,
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"typings": "lib/index",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/comunica/comunica.git",
|
|
11
|
+
"directory": "packages/actor-query-result-serialize-sparql-csv"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"comunica",
|
|
18
|
+
"actor",
|
|
19
|
+
"query-result-serialize",
|
|
20
|
+
"sparql-csv"
|
|
21
|
+
],
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/comunica/comunica/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://comunica.dev/",
|
|
27
|
+
"files": [
|
|
28
|
+
"components",
|
|
29
|
+
"lib/**/*.d.ts",
|
|
30
|
+
"lib/**/*.js"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@comunica/bus-query-operation": "2.0.1-alpha.5.0",
|
|
34
|
+
"@comunica/bus-query-result-serialize": "2.0.1-alpha.5.0",
|
|
35
|
+
"@comunica/core": "2.0.1-alpha.5.0",
|
|
36
|
+
"@comunica/types": "2.0.1-alpha.5.0",
|
|
37
|
+
"@rdfjs/types": "*"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "npm run build:ts && npm run build:components",
|
|
41
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
42
|
+
"build:components": "componentsjs-generator"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "e2ae2e9e924bf0656df60cc99774f7e560d47695"
|
|
45
|
+
}
|