pyjelly 0.7.1__cp311-cp311-macosx_11_0_x86_64.whl
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.
- cb523b6bada1c6eba8b4__mypyc.cpython-311-darwin.so +0 -0
- pyjelly/__init__.py +0 -0
- pyjelly/_proto/grpc.proto +33 -0
- pyjelly/_proto/patch.proto +165 -0
- pyjelly/_proto/rdf.proto +384 -0
- pyjelly/errors.py +10 -0
- pyjelly/integrations/__init__.py +0 -0
- pyjelly/integrations/generic/__init__.py +0 -0
- pyjelly/integrations/generic/generic_sink.py +202 -0
- pyjelly/integrations/generic/parse.py +412 -0
- pyjelly/integrations/generic/serialize.cpython-311-darwin.so +0 -0
- pyjelly/integrations/generic/serialize.py +402 -0
- pyjelly/integrations/rdflib/__init__.py +24 -0
- pyjelly/integrations/rdflib/parse.py +560 -0
- pyjelly/integrations/rdflib/serialize.py +408 -0
- pyjelly/jelly/__init__.py +5 -0
- pyjelly/jelly/rdf_pb2.py +70 -0
- pyjelly/jelly/rdf_pb2.pyi +231 -0
- pyjelly/options.py +141 -0
- pyjelly/parse/__init__.py +0 -0
- pyjelly/parse/decode.cpython-311-darwin.so +0 -0
- pyjelly/parse/decode.py +447 -0
- pyjelly/parse/ioutils.cpython-311-darwin.so +0 -0
- pyjelly/parse/ioutils.py +115 -0
- pyjelly/parse/lookup.cpython-311-darwin.so +0 -0
- pyjelly/parse/lookup.py +70 -0
- pyjelly/serialize/__init__.py +0 -0
- pyjelly/serialize/encode.cpython-311-darwin.so +0 -0
- pyjelly/serialize/encode.py +397 -0
- pyjelly/serialize/flows.py +196 -0
- pyjelly/serialize/ioutils.cpython-311-darwin.so +0 -0
- pyjelly/serialize/ioutils.py +13 -0
- pyjelly/serialize/lookup.cpython-311-darwin.so +0 -0
- pyjelly/serialize/lookup.py +137 -0
- pyjelly/serialize/streams.cpython-311-darwin.so +0 -0
- pyjelly/serialize/streams.py +281 -0
- pyjelly-0.7.1.dist-info/METADATA +114 -0
- pyjelly-0.7.1.dist-info/RECORD +41 -0
- pyjelly-0.7.1.dist-info/WHEEL +6 -0
- pyjelly-0.7.1.dist-info/entry_points.txt +7 -0
- pyjelly-0.7.1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# ruff: noqa: I001
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
from typing import cast
|
|
4
|
+
from collections.abc import Generator
|
|
5
|
+
from functools import singledispatch
|
|
6
|
+
from typing import Any, IO
|
|
7
|
+
from typing_extensions import override
|
|
8
|
+
from itertools import chain
|
|
9
|
+
from pyjelly.integrations.rdflib.parse import Quad, Triple
|
|
10
|
+
from pyjelly.options import StreamParameters
|
|
11
|
+
|
|
12
|
+
import rdflib
|
|
13
|
+
from rdflib import Graph
|
|
14
|
+
from rdflib.graph import DATASET_DEFAULT_GRAPH_ID, Dataset, QuotedGraph
|
|
15
|
+
from rdflib.serializer import Serializer as RDFLibSerializer
|
|
16
|
+
|
|
17
|
+
from mypy_extensions import mypyc_attr
|
|
18
|
+
|
|
19
|
+
from pyjelly import jelly
|
|
20
|
+
from pyjelly.serialize.encode import Rows, Slot, TermEncoder, Statement, HasGraph
|
|
21
|
+
from pyjelly.serialize.ioutils import write_delimited, write_single
|
|
22
|
+
from pyjelly.serialize.streams import (
|
|
23
|
+
GraphStream,
|
|
24
|
+
QuadStream,
|
|
25
|
+
SerializerOptions,
|
|
26
|
+
Stream,
|
|
27
|
+
TripleStream,
|
|
28
|
+
) # ruff: enable
|
|
29
|
+
|
|
30
|
+
QUAD_ARITY = 4
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@mypyc_attr(allow_interpreted_subclasses=True)
|
|
34
|
+
class RDFLibTermEncoder(TermEncoder):
|
|
35
|
+
def encode_spo(self, term: object, slot: Slot, statement: Statement) -> Rows:
|
|
36
|
+
"""
|
|
37
|
+
Encode s/p/o term based on its RDFLib object.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
term (object): term to encode
|
|
41
|
+
slot (Slot): its place in statement.
|
|
42
|
+
statement (Statement): Triple/Quad message to fill with s/p/o terms.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
Rows: encoded extra rows
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
if isinstance(term, rdflib.URIRef):
|
|
49
|
+
iri = self.get_iri_field(statement, slot)
|
|
50
|
+
return self.encode_iri(term, iri)
|
|
51
|
+
|
|
52
|
+
if isinstance(term, rdflib.Literal):
|
|
53
|
+
literal = self.get_literal_field(statement, slot)
|
|
54
|
+
return self.encode_literal(
|
|
55
|
+
lex=str(term),
|
|
56
|
+
language=term.language,
|
|
57
|
+
# `datatype` is cast to `str` explicitly because
|
|
58
|
+
# `URIRef.__eq__` overrides `str.__eq__` in an incompatible manner
|
|
59
|
+
datatype=term.datatype and str(term.datatype),
|
|
60
|
+
literal=literal,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
if isinstance(term, rdflib.BNode):
|
|
64
|
+
self.set_bnode_field(statement, slot, str(term))
|
|
65
|
+
return ()
|
|
66
|
+
|
|
67
|
+
return super().encode_spo(term, slot, statement) # error if not handled
|
|
68
|
+
|
|
69
|
+
def encode_graph(self, term: object, statement: HasGraph) -> Rows:
|
|
70
|
+
"""
|
|
71
|
+
Encode graph name term based on its RDFLib object.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
term (object): term to encode
|
|
75
|
+
statement (HasGraph): Quad/GraphStart message to fill g_{} in.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Rows: encoded extra rows
|
|
79
|
+
|
|
80
|
+
"""
|
|
81
|
+
if term == DATASET_DEFAULT_GRAPH_ID:
|
|
82
|
+
return self.encode_default_graph(statement.g_default_graph)
|
|
83
|
+
|
|
84
|
+
if isinstance(term, rdflib.URIRef):
|
|
85
|
+
return self.encode_iri(term, statement.g_iri)
|
|
86
|
+
|
|
87
|
+
if isinstance(term, rdflib.BNode):
|
|
88
|
+
statement.g_bnode = str(term)
|
|
89
|
+
return ()
|
|
90
|
+
return super().encode_graph(term, statement) # error if not handled
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def namespace_declarations(store: Graph, stream: Stream) -> None:
|
|
94
|
+
for prefix, namespace in store.namespaces():
|
|
95
|
+
stream.namespace_declaration(name=prefix, iri=namespace)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@singledispatch
|
|
99
|
+
def stream_frames(
|
|
100
|
+
stream: Stream,
|
|
101
|
+
data: Graph | Generator[Quad | Triple], # noqa: ARG001
|
|
102
|
+
) -> Generator[jelly.RdfStreamFrame]:
|
|
103
|
+
msg = f"invalid stream implementation {stream}"
|
|
104
|
+
raise TypeError(msg)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@stream_frames.register(TripleStream)
|
|
108
|
+
def triples_stream_frames(
|
|
109
|
+
stream: TripleStream,
|
|
110
|
+
data: Graph | Dataset | Generator[Triple],
|
|
111
|
+
) -> Generator[jelly.RdfStreamFrame]:
|
|
112
|
+
"""
|
|
113
|
+
Serialize a Graph/Dataset into jelly frames.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
stream (TripleStream): stream that specifies triples processing
|
|
117
|
+
data (Graph | Dataset | Generator[Triple]):
|
|
118
|
+
Graph/Dataset/Statements to serialize.
|
|
119
|
+
|
|
120
|
+
Notes:
|
|
121
|
+
if Dataset is given, its graphs are unpacked and iterated over
|
|
122
|
+
if flow is GraphsFrameFlow, emits a frame per graph.
|
|
123
|
+
|
|
124
|
+
Yields:
|
|
125
|
+
Generator[jelly.RdfStreamFrame]: jelly frames.
|
|
126
|
+
|
|
127
|
+
"""
|
|
128
|
+
stream.enroll()
|
|
129
|
+
if isinstance(data, Graph) and stream.options.params.namespace_declarations:
|
|
130
|
+
namespace_declarations(data, stream)
|
|
131
|
+
|
|
132
|
+
graphs = (data,) if not isinstance(data, Dataset) else data.graphs()
|
|
133
|
+
for graph in graphs:
|
|
134
|
+
for terms in graph:
|
|
135
|
+
if frame := stream.triple(terms):
|
|
136
|
+
yield frame
|
|
137
|
+
if frame := stream.flow.frame_from_graph():
|
|
138
|
+
yield frame
|
|
139
|
+
if stream.stream_types.flat and (frame := stream.flow.to_stream_frame()):
|
|
140
|
+
yield frame
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@stream_frames.register(QuadStream)
|
|
144
|
+
def quads_stream_frames(
|
|
145
|
+
stream: QuadStream,
|
|
146
|
+
data: Dataset | Generator[Quad],
|
|
147
|
+
) -> Generator[jelly.RdfStreamFrame]:
|
|
148
|
+
"""
|
|
149
|
+
Serialize a Dataset into jelly frames.
|
|
150
|
+
|
|
151
|
+
Notes:
|
|
152
|
+
Emits one frame per dataset if flow is of DatasetsFrameFlow.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
stream (QuadStream): stream that specifies quads processing
|
|
156
|
+
data (Dataset | Generator[Quad]): Dataset to serialize.
|
|
157
|
+
|
|
158
|
+
Yields:
|
|
159
|
+
Generator[jelly.RdfStreamFrame]: jelly frames
|
|
160
|
+
|
|
161
|
+
"""
|
|
162
|
+
stream.enroll()
|
|
163
|
+
if stream.options.params.namespace_declarations:
|
|
164
|
+
namespace_declarations(data, stream) # type: ignore[arg-type]
|
|
165
|
+
iterator: Generator[Quad, None, None]
|
|
166
|
+
if isinstance(data, Dataset):
|
|
167
|
+
iterator = cast(Generator[Quad, None, None], data.quads())
|
|
168
|
+
else:
|
|
169
|
+
iterator = data
|
|
170
|
+
|
|
171
|
+
for terms in iterator:
|
|
172
|
+
if frame := stream.quad(terms):
|
|
173
|
+
yield frame
|
|
174
|
+
if frame := stream.flow.frame_from_dataset():
|
|
175
|
+
yield frame
|
|
176
|
+
if stream.stream_types.flat and (frame := stream.flow.to_stream_frame()):
|
|
177
|
+
yield frame
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
@stream_frames.register(GraphStream)
|
|
181
|
+
def graphs_stream_frames(
|
|
182
|
+
stream: GraphStream,
|
|
183
|
+
data: Dataset | Generator[Quad],
|
|
184
|
+
) -> Generator[jelly.RdfStreamFrame]:
|
|
185
|
+
"""
|
|
186
|
+
Serialize a Dataset into jelly frames as a stream of graphs.
|
|
187
|
+
|
|
188
|
+
Notes:
|
|
189
|
+
If flow of DatasetsFrameFlow type, the whole dataset
|
|
190
|
+
will be encoded into one frame.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
stream (GraphStream): stream that specifies graphs processing
|
|
194
|
+
data (Dataset | Generator[Quad]): Dataset to serialize.
|
|
195
|
+
|
|
196
|
+
Yields:
|
|
197
|
+
Generator[jelly.RdfStreamFrame]: jelly frames
|
|
198
|
+
|
|
199
|
+
"""
|
|
200
|
+
stream.enroll()
|
|
201
|
+
if stream.options.params.namespace_declarations:
|
|
202
|
+
namespace_declarations(data, stream) # type: ignore[arg-type]
|
|
203
|
+
|
|
204
|
+
if isinstance(data, Dataset):
|
|
205
|
+
graphs = data.graphs()
|
|
206
|
+
else:
|
|
207
|
+
ds = Dataset()
|
|
208
|
+
for quad in data:
|
|
209
|
+
ctx = ds.get_context(quad.g)
|
|
210
|
+
ctx.add((quad.s, quad.p, quad.o))
|
|
211
|
+
graphs = ds.graphs()
|
|
212
|
+
|
|
213
|
+
for graph in graphs:
|
|
214
|
+
yield from stream.graph(graph_id=graph.identifier, graph=graph)
|
|
215
|
+
|
|
216
|
+
if frame := stream.flow.frame_from_dataset():
|
|
217
|
+
yield frame
|
|
218
|
+
if stream.stream_types.flat and (frame := stream.flow.to_stream_frame()):
|
|
219
|
+
yield frame
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def guess_options(sink: Graph | Dataset) -> SerializerOptions:
|
|
223
|
+
"""
|
|
224
|
+
Guess the serializer options based on the store type.
|
|
225
|
+
|
|
226
|
+
>>> guess_options(Graph()).logical_type
|
|
227
|
+
1
|
|
228
|
+
>>> guess_options(Dataset()).logical_type
|
|
229
|
+
2
|
|
230
|
+
"""
|
|
231
|
+
logical_type = (
|
|
232
|
+
jelly.LOGICAL_STREAM_TYPE_FLAT_QUADS
|
|
233
|
+
if isinstance(sink, Dataset)
|
|
234
|
+
else jelly.LOGICAL_STREAM_TYPE_FLAT_TRIPLES
|
|
235
|
+
)
|
|
236
|
+
# RDFLib doesn't support RDF-star and generalized statements by default
|
|
237
|
+
# as it requires specific handling for quoted triples and non-standard RDF terms
|
|
238
|
+
params = StreamParameters(generalized_statements=False, rdf_star=False)
|
|
239
|
+
return SerializerOptions(logical_type=logical_type, params=params)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def guess_stream(options: SerializerOptions, sink: Graph | Dataset) -> Stream:
|
|
243
|
+
"""
|
|
244
|
+
Return an appropriate stream implementation for the given options.
|
|
245
|
+
|
|
246
|
+
Notes: if base(!) logical type is GRAPHS and Dataset is given,
|
|
247
|
+
initializes TripleStream
|
|
248
|
+
|
|
249
|
+
>>> graph_ser = RDFLibJellySerializer(Graph())
|
|
250
|
+
>>> ds_ser = RDFLibJellySerializer(Dataset())
|
|
251
|
+
|
|
252
|
+
>>> type(guess_stream(guess_options(graph_ser.store), graph_ser.store))
|
|
253
|
+
<class 'pyjelly.serialize.streams.TripleStream'>
|
|
254
|
+
>>> type(guess_stream(guess_options(ds_ser.store), ds_ser.store))
|
|
255
|
+
<class 'pyjelly.serialize.streams.QuadStream'>
|
|
256
|
+
"""
|
|
257
|
+
stream_cls: type[Stream]
|
|
258
|
+
if (options.logical_type % 10) != jelly.LOGICAL_STREAM_TYPE_GRAPHS and isinstance(
|
|
259
|
+
sink, Dataset
|
|
260
|
+
):
|
|
261
|
+
stream_cls = QuadStream
|
|
262
|
+
else:
|
|
263
|
+
stream_cls = TripleStream
|
|
264
|
+
return stream_cls.for_rdflib(options=options)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class RDFLibJellySerializer(RDFLibSerializer):
|
|
268
|
+
"""
|
|
269
|
+
RDFLib serializer for writing graphs in Jelly RDF stream format.
|
|
270
|
+
|
|
271
|
+
Handles streaming RDF terms into Jelly frames using internal encoders.
|
|
272
|
+
Supports only graphs and datasets (not quoted graphs).
|
|
273
|
+
|
|
274
|
+
"""
|
|
275
|
+
|
|
276
|
+
def __init__(self, store: Graph) -> None:
|
|
277
|
+
if isinstance(store, QuotedGraph):
|
|
278
|
+
msg = "N3 format is not supported"
|
|
279
|
+
raise NotImplementedError(msg)
|
|
280
|
+
super().__init__(store)
|
|
281
|
+
|
|
282
|
+
@override
|
|
283
|
+
def serialize( # type: ignore[override]
|
|
284
|
+
self,
|
|
285
|
+
out: IO[bytes],
|
|
286
|
+
/,
|
|
287
|
+
*,
|
|
288
|
+
stream: Stream | None = None,
|
|
289
|
+
options: SerializerOptions | None = None,
|
|
290
|
+
**unused: Any,
|
|
291
|
+
) -> None:
|
|
292
|
+
"""
|
|
293
|
+
Serialize self.store content to Jelly format.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
out (IO[bytes]): output buffered writer
|
|
297
|
+
stream (Stream | None, optional): Jelly stream object. Defaults to None.
|
|
298
|
+
options (SerializerOptions | None, optional): Serializer options
|
|
299
|
+
if defined beforehand, e.g., read from a separate file.
|
|
300
|
+
Defaults to None.
|
|
301
|
+
**unused(Any): unused args for RDFLib serialize
|
|
302
|
+
|
|
303
|
+
"""
|
|
304
|
+
if options is None:
|
|
305
|
+
options = guess_options(self.store)
|
|
306
|
+
if stream is None:
|
|
307
|
+
stream = guess_stream(options, self.store)
|
|
308
|
+
write = write_delimited if stream.options.params.delimited else write_single
|
|
309
|
+
for stream_frame in stream_frames(stream, self.store):
|
|
310
|
+
write(stream_frame, out)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def grouped_stream_to_frames(
|
|
314
|
+
sink_generator: Generator[Graph] | Generator[Dataset],
|
|
315
|
+
options: SerializerOptions | None = None,
|
|
316
|
+
) -> Generator[jelly.RdfStreamFrame]:
|
|
317
|
+
"""
|
|
318
|
+
Transform Graphs/Datasets into Jelly frames, one frame per Graph/Dataset.
|
|
319
|
+
|
|
320
|
+
Note: options are guessed if not provided.
|
|
321
|
+
|
|
322
|
+
Args:
|
|
323
|
+
sink_generator (Generator[Graph] | Generator[Dataset]): Generator of
|
|
324
|
+
Graphs/Dataset to transform.
|
|
325
|
+
options (SerializerOptions | None, optional): stream options to use.
|
|
326
|
+
Options are guessed based on the sink store type. Defaults to None.
|
|
327
|
+
|
|
328
|
+
Yields:
|
|
329
|
+
Generator[jelly.RdfStreamFrame]: produced Jelly frames
|
|
330
|
+
|
|
331
|
+
"""
|
|
332
|
+
stream = None
|
|
333
|
+
for sink in sink_generator:
|
|
334
|
+
if not stream:
|
|
335
|
+
if options is None:
|
|
336
|
+
options = guess_options(sink)
|
|
337
|
+
stream = guess_stream(options, sink)
|
|
338
|
+
yield from stream_frames(stream, sink)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def grouped_stream_to_file(
|
|
342
|
+
stream: Generator[Graph] | Generator[Dataset],
|
|
343
|
+
output_file: IO[bytes],
|
|
344
|
+
**kwargs: Any,
|
|
345
|
+
) -> None:
|
|
346
|
+
"""
|
|
347
|
+
Write stream of Graphs/Datasets to a binary file.
|
|
348
|
+
|
|
349
|
+
Args:
|
|
350
|
+
stream (Generator[Graph] | Generator[Dataset]): Generator of
|
|
351
|
+
Graphs/Dataset to transform.
|
|
352
|
+
output_file (IO[bytes]): output buffered writer.
|
|
353
|
+
**kwargs (Any): options to pass to stream.
|
|
354
|
+
|
|
355
|
+
"""
|
|
356
|
+
for frame in grouped_stream_to_frames(stream, **kwargs):
|
|
357
|
+
write_delimited(frame, output_file)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def flat_stream_to_frames(
|
|
361
|
+
statements: Generator[Triple | Quad],
|
|
362
|
+
options: SerializerOptions | None = None,
|
|
363
|
+
) -> Generator[jelly.RdfStreamFrame]:
|
|
364
|
+
"""
|
|
365
|
+
Serialize a stream of raw triples or quads into Jelly frames.
|
|
366
|
+
|
|
367
|
+
Args:
|
|
368
|
+
statements (Generator[Triple | Quad]):
|
|
369
|
+
s/p/o triples or s/p/o/g quads to serialize.
|
|
370
|
+
options (SerializerOptions | None, optional):
|
|
371
|
+
if omitted, guessed based on the first tuple.
|
|
372
|
+
|
|
373
|
+
Yields:
|
|
374
|
+
Generator[jelly.RdfStreamFrame]: generated frames.
|
|
375
|
+
|
|
376
|
+
"""
|
|
377
|
+
first = next(statements, None)
|
|
378
|
+
if first is None:
|
|
379
|
+
return
|
|
380
|
+
|
|
381
|
+
sink = Dataset() if len(first) == QUAD_ARITY else Graph()
|
|
382
|
+
if options is None:
|
|
383
|
+
options = guess_options(sink)
|
|
384
|
+
stream = guess_stream(options, sink)
|
|
385
|
+
|
|
386
|
+
combined: Generator[Triple | Quad] | Graph = (
|
|
387
|
+
item for item in chain([first], statements)
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
yield from stream_frames(stream, combined)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def flat_stream_to_file(
|
|
394
|
+
statements: Generator[Triple | Quad],
|
|
395
|
+
output_file: IO[bytes],
|
|
396
|
+
options: SerializerOptions | None = None,
|
|
397
|
+
) -> None:
|
|
398
|
+
"""
|
|
399
|
+
Write Triple or Quad events to a binary file in Jelly flat format.
|
|
400
|
+
|
|
401
|
+
Args:
|
|
402
|
+
statements (Generator[Triple | Quad]): statements to serialize.
|
|
403
|
+
output_file (IO[bytes]): output buffered writer.
|
|
404
|
+
options (SerializerOptions | None, optional): stream options.
|
|
405
|
+
|
|
406
|
+
"""
|
|
407
|
+
for frame in flat_stream_to_frames(statements, options):
|
|
408
|
+
write_delimited(frame, output_file)
|
pyjelly/jelly/rdf_pb2.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: rdf.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.0
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
0,
|
|
17
|
+
'',
|
|
18
|
+
'rdf.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\trdf.proto\x12!eu.ostrzyciel.jelly.core.proto.v1\",\n\x06RdfIri\x12\x11\n\tprefix_id\x18\x01 \x01(\r\x12\x0f\n\x07name_id\x18\x02 \x01(\r\"O\n\nRdfLiteral\x12\x0b\n\x03lex\x18\x01 \x01(\t\x12\x11\n\x07langtag\x18\x02 \x01(\tH\x00\x12\x12\n\x08\x64\x61tatype\x18\x03 \x01(\rH\x00\x42\r\n\x0bliteralKind\"\x11\n\x0fRdfDefaultGraph\"\xbb\x05\n\tRdfTriple\x12:\n\x05s_iri\x18\x01 \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x00\x12\x11\n\x07s_bnode\x18\x02 \x01(\tH\x00\x12\x42\n\ts_literal\x18\x03 \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x00\x12\x45\n\rs_triple_term\x18\x04 \x01(\x0b\x32,.eu.ostrzyciel.jelly.core.proto.v1.RdfTripleH\x00\x12:\n\x05p_iri\x18\x05 \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x01\x12\x11\n\x07p_bnode\x18\x06 \x01(\tH\x01\x12\x42\n\tp_literal\x18\x07 \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x01\x12\x45\n\rp_triple_term\x18\x08 \x01(\x0b\x32,.eu.ostrzyciel.jelly.core.proto.v1.RdfTripleH\x01\x12:\n\x05o_iri\x18\t \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x02\x12\x11\n\x07o_bnode\x18\n \x01(\tH\x02\x12\x42\n\to_literal\x18\x0b \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x02\x12\x45\n\ro_triple_term\x18\x0c \x01(\x0b\x32,.eu.ostrzyciel.jelly.core.proto.v1.RdfTripleH\x02\x42\t\n\x07subjectB\x0b\n\tpredicateB\x08\n\x06object\"\xa4\x07\n\x07RdfQuad\x12:\n\x05s_iri\x18\x01 \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x00\x12\x11\n\x07s_bnode\x18\x02 \x01(\tH\x00\x12\x42\n\ts_literal\x18\x03 \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x00\x12\x45\n\rs_triple_term\x18\x04 \x01(\x0b\x32,.eu.ostrzyciel.jelly.core.proto.v1.RdfTripleH\x00\x12:\n\x05p_iri\x18\x05 \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x01\x12\x11\n\x07p_bnode\x18\x06 \x01(\tH\x01\x12\x42\n\tp_literal\x18\x07 \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x01\x12\x45\n\rp_triple_term\x18\x08 \x01(\x0b\x32,.eu.ostrzyciel.jelly.core.proto.v1.RdfTripleH\x01\x12:\n\x05o_iri\x18\t \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x02\x12\x11\n\x07o_bnode\x18\n \x01(\tH\x02\x12\x42\n\to_literal\x18\x0b \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x02\x12\x45\n\ro_triple_term\x18\x0c \x01(\x0b\x32,.eu.ostrzyciel.jelly.core.proto.v1.RdfTripleH\x02\x12:\n\x05g_iri\x18\r \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x03\x12\x11\n\x07g_bnode\x18\x0e \x01(\tH\x03\x12M\n\x0fg_default_graph\x18\x0f \x01(\x0b\x32\x32.eu.ostrzyciel.jelly.core.proto.v1.RdfDefaultGraphH\x03\x12\x42\n\tg_literal\x18\x10 \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x03\x42\t\n\x07subjectB\x0b\n\tpredicateB\x08\n\x06objectB\x07\n\x05graph\"\xfa\x01\n\rRdfGraphStart\x12:\n\x05g_iri\x18\x01 \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIriH\x00\x12\x11\n\x07g_bnode\x18\x02 \x01(\tH\x00\x12M\n\x0fg_default_graph\x18\x03 \x01(\x0b\x32\x32.eu.ostrzyciel.jelly.core.proto.v1.RdfDefaultGraphH\x00\x12\x42\n\tg_literal\x18\x04 \x01(\x0b\x32-.eu.ostrzyciel.jelly.core.proto.v1.RdfLiteralH\x00\x42\x07\n\x05graph\"\r\n\x0bRdfGraphEnd\"a\n\x17RdfNamespaceDeclaration\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).eu.ostrzyciel.jelly.core.proto.v1.RdfIri\")\n\x0cRdfNameEntry\x12\n\n\x02id\x18\x01 \x01(\r\x12\r\n\x05value\x18\x02 \x01(\t\"+\n\x0eRdfPrefixEntry\x12\n\n\x02id\x18\x01 \x01(\r\x12\r\n\x05value\x18\x02 \x01(\t\"-\n\x10RdfDatatypeEntry\x12\n\n\x02id\x18\x01 \x01(\r\x12\r\n\x05value\x18\x02 \x01(\t\"\xe1\x02\n\x10RdfStreamOptions\x12\x13\n\x0bstream_name\x18\x01 \x01(\t\x12L\n\rphysical_type\x18\x02 \x01(\x0e\x32\x35.eu.ostrzyciel.jelly.core.proto.v1.PhysicalStreamType\x12\x1e\n\x16generalized_statements\x18\x03 \x01(\x08\x12\x10\n\x08rdf_star\x18\x04 \x01(\x08\x12\x1b\n\x13max_name_table_size\x18\t \x01(\r\x12\x1d\n\x15max_prefix_table_size\x18\n \x01(\r\x12\x1f\n\x17max_datatype_table_size\x18\x0b \x01(\r\x12J\n\x0clogical_type\x18\x0e \x01(\x0e\x32\x34.eu.ostrzyciel.jelly.core.proto.v1.LogicalStreamType\x12\x0f\n\x07version\x18\x0f \x01(\r\"\x87\x05\n\x0cRdfStreamRow\x12\x46\n\x07options\x18\x01 \x01(\x0b\x32\x33.eu.ostrzyciel.jelly.core.proto.v1.RdfStreamOptionsH\x00\x12>\n\x06triple\x18\x02 \x01(\x0b\x32,.eu.ostrzyciel.jelly.core.proto.v1.RdfTripleH\x00\x12:\n\x04quad\x18\x03 \x01(\x0b\x32*.eu.ostrzyciel.jelly.core.proto.v1.RdfQuadH\x00\x12G\n\x0bgraph_start\x18\x04 \x01(\x0b\x32\x30.eu.ostrzyciel.jelly.core.proto.v1.RdfGraphStartH\x00\x12\x43\n\tgraph_end\x18\x05 \x01(\x0b\x32..eu.ostrzyciel.jelly.core.proto.v1.RdfGraphEndH\x00\x12O\n\tnamespace\x18\x06 \x01(\x0b\x32:.eu.ostrzyciel.jelly.core.proto.v1.RdfNamespaceDeclarationH\x00\x12?\n\x04name\x18\t \x01(\x0b\x32/.eu.ostrzyciel.jelly.core.proto.v1.RdfNameEntryH\x00\x12\x43\n\x06prefix\x18\n \x01(\x0b\x32\x31.eu.ostrzyciel.jelly.core.proto.v1.RdfPrefixEntryH\x00\x12G\n\x08\x64\x61tatype\x18\x0b \x01(\x0b\x32\x33.eu.ostrzyciel.jelly.core.proto.v1.RdfDatatypeEntryH\x00\x42\x05\n\x03row\"\xd3\x01\n\x0eRdfStreamFrame\x12=\n\x04rows\x18\x01 \x03(\x0b\x32/.eu.ostrzyciel.jelly.core.proto.v1.RdfStreamRow\x12Q\n\x08metadata\x18\x0f \x03(\x0b\x32?.eu.ostrzyciel.jelly.core.proto.v1.RdfStreamFrame.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01*\x9d\x01\n\x12PhysicalStreamType\x12$\n PHYSICAL_STREAM_TYPE_UNSPECIFIED\x10\x00\x12 \n\x1cPHYSICAL_STREAM_TYPE_TRIPLES\x10\x01\x12\x1e\n\x1aPHYSICAL_STREAM_TYPE_QUADS\x10\x02\x12\x1f\n\x1bPHYSICAL_STREAM_TYPE_GRAPHS\x10\x03*\xc4\x02\n\x11LogicalStreamType\x12#\n\x1fLOGICAL_STREAM_TYPE_UNSPECIFIED\x10\x00\x12$\n LOGICAL_STREAM_TYPE_FLAT_TRIPLES\x10\x01\x12\"\n\x1eLOGICAL_STREAM_TYPE_FLAT_QUADS\x10\x02\x12\x1e\n\x1aLOGICAL_STREAM_TYPE_GRAPHS\x10\x03\x12 \n\x1cLOGICAL_STREAM_TYPE_DATASETS\x10\x04\x12&\n\"LOGICAL_STREAM_TYPE_SUBJECT_GRAPHS\x10\r\x12$\n LOGICAL_STREAM_TYPE_NAMED_GRAPHS\x10\x0e\x12\x30\n,LOGICAL_STREAM_TYPE_TIMESTAMPED_NAMED_GRAPHS\x10rb\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'rdf_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
DESCRIPTOR._loaded_options = None
|
|
34
|
+
_globals['_RDFSTREAMFRAME_METADATAENTRY']._loaded_options = None
|
|
35
|
+
_globals['_RDFSTREAMFRAME_METADATAENTRY']._serialized_options = b'8\001'
|
|
36
|
+
_globals['_PHYSICALSTREAMTYPE']._serialized_start=3554
|
|
37
|
+
_globals['_PHYSICALSTREAMTYPE']._serialized_end=3711
|
|
38
|
+
_globals['_LOGICALSTREAMTYPE']._serialized_start=3714
|
|
39
|
+
_globals['_LOGICALSTREAMTYPE']._serialized_end=4038
|
|
40
|
+
_globals['_RDFIRI']._serialized_start=48
|
|
41
|
+
_globals['_RDFIRI']._serialized_end=92
|
|
42
|
+
_globals['_RDFLITERAL']._serialized_start=94
|
|
43
|
+
_globals['_RDFLITERAL']._serialized_end=173
|
|
44
|
+
_globals['_RDFDEFAULTGRAPH']._serialized_start=175
|
|
45
|
+
_globals['_RDFDEFAULTGRAPH']._serialized_end=192
|
|
46
|
+
_globals['_RDFTRIPLE']._serialized_start=195
|
|
47
|
+
_globals['_RDFTRIPLE']._serialized_end=894
|
|
48
|
+
_globals['_RDFQUAD']._serialized_start=897
|
|
49
|
+
_globals['_RDFQUAD']._serialized_end=1829
|
|
50
|
+
_globals['_RDFGRAPHSTART']._serialized_start=1832
|
|
51
|
+
_globals['_RDFGRAPHSTART']._serialized_end=2082
|
|
52
|
+
_globals['_RDFGRAPHEND']._serialized_start=2084
|
|
53
|
+
_globals['_RDFGRAPHEND']._serialized_end=2097
|
|
54
|
+
_globals['_RDFNAMESPACEDECLARATION']._serialized_start=2099
|
|
55
|
+
_globals['_RDFNAMESPACEDECLARATION']._serialized_end=2196
|
|
56
|
+
_globals['_RDFNAMEENTRY']._serialized_start=2198
|
|
57
|
+
_globals['_RDFNAMEENTRY']._serialized_end=2239
|
|
58
|
+
_globals['_RDFPREFIXENTRY']._serialized_start=2241
|
|
59
|
+
_globals['_RDFPREFIXENTRY']._serialized_end=2284
|
|
60
|
+
_globals['_RDFDATATYPEENTRY']._serialized_start=2286
|
|
61
|
+
_globals['_RDFDATATYPEENTRY']._serialized_end=2331
|
|
62
|
+
_globals['_RDFSTREAMOPTIONS']._serialized_start=2334
|
|
63
|
+
_globals['_RDFSTREAMOPTIONS']._serialized_end=2687
|
|
64
|
+
_globals['_RDFSTREAMROW']._serialized_start=2690
|
|
65
|
+
_globals['_RDFSTREAMROW']._serialized_end=3337
|
|
66
|
+
_globals['_RDFSTREAMFRAME']._serialized_start=3340
|
|
67
|
+
_globals['_RDFSTREAMFRAME']._serialized_end=3551
|
|
68
|
+
_globals['_RDFSTREAMFRAME_METADATAENTRY']._serialized_start=3504
|
|
69
|
+
_globals['_RDFSTREAMFRAME_METADATAENTRY']._serialized_end=3551
|
|
70
|
+
# @@protoc_insertion_point(module_scope)
|