rdf4j-python 0.1.0__py3-none-any.whl → 0.1.2__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 +11 -6
- rdf4j_python/_client/_client.py +156 -5
- rdf4j_python/_driver/__init__.py +6 -4
- rdf4j_python/_driver/_async_named_graph.py +75 -0
- rdf4j_python/_driver/_async_rdf4j_db.py +64 -36
- rdf4j_python/_driver/_async_repository.py +348 -17
- rdf4j_python/exception/__init__.py +5 -0
- rdf4j_python/exception/repo_exception.py +32 -2
- rdf4j_python/model/__init__.py +13 -0
- rdf4j_python/model/_base_model.py +26 -4
- rdf4j_python/model/_dataset.py +38 -0
- rdf4j_python/model/_namespace.py +134 -0
- rdf4j_python/model/{repository.py → _repository_info.py} +15 -4
- rdf4j_python/model/repository_config.py +1447 -0
- rdf4j_python/model/term.py +14 -0
- rdf4j_python/model/vocabulary.py +6 -0
- rdf4j_python/utils/__init__.py +3 -0
- rdf4j_python/utils/const.py +4 -4
- rdf4j_python/utils/helpers.py +22 -0
- rdf4j_python-0.1.2.dist-info/METADATA +77 -0
- rdf4j_python-0.1.2.dist-info/RECORD +25 -0
- {rdf4j_python-0.1.0.dist-info → rdf4j_python-0.1.2.dist-info}/WHEEL +1 -1
- rdf4j_python-0.1.2.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.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,1447 @@
|
|
|
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.
|
|
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
|
+
"""
|
|
26
|
+
Initializes a new RepositoryConfig instance.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
repo_id (str): The unique identifier for the repository.
|
|
30
|
+
title (Optional[str], optional): A human-readable title for the repository. Defaults to None.
|
|
31
|
+
impl (Optional[RepositoryImplConfig], optional): The implementation configuration for the repository. Defaults to None.
|
|
32
|
+
"""
|
|
33
|
+
self._repo_id = repo_id
|
|
34
|
+
self._title = title
|
|
35
|
+
self._impl = impl
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def repo_id(self) -> str:
|
|
39
|
+
"""
|
|
40
|
+
Returns the repository ID.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
str: The repository ID.
|
|
44
|
+
"""
|
|
45
|
+
return self._repo_id
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def title(self) -> Optional[str]:
|
|
49
|
+
"""
|
|
50
|
+
Returns the human-readable title for the repository.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Optional[str]: The human-readable title for the repository, or None if not set.
|
|
54
|
+
"""
|
|
55
|
+
return self._title
|
|
56
|
+
|
|
57
|
+
def to_turtle(self) -> str:
|
|
58
|
+
"""
|
|
59
|
+
Serializes the Repository configuration to Turtle syntax using RDFlib.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
str: A UTF-8 encoded Turtle string representing the RDF4J repository configuration.
|
|
63
|
+
The serialization includes the repository ID, optional human-readable title,
|
|
64
|
+
and nested repository implementation configuration if available.
|
|
65
|
+
|
|
66
|
+
Raises:
|
|
67
|
+
ValueError: If any of the configuration values are of unsupported types during serialization.
|
|
68
|
+
"""
|
|
69
|
+
graph = Graph()
|
|
70
|
+
graph.bind("rdfs", RDFS)
|
|
71
|
+
graph.bind("config", CONFIG)
|
|
72
|
+
graph.bind("xsd", XSD)
|
|
73
|
+
repo_node = BNode()
|
|
74
|
+
graph.add((repo_node, RDF["type"], CONFIG["Repository"]))
|
|
75
|
+
|
|
76
|
+
graph.add((repo_node, CONFIG["rep.id"], Literal(self._repo_id)))
|
|
77
|
+
|
|
78
|
+
if self._title:
|
|
79
|
+
graph.add((repo_node, RDFS["label"], Literal(self._title)))
|
|
80
|
+
|
|
81
|
+
if self._impl:
|
|
82
|
+
impl_node = self._impl.add_to_graph(graph)
|
|
83
|
+
graph.add((repo_node, CONFIG["rep.impl"], impl_node))
|
|
84
|
+
|
|
85
|
+
return graph.serialize(format="turtle").encode("utf-8")
|
|
86
|
+
|
|
87
|
+
class Builder:
|
|
88
|
+
"""
|
|
89
|
+
Builder for creating RepositoryConfig instances.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
def __init__(self, repo_id: Optional[str] = None):
|
|
93
|
+
"""
|
|
94
|
+
Initializes a new RepositoryConfig.Builder instance.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
repo_id (Optional[str], optional): The unique identifier for the repository. Defaults to None.
|
|
98
|
+
"""
|
|
99
|
+
self._repo_id = repo_id
|
|
100
|
+
self._title: Optional[str] = None
|
|
101
|
+
self._impl: Optional["RepositoryImplConfig"] = None
|
|
102
|
+
|
|
103
|
+
def repo_id(self, repo_id: str) -> "RepositoryConfig.Builder":
|
|
104
|
+
"""
|
|
105
|
+
Sets the repository ID.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
repo_id (str): The unique identifier for the repository.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
RepositoryConfig.Builder: The builder instance.
|
|
112
|
+
"""
|
|
113
|
+
self._repo_id = repo_id
|
|
114
|
+
return self
|
|
115
|
+
|
|
116
|
+
def title(self, title: str) -> "RepositoryConfig.Builder":
|
|
117
|
+
"""
|
|
118
|
+
Sets the human-readable title for the repository.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
title (str): The human-readable title for the repository.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
RepositoryConfig.Builder: The builder instance.
|
|
125
|
+
"""
|
|
126
|
+
self._title = title
|
|
127
|
+
return self
|
|
128
|
+
|
|
129
|
+
def repo_impl(self, impl: "RepositoryImplConfig") -> "RepositoryConfig.Builder":
|
|
130
|
+
"""
|
|
131
|
+
Sets the repository implementation configuration.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
impl (RepositoryImplConfig): The implementation configuration for the repository.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
RepositoryConfig.Builder: The builder instance.
|
|
138
|
+
"""
|
|
139
|
+
self._impl = impl
|
|
140
|
+
return self
|
|
141
|
+
|
|
142
|
+
def sail_repository_impl(
|
|
143
|
+
self, sail_impl: "SailConfig"
|
|
144
|
+
) -> "RepositoryConfig.Builder":
|
|
145
|
+
"""
|
|
146
|
+
Sets the repository implementation configuration to a SailRepositoryConfig.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
sail_impl (SailConfig): The Sail configuration for the repository.
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
RepositoryConfig.Builder: The builder instance.
|
|
153
|
+
"""
|
|
154
|
+
self.repo_impl(SailRepositoryConfig.Builder().sail_impl(sail_impl).build())
|
|
155
|
+
return self
|
|
156
|
+
|
|
157
|
+
def build(self) -> "RepositoryConfig":
|
|
158
|
+
"""
|
|
159
|
+
Builds and returns the RepositoryConfig instance.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
RepositoryConfig: The constructed RepositoryConfig instance.
|
|
163
|
+
"""
|
|
164
|
+
return RepositoryConfig(
|
|
165
|
+
repo_id=self._repo_id, title=self._title, impl=self._impl
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class RepositoryImplConfig:
|
|
170
|
+
"""
|
|
171
|
+
Base class for repository implementation configurations using RDFlib.
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
def __init__(self, rep_type: str):
|
|
175
|
+
self.rep_type = rep_type
|
|
176
|
+
self.config_params: Dict[str, Any] = {}
|
|
177
|
+
|
|
178
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
179
|
+
"""
|
|
180
|
+
Adds the repository implementation configuration to the RDF graph.
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
The RDF node representing this configuration.
|
|
184
|
+
"""
|
|
185
|
+
sail_node = BNode()
|
|
186
|
+
graph.add((sail_node, CONFIG["rep.type"], Literal(self.rep_type)))
|
|
187
|
+
for key, value in self.config_params.items():
|
|
188
|
+
if isinstance(value, str):
|
|
189
|
+
graph.add((sail_node, CONFIG[key], Literal(value)))
|
|
190
|
+
elif isinstance(value, int):
|
|
191
|
+
graph.add(
|
|
192
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.integer))
|
|
193
|
+
)
|
|
194
|
+
elif isinstance(value, float):
|
|
195
|
+
graph.add((sail_node, CONFIG[key], Literal(value, datatype=XSD.double)))
|
|
196
|
+
elif isinstance(value, bool):
|
|
197
|
+
graph.add(
|
|
198
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.boolean))
|
|
199
|
+
)
|
|
200
|
+
elif isinstance(value, list):
|
|
201
|
+
for item in value:
|
|
202
|
+
graph.add((sail_node, CONFIG[key], URIRef(item))) # Assuming IRIs
|
|
203
|
+
elif isinstance(value, RepositoryImplConfig) or isinstance(
|
|
204
|
+
value, SailConfig
|
|
205
|
+
):
|
|
206
|
+
nested_node = value.add_to_graph(graph)
|
|
207
|
+
graph.add((sail_node, CONFIG[key], nested_node))
|
|
208
|
+
else:
|
|
209
|
+
raise ValueError(f"Unsupported configuration value type: {type(value)}")
|
|
210
|
+
return sail_node
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class SPARQLRepositoryConfig(RepositoryImplConfig):
|
|
214
|
+
"""
|
|
215
|
+
Configuration for a SPARQLRepository using RDFlib.
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
TYPE = "openrdf:SPARQLRepository"
|
|
219
|
+
|
|
220
|
+
def __init__(self, query_endpoint: str, update_endpoint: Optional[str] = None):
|
|
221
|
+
"""
|
|
222
|
+
Initializes a new SPARQLRepositoryConfig instance.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
query_endpoint (str): The SPARQL query endpoint URL.
|
|
226
|
+
update_endpoint (Optional[str], optional): The SPARQL update endpoint URL. Defaults to None.
|
|
227
|
+
"""
|
|
228
|
+
super().__init__(rep_type=SPARQLRepositoryConfig.TYPE)
|
|
229
|
+
self.config_params["sparql.queryEndpoint"] = query_endpoint
|
|
230
|
+
if update_endpoint:
|
|
231
|
+
self.config_params["sparql.updateEndpoint"] = update_endpoint
|
|
232
|
+
|
|
233
|
+
class Builder:
|
|
234
|
+
def __init__(self, query_endpoint: str):
|
|
235
|
+
"""
|
|
236
|
+
Initializes a new SPARQLRepositoryConfig.Builder instance.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
query_endpoint (str): The SPARQL query endpoint URL.
|
|
240
|
+
"""
|
|
241
|
+
self._query_endpoint = query_endpoint
|
|
242
|
+
self._update_endpoint: Optional[str] = None
|
|
243
|
+
|
|
244
|
+
def update_endpoint(
|
|
245
|
+
self, update_endpoint: str
|
|
246
|
+
) -> "SPARQLRepositoryConfig.Builder":
|
|
247
|
+
"""
|
|
248
|
+
Sets the SPARQL update endpoint URL.
|
|
249
|
+
|
|
250
|
+
Args:
|
|
251
|
+
update_endpoint (str): The SPARQL update endpoint URL.
|
|
252
|
+
|
|
253
|
+
Returns:
|
|
254
|
+
SPARQLRepositoryConfig.Builder: The builder instance.
|
|
255
|
+
"""
|
|
256
|
+
self._update_endpoint = update_endpoint
|
|
257
|
+
return self
|
|
258
|
+
|
|
259
|
+
def build(self) -> "SPARQLRepositoryConfig":
|
|
260
|
+
return SPARQLRepositoryConfig(
|
|
261
|
+
query_endpoint=self._query_endpoint,
|
|
262
|
+
update_endpoint=self._update_endpoint,
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class HTTPRepositoryConfig(RepositoryImplConfig):
|
|
267
|
+
"""
|
|
268
|
+
Configuration for an HTTPRepository using RDFlib.
|
|
269
|
+
"""
|
|
270
|
+
|
|
271
|
+
TYPE = "openrdf:HTTPRepository"
|
|
272
|
+
|
|
273
|
+
def __init__(
|
|
274
|
+
self, url: str, username: Optional[str] = None, password: Optional[str] = None
|
|
275
|
+
):
|
|
276
|
+
super().__init__(rep_type=HTTPRepositoryConfig.TYPE)
|
|
277
|
+
self.config_params["http.url"] = url
|
|
278
|
+
if username:
|
|
279
|
+
self.config_params["http.username"] = username
|
|
280
|
+
if password:
|
|
281
|
+
self.config_params["http.password"] = password
|
|
282
|
+
|
|
283
|
+
class Builder:
|
|
284
|
+
def __init__(self, url: str):
|
|
285
|
+
self._url = url
|
|
286
|
+
self._username: Optional[str] = None
|
|
287
|
+
self._password: Optional[str] = None
|
|
288
|
+
|
|
289
|
+
def username(self, username: str) -> "HTTPRepositoryConfig.Builder":
|
|
290
|
+
"""
|
|
291
|
+
Sets the username for the HTTP repository.
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
username (str): The username for the HTTP repository.
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
HTTPRepositoryConfig.Builder: The builder instance.
|
|
298
|
+
"""
|
|
299
|
+
self._username = username
|
|
300
|
+
return self
|
|
301
|
+
|
|
302
|
+
def password(self, password: str) -> "HTTPRepositoryConfig.Builder":
|
|
303
|
+
"""
|
|
304
|
+
Sets the password for the HTTP repository.
|
|
305
|
+
|
|
306
|
+
Args:
|
|
307
|
+
password (str): The password for the HTTP repository.
|
|
308
|
+
|
|
309
|
+
Returns:
|
|
310
|
+
HTTPRepositoryConfig.Builder: The builder instance.
|
|
311
|
+
"""
|
|
312
|
+
self._password = password
|
|
313
|
+
return self
|
|
314
|
+
|
|
315
|
+
def build(self) -> "HTTPRepositoryConfig":
|
|
316
|
+
return HTTPRepositoryConfig(
|
|
317
|
+
url=self._url, username=self._username, password=self._password
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
class SailRepositoryConfig(RepositoryImplConfig):
|
|
322
|
+
"""
|
|
323
|
+
Configuration for a SailRepository using RDFlib.
|
|
324
|
+
"""
|
|
325
|
+
|
|
326
|
+
TYPE = "openrdf:SailRepository"
|
|
327
|
+
|
|
328
|
+
def __init__(self, sail_impl: "SailConfig"):
|
|
329
|
+
super().__init__(rep_type=SailRepositoryConfig.TYPE)
|
|
330
|
+
self.config_params["sail.impl"] = sail_impl
|
|
331
|
+
|
|
332
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
333
|
+
"""
|
|
334
|
+
Adds the SailRepository configuration to the RDF graph.
|
|
335
|
+
"""
|
|
336
|
+
return super().add_to_graph(graph)
|
|
337
|
+
|
|
338
|
+
class Builder:
|
|
339
|
+
def __init__(self, sail_impl: Optional["SailConfig"] = None):
|
|
340
|
+
self._sail_impl = sail_impl
|
|
341
|
+
|
|
342
|
+
def sail_impl(self, sail_impl: "SailConfig") -> "SailRepositoryConfig.Builder":
|
|
343
|
+
"""
|
|
344
|
+
Sets the Sail configuration for the repository.
|
|
345
|
+
|
|
346
|
+
Args:
|
|
347
|
+
sail_impl (SailConfig): The Sail configuration for the repository.
|
|
348
|
+
|
|
349
|
+
Returns:
|
|
350
|
+
SailRepositoryConfig.Builder: The builder instance.
|
|
351
|
+
"""
|
|
352
|
+
self._sail_impl = sail_impl
|
|
353
|
+
return self
|
|
354
|
+
|
|
355
|
+
def build(self) -> "SailRepositoryConfig":
|
|
356
|
+
"""
|
|
357
|
+
Builds and returns the SailRepositoryConfig instance.
|
|
358
|
+
|
|
359
|
+
Returns:
|
|
360
|
+
SailRepositoryConfig: The constructed SailRepositoryConfig instance.
|
|
361
|
+
"""
|
|
362
|
+
return SailRepositoryConfig(sail_impl=self._sail_impl)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
class DatasetRepositoryConfig(RepositoryImplConfig):
|
|
366
|
+
"""
|
|
367
|
+
Configuration for a DatasetRepository using RDFlib.
|
|
368
|
+
"""
|
|
369
|
+
|
|
370
|
+
TYPE = "openrdf:DatasetRepository"
|
|
371
|
+
|
|
372
|
+
def __init__(self, delegate: "RepositoryImplConfig"):
|
|
373
|
+
super().__init__(rep_type=DatasetRepositoryConfig.TYPE)
|
|
374
|
+
self.config_params["delegate"] = delegate
|
|
375
|
+
|
|
376
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
377
|
+
"""
|
|
378
|
+
Adds the DatasetRepository configuration to the RDF Graph
|
|
379
|
+
"""
|
|
380
|
+
repo_node = super().add_to_graph(graph)
|
|
381
|
+
return repo_node
|
|
382
|
+
|
|
383
|
+
class Builder:
|
|
384
|
+
def __init__(self, delegate: "RepositoryImplConfig"):
|
|
385
|
+
self._delegate = delegate
|
|
386
|
+
|
|
387
|
+
def build(self) -> "DatasetRepositoryConfig":
|
|
388
|
+
return DatasetRepositoryConfig(delegate=self._delegate)
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
class SailConfig:
|
|
392
|
+
"""
|
|
393
|
+
Base class for SAIL configurations using RDFlib.
|
|
394
|
+
"""
|
|
395
|
+
|
|
396
|
+
def __init__(
|
|
397
|
+
self,
|
|
398
|
+
sail_type: str,
|
|
399
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
400
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
401
|
+
):
|
|
402
|
+
self.sail_type = sail_type
|
|
403
|
+
self.config_params: Dict[str, Any] = {}
|
|
404
|
+
if iteration_cache_sync_threshold is not None:
|
|
405
|
+
self.config_params["sail.iterationCacheSyncThreshold"] = (
|
|
406
|
+
iteration_cache_sync_threshold
|
|
407
|
+
)
|
|
408
|
+
if default_query_evaluation_mode:
|
|
409
|
+
self.config_params["sail.defaultQueryEvaluationMode"] = (
|
|
410
|
+
default_query_evaluation_mode
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
414
|
+
"""
|
|
415
|
+
Adds the SAIL configuration to the RDF graph.
|
|
416
|
+
|
|
417
|
+
Returns:
|
|
418
|
+
The RDF node representing this configuration.
|
|
419
|
+
"""
|
|
420
|
+
sail_node = BNode()
|
|
421
|
+
graph.add((sail_node, CONFIG["sail.type"], Literal(self.sail_type)))
|
|
422
|
+
for key, value in self.config_params.items():
|
|
423
|
+
if isinstance(value, str):
|
|
424
|
+
graph.add((sail_node, CONFIG[key], Literal(value)))
|
|
425
|
+
elif isinstance(value, int):
|
|
426
|
+
graph.add(
|
|
427
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.integer))
|
|
428
|
+
)
|
|
429
|
+
elif isinstance(value, float):
|
|
430
|
+
graph.add((sail_node, CONFIG[key], Literal(value, datatype=XSD.double)))
|
|
431
|
+
elif isinstance(value, bool):
|
|
432
|
+
graph.add(
|
|
433
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.boolean))
|
|
434
|
+
)
|
|
435
|
+
elif isinstance(value, list):
|
|
436
|
+
for item in value:
|
|
437
|
+
graph.add((sail_node, CONFIG[key], URIRef(item)))
|
|
438
|
+
elif isinstance(value, SailConfig) or isinstance(
|
|
439
|
+
value, RepositoryImplConfig
|
|
440
|
+
):
|
|
441
|
+
nested_node = value.add_to_graph(graph)
|
|
442
|
+
graph.add((sail_node, CONFIG[key], nested_node))
|
|
443
|
+
else:
|
|
444
|
+
raise ValueError(f"Unsupported configuration value type: {type(value)}")
|
|
445
|
+
return sail_node
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
class MemoryStoreConfig(SailConfig):
|
|
449
|
+
"""
|
|
450
|
+
Configuration for a MemoryStore using RDFlib.
|
|
451
|
+
"""
|
|
452
|
+
|
|
453
|
+
TYPE = "openrdf:MemoryStore"
|
|
454
|
+
|
|
455
|
+
def __init__(
|
|
456
|
+
self,
|
|
457
|
+
persist: Optional[bool] = None,
|
|
458
|
+
sync_delay: Optional[int] = None,
|
|
459
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
460
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
461
|
+
):
|
|
462
|
+
super().__init__(
|
|
463
|
+
sail_type=MemoryStoreConfig.TYPE,
|
|
464
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
465
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
466
|
+
)
|
|
467
|
+
if persist is not None:
|
|
468
|
+
self.config_params["mem.persist"] = persist
|
|
469
|
+
if sync_delay is not None:
|
|
470
|
+
self.config_params["mem.syncDelay"] = sync_delay
|
|
471
|
+
|
|
472
|
+
class Builder:
|
|
473
|
+
def __init__(self):
|
|
474
|
+
self._persist: Optional[bool] = None
|
|
475
|
+
self._sync_delay: Optional[int] = None
|
|
476
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
477
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
478
|
+
|
|
479
|
+
def persist(self, persist: bool) -> "MemoryStoreConfig.Builder":
|
|
480
|
+
"""
|
|
481
|
+
Sets the persist flag for the MemoryStore configuration.
|
|
482
|
+
|
|
483
|
+
Args:
|
|
484
|
+
persist (bool): The persist flag for the MemoryStore configuration.
|
|
485
|
+
|
|
486
|
+
Returns:
|
|
487
|
+
MemoryStoreConfig.Builder: The builder instance.
|
|
488
|
+
"""
|
|
489
|
+
self._persist = persist
|
|
490
|
+
return self
|
|
491
|
+
|
|
492
|
+
def sync_delay(self, sync_delay: int) -> "MemoryStoreConfig.Builder":
|
|
493
|
+
"""
|
|
494
|
+
Sets the sync delay for the MemoryStore configuration.
|
|
495
|
+
|
|
496
|
+
Args:
|
|
497
|
+
sync_delay (int): The sync delay for the MemoryStore configuration.
|
|
498
|
+
|
|
499
|
+
Returns:
|
|
500
|
+
MemoryStoreConfig.Builder: The builder instance.
|
|
501
|
+
"""
|
|
502
|
+
self._sync_delay = sync_delay
|
|
503
|
+
return self
|
|
504
|
+
|
|
505
|
+
def iteration_cache_sync_threshold(
|
|
506
|
+
self, threshold: int
|
|
507
|
+
) -> "MemoryStoreConfig.Builder":
|
|
508
|
+
"""
|
|
509
|
+
Sets the iteration cache sync threshold for the MemoryStore configuration.
|
|
510
|
+
|
|
511
|
+
Args:
|
|
512
|
+
threshold (int): The iteration cache sync threshold for the MemoryStore configuration.
|
|
513
|
+
|
|
514
|
+
Returns:
|
|
515
|
+
MemoryStoreConfig.Builder: The builder instance.
|
|
516
|
+
"""
|
|
517
|
+
self._iteration_cache_sync_threshold = threshold
|
|
518
|
+
return self
|
|
519
|
+
|
|
520
|
+
def default_query_evaluation_mode(
|
|
521
|
+
self, mode: str
|
|
522
|
+
) -> "MemoryStoreConfig.Builder":
|
|
523
|
+
"""
|
|
524
|
+
Sets the default query evaluation mode for the MemoryStore configuration.
|
|
525
|
+
|
|
526
|
+
Args:
|
|
527
|
+
mode (str): The default query evaluation mode for the MemoryStore configuration.
|
|
528
|
+
|
|
529
|
+
Returns:
|
|
530
|
+
MemoryStoreConfig.Builder: The builder instance.
|
|
531
|
+
"""
|
|
532
|
+
self._default_query_evaluation_mode = mode
|
|
533
|
+
return self
|
|
534
|
+
|
|
535
|
+
def build(self) -> "MemoryStoreConfig":
|
|
536
|
+
return MemoryStoreConfig(
|
|
537
|
+
persist=self._persist,
|
|
538
|
+
sync_delay=self._sync_delay,
|
|
539
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
540
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
class NativeStoreConfig(SailConfig):
|
|
545
|
+
"""
|
|
546
|
+
Configuration for a NativeStore using RDFlib.
|
|
547
|
+
"""
|
|
548
|
+
|
|
549
|
+
TYPE = "openrdf:NativeStore"
|
|
550
|
+
|
|
551
|
+
def __init__(
|
|
552
|
+
self,
|
|
553
|
+
triple_indexes: Optional[str] = None,
|
|
554
|
+
force_sync: Optional[bool] = None,
|
|
555
|
+
value_cache_size: Optional[int] = None,
|
|
556
|
+
value_id_cache_size: Optional[int] = None,
|
|
557
|
+
namespace_cache_size: Optional[int] = None,
|
|
558
|
+
namespace_id_cache_size: Optional[int] = None,
|
|
559
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
560
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
561
|
+
):
|
|
562
|
+
super().__init__(
|
|
563
|
+
sail_type=NativeStoreConfig.TYPE,
|
|
564
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
565
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
566
|
+
)
|
|
567
|
+
if triple_indexes:
|
|
568
|
+
self.config_params["native.tripleIndexes"] = triple_indexes
|
|
569
|
+
if force_sync:
|
|
570
|
+
self.config_params["native.forceSync"] = force_sync
|
|
571
|
+
if value_cache_size:
|
|
572
|
+
self.config_params["native.valueCacheSize"] = value_cache_size
|
|
573
|
+
if value_id_cache_size:
|
|
574
|
+
self.config_params["native.valueIDCacheSize"] = value_id_cache_size
|
|
575
|
+
if namespace_cache_size:
|
|
576
|
+
self.config_params["native.namespaceCacheSize"] = namespace_cache_size
|
|
577
|
+
if namespace_id_cache_size:
|
|
578
|
+
self.config_params["native.namespaceIDCacheSize"] = namespace_id_cache_size
|
|
579
|
+
|
|
580
|
+
class Builder:
|
|
581
|
+
def __init__(self):
|
|
582
|
+
self._triple_indexes: Optional[str] = None
|
|
583
|
+
self._force_sync: Optional[bool] = None
|
|
584
|
+
self._value_cache_size: Optional[int] = None
|
|
585
|
+
self._value_id_cache_size: Optional[int] = None
|
|
586
|
+
self._namespace_cache_size: Optional[int] = None
|
|
587
|
+
self._namespace_id_cache_size: Optional[int] = None
|
|
588
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
589
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
590
|
+
|
|
591
|
+
def triple_indexes(self, indexes: str) -> "NativeStoreConfig.Builder":
|
|
592
|
+
"""
|
|
593
|
+
Sets the triple indexes for the NativeStore configuration.
|
|
594
|
+
|
|
595
|
+
Args:
|
|
596
|
+
indexes (str): The triple indexes for the NativeStore configuration.
|
|
597
|
+
|
|
598
|
+
Returns:
|
|
599
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
600
|
+
"""
|
|
601
|
+
self._triple_indexes = indexes
|
|
602
|
+
return self
|
|
603
|
+
|
|
604
|
+
def force_sync(self, sync: bool) -> "NativeStoreConfig.Builder":
|
|
605
|
+
"""
|
|
606
|
+
Sets the force sync flag for the NativeStore configuration.
|
|
607
|
+
|
|
608
|
+
Args:
|
|
609
|
+
sync (bool): The force sync flag for the NativeStore configuration.
|
|
610
|
+
|
|
611
|
+
Returns:
|
|
612
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
613
|
+
"""
|
|
614
|
+
self._force_sync = sync
|
|
615
|
+
return self
|
|
616
|
+
|
|
617
|
+
def value_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
618
|
+
"""
|
|
619
|
+
Sets the value cache size for the NativeStore configuration.
|
|
620
|
+
|
|
621
|
+
Args:
|
|
622
|
+
size (int): The value cache size for the NativeStore configuration.
|
|
623
|
+
|
|
624
|
+
Returns:
|
|
625
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
626
|
+
"""
|
|
627
|
+
self._value_cache_size = size
|
|
628
|
+
return self
|
|
629
|
+
|
|
630
|
+
def value_id_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
631
|
+
"""
|
|
632
|
+
Sets the value ID cache size for the NativeStore configuration.
|
|
633
|
+
|
|
634
|
+
Args:
|
|
635
|
+
size (int): The value ID cache size for the NativeStore configuration.
|
|
636
|
+
|
|
637
|
+
Returns:
|
|
638
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
639
|
+
"""
|
|
640
|
+
self._value_id_cache_size = size
|
|
641
|
+
return self
|
|
642
|
+
|
|
643
|
+
def namespace_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
644
|
+
"""
|
|
645
|
+
Sets the namespace cache size for the NativeStore configuration.
|
|
646
|
+
|
|
647
|
+
Args:
|
|
648
|
+
size (int): The namespace cache size for the NativeStore configuration.
|
|
649
|
+
|
|
650
|
+
Returns:
|
|
651
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
652
|
+
"""
|
|
653
|
+
self._namespace_cache_size = size
|
|
654
|
+
return self
|
|
655
|
+
|
|
656
|
+
def namespace_id_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
|
|
657
|
+
"""
|
|
658
|
+
Sets the namespace ID cache size for the NativeStore configuration.
|
|
659
|
+
|
|
660
|
+
Args:
|
|
661
|
+
size (int): The namespace ID cache size for the NativeStore configuration.
|
|
662
|
+
|
|
663
|
+
Returns:
|
|
664
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
665
|
+
"""
|
|
666
|
+
self._namespace_id_cache_size = size
|
|
667
|
+
return self
|
|
668
|
+
|
|
669
|
+
def iteration_cache_sync_threshold(
|
|
670
|
+
self, threshold: int
|
|
671
|
+
) -> "NativeStoreConfig.Builder":
|
|
672
|
+
"""
|
|
673
|
+
Sets the iteration cache sync threshold for the NativeStore configuration.
|
|
674
|
+
|
|
675
|
+
Args:
|
|
676
|
+
threshold (int): The iteration cache sync threshold for the NativeStore configuration.
|
|
677
|
+
|
|
678
|
+
Returns:
|
|
679
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
680
|
+
"""
|
|
681
|
+
self._iteration_cache_sync_threshold = threshold
|
|
682
|
+
return self
|
|
683
|
+
|
|
684
|
+
def default_query_evaluation_mode(
|
|
685
|
+
self, mode: str
|
|
686
|
+
) -> "NativeStoreConfig.Builder":
|
|
687
|
+
"""
|
|
688
|
+
Sets the default query evaluation mode for the NativeStore configuration.
|
|
689
|
+
|
|
690
|
+
Args:
|
|
691
|
+
mode (str): The default query evaluation mode for the NativeStore configuration.
|
|
692
|
+
|
|
693
|
+
Returns:
|
|
694
|
+
NativeStoreConfig.Builder: The builder instance.
|
|
695
|
+
"""
|
|
696
|
+
self._default_query_evaluation_mode = mode
|
|
697
|
+
return self
|
|
698
|
+
|
|
699
|
+
def build(self) -> "NativeStoreConfig":
|
|
700
|
+
return NativeStoreConfig(
|
|
701
|
+
triple_indexes=self._triple_indexes,
|
|
702
|
+
force_sync=self._force_sync,
|
|
703
|
+
value_cache_size=self._value_cache_size,
|
|
704
|
+
value_id_cache_size=self._value_id_cache_size,
|
|
705
|
+
namespace_cache_size=self._namespace_cache_size,
|
|
706
|
+
namespace_id_cache_size=self._namespace_id_cache_size,
|
|
707
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
708
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
709
|
+
)
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
class ElasticsearchStoreConfig(SailConfig):
|
|
713
|
+
"""
|
|
714
|
+
Configuration for an ElasticsearchStore using RDFlib.
|
|
715
|
+
"""
|
|
716
|
+
|
|
717
|
+
TYPE = "rdf4j:ElasticsearchStore"
|
|
718
|
+
|
|
719
|
+
def __init__(
|
|
720
|
+
self,
|
|
721
|
+
hostname: str,
|
|
722
|
+
port: Optional[int] = None,
|
|
723
|
+
cluster_name: Optional[str] = None,
|
|
724
|
+
index: Optional[str] = None,
|
|
725
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
726
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
727
|
+
):
|
|
728
|
+
super().__init__(
|
|
729
|
+
sail_type=ElasticsearchStoreConfig.TYPE,
|
|
730
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
731
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
732
|
+
)
|
|
733
|
+
self.config_params["ess.hostname"] = hostname
|
|
734
|
+
if port is not None:
|
|
735
|
+
self.config_params["ess.port"] = port
|
|
736
|
+
if cluster_name is not None:
|
|
737
|
+
self.config_params["ess.clusterName"] = cluster_name
|
|
738
|
+
if index is not None:
|
|
739
|
+
self.config_params["ess.index"] = index
|
|
740
|
+
|
|
741
|
+
class Builder:
|
|
742
|
+
def __init__(self, hostname: str):
|
|
743
|
+
self._hostname = hostname
|
|
744
|
+
self._port: Optional[int] = None
|
|
745
|
+
self._cluster_name: Optional[str] = None
|
|
746
|
+
self._index: Optional[str] = None
|
|
747
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
748
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
749
|
+
|
|
750
|
+
def port(self, port: int) -> "ElasticsearchStoreConfig.Builder":
|
|
751
|
+
"""
|
|
752
|
+
Sets the port for the ElasticsearchStore configuration.
|
|
753
|
+
|
|
754
|
+
Args:
|
|
755
|
+
port (int): The port for the ElasticsearchStore configuration.
|
|
756
|
+
|
|
757
|
+
Returns:
|
|
758
|
+
ElasticsearchStoreConfig.Builder: The builder instance.
|
|
759
|
+
"""
|
|
760
|
+
self._port = port
|
|
761
|
+
return self
|
|
762
|
+
|
|
763
|
+
def cluster_name(self, cluster_name: str) -> "ElasticsearchStoreConfig.Builder":
|
|
764
|
+
"""
|
|
765
|
+
Sets the cluster name for the ElasticsearchStore configuration.
|
|
766
|
+
|
|
767
|
+
Args:
|
|
768
|
+
cluster_name (str): The cluster name for the ElasticsearchStore configuration.
|
|
769
|
+
|
|
770
|
+
Returns:
|
|
771
|
+
ElasticsearchStoreConfig.Builder: The builder instance.
|
|
772
|
+
"""
|
|
773
|
+
self._cluster_name = cluster_name
|
|
774
|
+
return self
|
|
775
|
+
|
|
776
|
+
def index(self, index: str) -> "ElasticsearchStoreConfig.Builder":
|
|
777
|
+
"""
|
|
778
|
+
Sets the index for the ElasticsearchStore configuration.
|
|
779
|
+
|
|
780
|
+
Args:
|
|
781
|
+
index (str): The index for the ElasticsearchStore configuration.
|
|
782
|
+
|
|
783
|
+
Returns:
|
|
784
|
+
ElasticsearchStoreConfig.Builder: The builder instance.
|
|
785
|
+
"""
|
|
786
|
+
self._index = index
|
|
787
|
+
return self
|
|
788
|
+
|
|
789
|
+
def iteration_cache_sync_threshold(
|
|
790
|
+
self, threshold: int
|
|
791
|
+
) -> "ElasticsearchStoreConfig.Builder":
|
|
792
|
+
"""
|
|
793
|
+
Sets the iteration cache sync threshold for the ElasticsearchStore configuration.
|
|
794
|
+
|
|
795
|
+
Args:
|
|
796
|
+
threshold (int): The iteration cache sync threshold for the ElasticsearchStore configuration.
|
|
797
|
+
|
|
798
|
+
Returns:
|
|
799
|
+
ElasticsearchStoreConfig.Builder: The builder instance.
|
|
800
|
+
"""
|
|
801
|
+
self._iteration_cache_sync_threshold = threshold
|
|
802
|
+
return self
|
|
803
|
+
|
|
804
|
+
def default_query_evaluation_mode(
|
|
805
|
+
self, mode: str
|
|
806
|
+
) -> "ElasticsearchStoreConfig.Builder":
|
|
807
|
+
"""
|
|
808
|
+
Sets the default query evaluation mode for the ElasticsearchStore configuration.
|
|
809
|
+
|
|
810
|
+
Args:
|
|
811
|
+
mode (str): The default query evaluation mode for the ElasticsearchStore configuration.
|
|
812
|
+
|
|
813
|
+
Returns:
|
|
814
|
+
ElasticsearchStoreConfig.Builder: The builder instance.
|
|
815
|
+
"""
|
|
816
|
+
self._default_query_evaluation_mode = mode
|
|
817
|
+
return self
|
|
818
|
+
|
|
819
|
+
def build(self) -> "ElasticsearchStoreConfig":
|
|
820
|
+
"""
|
|
821
|
+
Builds and returns the ElasticsearchStoreConfig instance.
|
|
822
|
+
|
|
823
|
+
Returns:
|
|
824
|
+
ElasticsearchStoreConfig: The constructed ElasticsearchStoreConfig instance.
|
|
825
|
+
"""
|
|
826
|
+
return ElasticsearchStoreConfig(
|
|
827
|
+
hostname=self._hostname,
|
|
828
|
+
port=self._port,
|
|
829
|
+
cluster_name=self._cluster_name,
|
|
830
|
+
index=self._index,
|
|
831
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
832
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
class SchemaCachingRDFSInferencerConfig(SailConfig):
|
|
837
|
+
"""
|
|
838
|
+
Configuration for the RDF Schema inferencer using RDFlib.
|
|
839
|
+
"""
|
|
840
|
+
|
|
841
|
+
TYPE = "rdf4j:SchemaCachingRDFSInferencer"
|
|
842
|
+
|
|
843
|
+
def __init__(
|
|
844
|
+
self,
|
|
845
|
+
delegate: "SailConfig",
|
|
846
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
847
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
848
|
+
):
|
|
849
|
+
"""
|
|
850
|
+
Initializes a new SchemaCachingRDFSInferencerConfig.
|
|
851
|
+
|
|
852
|
+
Args:
|
|
853
|
+
delegate (SailConfig): The delegate configuration for the SchemaCachingRDFSInferencer.
|
|
854
|
+
iteration_cache_sync_threshold (Optional[int]): The iteration cache sync threshold.
|
|
855
|
+
default_query_evaluation_mode (Optional[str]): The default query evaluation mode.
|
|
856
|
+
"""
|
|
857
|
+
super().__init__(
|
|
858
|
+
sail_type=SchemaCachingRDFSInferencerConfig.TYPE,
|
|
859
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
860
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
861
|
+
)
|
|
862
|
+
self.config_params["delegate"] = delegate
|
|
863
|
+
|
|
864
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
865
|
+
"""
|
|
866
|
+
Adds the SchemaCachingRDFSInferencer configuration to the RDF graph.
|
|
867
|
+
|
|
868
|
+
Args:
|
|
869
|
+
graph (Graph): The RDF graph to add the configuration to.
|
|
870
|
+
|
|
871
|
+
Returns:
|
|
872
|
+
URIRef: The URIRef of the added configuration.
|
|
873
|
+
"""
|
|
874
|
+
sail_node = super().add_to_graph(graph)
|
|
875
|
+
delegate_node = self.config_params["delegate"].to_rdf(graph)
|
|
876
|
+
graph.add((sail_node, CONFIG.delegate, delegate_node))
|
|
877
|
+
return sail_node
|
|
878
|
+
|
|
879
|
+
class Builder:
|
|
880
|
+
def __init__(self, delegate: "SailConfig"):
|
|
881
|
+
self._delegate = delegate
|
|
882
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
883
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
884
|
+
|
|
885
|
+
def iteration_cache_sync_threshold(
|
|
886
|
+
self, threshold: int
|
|
887
|
+
) -> "SchemaCachingRDFSInferencerConfig.Builder":
|
|
888
|
+
"""
|
|
889
|
+
Sets the iteration cache sync threshold for the SchemaCachingRDFSInferencer configuration.
|
|
890
|
+
|
|
891
|
+
Args:
|
|
892
|
+
threshold (int): The iteration cache sync threshold for the SchemaCachingRDFSInferencer configuration.
|
|
893
|
+
|
|
894
|
+
Returns:
|
|
895
|
+
SchemaCachingRDFSInferencerConfig.Builder: The builder instance.
|
|
896
|
+
"""
|
|
897
|
+
self._iteration_cache_sync_threshold = threshold
|
|
898
|
+
return self
|
|
899
|
+
|
|
900
|
+
def default_query_evaluation_mode(
|
|
901
|
+
self, mode: str
|
|
902
|
+
) -> "SchemaCachingRDFSInferencerConfig.Builder":
|
|
903
|
+
"""
|
|
904
|
+
Sets the default query evaluation mode for the SchemaCachingRDFSInferencer configuration.
|
|
905
|
+
|
|
906
|
+
Args:
|
|
907
|
+
mode (str): The default query evaluation mode for the SchemaCachingRDFSInferencer configuration.
|
|
908
|
+
|
|
909
|
+
Returns:
|
|
910
|
+
SchemaCachingRDFSInferencerConfig.Builder: The builder instance.
|
|
911
|
+
"""
|
|
912
|
+
self._default_query_evaluation_mode = mode
|
|
913
|
+
return self
|
|
914
|
+
|
|
915
|
+
def build(self) -> "SchemaCachingRDFSInferencerConfig":
|
|
916
|
+
"""
|
|
917
|
+
Builds and returns the SchemaCachingRDFSInferencerConfig instance.
|
|
918
|
+
|
|
919
|
+
Returns:
|
|
920
|
+
SchemaCachingRDFSInferencerConfig: The constructed SchemaCachingRDFSInferencerConfig instance.
|
|
921
|
+
"""
|
|
922
|
+
return SchemaCachingRDFSInferencerConfig(
|
|
923
|
+
delegate=self._delegate,
|
|
924
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
925
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
926
|
+
)
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
class DirectTypeHierarchyInferencerConfig(SailConfig):
|
|
930
|
+
"""
|
|
931
|
+
Configuration for the Direct Type inferencer using RDFlib.
|
|
932
|
+
"""
|
|
933
|
+
|
|
934
|
+
TYPE = "openrdf:DirectTypeHierarchyInferencer"
|
|
935
|
+
|
|
936
|
+
def __init__(
|
|
937
|
+
self,
|
|
938
|
+
delegate: "SailConfig",
|
|
939
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
940
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
941
|
+
):
|
|
942
|
+
"""
|
|
943
|
+
Initializes a new DirectTypeHierarchyInferencerConfig.
|
|
944
|
+
|
|
945
|
+
Args:
|
|
946
|
+
delegate (SailConfig): The delegate configuration for the DirectTypeHierarchyInferencer.
|
|
947
|
+
iteration_cache_sync_threshold (Optional[int]): The iteration cache sync threshold.
|
|
948
|
+
default_query_evaluation_mode (Optional[str]): The default query evaluation mode.
|
|
949
|
+
"""
|
|
950
|
+
super().__init__(
|
|
951
|
+
sail_type=DirectTypeHierarchyInferencerConfig.TYPE,
|
|
952
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
953
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
954
|
+
)
|
|
955
|
+
self.config_params["delegate"] = delegate
|
|
956
|
+
|
|
957
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
958
|
+
"""
|
|
959
|
+
Adds the DirectTypeHierarchyInferencerConfig to the graph
|
|
960
|
+
|
|
961
|
+
Args:
|
|
962
|
+
graph (Graph): The RDF graph to add the configuration to.
|
|
963
|
+
|
|
964
|
+
Returns:
|
|
965
|
+
URIRef: The URIRef of the added configuration.
|
|
966
|
+
"""
|
|
967
|
+
sail_node = super().add_to_graph(graph)
|
|
968
|
+
delegate_node = self.config_params["delegate"].to_rdf(graph)
|
|
969
|
+
graph.add((sail_node, CONFIG["delegate"], delegate_node))
|
|
970
|
+
return sail_node
|
|
971
|
+
|
|
972
|
+
class Builder:
|
|
973
|
+
def __init__(self, delegate: "SailConfig"):
|
|
974
|
+
"""
|
|
975
|
+
Initializes a new DirectTypeHierarchyInferencerConfig.Builder.
|
|
976
|
+
|
|
977
|
+
Args:
|
|
978
|
+
delegate (SailConfig): The delegate configuration for the DirectTypeHierarchyInferencer.
|
|
979
|
+
"""
|
|
980
|
+
self._delegate = delegate
|
|
981
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
982
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
983
|
+
|
|
984
|
+
def iteration_cache_sync_threshold(
|
|
985
|
+
self, threshold: int
|
|
986
|
+
) -> "DirectTypeHierarchyInferencerConfig.Builder":
|
|
987
|
+
"""
|
|
988
|
+
Sets the iteration cache sync threshold for the DirectTypeHierarchyInferencer configuration.
|
|
989
|
+
|
|
990
|
+
Args:
|
|
991
|
+
threshold (int): The iteration cache sync threshold for the DirectTypeHierarchyInferencer configuration.
|
|
992
|
+
|
|
993
|
+
Returns:
|
|
994
|
+
DirectTypeHierarchyInferencerConfig.Builder: The builder instance.
|
|
995
|
+
"""
|
|
996
|
+
self._iteration_cache_sync_threshold = threshold
|
|
997
|
+
return self
|
|
998
|
+
|
|
999
|
+
def default_query_evaluation_mode(
|
|
1000
|
+
self, mode: str
|
|
1001
|
+
) -> "DirectTypeHierarchyInferencerConfig.Builder":
|
|
1002
|
+
"""
|
|
1003
|
+
Sets the default query evaluation mode for the DirectTypeHierarchyInferencer configuration.
|
|
1004
|
+
|
|
1005
|
+
Args:
|
|
1006
|
+
mode (str): The default query evaluation mode for the DirectTypeHierarchyInferencer configuration.
|
|
1007
|
+
|
|
1008
|
+
Returns:
|
|
1009
|
+
DirectTypeHierarchyInferencerConfig.Builder: The builder instance.
|
|
1010
|
+
"""
|
|
1011
|
+
self._default_query_evaluation_mode = mode
|
|
1012
|
+
return self
|
|
1013
|
+
|
|
1014
|
+
def build(self) -> "DirectTypeHierarchyInferencerConfig":
|
|
1015
|
+
"""
|
|
1016
|
+
Builds and returns the DirectTypeHierarchyInferencerConfig instance.
|
|
1017
|
+
|
|
1018
|
+
Returns:
|
|
1019
|
+
DirectTypeHierarchyInferencerConfig: The constructed DirectTypeHierarchyInferencerConfig instance.
|
|
1020
|
+
"""
|
|
1021
|
+
return DirectTypeHierarchyInferencerConfig(
|
|
1022
|
+
delegate=self._delegate,
|
|
1023
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
1024
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
1025
|
+
)
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
class SHACLSailConfig(SailConfig):
|
|
1029
|
+
"""
|
|
1030
|
+
Configuration for the SHACL Sail using RDFlib.
|
|
1031
|
+
"""
|
|
1032
|
+
|
|
1033
|
+
TYPE = "rdf4j:ShaclSail"
|
|
1034
|
+
|
|
1035
|
+
def __init__(
|
|
1036
|
+
self,
|
|
1037
|
+
delegate: "SailConfig",
|
|
1038
|
+
parallel_validation: Optional[bool] = None,
|
|
1039
|
+
undefined_target_validates_all_subjects: Optional[bool] = None,
|
|
1040
|
+
log_validation_plans: Optional[bool] = None,
|
|
1041
|
+
log_validation_violations: Optional[bool] = None,
|
|
1042
|
+
ignore_no_shapes_loaded_exception: Optional[bool] = None,
|
|
1043
|
+
validation_enabled: Optional[bool] = None,
|
|
1044
|
+
cache_select_nodes: Optional[bool] = None,
|
|
1045
|
+
global_log_validation_execution: Optional[bool] = None,
|
|
1046
|
+
rdfs_sub_class_reasoning: Optional[bool] = None,
|
|
1047
|
+
performance_logging: Optional[bool] = None,
|
|
1048
|
+
serializable_validation: Optional[bool] = None,
|
|
1049
|
+
eclipse_rdf4j_shacl_extensions: Optional[bool] = None,
|
|
1050
|
+
dash_data_shapes: Optional[bool] = None,
|
|
1051
|
+
validation_results_limit_total: Optional[int] = None,
|
|
1052
|
+
validation_results_limit_per_constraint: Optional[int] = None,
|
|
1053
|
+
iteration_cache_sync_threshold: Optional[int] = None,
|
|
1054
|
+
default_query_evaluation_mode: Optional[str] = None,
|
|
1055
|
+
):
|
|
1056
|
+
"""
|
|
1057
|
+
Initializes a new SHACLSailConfig.
|
|
1058
|
+
|
|
1059
|
+
Args:
|
|
1060
|
+
delegate (SailConfig): The delegate configuration for the SHACL Sail.
|
|
1061
|
+
parallel_validation (Optional[bool]): Whether to enable parallel validation.
|
|
1062
|
+
undefined_target_validates_all_subjects (Optional[bool]): Whether to validate all subjects when undefined targets are encountered.
|
|
1063
|
+
log_validation_plans (Optional[bool]): Whether to log validation plans.
|
|
1064
|
+
log_validation_violations (Optional[bool]): Whether to log validation violations.
|
|
1065
|
+
ignore_no_shapes_loaded_exception (Optional[bool]): Whether to ignore exceptions when no shapes are loaded.
|
|
1066
|
+
validation_enabled (Optional[bool]): Whether to enable validation.
|
|
1067
|
+
cache_select_nodes (Optional[bool]): Whether to cache select nodes.
|
|
1068
|
+
global_log_validation_execution (Optional[bool]): Whether to log validation execution globally.
|
|
1069
|
+
rdfs_sub_class_reasoning (Optional[bool]): Whether to enable RDFS sub-class reasoning.
|
|
1070
|
+
performance_logging (Optional[bool]): Whether to enable performance logging.
|
|
1071
|
+
serializable_validation (Optional[bool]): Whether to enable serializable validation.
|
|
1072
|
+
eclipse_rdf4j_shacl_extensions (Optional[bool]): Whether to enable Eclipse RDF4J SHACL extensions.
|
|
1073
|
+
dash_data_shapes (Optional[bool]): Whether to enable Dash Data Shapes.
|
|
1074
|
+
validation_results_limit_total (Optional[int]): The total number of validation results to limit.
|
|
1075
|
+
validation_results_limit_per_constraint (Optional[int]): The number of validation results to limit per constraint.
|
|
1076
|
+
iteration_cache_sync_threshold (Optional[int]): The iteration cache sync threshold.
|
|
1077
|
+
default_query_evaluation_mode (Optional[str]): The default query evaluation mode.
|
|
1078
|
+
"""
|
|
1079
|
+
super().__init__(
|
|
1080
|
+
sail_type=SHACLSailConfig.TYPE,
|
|
1081
|
+
iteration_cache_sync_threshold=iteration_cache_sync_threshold,
|
|
1082
|
+
default_query_evaluation_mode=default_query_evaluation_mode,
|
|
1083
|
+
)
|
|
1084
|
+
self.config_params["delegate"] = delegate
|
|
1085
|
+
if parallel_validation is not None:
|
|
1086
|
+
self.config_params["shacl.parallelValidation"] = parallel_validation
|
|
1087
|
+
if undefined_target_validates_all_subjects is not None:
|
|
1088
|
+
self.config_params["shacl.undefinedTargetValidatesAllSubjects"] = (
|
|
1089
|
+
undefined_target_validates_all_subjects
|
|
1090
|
+
)
|
|
1091
|
+
if log_validation_plans is not None:
|
|
1092
|
+
self.config_params["shacl.logValidationPlans"] = log_validation_plans
|
|
1093
|
+
if log_validation_violations is not None:
|
|
1094
|
+
self.config_params["shacl.logValidationViolations"] = (
|
|
1095
|
+
log_validation_violations
|
|
1096
|
+
)
|
|
1097
|
+
if ignore_no_shapes_loaded_exception is not None:
|
|
1098
|
+
self.config_params["shacl.ignoreNoShapesLoadedException"] = (
|
|
1099
|
+
ignore_no_shapes_loaded_exception
|
|
1100
|
+
)
|
|
1101
|
+
if validation_enabled is not None:
|
|
1102
|
+
self.config_params["shacl.validationEnabled"] = validation_enabled
|
|
1103
|
+
if cache_select_nodes is not None:
|
|
1104
|
+
self.config_params["shacl.cacheSelectNodes"] = cache_select_nodes
|
|
1105
|
+
if global_log_validation_execution is not None:
|
|
1106
|
+
self.config_params["shacl.globalLogValidationExecution"] = (
|
|
1107
|
+
global_log_validation_execution
|
|
1108
|
+
)
|
|
1109
|
+
if rdfs_sub_class_reasoning is not None:
|
|
1110
|
+
self.config_params["shacl.rdfsSubClassReasoning"] = rdfs_sub_class_reasoning
|
|
1111
|
+
if performance_logging is not None:
|
|
1112
|
+
self.config_params["shacl.performanceLogging"] = performance_logging
|
|
1113
|
+
if serializable_validation is not None:
|
|
1114
|
+
self.config_params["shacl.serializableValidation"] = serializable_validation
|
|
1115
|
+
if eclipse_rdf4j_shacl_extensions is not None:
|
|
1116
|
+
self.config_params["shacl.eclipseRdf4jShaclExtensions"] = (
|
|
1117
|
+
eclipse_rdf4j_shacl_extensions
|
|
1118
|
+
)
|
|
1119
|
+
if dash_data_shapes is not None:
|
|
1120
|
+
self.config_params["shacl.dashDataShapes"] = dash_data_shapes
|
|
1121
|
+
if validation_results_limit_total is not None:
|
|
1122
|
+
self.config_params["shacl.validationResultsLimitTotal"] = (
|
|
1123
|
+
validation_results_limit_total
|
|
1124
|
+
)
|
|
1125
|
+
if validation_results_limit_per_constraint is not None:
|
|
1126
|
+
self.config_params["shacl.validationResultsLimitPerConstraint"] = (
|
|
1127
|
+
validation_results_limit_per_constraint
|
|
1128
|
+
)
|
|
1129
|
+
|
|
1130
|
+
def add_to_graph(self, graph: Graph) -> URIRef:
|
|
1131
|
+
"""
|
|
1132
|
+
Adds the SHACLSailConfig to the RDF graph.
|
|
1133
|
+
|
|
1134
|
+
Args:
|
|
1135
|
+
graph (Graph): The RDF graph to add the configuration to.
|
|
1136
|
+
|
|
1137
|
+
Returns:
|
|
1138
|
+
URIRef: The URIRef of the added configuration.
|
|
1139
|
+
"""
|
|
1140
|
+
sail_node = super().add_to_graph(graph) # Get the basic node
|
|
1141
|
+
delegate_node = self.config_params["delegate"].to_rdf(graph)
|
|
1142
|
+
graph.add((sail_node, CONFIG.delegate, delegate_node))
|
|
1143
|
+
|
|
1144
|
+
# Add SHACL-specific parameters
|
|
1145
|
+
for key, value in self.config_params.items():
|
|
1146
|
+
if key != "delegate": # Delegate is already handled
|
|
1147
|
+
if isinstance(value, bool):
|
|
1148
|
+
graph.add(
|
|
1149
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.boolean))
|
|
1150
|
+
)
|
|
1151
|
+
elif isinstance(value, int):
|
|
1152
|
+
graph.add(
|
|
1153
|
+
(sail_node, CONFIG[key], Literal(value, datatype=XSD.integer))
|
|
1154
|
+
)
|
|
1155
|
+
else:
|
|
1156
|
+
graph.add((sail_node, CONFIG[key], Literal(value)))
|
|
1157
|
+
return sail_node
|
|
1158
|
+
|
|
1159
|
+
class Builder:
|
|
1160
|
+
def __init__(self, delegate: "SailConfig"):
|
|
1161
|
+
"""
|
|
1162
|
+
Initializes a new SHACLSailConfig.Builder.
|
|
1163
|
+
|
|
1164
|
+
Args:
|
|
1165
|
+
delegate (SailConfig): The delegate configuration for the SHACL Sail.
|
|
1166
|
+
"""
|
|
1167
|
+
self._delegate = delegate
|
|
1168
|
+
self._parallel_validation: Optional[bool] = None
|
|
1169
|
+
self._undefined_target_validates_all_subjects: Optional[bool] = None
|
|
1170
|
+
self._log_validation_plans: Optional[bool] = None
|
|
1171
|
+
self._log_validation_violations: Optional[bool] = None
|
|
1172
|
+
self._ignore_no_shapes_loaded_exception: Optional[bool] = None
|
|
1173
|
+
self._validation_enabled: Optional[bool] = None
|
|
1174
|
+
self._cache_select_nodes: Optional[bool] = None
|
|
1175
|
+
self._global_log_validation_execution: Optional[bool] = None
|
|
1176
|
+
self._rdfs_sub_class_reasoning: Optional[bool] = None
|
|
1177
|
+
self._performance_logging: Optional[bool] = None
|
|
1178
|
+
self._serializable_validation: Optional[bool] = None
|
|
1179
|
+
self._eclipse_rdf4j_shacl_extensions: Optional[bool] = None
|
|
1180
|
+
self._dash_data_shapes: Optional[bool] = None
|
|
1181
|
+
self._validation_results_limit_total: Optional[int] = None
|
|
1182
|
+
self._validation_results_limit_per_constraint: Optional[int] = None
|
|
1183
|
+
self._iteration_cache_sync_threshold: Optional[int] = None
|
|
1184
|
+
self._default_query_evaluation_mode: Optional[str] = None
|
|
1185
|
+
|
|
1186
|
+
def parallel_validation(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1187
|
+
"""
|
|
1188
|
+
Sets the parallel validation flag for the SHACL Sail configuration.
|
|
1189
|
+
|
|
1190
|
+
Args:
|
|
1191
|
+
value (bool): The parallel validation flag for the SHACL Sail configuration.
|
|
1192
|
+
|
|
1193
|
+
Returns:
|
|
1194
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1195
|
+
"""
|
|
1196
|
+
self._parallel_validation = value
|
|
1197
|
+
return self
|
|
1198
|
+
|
|
1199
|
+
def undefined_target_validates_all_subjects(
|
|
1200
|
+
self, value: bool
|
|
1201
|
+
) -> "SHACLSailConfig.Builder":
|
|
1202
|
+
"""
|
|
1203
|
+
Sets the undefined target validates all subjects flag for the SHACL Sail configuration.
|
|
1204
|
+
|
|
1205
|
+
Args:
|
|
1206
|
+
value (bool): The undefined target validates all subjects flag for the SHACL Sail configuration.
|
|
1207
|
+
|
|
1208
|
+
Returns:
|
|
1209
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1210
|
+
"""
|
|
1211
|
+
self._undefined_target_validates_all_subjects = value
|
|
1212
|
+
return self
|
|
1213
|
+
|
|
1214
|
+
def log_validation_plans(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1215
|
+
"""
|
|
1216
|
+
Sets the log validation plans flag for the SHACL Sail configuration.
|
|
1217
|
+
|
|
1218
|
+
Args:
|
|
1219
|
+
value (bool): The log validation plans flag for the SHACL Sail configuration.
|
|
1220
|
+
|
|
1221
|
+
Returns:
|
|
1222
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1223
|
+
"""
|
|
1224
|
+
self._log_validation_plans = value
|
|
1225
|
+
return self
|
|
1226
|
+
|
|
1227
|
+
def log_validation_violations(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1228
|
+
"""
|
|
1229
|
+
Sets the log validation violations flag for the SHACL Sail configuration.
|
|
1230
|
+
|
|
1231
|
+
Args:
|
|
1232
|
+
value (bool): The log validation violations flag for the SHACL Sail configuration.
|
|
1233
|
+
|
|
1234
|
+
Returns:
|
|
1235
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1236
|
+
"""
|
|
1237
|
+
self._log_validation_violations = value
|
|
1238
|
+
return self
|
|
1239
|
+
|
|
1240
|
+
def ignore_no_shapes_loaded_exception(
|
|
1241
|
+
self, value: bool
|
|
1242
|
+
) -> "SHACLSailConfig.Builder":
|
|
1243
|
+
"""
|
|
1244
|
+
Sets the ignore no shapes loaded exception flag for the SHACL Sail configuration.
|
|
1245
|
+
|
|
1246
|
+
Args:
|
|
1247
|
+
value (bool): The ignore no shapes loaded exception flag for the SHACL Sail configuration.
|
|
1248
|
+
|
|
1249
|
+
Returns:
|
|
1250
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1251
|
+
"""
|
|
1252
|
+
self._ignore_no_shapes_loaded_exception = value
|
|
1253
|
+
return self
|
|
1254
|
+
|
|
1255
|
+
def validation_enabled(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1256
|
+
"""
|
|
1257
|
+
Sets the validation enabled flag for the SHACL Sail configuration.
|
|
1258
|
+
|
|
1259
|
+
Args:
|
|
1260
|
+
value (bool): The validation enabled flag for the SHACL Sail configuration.
|
|
1261
|
+
|
|
1262
|
+
Returns:
|
|
1263
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1264
|
+
"""
|
|
1265
|
+
self._validation_enabled = value
|
|
1266
|
+
return self
|
|
1267
|
+
|
|
1268
|
+
def cache_select_nodes(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1269
|
+
"""
|
|
1270
|
+
Sets the cache select nodes flag for the SHACL Sail configuration.
|
|
1271
|
+
|
|
1272
|
+
Args:
|
|
1273
|
+
value (bool): The cache select nodes flag for the SHACL Sail configuration.
|
|
1274
|
+
|
|
1275
|
+
Returns:
|
|
1276
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1277
|
+
"""
|
|
1278
|
+
self._cache_select_nodes = value
|
|
1279
|
+
return self
|
|
1280
|
+
|
|
1281
|
+
def global_log_validation_execution(
|
|
1282
|
+
self, value: bool
|
|
1283
|
+
) -> "SHACLSailConfig.Builder":
|
|
1284
|
+
"""
|
|
1285
|
+
Sets the global log validation execution flag for the SHACL Sail configuration.
|
|
1286
|
+
|
|
1287
|
+
Args:
|
|
1288
|
+
value (bool): The global log validation execution flag for the SHACL Sail configuration.
|
|
1289
|
+
|
|
1290
|
+
Returns:
|
|
1291
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1292
|
+
"""
|
|
1293
|
+
self._global_log_validation_execution = value
|
|
1294
|
+
return self
|
|
1295
|
+
|
|
1296
|
+
def rdfs_sub_class_reasoning(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1297
|
+
"""
|
|
1298
|
+
Sets the RDFS sub-class reasoning flag for the SHACL Sail configuration.
|
|
1299
|
+
|
|
1300
|
+
Args:
|
|
1301
|
+
value (bool): The RDFS sub-class reasoning flag for the SHACL Sail configuration.
|
|
1302
|
+
|
|
1303
|
+
Returns:
|
|
1304
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1305
|
+
"""
|
|
1306
|
+
self._rdfs_sub_class_reasoning = value
|
|
1307
|
+
return self
|
|
1308
|
+
|
|
1309
|
+
def performance_logging(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1310
|
+
"""
|
|
1311
|
+
Sets the performance logging flag for the SHACL Sail configuration.
|
|
1312
|
+
|
|
1313
|
+
Args:
|
|
1314
|
+
value (bool): The performance logging flag for the SHACL Sail configuration.
|
|
1315
|
+
|
|
1316
|
+
Returns:
|
|
1317
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1318
|
+
"""
|
|
1319
|
+
self._performance_logging = value
|
|
1320
|
+
return self
|
|
1321
|
+
|
|
1322
|
+
def serializable_validation(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1323
|
+
"""
|
|
1324
|
+
Sets the serializable validation flag for the SHACL Sail configuration.
|
|
1325
|
+
|
|
1326
|
+
Args:
|
|
1327
|
+
value (bool): The serializable validation flag for the SHACL Sail configuration.
|
|
1328
|
+
|
|
1329
|
+
Returns:
|
|
1330
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1331
|
+
"""
|
|
1332
|
+
self._serializable_validation = value
|
|
1333
|
+
return self
|
|
1334
|
+
|
|
1335
|
+
def eclipse_rdf4j_shacl_extensions(
|
|
1336
|
+
self, value: bool
|
|
1337
|
+
) -> "SHACLSailConfig.Builder":
|
|
1338
|
+
"""
|
|
1339
|
+
Sets the Eclipse RDF4J SHACL extensions flag for the SHACL Sail configuration.
|
|
1340
|
+
|
|
1341
|
+
Args:
|
|
1342
|
+
value (bool): The Eclipse RDF4J SHACL extensions flag for the SHACL Sail configuration.
|
|
1343
|
+
|
|
1344
|
+
Returns:
|
|
1345
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1346
|
+
"""
|
|
1347
|
+
self._eclipse_rdf4j_shacl_extensions = value
|
|
1348
|
+
return self
|
|
1349
|
+
|
|
1350
|
+
def dash_data_shapes(self, value: bool) -> "SHACLSailConfig.Builder":
|
|
1351
|
+
"""
|
|
1352
|
+
Sets the Dash Data Shapes flag for the SHACL Sail configuration.
|
|
1353
|
+
|
|
1354
|
+
Args:
|
|
1355
|
+
value (bool): The Dash Data Shapes flag for the SHACL Sail configuration.
|
|
1356
|
+
|
|
1357
|
+
Returns:
|
|
1358
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1359
|
+
"""
|
|
1360
|
+
self._dash_data_shapes = value
|
|
1361
|
+
return self
|
|
1362
|
+
|
|
1363
|
+
def validation_results_limit_total(
|
|
1364
|
+
self, value: int
|
|
1365
|
+
) -> "SHACLSailConfig.Builder":
|
|
1366
|
+
"""
|
|
1367
|
+
Sets the validation results limit total flag for the SHACL Sail configuration.
|
|
1368
|
+
|
|
1369
|
+
Args:
|
|
1370
|
+
value (int): The validation results limit total flag for the SHACL Sail configuration.
|
|
1371
|
+
|
|
1372
|
+
Returns:
|
|
1373
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1374
|
+
"""
|
|
1375
|
+
self._validation_results_limit_total = value
|
|
1376
|
+
return self
|
|
1377
|
+
|
|
1378
|
+
def validation_results_limit_per_constraint(
|
|
1379
|
+
self, value: int
|
|
1380
|
+
) -> "SHACLSailConfig.Builder":
|
|
1381
|
+
"""
|
|
1382
|
+
Sets the validation results limit per constraint flag for the SHACL Sail configuration.
|
|
1383
|
+
|
|
1384
|
+
Args:
|
|
1385
|
+
value (int): The validation results limit per constraint flag for the SHACL Sail configuration.
|
|
1386
|
+
|
|
1387
|
+
Returns:
|
|
1388
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1389
|
+
"""
|
|
1390
|
+
self._validation_results_limit_per_constraint = value
|
|
1391
|
+
return self
|
|
1392
|
+
|
|
1393
|
+
def iteration_cache_sync_threshold(
|
|
1394
|
+
self, threshold: int
|
|
1395
|
+
) -> "SHACLSailConfig.Builder":
|
|
1396
|
+
"""
|
|
1397
|
+
Sets the iteration cache sync threshold flag for the SHACL Sail configuration.
|
|
1398
|
+
|
|
1399
|
+
Args:
|
|
1400
|
+
threshold (int): The iteration cache sync threshold flag for the SHACL Sail configuration.
|
|
1401
|
+
|
|
1402
|
+
Returns:
|
|
1403
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1404
|
+
"""
|
|
1405
|
+
self._iteration_cache_sync_threshold = threshold
|
|
1406
|
+
return self
|
|
1407
|
+
|
|
1408
|
+
def default_query_evaluation_mode(self, mode: str) -> "SHACLSailConfig.Builder":
|
|
1409
|
+
"""
|
|
1410
|
+
Sets the default query evaluation mode flag for the SHACL Sail configuration.
|
|
1411
|
+
|
|
1412
|
+
Args:
|
|
1413
|
+
mode (str): The default query evaluation mode flag for the SHACL Sail configuration.
|
|
1414
|
+
|
|
1415
|
+
Returns:
|
|
1416
|
+
SHACLSailConfig.Builder: The builder instance.
|
|
1417
|
+
"""
|
|
1418
|
+
self._default_query_evaluation_mode = mode
|
|
1419
|
+
return self
|
|
1420
|
+
|
|
1421
|
+
def build(self) -> "SHACLSailConfig":
|
|
1422
|
+
"""
|
|
1423
|
+
Builds the SHACLSailConfig.
|
|
1424
|
+
|
|
1425
|
+
Returns:
|
|
1426
|
+
SHACLSailConfig: The built SHACLSailConfig.
|
|
1427
|
+
"""
|
|
1428
|
+
return SHACLSailConfig(
|
|
1429
|
+
delegate=self._delegate,
|
|
1430
|
+
parallel_validation=self._parallel_validation,
|
|
1431
|
+
undefined_target_validates_all_subjects=self._undefined_target_validates_all_subjects,
|
|
1432
|
+
log_validation_plans=self._log_validation_plans,
|
|
1433
|
+
log_validation_violations=self._log_validation_violations,
|
|
1434
|
+
ignore_no_shapes_loaded_exception=self._ignore_no_shapes_loaded_exception,
|
|
1435
|
+
validation_enabled=self._validation_enabled,
|
|
1436
|
+
cache_select_nodes=self._cache_select_nodes,
|
|
1437
|
+
global_log_validation_execution=self._global_log_validation_execution,
|
|
1438
|
+
rdfs_sub_class_reasoning=self._rdfs_sub_class_reasoning,
|
|
1439
|
+
performance_logging=self._performance_logging,
|
|
1440
|
+
serializable_validation=self._serializable_validation,
|
|
1441
|
+
eclipse_rdf4j_shacl_extensions=self._eclipse_rdf4j_shacl_extensions,
|
|
1442
|
+
dash_data_shapes=self._dash_data_shapes,
|
|
1443
|
+
validation_results_limit_total=self._validation_results_limit_total,
|
|
1444
|
+
validation_results_limit_per_constraint=self._validation_results_limit_per_constraint,
|
|
1445
|
+
iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
|
|
1446
|
+
default_query_evaluation_mode=self._default_query_evaluation_mode,
|
|
1447
|
+
)
|