rdf4j-python 0.1.0__py3-none-any.whl → 0.1.1a0__py3-none-any.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.
- rdf4j_python/__init__.py +3 -3
- rdf4j_python/_driver/__init__.py +4 -4
- rdf4j_python/_driver/_async_rdf4j_db.py +10 -8
- rdf4j_python/_driver/_async_repository.py +66 -8
- rdf4j_python/exception/repo_exception.py +9 -0
- rdf4j_python/model/__init__.py +16 -0
- rdf4j_python/model/_namespace.py +56 -0
- rdf4j_python/model/_repository_config.py +899 -0
- rdf4j_python/model/{repository.py → _repository_info.py} +3 -3
- rdf4j_python-0.1.1a0.dist-info/METADATA +77 -0
- rdf4j_python-0.1.1a0.dist-info/RECORD +19 -0
- {rdf4j_python-0.1.0.dist-info → rdf4j_python-0.1.1a0.dist-info}/WHEEL +1 -1
- rdf4j_python-0.1.1a0.dist-info/licenses/LICENSE +28 -0
- rdf4j_python-0.1.0.dist-info/METADATA +0 -8
- rdf4j_python-0.1.0.dist-info/RECORD +0 -15
- {rdf4j_python-0.1.0.dist-info → rdf4j_python-0.1.1a0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,899 @@
|
|
|
1
|
+
from typing import Any, Dict, Optional
|
|
2
|
+
|
|
3
|
+
from rdflib import BNode, Graph, Literal, Namespace, URIRef
|
|
4
|
+
from rdflib.namespace import RDF, RDFS, XSD
|
|
5
|
+
|
|
6
|
+
# Define the RDF4J configuration namespace
|
|
7
|
+
CONFIG = Namespace("tag:rdf4j.org,2023:config/")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RepositoryConfig:
|
|
11
|
+
"""
|
|
12
|
+
Represents the configuration for an RDF4J Repository using RDFlib.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
_repo_id: str
|
|
16
|
+
_title: Optional[str] = None
|
|
17
|
+
_impl: Optional["RepositoryImplConfig"] = None
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
repo_id: str,
|
|
22
|
+
title: Optional[str] = None,
|
|
23
|
+
impl: Optional["RepositoryImplConfig"] = None,
|
|
24
|
+
):
|
|
25
|
+
self._repo_id = repo_id
|
|
26
|
+
self._title = title
|
|
27
|
+
self._impl = impl
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def repo_id(self) -> str:
|
|
31
|
+
return self._repo_id
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def title(self) -> Optional[str]:
|
|
35
|
+
return self._title
|
|
36
|
+
|
|
37
|
+
def to_turtle(self) -> str:
|
|
38
|
+
"""
|
|
39
|
+
Serializes the Repository configuration to Turtle syntax using RDFlib.
|
|
40
|
+
"""
|
|
41
|
+
graph = Graph()
|
|
42
|
+
graph.bind("rdfs", RDFS)
|
|
43
|
+
graph.bind("config", CONFIG)
|
|
44
|
+
graph.bind("xsd", XSD)
|
|
45
|
+
repo_node = BNode()
|
|
46
|
+
graph.add((repo_node, RDF["type"], CONFIG["Repository"]))
|
|
47
|
+
|
|
48
|
+
graph.add((repo_node, CONFIG["rep.id"], Literal(self._repo_id)))
|
|
49
|
+
|
|
50
|
+
if self._title:
|
|
51
|
+
graph.add((repo_node, RDFS["label"], Literal(self._title)))
|
|
52
|
+
|
|
53
|
+
if self._impl:
|
|
54
|
+
impl_node = self._impl.add_to_graph(graph)
|
|
55
|
+
graph.add((repo_node, CONFIG["rep.impl"], impl_node))
|
|
56
|
+
|
|
57
|
+
return graph.serialize(format="turtle").encode("utf-8")
|
|
58
|
+
|
|
59
|
+
@staticmethod
|
|
60
|
+
def builder_with_sail_repository(
|
|
61
|
+
sail_impl: "SailConfig",
|
|
62
|
+
) -> "RepositoryConfig.Builder":
|
|
63
|
+
"""
|
|
64
|
+
Convenience method to create a RepositoryConfig with a SailRepositoryConfig.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
repo_config = RepositoryConfig.Builder().repo_impl(
|
|
68
|
+
SailRepositoryConfig.Builder().sail_impl(sail_impl).build()
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
return repo_config
|
|
72
|
+
|
|
73
|
+
class Builder:
|
|
74
|
+
"""
|
|
75
|
+
Builder class for creating RepositoryConfig instances.
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
def __init__(self, repo_id: Optional[str] = None):
|
|
79
|
+
self._repo_id = repo_id
|
|
80
|
+
self._title: Optional[str] = None
|
|
81
|
+
self._impl: Optional["RepositoryImplConfig"] = None
|
|
82
|
+
|
|
83
|
+
def repo_id(self, repo_id: str) -> "RepositoryConfig.Builder":
|
|
84
|
+
"""
|
|
85
|
+
Sets the repository ID.
|
|
86
|
+
"""
|
|
87
|
+
self._repo_id = repo_id
|
|
88
|
+
return self
|
|
89
|
+
|
|
90
|
+
def title(self, title: str) -> "RepositoryConfig.Builder":
|
|
91
|
+
"""
|
|
92
|
+
Sets the human-readable title for the repository.
|
|
93
|
+
"""
|
|
94
|
+
self._title = title
|
|
95
|
+
return self
|
|
96
|
+
|
|
97
|
+
def repo_impl(self, impl: "RepositoryImplConfig") -> "RepositoryConfig.Builder":
|
|
98
|
+
"""
|
|
99
|
+
Sets the repository implementation configuration.
|
|
100
|
+
"""
|
|
101
|
+
self._impl = impl
|
|
102
|
+
return self
|
|
103
|
+
|
|
104
|
+
def build(self) -> "RepositoryConfig":
|
|
105
|
+
"""
|
|
106
|
+
Builds and returns the RepositoryConfig instance.
|
|
107
|
+
"""
|
|
108
|
+
return RepositoryConfig(
|
|
109
|
+
repo_id=self._repo_id, title=self._title, impl=self._impl
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class RepositoryImplConfig:
|
|
114
|
+
"""
|
|
115
|
+
Base class for repository implementation configurations using RDFlib.
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
def __init__(self, rep_type: str):
|
|
119
|
+
self.rep_type = rep_type
|
|
120
|
+
self.config_params: Dict[str, Any] = {}
|
|
121
|
+
|
|
122
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
123
|
+
"""
|
|
124
|
+
Adds the repository implementation configuration to the RDF graph.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
The RDF node representing this configuration.
|
|
128
|
+
"""
|
|
129
|
+
sail_node = BNode()
|
|
130
|
+
graph.add((sail_node, CONFIG["rep.type"], Literal(self.rep_type)))
|
|
131
|
+
for key, value in self.config_params.items():
|
|
132
|
+
if isinstance(value, str):
|
|
133
|
+
graph.add((sail_node, CONFIG[key], Literal(value)))
|
|
134
|
+
elif isinstance(value, int):
|
|
135
|
+
graph.add(
|
|
136
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.integer))
|
|
137
|
+
)
|
|
138
|
+
elif isinstance(value, float):
|
|
139
|
+
graph.add((sail_node, CONFIG[key], Literal(value, datatype=XSD.double)))
|
|
140
|
+
elif isinstance(value, bool):
|
|
141
|
+
graph.add(
|
|
142
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.boolean))
|
|
143
|
+
)
|
|
144
|
+
elif isinstance(value, list):
|
|
145
|
+
for item in value:
|
|
146
|
+
graph.add((sail_node, CONFIG[key], URIRef(item))) # Assuming IRIs
|
|
147
|
+
elif isinstance(value, RepositoryImplConfig) or isinstance(
|
|
148
|
+
value, SailConfig
|
|
149
|
+
):
|
|
150
|
+
nested_node = value.add_to_graph(graph)
|
|
151
|
+
graph.add((sail_node, CONFIG[key], nested_node))
|
|
152
|
+
else:
|
|
153
|
+
raise ValueError(f"Unsupported configuration value type: {type(value)}")
|
|
154
|
+
return sail_node
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class SPARQLRepositoryConfig(RepositoryImplConfig):
|
|
158
|
+
"""
|
|
159
|
+
Configuration for a SPARQLRepository using RDFlib.
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
TYPE = "openrdf:SPARQLRepository"
|
|
163
|
+
|
|
164
|
+
def __init__(self, query_endpoint: str, update_endpoint: Optional[str] = None):
|
|
165
|
+
super().__init__(rep_type=SPARQLRepositoryConfig.TYPE)
|
|
166
|
+
self.config_params["sparql.queryEndpoint"] = query_endpoint
|
|
167
|
+
if update_endpoint:
|
|
168
|
+
self.config_params["sparql.updateEndpoint"] = update_endpoint
|
|
169
|
+
|
|
170
|
+
class Builder:
|
|
171
|
+
def __init__(self, query_endpoint: str):
|
|
172
|
+
self._query_endpoint = query_endpoint
|
|
173
|
+
self._update_endpoint: Optional[str] = None
|
|
174
|
+
|
|
175
|
+
def update_endpoint(
|
|
176
|
+
self, update_endpoint: str
|
|
177
|
+
) -> "SPARQLRepositoryConfig.Builder":
|
|
178
|
+
self._update_endpoint = update_endpoint
|
|
179
|
+
return self
|
|
180
|
+
|
|
181
|
+
def build(self) -> "SPARQLRepositoryConfig":
|
|
182
|
+
return SPARQLRepositoryConfig(
|
|
183
|
+
query_endpoint=self._query_endpoint,
|
|
184
|
+
update_endpoint=self._update_endpoint,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class HTTPRepositoryConfig(RepositoryImplConfig):
|
|
189
|
+
"""
|
|
190
|
+
Configuration for an HTTPRepository using RDFlib.
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
TYPE = "openrdf:HTTPRepository"
|
|
194
|
+
|
|
195
|
+
def __init__(
|
|
196
|
+
self, url: str, username: Optional[str] = None, password: Optional[str] = None
|
|
197
|
+
):
|
|
198
|
+
super().__init__(rep_type=HTTPRepositoryConfig.TYPE)
|
|
199
|
+
self.config_params["http.url"] = url
|
|
200
|
+
if username:
|
|
201
|
+
self.config_params["http.username"] = username
|
|
202
|
+
if password:
|
|
203
|
+
self.config_params["http.password"] = password
|
|
204
|
+
|
|
205
|
+
class Builder:
|
|
206
|
+
def __init__(self, url: str):
|
|
207
|
+
self._url = url
|
|
208
|
+
self._username: Optional[str] = None
|
|
209
|
+
self._password: Optional[str] = None
|
|
210
|
+
|
|
211
|
+
def username(self, username: str) -> "HTTPRepositoryConfig.Builder":
|
|
212
|
+
self._username = username
|
|
213
|
+
return self
|
|
214
|
+
|
|
215
|
+
def password(self, password: str) -> "HTTPRepositoryConfig.Builder":
|
|
216
|
+
self._password = password
|
|
217
|
+
return self
|
|
218
|
+
|
|
219
|
+
def build(self) -> "HTTPRepositoryConfig":
|
|
220
|
+
return HTTPRepositoryConfig(
|
|
221
|
+
url=self._url, username=self._username, password=self._password
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class SailRepositoryConfig(RepositoryImplConfig):
|
|
226
|
+
"""
|
|
227
|
+
Configuration for a SailRepository using RDFlib.
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
TYPE = "openrdf:SailRepository"
|
|
231
|
+
|
|
232
|
+
def __init__(self, sail_impl: "SailConfig"):
|
|
233
|
+
super().__init__(rep_type=SailRepositoryConfig.TYPE)
|
|
234
|
+
self.config_params["sail.impl"] = sail_impl
|
|
235
|
+
|
|
236
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
237
|
+
"""
|
|
238
|
+
Adds the SailRepository configuration to the RDF graph.
|
|
239
|
+
"""
|
|
240
|
+
return super().add_to_graph(graph)
|
|
241
|
+
|
|
242
|
+
class Builder:
|
|
243
|
+
def __init__(self, sail_impl: Optional["SailConfig"] = None):
|
|
244
|
+
self._sail_impl = sail_impl
|
|
245
|
+
|
|
246
|
+
def sail_impl(self, sail_impl: "SailConfig") -> "SailRepositoryConfig.Builder":
|
|
247
|
+
self._sail_impl = sail_impl
|
|
248
|
+
return self
|
|
249
|
+
|
|
250
|
+
def build(self) -> "SailRepositoryConfig":
|
|
251
|
+
return SailRepositoryConfig(sail_impl=self._sail_impl)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class DatasetRepositoryConfig(RepositoryImplConfig):
|
|
255
|
+
"""
|
|
256
|
+
Configuration for a DatasetRepository using RDFlib.
|
|
257
|
+
"""
|
|
258
|
+
|
|
259
|
+
TYPE = "openrdf:DatasetRepository"
|
|
260
|
+
|
|
261
|
+
def __init__(self, delegate: "RepositoryImplConfig"):
|
|
262
|
+
super().__init__(rep_type=DatasetRepositoryConfig.TYPE)
|
|
263
|
+
self.config_params["delegate"] = delegate
|
|
264
|
+
|
|
265
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
266
|
+
"""
|
|
267
|
+
Adds the DatasetRepository configuration to the RDF Graph
|
|
268
|
+
"""
|
|
269
|
+
repo_node = super().add_to_graph(graph)
|
|
270
|
+
return repo_node
|
|
271
|
+
|
|
272
|
+
class Builder:
|
|
273
|
+
def __init__(self, delegate: "RepositoryImplConfig"):
|
|
274
|
+
self._delegate = delegate
|
|
275
|
+
|
|
276
|
+
def build(self) -> "DatasetRepositoryConfig":
|
|
277
|
+
return DatasetRepositoryConfig(delegate=self._delegate)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class SailConfig:
|
|
281
|
+
"""
|
|
282
|
+
Base class for SAIL configurations using RDFlib.
|
|
283
|
+
"""
|
|
284
|
+
|
|
285
|
+
def __init__(
|
|
286
|
+
self,
|
|
287
|
+
sail_type: str,
|
|
288
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
289
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
290
|
+
):
|
|
291
|
+
self.sail_type = sail_type
|
|
292
|
+
self.config_params: Dict[str, Any] = {}
|
|
293
|
+
if iteration_cache_sync_threshold is not None:
|
|
294
|
+
self.config_params["sail.iterationCacheSyncThreshold"] = (
|
|
295
|
+
iteration_cache_sync_threshold
|
|
296
|
+
)
|
|
297
|
+
if default_query_evaluation_mode:
|
|
298
|
+
self.config_params["sail.defaultQueryEvaluationMode"] = (
|
|
299
|
+
default_query_evaluation_mode
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
303
|
+
"""
|
|
304
|
+
Adds the SAIL configuration to the RDF graph.
|
|
305
|
+
|
|
306
|
+
Returns:
|
|
307
|
+
The RDF node representing this configuration.
|
|
308
|
+
"""
|
|
309
|
+
sail_node = BNode()
|
|
310
|
+
graph.add((sail_node, CONFIG["sail.type"], Literal(self.sail_type)))
|
|
311
|
+
for key, value in self.config_params.items():
|
|
312
|
+
if isinstance(value, str):
|
|
313
|
+
graph.add((sail_node, CONFIG[key], Literal(value)))
|
|
314
|
+
elif isinstance(value, int):
|
|
315
|
+
graph.add(
|
|
316
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.integer))
|
|
317
|
+
)
|
|
318
|
+
elif isinstance(value, float):
|
|
319
|
+
graph.add((sail_node, CONFIG[key], Literal(value, datatype=XSD.double)))
|
|
320
|
+
elif isinstance(value, bool):
|
|
321
|
+
graph.add(
|
|
322
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.boolean))
|
|
323
|
+
)
|
|
324
|
+
elif isinstance(value, list):
|
|
325
|
+
for item in value:
|
|
326
|
+
graph.add((sail_node, CONFIG[key], URIRef(item)))
|
|
327
|
+
elif isinstance(value, SailConfig) or isinstance(
|
|
328
|
+
value, RepositoryImplConfig
|
|
329
|
+
):
|
|
330
|
+
nested_node = value.add_to_graph(graph)
|
|
331
|
+
graph.add((sail_node, CONFIG[key], nested_node))
|
|
332
|
+
else:
|
|
333
|
+
raise ValueError(f"Unsupported configuration value type: {type(value)}")
|
|
334
|
+
return sail_node
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class MemoryStoreConfig(SailConfig):
|
|
338
|
+
"""
|
|
339
|
+
Configuration for a MemoryStore using RDFlib.
|
|
340
|
+
"""
|
|
341
|
+
|
|
342
|
+
TYPE = "openrdf:MemoryStore"
|
|
343
|
+
|
|
344
|
+
def __init__(
|
|
345
|
+
self,
|
|
346
|
+
persist: Optional[bool] = None,
|
|
347
|
+
sync_delay: Optional[int] = None,
|
|
348
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
349
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
350
|
+
):
|
|
351
|
+
super().__init__(
|
|
352
|
+
sail_type=MemoryStoreConfig.TYPE,
|
|
353
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
354
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
355
|
+
)
|
|
356
|
+
if persist is not None:
|
|
357
|
+
self.config_params["mem.persist"] = persist
|
|
358
|
+
if sync_delay is not None:
|
|
359
|
+
self.config_params["mem.syncDelay"] = sync_delay
|
|
360
|
+
|
|
361
|
+
class Builder:
|
|
362
|
+
def __init__(self):
|
|
363
|
+
self._persist: Optional[bool] = None
|
|
364
|
+
self._sync_delay: Optional[int] = None
|
|
365
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
366
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
367
|
+
|
|
368
|
+
def persist(self, persist: bool) -> "MemoryStoreConfig.Builder":
|
|
369
|
+
self._persist = persist
|
|
370
|
+
return self
|
|
371
|
+
|
|
372
|
+
def sync_delay(self, sync_delay: int) -> "MemoryStoreConfig.Builder":
|
|
373
|
+
self._sync_delay = sync_delay
|
|
374
|
+
return self
|
|
375
|
+
|
|
376
|
+
def iteration_cache_sync_threshold(
|
|
377
|
+
self, threshold: int
|
|
378
|
+
) -> "MemoryStoreConfig.Builder":
|
|
379
|
+
self._iteration_cache_sync_threshold = threshold
|
|
380
|
+
return self
|
|
381
|
+
|
|
382
|
+
def default_query_evaluation_mode(
|
|
383
|
+
self, mode: str
|
|
384
|
+
) -> "MemoryStoreConfig.Builder":
|
|
385
|
+
self._default_query_evaluation_mode = mode
|
|
386
|
+
return self
|
|
387
|
+
|
|
388
|
+
def build(self) -> "MemoryStoreConfig":
|
|
389
|
+
return MemoryStoreConfig(
|
|
390
|
+
persist=self._persist,
|
|
391
|
+
sync_delay=self._sync_delay,
|
|
392
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
393
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
class NativeStoreConfig(SailConfig):
|
|
398
|
+
"""
|
|
399
|
+
Configuration for a NativeStore using RDFlib.
|
|
400
|
+
"""
|
|
401
|
+
|
|
402
|
+
TYPE = "openrdf:NativeStore"
|
|
403
|
+
|
|
404
|
+
def __init__(
|
|
405
|
+
self,
|
|
406
|
+
triple_indexes: Optional[str] = None,
|
|
407
|
+
force_sync: Optional[bool] = None,
|
|
408
|
+
value_cache_size: Optional[int] = None,
|
|
409
|
+
value_id_cache_size: Optional[int] = None,
|
|
410
|
+
namespace_cache_size: Optional[int] = None,
|
|
411
|
+
namespace_id_cache_size: Optional[int] = None,
|
|
412
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
413
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
414
|
+
):
|
|
415
|
+
super().__init__(
|
|
416
|
+
sail_type=NativeStoreConfig.TYPE,
|
|
417
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
418
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
419
|
+
)
|
|
420
|
+
if triple_indexes:
|
|
421
|
+
self.config_params["native.tripleIndexes"] = triple_indexes
|
|
422
|
+
if force_sync:
|
|
423
|
+
self.config_params["native.forceSync"] = force_sync
|
|
424
|
+
if value_cache_size:
|
|
425
|
+
self.config_params["native.valueCacheSize"] = value_cache_size
|
|
426
|
+
if value_id_cache_size:
|
|
427
|
+
self.config_params["native.valueIDCacheSize"] = value_id_cache_size
|
|
428
|
+
if namespace_cache_size:
|
|
429
|
+
self.config_params["native.namespaceCacheSize"] = namespace_cache_size
|
|
430
|
+
if namespace_id_cache_size:
|
|
431
|
+
self.config_params["native.namespaceIDCacheSize"] = namespace_id_cache_size
|
|
432
|
+
|
|
433
|
+
class Builder:
|
|
434
|
+
def __init__(self):
|
|
435
|
+
self._triple_indexes: Optional[str] = None
|
|
436
|
+
self._force_sync: Optional[bool] = None
|
|
437
|
+
self._value_cache_size: Optional[int] = None
|
|
438
|
+
self._value_id_cache_size: Optional[int] = None
|
|
439
|
+
self._namespace_cache_size: Optional[int] = None
|
|
440
|
+
self._namespace_id_cache_size: Optional[int] = None
|
|
441
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
442
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
443
|
+
|
|
444
|
+
def triple_indexes(self, indexes: str) -> "NativeStoreConfig.Builder":
|
|
445
|
+
self._triple_indexes = indexes
|
|
446
|
+
return self
|
|
447
|
+
|
|
448
|
+
def force_sync(self, sync: bool) -> "NativeStoreConfig.Builder":
|
|
449
|
+
self._force_sync = sync
|
|
450
|
+
return self
|
|
451
|
+
|
|
452
|
+
def value_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
453
|
+
self._value_cache_size = size
|
|
454
|
+
return self
|
|
455
|
+
|
|
456
|
+
def value_id_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
457
|
+
self._value_id_cache_size = size
|
|
458
|
+
return self
|
|
459
|
+
|
|
460
|
+
def namespace_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
461
|
+
self._namespace_cache_size = size
|
|
462
|
+
return self
|
|
463
|
+
|
|
464
|
+
def namespace_id_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
465
|
+
self._namespace_id_cache_size = size
|
|
466
|
+
return self
|
|
467
|
+
|
|
468
|
+
def iteration_cache_sync_threshold(
|
|
469
|
+
self, threshold: int
|
|
470
|
+
) -> "NativeStoreConfig.Builder":
|
|
471
|
+
self._iteration_cache_sync_threshold = threshold
|
|
472
|
+
return self
|
|
473
|
+
|
|
474
|
+
def default_query_evaluation_mode(
|
|
475
|
+
self, mode: str
|
|
476
|
+
) -> "NativeStoreConfig.Builder":
|
|
477
|
+
self._default_query_evaluation_mode = mode
|
|
478
|
+
return self
|
|
479
|
+
|
|
480
|
+
def build(self) -> "NativeStoreConfig":
|
|
481
|
+
return NativeStoreConfig(
|
|
482
|
+
triple_indexes=self._triple_indexes,
|
|
483
|
+
force_sync=self._force_sync,
|
|
484
|
+
value_cache_size=self._value_cache_size,
|
|
485
|
+
value_id_cache_size=self._value_id_cache_size,
|
|
486
|
+
namespace_cache_size=self._namespace_cache_size,
|
|
487
|
+
namespace_id_cache_size=self._namespace_id_cache_size,
|
|
488
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
489
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
class ElasticsearchStoreConfig(SailConfig):
|
|
494
|
+
"""
|
|
495
|
+
Configuration for an ElasticsearchStore using RDFlib.
|
|
496
|
+
"""
|
|
497
|
+
|
|
498
|
+
TYPE = "rdf4j:ElasticsearchStore"
|
|
499
|
+
|
|
500
|
+
def __init__(
|
|
501
|
+
self,
|
|
502
|
+
hostname: str,
|
|
503
|
+
port: Optional[int] = None,
|
|
504
|
+
cluster_name: Optional[str] = None,
|
|
505
|
+
index: Optional[str] = None,
|
|
506
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
507
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
508
|
+
):
|
|
509
|
+
super().__init__(
|
|
510
|
+
sail_type=ElasticsearchStoreConfig.TYPE,
|
|
511
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
512
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
513
|
+
)
|
|
514
|
+
self.config_params["ess.hostname"] = hostname
|
|
515
|
+
if port is not None:
|
|
516
|
+
self.config_params["ess.port"] = port
|
|
517
|
+
if cluster_name is not None:
|
|
518
|
+
self.config_params["ess.clusterName"] = cluster_name
|
|
519
|
+
if index is not None:
|
|
520
|
+
self.config_params["ess.index"] = index
|
|
521
|
+
|
|
522
|
+
class Builder:
|
|
523
|
+
def __init__(self, hostname: str):
|
|
524
|
+
self._hostname = hostname
|
|
525
|
+
self._port: Optional[int] = None
|
|
526
|
+
self._cluster_name: Optional[str] = None
|
|
527
|
+
self._index: Optional[str] = None
|
|
528
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
529
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
530
|
+
|
|
531
|
+
def port(self, port: int) -> "ElasticsearchStoreConfig.Builder":
|
|
532
|
+
self._port = port
|
|
533
|
+
return self
|
|
534
|
+
|
|
535
|
+
def cluster_name(self, cluster_name: str) -> "ElasticsearchStoreConfig.Builder":
|
|
536
|
+
self._cluster_name = cluster_name
|
|
537
|
+
return self
|
|
538
|
+
|
|
539
|
+
def index(self, index: str) -> "ElasticsearchStoreConfig.Builder":
|
|
540
|
+
self._index = index
|
|
541
|
+
return self
|
|
542
|
+
|
|
543
|
+
def iteration_cache_sync_threshold(
|
|
544
|
+
self, threshold: int
|
|
545
|
+
) -> "ElasticsearchStoreConfig.Builder":
|
|
546
|
+
self._iteration_cache_sync_threshold = threshold
|
|
547
|
+
return self
|
|
548
|
+
|
|
549
|
+
def default_query_evaluation_mode(
|
|
550
|
+
self, mode: str
|
|
551
|
+
) -> "ElasticsearchStoreConfig.Builder":
|
|
552
|
+
self._default_query_evaluation_mode = mode
|
|
553
|
+
return self
|
|
554
|
+
|
|
555
|
+
def build(self) -> "ElasticsearchStoreConfig":
|
|
556
|
+
return ElasticsearchStoreConfig(
|
|
557
|
+
hostname=self._hostname,
|
|
558
|
+
port=self._port,
|
|
559
|
+
cluster_name=self._cluster_name,
|
|
560
|
+
index=self._index,
|
|
561
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
562
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
class SchemaCachingRDFSInferencerConfig(SailConfig):
|
|
567
|
+
"""
|
|
568
|
+
Configuration for the RDF Schema inferencer using RDFlib.
|
|
569
|
+
"""
|
|
570
|
+
|
|
571
|
+
TYPE = "rdf4j:SchemaCachingRDFSInferencer"
|
|
572
|
+
|
|
573
|
+
def __init__(
|
|
574
|
+
self,
|
|
575
|
+
delegate: "SailConfig",
|
|
576
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
577
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
578
|
+
):
|
|
579
|
+
super().__init__(
|
|
580
|
+
sail_type=SchemaCachingRDFSInferencerConfig.TYPE,
|
|
581
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
582
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
583
|
+
)
|
|
584
|
+
self.config_params["delegate"] = delegate
|
|
585
|
+
|
|
586
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
587
|
+
"""
|
|
588
|
+
Adds the SchemaCachingRDFSInferencer configuration to the RDF graph.
|
|
589
|
+
"""
|
|
590
|
+
sail_node = super().add_to_graph(graph)
|
|
591
|
+
delegate_node = self.config_params["delegate"].to_rdf(graph)
|
|
592
|
+
graph.add((sail_node, CONFIG.delegate, delegate_node))
|
|
593
|
+
return sail_node
|
|
594
|
+
|
|
595
|
+
class Builder:
|
|
596
|
+
def __init__(self, delegate: "SailConfig"):
|
|
597
|
+
self._delegate = delegate
|
|
598
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
599
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
600
|
+
|
|
601
|
+
def iteration_cache_sync_threshold(
|
|
602
|
+
self, threshold: int
|
|
603
|
+
) -> "SchemaCachingRDFSInferencerConfig.Builder":
|
|
604
|
+
self._iteration_cache_sync_threshold = threshold
|
|
605
|
+
return self
|
|
606
|
+
|
|
607
|
+
def default_query_evaluation_mode(
|
|
608
|
+
self, mode: str
|
|
609
|
+
) -> "SchemaCachingRDFSInferencerConfig.Builder":
|
|
610
|
+
self._default_query_evaluation_mode = mode
|
|
611
|
+
return self
|
|
612
|
+
|
|
613
|
+
def build(self) -> "SchemaCachingRDFSInferencerConfig":
|
|
614
|
+
return SchemaCachingRDFSInferencerConfig(
|
|
615
|
+
delegate=self._delegate,
|
|
616
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
617
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
618
|
+
)
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
class DirectTypeHierarchyInferencerConfig(SailConfig):
|
|
622
|
+
"""
|
|
623
|
+
Configuration for the Direct Type inferencer using RDFlib.
|
|
624
|
+
"""
|
|
625
|
+
|
|
626
|
+
TYPE = "openrdf:DirectTypeHierarchyInferencer"
|
|
627
|
+
|
|
628
|
+
def __init__(
|
|
629
|
+
self,
|
|
630
|
+
delegate: "SailConfig",
|
|
631
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
632
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
633
|
+
):
|
|
634
|
+
super().__init__(
|
|
635
|
+
sail_type=DirectTypeHierarchyInferencerConfig.TYPE,
|
|
636
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
637
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
638
|
+
)
|
|
639
|
+
self.config_params["delegate"] = delegate
|
|
640
|
+
|
|
641
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
642
|
+
"""
|
|
643
|
+
Adds the DirectTypeHierarchyInferencerConfig to the graph
|
|
644
|
+
"""
|
|
645
|
+
sail_node = super().add_to_graph(graph)
|
|
646
|
+
delegate_node = self.config_params["delegate"].to_rdf(graph)
|
|
647
|
+
graph.add((sail_node, CONFIG["delegate"], delegate_node))
|
|
648
|
+
return sail_node
|
|
649
|
+
|
|
650
|
+
class Builder:
|
|
651
|
+
def __init__(self, delegate: "SailConfig"):
|
|
652
|
+
self._delegate = delegate
|
|
653
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
654
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
655
|
+
|
|
656
|
+
def iteration_cache_sync_threshold(
|
|
657
|
+
self, threshold: int
|
|
658
|
+
) -> "DirectTypeHierarchyInferencerConfig.Builder":
|
|
659
|
+
self._iteration_cache_sync_threshold = threshold
|
|
660
|
+
return self
|
|
661
|
+
|
|
662
|
+
def default_query_evaluation_mode(
|
|
663
|
+
self, mode: str
|
|
664
|
+
) -> "DirectTypeHierarchyInferencerConfig.Builder":
|
|
665
|
+
self._default_query_evaluation_mode = mode
|
|
666
|
+
return self
|
|
667
|
+
|
|
668
|
+
def build(self) -> "DirectTypeHierarchyInferencerConfig":
|
|
669
|
+
return DirectTypeHierarchyInferencerConfig(
|
|
670
|
+
delegate=self._delegate,
|
|
671
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
672
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
class SHACLSailConfig(SailConfig):
|
|
677
|
+
"""
|
|
678
|
+
Configuration for the SHACL Sail using RDFlib.
|
|
679
|
+
"""
|
|
680
|
+
|
|
681
|
+
TYPE = "rdf4j:ShaclSail"
|
|
682
|
+
|
|
683
|
+
def __init__(
|
|
684
|
+
self,
|
|
685
|
+
delegate: "SailConfig",
|
|
686
|
+
parallel_validation: Optional[bool] = None,
|
|
687
|
+
undefined_target_validates_all_subjects: Optional[bool] = None,
|
|
688
|
+
log_validation_plans: Optional[bool] = None,
|
|
689
|
+
log_validation_violations: Optional[bool] = None,
|
|
690
|
+
ignore_no_shapes_loaded_exception: Optional[bool] = None,
|
|
691
|
+
validation_enabled: Optional[bool] = None,
|
|
692
|
+
cache_select_nodes: Optional[bool] = None,
|
|
693
|
+
global_log_validation_execution: Optional[bool] = None,
|
|
694
|
+
rdfs_sub_class_reasoning: Optional[bool] = None,
|
|
695
|
+
performance_logging: Optional[bool] = None,
|
|
696
|
+
serializable_validation: Optional[bool] = None,
|
|
697
|
+
eclipse_rdf4j_shacl_extensions: Optional[bool] = None,
|
|
698
|
+
dash_data_shapes: Optional[bool] = None,
|
|
699
|
+
validation_results_limit_total: Optional[int] = None,
|
|
700
|
+
validation_results_limit_per_constraint: Optional[int] = None,
|
|
701
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
702
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
703
|
+
):
|
|
704
|
+
super().__init__(
|
|
705
|
+
sail_type=SHACLSailConfig.TYPE,
|
|
706
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
707
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
708
|
+
)
|
|
709
|
+
self.config_params["delegate"] = delegate
|
|
710
|
+
if parallel_validation is not None:
|
|
711
|
+
self.config_params["shacl.parallelValidation"] = parallel_validation
|
|
712
|
+
if undefined_target_validates_all_subjects is not None:
|
|
713
|
+
self.config_params["shacl.undefinedTargetValidatesAllSubjects"] = (
|
|
714
|
+
undefined_target_validates_all_subjects
|
|
715
|
+
)
|
|
716
|
+
if log_validation_plans is not None:
|
|
717
|
+
self.config_params["shacl.logValidationPlans"] = log_validation_plans
|
|
718
|
+
if log_validation_violations is not None:
|
|
719
|
+
self.config_params["shacl.logValidationViolations"] = (
|
|
720
|
+
log_validation_violations
|
|
721
|
+
)
|
|
722
|
+
if ignore_no_shapes_loaded_exception is not None:
|
|
723
|
+
self.config_params["shacl.ignoreNoShapesLoadedException"] = (
|
|
724
|
+
ignore_no_shapes_loaded_exception
|
|
725
|
+
)
|
|
726
|
+
if validation_enabled is not None:
|
|
727
|
+
self.config_params["shacl.validationEnabled"] = validation_enabled
|
|
728
|
+
if cache_select_nodes is not None:
|
|
729
|
+
self.config_params["shacl.cacheSelectNodes"] = cache_select_nodes
|
|
730
|
+
if global_log_validation_execution is not None:
|
|
731
|
+
self.config_params["shacl.globalLogValidationExecution"] = (
|
|
732
|
+
global_log_validation_execution
|
|
733
|
+
)
|
|
734
|
+
if rdfs_sub_class_reasoning is not None:
|
|
735
|
+
self.config_params["shacl.rdfsSubClassReasoning"] = rdfs_sub_class_reasoning
|
|
736
|
+
if performance_logging is not None:
|
|
737
|
+
self.config_params["shacl.performanceLogging"] = performance_logging
|
|
738
|
+
if serializable_validation is not None:
|
|
739
|
+
self.config_params["shacl.serializableValidation"] = serializable_validation
|
|
740
|
+
if eclipse_rdf4j_shacl_extensions is not None:
|
|
741
|
+
self.config_params["shacl.eclipseRdf4jShaclExtensions"] = (
|
|
742
|
+
eclipse_rdf4j_shacl_extensions
|
|
743
|
+
)
|
|
744
|
+
if dash_data_shapes is not None:
|
|
745
|
+
self.config_params["shacl.dashDataShapes"] = dash_data_shapes
|
|
746
|
+
if validation_results_limit_total is not None:
|
|
747
|
+
self.config_params["shacl.validationResultsLimitTotal"] = (
|
|
748
|
+
validation_results_limit_total
|
|
749
|
+
)
|
|
750
|
+
if validation_results_limit_per_constraint is not None:
|
|
751
|
+
self.config_params["shacl.validationResultsLimitPerConstraint"] = (
|
|
752
|
+
validation_results_limit_per_constraint
|
|
753
|
+
)
|
|
754
|
+
|
|
755
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
756
|
+
"""Adds the SHACLSailConfig to the RDF graph."""
|
|
757
|
+
sail_node = super().add_to_graph(graph) # Get the basic node
|
|
758
|
+
delegate_node = self.config_params["delegate"].to_rdf(graph)
|
|
759
|
+
graph.add((sail_node, CONFIG.delegate, delegate_node))
|
|
760
|
+
|
|
761
|
+
# Add SHACL-specific parameters
|
|
762
|
+
for key, value in self.config_params.items():
|
|
763
|
+
if key != "delegate": # Delegate is already handled
|
|
764
|
+
if isinstance(value, bool):
|
|
765
|
+
graph.add(
|
|
766
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.boolean))
|
|
767
|
+
)
|
|
768
|
+
elif isinstance(value, int):
|
|
769
|
+
graph.add(
|
|
770
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.integer))
|
|
771
|
+
)
|
|
772
|
+
else:
|
|
773
|
+
graph.add((sail_node, CONFIG[key], Literal(value)))
|
|
774
|
+
return sail_node
|
|
775
|
+
|
|
776
|
+
class Builder:
|
|
777
|
+
def __init__(self, delegate: "SailConfig"):
|
|
778
|
+
self._delegate = delegate
|
|
779
|
+
self._parallel_validation: Optional[bool] = None
|
|
780
|
+
self._undefined_target_validates_all_subjects: Optional[bool] = None
|
|
781
|
+
self._log_validation_plans: Optional[bool] = None
|
|
782
|
+
self._log_validation_violations: Optional[bool] = None
|
|
783
|
+
self._ignore_no_shapes_loaded_exception: Optional[bool] = None
|
|
784
|
+
self._validation_enabled: Optional[bool] = None
|
|
785
|
+
self._cache_select_nodes: Optional[bool] = None
|
|
786
|
+
self._global_log_validation_execution: Optional[bool] = None
|
|
787
|
+
self._rdfs_sub_class_reasoning: Optional[bool] = None
|
|
788
|
+
self._performance_logging: Optional[bool] = None
|
|
789
|
+
self._serializable_validation: Optional[bool] = None
|
|
790
|
+
self._eclipse_rdf4j_shacl_extensions: Optional[bool] = None
|
|
791
|
+
self._dash_data_shapes: Optional[bool] = None
|
|
792
|
+
self._validation_results_limit_total: Optional[int] = None
|
|
793
|
+
self._validation_results_limit_per_constraint: Optional[int] = None
|
|
794
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
795
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
796
|
+
|
|
797
|
+
def parallel_validation(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
798
|
+
self._parallel_validation = value
|
|
799
|
+
return self
|
|
800
|
+
|
|
801
|
+
def undefined_target_validates_all_subjects(
|
|
802
|
+
self, value: bool
|
|
803
|
+
) -> "SHACLSailConfig.Builder":
|
|
804
|
+
self._undefined_target_validates_all_subjects = value
|
|
805
|
+
return self
|
|
806
|
+
|
|
807
|
+
def log_validation_plans(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
808
|
+
self._log_validation_plans = value
|
|
809
|
+
return self
|
|
810
|
+
|
|
811
|
+
def log_validation_violations(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
812
|
+
self._log_validation_violations = value
|
|
813
|
+
return self
|
|
814
|
+
|
|
815
|
+
def ignore_no_shapes_loaded_exception(
|
|
816
|
+
self, value: bool
|
|
817
|
+
) -> "SHACLSailConfig.Builder":
|
|
818
|
+
self._ignore_no_shapes_loaded_exception = value
|
|
819
|
+
return self
|
|
820
|
+
|
|
821
|
+
def validation_enabled(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
822
|
+
self._validation_enabled = value
|
|
823
|
+
return self
|
|
824
|
+
|
|
825
|
+
def cache_select_nodes(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
826
|
+
self._cache_select_nodes = value
|
|
827
|
+
return self
|
|
828
|
+
|
|
829
|
+
def global_log_validation_execution(
|
|
830
|
+
self, value: bool
|
|
831
|
+
) -> "SHACLSailConfig.Builder":
|
|
832
|
+
self._global_log_validation_execution = value
|
|
833
|
+
return self
|
|
834
|
+
|
|
835
|
+
def rdfs_sub_class_reasoning(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
836
|
+
self._rdfs_sub_class_reasoning = value
|
|
837
|
+
return self
|
|
838
|
+
|
|
839
|
+
def performance_logging(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
840
|
+
self._performance_logging = value
|
|
841
|
+
return self
|
|
842
|
+
|
|
843
|
+
def serializable_validation(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
844
|
+
self._serializable_validation = value
|
|
845
|
+
return self
|
|
846
|
+
|
|
847
|
+
def eclipse_rdf4j_shacl_extensions(
|
|
848
|
+
self, value: bool
|
|
849
|
+
) -> "SHACLSailConfig.Builder":
|
|
850
|
+
self._eclipse_rdf4j_shacl_extensions = value
|
|
851
|
+
return self
|
|
852
|
+
|
|
853
|
+
def dash_data_shapes(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
854
|
+
self._dash_data_shapes = value
|
|
855
|
+
return self
|
|
856
|
+
|
|
857
|
+
def validation_results_limit_total(
|
|
858
|
+
self, value: int
|
|
859
|
+
) -> "SHACLSailConfig.Builder":
|
|
860
|
+
self._validation_results_limit_total = value
|
|
861
|
+
return self
|
|
862
|
+
|
|
863
|
+
def validation_results_limit_per_constraint(
|
|
864
|
+
self, value: int
|
|
865
|
+
) -> "SHACLSailConfig.Builder":
|
|
866
|
+
self._validation_results_limit_per_constraint = value
|
|
867
|
+
return self
|
|
868
|
+
|
|
869
|
+
def iteration_cache_sync_threshold(
|
|
870
|
+
self, threshold: int
|
|
871
|
+
) -> "SHACLSailConfig.Builder":
|
|
872
|
+
self._iteration_cache_sync_threshold = threshold
|
|
873
|
+
return self
|
|
874
|
+
|
|
875
|
+
def default_query_evaluation_mode(self, mode: str) -> "SHACLSailConfig.Builder":
|
|
876
|
+
self._default_query_evaluation_mode = mode
|
|
877
|
+
return self
|
|
878
|
+
|
|
879
|
+
def build(self) -> "SHACLSailConfig":
|
|
880
|
+
return SHACLSailConfig(
|
|
881
|
+
delegate=self._delegate,
|
|
882
|
+
parallel_validation=self._parallel_validation,
|
|
883
|
+
undefined_target_validates_all_subjects=self._undefined_target_validates_all_subjects,
|
|
884
|
+
log_validation_plans=self._log_validation_plans,
|
|
885
|
+
log_validation_violations=self._log_validation_violations,
|
|
886
|
+
ignore_no_shapes_loaded_exception=self._ignore_no_shapes_loaded_exception,
|
|
887
|
+
validation_enabled=self._validation_enabled,
|
|
888
|
+
cache_select_nodes=self._cache_select_nodes,
|
|
889
|
+
global_log_validation_execution=self._global_log_validation_execution,
|
|
890
|
+
rdfs_sub_class_reasoning=self._rdfs_sub_class_reasoning,
|
|
891
|
+
performance_logging=self._performance_logging,
|
|
892
|
+
serializable_validation=self._serializable_validation,
|
|
893
|
+
eclipse_rdf4j_shacl_extensions=self._eclipse_rdf4j_shacl_extensions,
|
|
894
|
+
dash_data_shapes=self._dash_data_shapes,
|
|
895
|
+
validation_results_limit_total=self._validation_results_limit_total,
|
|
896
|
+
validation_results_limit_per_constraint=self._validation_results_limit_per_constraint,
|
|
897
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
898
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
899
|
+
)
|