@rdfc/js-runner 2.0.0-alpha.5 → 2.0.0-alpha.7
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/examples/echo/.idea/echo.iml +9 -0
- package/examples/echo/.idea/misc.xml +6 -0
- package/examples/echo/.idea/modules.xml +8 -0
- package/examples/echo/.idea/vcs.xml +7 -0
- package/examples/echo/.swls/config.json +1 -0
- package/examples/echo/index.ttl +3 -0
- package/examples/echo/minimal.ttl +90 -0
- package/examples/echo/pipeline.ttl +22 -4
- package/examples/echo/processors.ttl +5 -7
- package/examples/echo/shacl.ttl +9 -0
- package/examples/echo/shape.ttl +1339 -0
- package/examples/echo/src/processors.ts +31 -30
- package/examples/echo/test.ttl +9 -12
- package/file:/home/silvius/Projects/mumo-pipeline/ldes/http_3A_2F_2Fdata.mumo.be_2Fstreams_2Fnodes_2Fdefault/root/index.trig +3 -0
- package/index.ttl +28 -20
- package/ldes/http_3A_2F_2Fdata.mumo.be_2Fstreams_2Fnodes_2Fdefault/root/index.trig +3 -0
- package/lib/jsonld.js +2 -2
- package/lib/reader.d.ts +2 -1
- package/lib/reader.js +1 -3
- package/lib/runner.d.ts +2 -2
- package/lib/runner.js +3 -5
- package/lib/testUtils.js +4 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util_processors.js +1 -1
- package/lib/writer.d.ts +2 -1
- package/lib/writer.js +1 -1
- package/minimal.ttl +99 -0
- package/package.json +1 -1
- package/src/jsonld.ts +1 -1
- package/src/reader.ts +130 -131
- package/src/runner.ts +144 -143
- package/src/testUtils.ts +3 -0
- package/src/util_processors.ts +1 -1
- package/src/writer.ts +66 -65
package/src/reader.ts
CHANGED
|
@@ -2,149 +2,148 @@ import { ClientReadableStream } from '@grpc/grpc-js'
|
|
|
2
2
|
import { DataChunk, Message, RunnerClient, StreamMessage } from '@rdfc/proto'
|
|
3
3
|
import winston from 'winston'
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
AnyConvertor,
|
|
6
|
+
Convertor,
|
|
7
|
+
NoConvertor,
|
|
8
|
+
StreamConvertor,
|
|
9
|
+
StringConvertor,
|
|
10
10
|
} from './convertor'
|
|
11
11
|
|
|
12
12
|
export type Any =
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
| {
|
|
14
|
+
string: string
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
| {
|
|
17
|
+
stream: AsyncGenerator<Uint8Array>
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
| {
|
|
20
|
+
buffer: Uint8Array
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface Reader {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
readonly uri: string
|
|
25
|
+
strings(): AsyncIterable<string>
|
|
26
|
+
streams(): AsyncIterable<AsyncGenerator<Uint8Array>>
|
|
27
|
+
buffers(): AsyncIterable<Uint8Array>
|
|
28
|
+
anys(): AsyncIterable<Any>
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
class MyIter<T> implements AsyncIterable<T> {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
32
|
+
private convertor: Convertor<T>
|
|
33
|
+
private queue: (T | undefined)[] = []
|
|
34
|
+
private resolveNext: ((value: T | undefined) => void) | null = null
|
|
35
|
+
|
|
36
|
+
constructor(convertor: Convertor<T>) {
|
|
37
|
+
this.convertor = convertor
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
push(buffer: Uint8Array) {
|
|
41
|
+
const item = this.convertor.from(buffer)
|
|
42
|
+
if (this.resolveNext) {
|
|
43
|
+
this.resolveNext(item)
|
|
44
|
+
this.resolveNext = null
|
|
45
|
+
} else {
|
|
46
|
+
this.queue.push(item)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
close() {
|
|
51
|
+
if (this.resolveNext) {
|
|
52
|
+
this.resolveNext(undefined)
|
|
53
|
+
this.resolveNext = null
|
|
54
|
+
} else {
|
|
55
|
+
this.queue.push(undefined)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async pushStream(chunks: ClientReadableStream<DataChunk>) {
|
|
60
|
+
const stream = (async function*(stream) {
|
|
61
|
+
for await (const c of stream) {
|
|
62
|
+
const chunk: DataChunk = c
|
|
63
|
+
yield chunk.data
|
|
64
|
+
}
|
|
65
|
+
})(chunks)
|
|
66
|
+
const item = await this.convertor.fromStream(stream)
|
|
67
|
+
if (this.resolveNext) {
|
|
68
|
+
this.resolveNext(item)
|
|
69
|
+
this.resolveNext = null
|
|
70
|
+
} else {
|
|
71
|
+
this.queue.push(item)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async *[Symbol.asyncIterator]() {
|
|
76
|
+
while (true) {
|
|
77
|
+
if (this.queue.length > 0) {
|
|
78
|
+
const item = this.queue.shift()!
|
|
79
|
+
if (item === undefined) break
|
|
80
|
+
yield item
|
|
81
|
+
} else {
|
|
82
|
+
const item = await new Promise<T | undefined>(
|
|
83
|
+
(resolve) => (this.resolveNext = resolve),
|
|
84
|
+
)
|
|
85
|
+
if (item === undefined) break
|
|
86
|
+
yield item
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
export class ReaderInstance implements Reader {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
}
|
|
93
|
+
private client: RunnerClient
|
|
94
|
+
readonly uri: string
|
|
95
|
+
private logger: winston.Logger
|
|
96
|
+
|
|
97
|
+
private iterators: MyIter<unknown>[] = []
|
|
98
|
+
|
|
99
|
+
constructor(uri: string, client: RunnerClient, logger: winston.Logger) {
|
|
100
|
+
this.uri = uri
|
|
101
|
+
this.client = client
|
|
102
|
+
this.logger = logger
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
anys(): AsyncIterable<Any> {
|
|
106
|
+
const iter = new MyIter(AnyConvertor)
|
|
107
|
+
this.iterators.push(iter)
|
|
108
|
+
return iter
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
strings(): AsyncIterable<string> {
|
|
112
|
+
const iter = new MyIter(StringConvertor)
|
|
113
|
+
this.iterators.push(iter)
|
|
114
|
+
return iter
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
buffers(): AsyncIterable<Uint8Array> {
|
|
118
|
+
const iter = new MyIter(NoConvertor)
|
|
119
|
+
this.iterators.push(iter)
|
|
120
|
+
return iter
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
streams(): AsyncIterable<AsyncGenerator<Uint8Array>> {
|
|
124
|
+
const iter = new MyIter(StreamConvertor)
|
|
125
|
+
this.iterators.push(iter)
|
|
126
|
+
return iter
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
handleMsg(msg: Message) {
|
|
130
|
+
this.logger.debug(`${this.uri} handling message`)
|
|
131
|
+
for (const iter of this.iterators) {
|
|
132
|
+
iter.push(msg.data)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
close() {
|
|
137
|
+
for (const iter of this.iterators) {
|
|
138
|
+
iter.close()
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
handleStreamingMessage(msg: StreamMessage) {
|
|
143
|
+
this.logger.debug(`${this.uri} handling streaming message`)
|
|
144
|
+
const chunks = this.client.receiveStreamMessage(msg.id!)
|
|
145
|
+
for (const iter of this.iterators) {
|
|
146
|
+
iter.pushStream(chunks)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
150
149
|
}
|
package/src/runner.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
OrchestratorMessage,
|
|
3
|
+
Processor,
|
|
4
|
+
RunnerClient,
|
|
5
|
+
RunnerMessage,
|
|
6
6
|
} from '@rdfc/proto'
|
|
7
7
|
import { Reader, ReaderInstance } from './reader'
|
|
8
8
|
import { Writer, WriterInstance } from './writer'
|
|
@@ -18,164 +18,165 @@ import { createNamespace, createUriAndTermNamespace, RDF } from '@treecg/types'
|
|
|
18
18
|
import { Quad, Term } from '@rdfjs/types'
|
|
19
19
|
|
|
20
20
|
const RDFL = createUriAndTermNamespace(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
'https://w3id.org/rdf-lens/ontology#',
|
|
22
|
+
'CBD',
|
|
23
|
+
'Path',
|
|
24
|
+
'PathLens',
|
|
25
|
+
'Context',
|
|
26
|
+
'TypedExtract',
|
|
27
|
+
'EnvVariable',
|
|
28
|
+
'envKey',
|
|
29
|
+
'envDefault',
|
|
30
|
+
'datatype',
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
const RDFC = createNamespace(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
'https://w3id.org/rdf-connect#',
|
|
35
|
+
(x) => x,
|
|
36
|
+
'Reader',
|
|
37
|
+
'Writer',
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
export type Writable = (msg: OrchestratorMessage) => Promise<unknown>
|
|
41
41
|
|
|
42
42
|
type ProcessorConfig = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
location: string
|
|
44
|
+
file: string
|
|
45
|
+
clazz?: string
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export type
|
|
48
|
+
export type FullProc<C extends Proc<unknown>> = C extends Proc<infer T> ? T & C : unknown;
|
|
49
49
|
export class Runner {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async addProcessor<P extends Proc<unknown>>(proc: Processor): Promise<P & GetMyClassT<P>> {
|
|
76
|
-
const procLogger = winston.createLogger({
|
|
77
|
-
transports: [
|
|
78
|
-
new RpcTransport({
|
|
79
|
-
entities: [proc.uri, this.uri],
|
|
80
|
-
stream: this.client.logStream(() => { }),
|
|
81
|
-
}),
|
|
82
|
-
],
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const ty = JSON.stringify(this.quads.filter(x => x.subject.value === proc.uri && x.predicate.equals(RDF.terms.type)).map(x => x.object.value))
|
|
86
|
-
this.logger.info("parsing " + proc.uri + " type " + ty)
|
|
87
|
-
const args = this.shapes.lenses[RDFL.TypedExtract].execute({
|
|
88
|
-
id: new NamedNode(proc.uri),
|
|
89
|
-
quads: this.quads,
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
const config: ProcessorConfig = JSON.parse(proc.config)
|
|
93
|
-
const url = new URL(config.location)
|
|
94
|
-
process.chdir(url.pathname)
|
|
95
|
-
const jsProgram = await import(config.file)
|
|
96
|
-
const clazz = jsProgram[config.clazz || 'default']
|
|
97
|
-
const instance: Proc<unknown> = new clazz(args, procLogger)
|
|
98
|
-
await instance.init()
|
|
99
|
-
|
|
100
|
-
this.logger.info("inited " + proc.uri + " type " + ty)
|
|
101
|
-
await this.write({ init: { uri: proc.uri } })
|
|
102
|
-
|
|
103
|
-
this.processors.push(instance)
|
|
104
|
-
this.processorTransforms.push(instance.transform())
|
|
105
|
-
|
|
106
|
-
return <P & GetMyClassT<P>>instance;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async start() {
|
|
110
|
-
await Promise.all(this.processors.map((x) => x.produce()))
|
|
111
|
-
await Promise.all(this.processorTransforms)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
createWriter(uri: Term): Writer {
|
|
115
|
-
const ids = uri.value;
|
|
116
|
-
|
|
117
|
-
if (this.writers[ids] === undefined) {
|
|
118
|
-
this.writers[ids] = []
|
|
50
|
+
private readonly readers: { [uri: string]: ReaderInstance[] } = {}
|
|
51
|
+
private readonly writers: { [uri: string]: WriterInstance[] } = {}
|
|
52
|
+
private readonly client: RunnerClient
|
|
53
|
+
private readonly write: Writable
|
|
54
|
+
private readonly logger: Logger
|
|
55
|
+
private shapes: Shapes
|
|
56
|
+
private quads: Quad[] = []
|
|
57
|
+
|
|
58
|
+
private readonly uri: string
|
|
59
|
+
|
|
60
|
+
private readonly processors: Proc<unknown>[] = []
|
|
61
|
+
private readonly processorTransforms: Promise<unknown>[] = []
|
|
62
|
+
|
|
63
|
+
constructor(
|
|
64
|
+
client: RunnerClient,
|
|
65
|
+
write: Writable,
|
|
66
|
+
uri: string,
|
|
67
|
+
logger: Logger,
|
|
68
|
+
) {
|
|
69
|
+
this.client = client
|
|
70
|
+
this.write = write
|
|
71
|
+
this.uri = uri
|
|
72
|
+
this.logger = logger
|
|
119
73
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
74
|
+
|
|
75
|
+
async addProcessor<P extends Proc<unknown>>(proc: Processor): Promise<FullProc<P>> {
|
|
76
|
+
const procLogger = winston.createLogger({
|
|
77
|
+
transports: [
|
|
78
|
+
new RpcTransport({
|
|
79
|
+
entities: [proc.uri, this.uri],
|
|
80
|
+
stream: this.client.logStream(() => { }),
|
|
81
|
+
}),
|
|
82
|
+
],
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const ty = JSON.stringify(this.quads.filter(x => x.subject.value === proc.uri && x.predicate.equals(RDF.terms.type)).map(x => x.object.value))
|
|
86
|
+
this.logger.info("parsing " + proc.uri + " type " + ty)
|
|
87
|
+
const args = this.shapes.lenses[RDFL.TypedExtract].execute({
|
|
88
|
+
id: new NamedNode(proc.uri),
|
|
89
|
+
quads: this.quads,
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const config: ProcessorConfig = JSON.parse(proc.config)
|
|
93
|
+
// const url = new URL(config.location)
|
|
94
|
+
// process.chdir(url.pathname)
|
|
95
|
+
const jsProgram = await import(config.file)
|
|
96
|
+
const clazz = jsProgram[config.clazz || 'default']
|
|
97
|
+
const instance: Proc<unknown> = new clazz(args, procLogger)
|
|
98
|
+
await instance.init()
|
|
99
|
+
|
|
100
|
+
this.logger.info("inited " + proc.uri + " type " + ty)
|
|
101
|
+
|
|
102
|
+
this.processors.push(instance)
|
|
103
|
+
this.processorTransforms.push(instance.transform())
|
|
104
|
+
|
|
105
|
+
await this.write({ init: { uri: proc.uri } })
|
|
106
|
+
|
|
107
|
+
return <FullProc<P>>instance;
|
|
147
108
|
}
|
|
148
109
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
110
|
+
async start() {
|
|
111
|
+
await Promise.all(this.processors.map((x) => x.produce()))
|
|
112
|
+
await Promise.all(this.processorTransforms)
|
|
153
113
|
}
|
|
154
114
|
|
|
155
|
-
|
|
156
|
-
|
|
115
|
+
createWriter(uri: Term): Writer {
|
|
116
|
+
const ids = uri.value;
|
|
117
|
+
|
|
118
|
+
if (this.writers[ids] === undefined) {
|
|
119
|
+
this.writers[ids] = []
|
|
120
|
+
}
|
|
121
|
+
const writer = new WriterInstance(
|
|
122
|
+
ids,
|
|
123
|
+
this.client,
|
|
124
|
+
this.write,
|
|
125
|
+
this.logger,
|
|
126
|
+
)
|
|
127
|
+
this.writers[ids].push(writer)
|
|
128
|
+
return writer
|
|
129
|
+
}
|
|
157
130
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
131
|
+
createReader(uri: Term): Reader {
|
|
132
|
+
const ids = uri.value;
|
|
161
133
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
134
|
+
if (this.readers[ids] === undefined) {
|
|
135
|
+
this.readers[ids] = []
|
|
136
|
+
}
|
|
137
|
+
const reader = new ReaderInstance(ids, this.client, this.logger)
|
|
138
|
+
this.readers[ids].push(reader)
|
|
139
|
+
return reader
|
|
165
140
|
}
|
|
166
141
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
142
|
+
async handleOrchMessage(msg: RunnerMessage) {
|
|
143
|
+
if (msg.msg) {
|
|
144
|
+
this.logger.debug('Handling data msg for ' + msg.msg.channel)
|
|
145
|
+
for (const reader of this.readers[msg.msg.channel] || []) {
|
|
146
|
+
reader.handleMsg(msg.msg)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (msg.streamMsg) {
|
|
151
|
+
for (const reader of this.readers[msg.streamMsg.channel] || []) {
|
|
152
|
+
reader.handleStreamingMessage(msg.streamMsg)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (msg.close) {
|
|
157
|
+
const uri = msg.close.channel
|
|
158
|
+
|
|
159
|
+
for (const reader of this.readers[uri] || []) {
|
|
160
|
+
reader.close()
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
for (const writer of this.writers[uri] || []) {
|
|
164
|
+
await writer.close(true)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (msg.pipeline) {
|
|
169
|
+
// here
|
|
170
|
+
const quads = new Parser().parse(msg.pipeline);
|
|
171
|
+
this.shapes = extractShapes(quads, {
|
|
172
|
+
[RDFC.Reader]: (x: Cont) => this.createReader(x.id),
|
|
173
|
+
[RDFC.Writer]: (x: Cont) => this.createWriter(x.id)
|
|
174
|
+
}, {
|
|
175
|
+
[RDFC.Reader]: empty<Cont>(),
|
|
176
|
+
[RDFC.Writer]: empty<Cont>()
|
|
177
|
+
});
|
|
178
|
+
this.quads = quads;
|
|
179
|
+
this.logger.info("extracted shapes " + JSON.stringify(Object.keys(this.shapes.lenses)));
|
|
180
|
+
}
|
|
179
181
|
}
|
|
180
|
-
}
|
|
181
182
|
}
|
package/src/testUtils.ts
CHANGED
package/src/util_processors.ts
CHANGED