rdf4j-python 0.1.3__py3-none-any.whl → 0.1.5__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.
@@ -59,12 +59,12 @@ class RepositoryConfig:
59
59
  """
60
60
  return self._title
61
61
 
62
- def to_turtle(self) -> str:
62
+ def to_turtle(self) -> bytes | None:
63
63
  """
64
- Serializes the Repository configuration to Turtle syntax using .
64
+ Serializes the Repository configuration to Turtle syntax using pyoxigraph.
65
65
 
66
66
  Returns:
67
- str: A UTF-8 encoded Turtle string representing the RDF4J repository configuration.
67
+ bytes | None: A UTF-8 encoded Turtle string representing the RDF4J repository configuration.
68
68
  The serialization includes the repository ID, optional human-readable title,
69
69
  and nested repository implementation configuration if available.
70
70
 
@@ -86,91 +86,10 @@ class RepositoryConfig:
86
86
 
87
87
  return serialize(graph, format=RdfFormat.TURTLE)
88
88
 
89
- class Builder:
90
- """
91
- Builder for creating RepositoryConfig instances.
92
- """
93
-
94
- def __init__(self, repo_id: Optional[str] = None):
95
- """
96
- Initializes a new RepositoryConfig.Builder instance.
97
-
98
- Args:
99
- repo_id (Optional[str], optional): The unique identifier for the repository. Defaults to None.
100
- """
101
- self._repo_id = repo_id
102
- self._title: Optional[str] = None
103
- self._impl: Optional["RepositoryImplConfig"] = None
104
-
105
- def repo_id(self, repo_id: str) -> "RepositoryConfig.Builder":
106
- """
107
- Sets the repository ID.
108
-
109
- Args:
110
- repo_id (str): The unique identifier for the repository.
111
-
112
- Returns:
113
- RepositoryConfig.Builder: The builder instance.
114
- """
115
- self._repo_id = repo_id
116
- return self
117
-
118
- def title(self, title: str) -> "RepositoryConfig.Builder":
119
- """
120
- Sets the human-readable title for the repository.
121
-
122
- Args:
123
- title (str): The human-readable title for the repository.
124
-
125
- Returns:
126
- RepositoryConfig.Builder: The builder instance.
127
- """
128
- self._title = title
129
- return self
130
-
131
- def repo_impl(self, impl: "RepositoryImplConfig") -> "RepositoryConfig.Builder":
132
- """
133
- Sets the repository implementation configuration.
134
-
135
- Args:
136
- impl (RepositoryImplConfig): The implementation configuration for the repository.
137
-
138
- Returns:
139
- RepositoryConfig.Builder: The builder instance.
140
- """
141
- self._impl = impl
142
- return self
143
-
144
- def sail_repository_impl(
145
- self, sail_impl: "SailConfig"
146
- ) -> "RepositoryConfig.Builder":
147
- """
148
- Sets the repository implementation configuration to a SailRepositoryConfig.
149
-
150
- Args:
151
- sail_impl (SailConfig): The Sail configuration for the repository.
152
-
153
- Returns:
154
- RepositoryConfig.Builder: The builder instance.
155
- """
156
- self.repo_impl(SailRepositoryConfig.Builder().sail_impl(sail_impl).build())
157
- return self
158
-
159
- def build(self) -> "RepositoryConfig":
160
- """
161
- Builds and returns the RepositoryConfig instance.
162
-
163
- Returns:
164
- RepositoryConfig: The constructed RepositoryConfig instance.
165
- """
166
- return RepositoryConfig(
167
- repo_id=self._repo_id, title=self._title, impl=self._impl
168
- )
169
-
170
89
 
171
90
  class RepositoryImplConfig:
172
91
  """
173
- Base class for repository implementation configurations using .
92
+ Base class for repository implementation configurations using RDF4J.
174
93
  """
175
94
 
176
95
  def __init__(self, rep_type: str):
@@ -249,38 +168,6 @@ class SPARQLRepositoryConfig(RepositoryImplConfig):
249
168
  if update_endpoint:
250
169
  self.config_params["sparql.updateEndpoint"] = update_endpoint
251
170
 
252
- class Builder:
253
- def __init__(self, query_endpoint: str):
254
- """
255
- Initializes a new SPARQLRepositoryConfig.Builder instance.
256
-
257
- Args:
258
- query_endpoint (str): The SPARQL query endpoint URL.
259
- """
260
- self._query_endpoint = query_endpoint
261
- self._update_endpoint: Optional[str] = None
262
-
263
- def update_endpoint(
264
- self, update_endpoint: str
265
- ) -> "SPARQLRepositoryConfig.Builder":
266
- """
267
- Sets the SPARQL update endpoint URL.
268
-
269
- Args:
270
- update_endpoint (str): The SPARQL update endpoint URL.
271
-
272
- Returns:
273
- SPARQLRepositoryConfig.Builder: The builder instance.
274
- """
275
- self._update_endpoint = update_endpoint
276
- return self
277
-
278
- def build(self) -> "SPARQLRepositoryConfig":
279
- return SPARQLRepositoryConfig(
280
- query_endpoint=self._query_endpoint,
281
- update_endpoint=self._update_endpoint,
282
- )
283
-
284
171
 
285
172
  class HTTPRepositoryConfig(RepositoryImplConfig):
286
173
  """
@@ -299,43 +186,6 @@ class HTTPRepositoryConfig(RepositoryImplConfig):
299
186
  if password:
300
187
  self.config_params["http.password"] = password
301
188
 
302
- class Builder:
303
- def __init__(self, url: str):
304
- self._url = url
305
- self._username: Optional[str] = None
306
- self._password: Optional[str] = None
307
-
308
- def username(self, username: str) -> "HTTPRepositoryConfig.Builder":
309
- """
310
- Sets the username for the HTTP repository.
311
-
312
- Args:
313
- username (str): The username for the HTTP repository.
314
-
315
- Returns:
316
- HTTPRepositoryConfig.Builder: The builder instance.
317
- """
318
- self._username = username
319
- return self
320
-
321
- def password(self, password: str) -> "HTTPRepositoryConfig.Builder":
322
- """
323
- Sets the password for the HTTP repository.
324
-
325
- Args:
326
- password (str): The password for the HTTP repository.
327
-
328
- Returns:
329
- HTTPRepositoryConfig.Builder: The builder instance.
330
- """
331
- self._password = password
332
- return self
333
-
334
- def build(self) -> "HTTPRepositoryConfig":
335
- return HTTPRepositoryConfig(
336
- url=self._url, username=self._username, password=self._password
337
- )
338
-
339
189
 
340
190
  class SailRepositoryConfig(RepositoryImplConfig):
341
191
  """
@@ -354,36 +204,10 @@ class SailRepositoryConfig(RepositoryImplConfig):
354
204
  """
355
205
  return super().add_to_graph(graph)
356
206
 
357
- class Builder:
358
- def __init__(self, sail_impl: Optional["SailConfig"] = None):
359
- self._sail_impl = sail_impl
360
-
361
- def sail_impl(self, sail_impl: "SailConfig") -> "SailRepositoryConfig.Builder":
362
- """
363
- Sets the Sail configuration for the repository.
364
-
365
- Args:
366
- sail_impl (SailConfig): The Sail configuration for the repository.
367
-
368
- Returns:
369
- SailRepositoryConfig.Builder: The builder instance.
370
- """
371
- self._sail_impl = sail_impl
372
- return self
373
-
374
- def build(self) -> "SailRepositoryConfig":
375
- """
376
- Builds and returns the SailRepositoryConfig instance.
377
-
378
- Returns:
379
- SailRepositoryConfig: The constructed SailRepositoryConfig instance.
380
- """
381
- return SailRepositoryConfig(sail_impl=self._sail_impl)
382
-
383
207
 
384
208
  class DatasetRepositoryConfig(RepositoryImplConfig):
385
209
  """
386
- Configuration for a DatasetRepository using .
210
+ Configuration for a DatasetRepository using RDF datasets.
387
211
  """
388
212
 
389
213
  TYPE = "openrdf:DatasetRepository"
@@ -399,17 +223,10 @@ class DatasetRepositoryConfig(RepositoryImplConfig):
399
223
  repo_node = super().add_to_graph(graph)
400
224
  return repo_node
401
225
 
402
- class Builder:
403
- def __init__(self, delegate: "RepositoryImplConfig"):
404
- self._delegate = delegate
405
-
406
- def build(self) -> "DatasetRepositoryConfig":
407
- return DatasetRepositoryConfig(delegate=self._delegate)
408
-
409
226
 
410
227
  class SailConfig:
411
228
  """
412
- Base class for SAIL configurations using .
229
+ Base class for SAIL configurations using RDF4J's Storage and Inference Layer.
413
230
  """
414
231
 
415
232
  def __init__(
@@ -483,7 +300,7 @@ class SailConfig:
483
300
 
484
301
  class MemoryStoreConfig(SailConfig):
485
302
  """
486
- Configuration for a MemoryStore using .
303
+ Configuration for a MemoryStore using in-memory RDF storage.
487
304
  """
488
305
 
489
306
  TYPE = "openrdf:MemoryStore"
@@ -505,81 +322,10 @@ class MemoryStoreConfig(SailConfig):
505
322
  if sync_delay is not None:
506
323
  self.config_params["mem.syncDelay"] = sync_delay
507
324
 
508
- class Builder:
509
- def __init__(self):
510
- self._persist: Optional[bool] = None
511
- self._sync_delay: Optional[int] = None
512
- self._iteration_cache_sync_threshold: Optional[int] = None
513
- self._default_query_evaluation_mode: Optional[str] = None
514
-
515
- def persist(self, persist: bool) -> "MemoryStoreConfig.Builder":
516
- """
517
- Sets the persist flag for the MemoryStore configuration.
518
-
519
- Args:
520
- persist (bool): The persist flag for the MemoryStore configuration.
521
-
522
- Returns:
523
- MemoryStoreConfig.Builder: The builder instance.
524
- """
525
- self._persist = persist
526
- return self
527
-
528
- def sync_delay(self, sync_delay: int) -> "MemoryStoreConfig.Builder":
529
- """
530
- Sets the sync delay for the MemoryStore configuration.
531
-
532
- Args:
533
- sync_delay (int): The sync delay for the MemoryStore configuration.
534
-
535
- Returns:
536
- MemoryStoreConfig.Builder: The builder instance.
537
- """
538
- self._sync_delay = sync_delay
539
- return self
540
-
541
- def iteration_cache_sync_threshold(
542
- self, threshold: int
543
- ) -> "MemoryStoreConfig.Builder":
544
- """
545
- Sets the iteration cache sync threshold for the MemoryStore configuration.
546
-
547
- Args:
548
- threshold (int): The iteration cache sync threshold for the MemoryStore configuration.
549
-
550
- Returns:
551
- MemoryStoreConfig.Builder: The builder instance.
552
- """
553
- self._iteration_cache_sync_threshold = threshold
554
- return self
555
-
556
- def default_query_evaluation_mode(
557
- self, mode: str
558
- ) -> "MemoryStoreConfig.Builder":
559
- """
560
- Sets the default query evaluation mode for the MemoryStore configuration.
561
-
562
- Args:
563
- mode (str): The default query evaluation mode for the MemoryStore configuration.
564
-
565
- Returns:
566
- MemoryStoreConfig.Builder: The builder instance.
567
- """
568
- self._default_query_evaluation_mode = mode
569
- return self
570
-
571
- def build(self) -> "MemoryStoreConfig":
572
- return MemoryStoreConfig(
573
- persist=self._persist,
574
- sync_delay=self._sync_delay,
575
- iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
576
- default_query_evaluation_mode=self._default_query_evaluation_mode,
577
- )
578
-
579
325
 
580
326
  class NativeStoreConfig(SailConfig):
581
327
  """
582
- Configuration for a NativeStore using .
328
+ Configuration for a NativeStore using persistent file-based RDF storage.
583
329
  """
584
330
 
585
331
  TYPE = "openrdf:NativeStore"
@@ -613,141 +359,10 @@ class NativeStoreConfig(SailConfig):
613
359
  if namespace_id_cache_size:
614
360
  self.config_params["native.namespaceIDCacheSize"] = namespace_id_cache_size
615
361
 
616
- class Builder:
617
- def __init__(self):
618
- self._triple_indexes: Optional[str] = None
619
- self._force_sync: Optional[bool] = None
620
- self._value_cache_size: Optional[int] = None
621
- self._value_id_cache_size: Optional[int] = None
622
- self._namespace_cache_size: Optional[int] = None
623
- self._namespace_id_cache_size: Optional[int] = None
624
- self._iteration_cache_sync_threshold: Optional[int] = None
625
- self._default_query_evaluation_mode: Optional[str] = None
626
-
627
- def triple_indexes(self, indexes: str) -> "NativeStoreConfig.Builder":
628
- """
629
- Sets the triple indexes for the NativeStore configuration.
630
-
631
- Args:
632
- indexes (str): The triple indexes for the NativeStore configuration.
633
-
634
- Returns:
635
- NativeStoreConfig.Builder: The builder instance.
636
- """
637
- self._triple_indexes = indexes
638
- return self
639
-
640
- def force_sync(self, sync: bool) -> "NativeStoreConfig.Builder":
641
- """
642
- Sets the force sync flag for the NativeStore configuration.
643
-
644
- Args:
645
- sync (bool): The force sync flag for the NativeStore configuration.
646
-
647
- Returns:
648
- NativeStoreConfig.Builder: The builder instance.
649
- """
650
- self._force_sync = sync
651
- return self
652
-
653
- def value_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
654
- """
655
- Sets the value cache size for the NativeStore configuration.
656
-
657
- Args:
658
- size (int): The value cache size for the NativeStore configuration.
659
-
660
- Returns:
661
- NativeStoreConfig.Builder: The builder instance.
662
- """
663
- self._value_cache_size = size
664
- return self
665
-
666
- def value_id_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
667
- """
668
- Sets the value ID cache size for the NativeStore configuration.
669
-
670
- Args:
671
- size (int): The value ID cache size for the NativeStore configuration.
672
-
673
- Returns:
674
- NativeStoreConfig.Builder: The builder instance.
675
- """
676
- self._value_id_cache_size = size
677
- return self
678
-
679
- def namespace_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
680
- """
681
- Sets the namespace cache size for the NativeStore configuration.
682
-
683
- Args:
684
- size (int): The namespace cache size for the NativeStore configuration.
685
-
686
- Returns:
687
- NativeStoreConfig.Builder: The builder instance.
688
- """
689
- self._namespace_cache_size = size
690
- return self
691
-
692
- def namespace_id_cache_size(self, size: int) -> "NativeStoreConfig.Builder":
693
- """
694
- Sets the namespace ID cache size for the NativeStore configuration.
695
-
696
- Args:
697
- size (int): The namespace ID cache size for the NativeStore configuration.
698
-
699
- Returns:
700
- NativeStoreConfig.Builder: The builder instance.
701
- """
702
- self._namespace_id_cache_size = size
703
- return self
704
-
705
- def iteration_cache_sync_threshold(
706
- self, threshold: int
707
- ) -> "NativeStoreConfig.Builder":
708
- """
709
- Sets the iteration cache sync threshold for the NativeStore configuration.
710
-
711
- Args:
712
- threshold (int): The iteration cache sync threshold for the NativeStore configuration.
713
-
714
- Returns:
715
- NativeStoreConfig.Builder: The builder instance.
716
- """
717
- self._iteration_cache_sync_threshold = threshold
718
- return self
719
-
720
- def default_query_evaluation_mode(
721
- self, mode: str
722
- ) -> "NativeStoreConfig.Builder":
723
- """
724
- Sets the default query evaluation mode for the NativeStore configuration.
725
-
726
- Args:
727
- mode (str): The default query evaluation mode for the NativeStore configuration.
728
-
729
- Returns:
730
- NativeStoreConfig.Builder: The builder instance.
731
- """
732
- self._default_query_evaluation_mode = mode
733
- return self
734
-
735
- def build(self) -> "NativeStoreConfig":
736
- return NativeStoreConfig(
737
- triple_indexes=self._triple_indexes,
738
- force_sync=self._force_sync,
739
- value_cache_size=self._value_cache_size,
740
- value_id_cache_size=self._value_id_cache_size,
741
- namespace_cache_size=self._namespace_cache_size,
742
- namespace_id_cache_size=self._namespace_id_cache_size,
743
- iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
744
- default_query_evaluation_mode=self._default_query_evaluation_mode,
745
- )
746
-
747
362
 
748
363
  class ElasticsearchStoreConfig(SailConfig):
749
364
  """
750
- Configuration for an ElasticsearchStore using .
365
+ Configuration for an ElasticsearchStore using Elasticsearch for RDF storage.
751
366
  """
752
367
 
753
368
  TYPE = "rdf4j:ElasticsearchStore"
@@ -774,104 +389,10 @@ class ElasticsearchStoreConfig(SailConfig):
774
389
  if index is not None:
775
390
  self.config_params["ess.index"] = index
776
391
 
777
- class Builder:
778
- def __init__(self, hostname: str):
779
- self._hostname = hostname
780
- self._port: Optional[int] = None
781
- self._cluster_name: Optional[str] = None
782
- self._index: Optional[str] = None
783
- self._iteration_cache_sync_threshold: Optional[int] = None
784
- self._default_query_evaluation_mode: Optional[str] = None
785
-
786
- def port(self, port: int) -> "ElasticsearchStoreConfig.Builder":
787
- """
788
- Sets the port for the ElasticsearchStore configuration.
789
-
790
- Args:
791
- port (int): The port for the ElasticsearchStore configuration.
792
-
793
- Returns:
794
- ElasticsearchStoreConfig.Builder: The builder instance.
795
- """
796
- self._port = port
797
- return self
798
-
799
- def cluster_name(self, cluster_name: str) -> "ElasticsearchStoreConfig.Builder":
800
- """
801
- Sets the cluster name for the ElasticsearchStore configuration.
802
-
803
- Args:
804
- cluster_name (str): The cluster name for the ElasticsearchStore configuration.
805
-
806
- Returns:
807
- ElasticsearchStoreConfig.Builder: The builder instance.
808
- """
809
- self._cluster_name = cluster_name
810
- return self
811
-
812
- def index(self, index: str) -> "ElasticsearchStoreConfig.Builder":
813
- """
814
- Sets the index for the ElasticsearchStore configuration.
815
-
816
- Args:
817
- index (str): The index for the ElasticsearchStore configuration.
818
-
819
- Returns:
820
- ElasticsearchStoreConfig.Builder: The builder instance.
821
- """
822
- self._index = index
823
- return self
824
-
825
- def iteration_cache_sync_threshold(
826
- self, threshold: int
827
- ) -> "ElasticsearchStoreConfig.Builder":
828
- """
829
- Sets the iteration cache sync threshold for the ElasticsearchStore configuration.
830
-
831
- Args:
832
- threshold (int): The iteration cache sync threshold for the ElasticsearchStore configuration.
833
-
834
- Returns:
835
- ElasticsearchStoreConfig.Builder: The builder instance.
836
- """
837
- self._iteration_cache_sync_threshold = threshold
838
- return self
839
-
840
- def default_query_evaluation_mode(
841
- self, mode: str
842
- ) -> "ElasticsearchStoreConfig.Builder":
843
- """
844
- Sets the default query evaluation mode for the ElasticsearchStore configuration.
845
-
846
- Args:
847
- mode (str): The default query evaluation mode for the ElasticsearchStore configuration.
848
-
849
- Returns:
850
- ElasticsearchStoreConfig.Builder: The builder instance.
851
- """
852
- self._default_query_evaluation_mode = mode
853
- return self
854
-
855
- def build(self) -> "ElasticsearchStoreConfig":
856
- """
857
- Builds and returns the ElasticsearchStoreConfig instance.
858
-
859
- Returns:
860
- ElasticsearchStoreConfig: The constructed ElasticsearchStoreConfig instance.
861
- """
862
- return ElasticsearchStoreConfig(
863
- hostname=self._hostname,
864
- port=self._port,
865
- cluster_name=self._cluster_name,
866
- index=self._index,
867
- iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
868
- default_query_evaluation_mode=self._default_query_evaluation_mode,
869
- )
870
-
871
392
 
872
393
  class SchemaCachingRDFSInferencerConfig(SailConfig):
873
394
  """
874
- Configuration for the RDF Schema inferencer using .
395
+ Configuration for the RDF Schema inferencer using schema caching for performance.
875
396
  """
876
397
 
877
398
  TYPE = "rdf4j:SchemaCachingRDFSInferencer"
@@ -907,64 +428,12 @@ class SchemaCachingRDFSInferencerConfig(SailConfig):
907
428
  Returns:
908
429
  URIRef: The URIRef of the added configuration.
909
430
  """
910
- sail_node = super().add_to_graph(graph)
911
- delegate_node = self.config_params["delegate"].to_rdf(graph)
912
- graph.add((sail_node, CONFIG.delegate, delegate_node))
913
- return sail_node
914
-
915
- class Builder:
916
- def __init__(self, delegate: "SailConfig"):
917
- self._delegate = delegate
918
- self._iteration_cache_sync_threshold: Optional[int] = None
919
- self._default_query_evaluation_mode: Optional[str] = None
920
-
921
- def iteration_cache_sync_threshold(
922
- self, threshold: int
923
- ) -> "SchemaCachingRDFSInferencerConfig.Builder":
924
- """
925
- Sets the iteration cache sync threshold for the SchemaCachingRDFSInferencer configuration.
926
-
927
- Args:
928
- threshold (int): The iteration cache sync threshold for the SchemaCachingRDFSInferencer configuration.
929
-
930
- Returns:
931
- SchemaCachingRDFSInferencerConfig.Builder: The builder instance.
932
- """
933
- self._iteration_cache_sync_threshold = threshold
934
- return self
935
-
936
- def default_query_evaluation_mode(
937
- self, mode: str
938
- ) -> "SchemaCachingRDFSInferencerConfig.Builder":
939
- """
940
- Sets the default query evaluation mode for the SchemaCachingRDFSInferencer configuration.
941
-
942
- Args:
943
- mode (str): The default query evaluation mode for the SchemaCachingRDFSInferencer configuration.
944
-
945
- Returns:
946
- SchemaCachingRDFSInferencerConfig.Builder: The builder instance.
947
- """
948
- self._default_query_evaluation_mode = mode
949
- return self
950
-
951
- def build(self) -> "SchemaCachingRDFSInferencerConfig":
952
- """
953
- Builds and returns the SchemaCachingRDFSInferencerConfig instance.
954
-
955
- Returns:
956
- SchemaCachingRDFSInferencerConfig: The constructed SchemaCachingRDFSInferencerConfig instance.
957
- """
958
- return SchemaCachingRDFSInferencerConfig(
959
- delegate=self._delegate,
960
- iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
961
- default_query_evaluation_mode=self._default_query_evaluation_mode,
962
- )
431
+ return super().add_to_graph(graph)
963
432
 
964
433
 
965
434
  class DirectTypeHierarchyInferencerConfig(SailConfig):
966
435
  """
967
- Configuration for the Direct Type inferencer using .
436
+ Configuration for the Direct Type inferencer using type hierarchy inference.
968
437
  """
969
438
 
970
439
  TYPE = "openrdf:DirectTypeHierarchyInferencer"
@@ -1000,70 +469,12 @@ class DirectTypeHierarchyInferencerConfig(SailConfig):
1000
469
  Returns:
1001
470
  URIRef: The URIRef of the added configuration.
1002
471
  """
1003
- sail_node = super().add_to_graph(graph)
1004
- delegate_node = self.config_params["delegate"].to_rdf(graph)
1005
- graph.add((sail_node, CONFIG["delegate"], delegate_node))
1006
- return sail_node
1007
-
1008
- class Builder:
1009
- def __init__(self, delegate: "SailConfig"):
1010
- """
1011
- Initializes a new DirectTypeHierarchyInferencerConfig.Builder.
1012
-
1013
- Args:
1014
- delegate (SailConfig): The delegate configuration for the DirectTypeHierarchyInferencer.
1015
- """
1016
- self._delegate = delegate
1017
- self._iteration_cache_sync_threshold: Optional[int] = None
1018
- self._default_query_evaluation_mode: Optional[str] = None
1019
-
1020
- def iteration_cache_sync_threshold(
1021
- self, threshold: int
1022
- ) -> "DirectTypeHierarchyInferencerConfig.Builder":
1023
- """
1024
- Sets the iteration cache sync threshold for the DirectTypeHierarchyInferencer configuration.
1025
-
1026
- Args:
1027
- threshold (int): The iteration cache sync threshold for the DirectTypeHierarchyInferencer configuration.
1028
-
1029
- Returns:
1030
- DirectTypeHierarchyInferencerConfig.Builder: The builder instance.
1031
- """
1032
- self._iteration_cache_sync_threshold = threshold
1033
- return self
1034
-
1035
- def default_query_evaluation_mode(
1036
- self, mode: str
1037
- ) -> "DirectTypeHierarchyInferencerConfig.Builder":
1038
- """
1039
- Sets the default query evaluation mode for the DirectTypeHierarchyInferencer configuration.
1040
-
1041
- Args:
1042
- mode (str): The default query evaluation mode for the DirectTypeHierarchyInferencer configuration.
1043
-
1044
- Returns:
1045
- DirectTypeHierarchyInferencerConfig.Builder: The builder instance.
1046
- """
1047
- self._default_query_evaluation_mode = mode
1048
- return self
1049
-
1050
- def build(self) -> "DirectTypeHierarchyInferencerConfig":
1051
- """
1052
- Builds and returns the DirectTypeHierarchyInferencerConfig instance.
1053
-
1054
- Returns:
1055
- DirectTypeHierarchyInferencerConfig: The constructed DirectTypeHierarchyInferencerConfig instance.
1056
- """
1057
- return DirectTypeHierarchyInferencerConfig(
1058
- delegate=self._delegate,
1059
- iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
1060
- default_query_evaluation_mode=self._default_query_evaluation_mode,
1061
- )
472
+ return super().add_to_graph(graph)
1062
473
 
1063
474
 
1064
475
  class SHACLSailConfig(SailConfig):
1065
476
  """
1066
- Configuration for the SHACL Sail using .
477
+ Configuration for the SHACL Sail using SHACL constraint validation.
1067
478
  """
1068
479
 
1069
480
  TYPE = "rdf4j:ShaclSail"
@@ -1173,328 +584,4 @@ class SHACLSailConfig(SailConfig):
1173
584
  Returns:
1174
585
  URIRef: The URIRef of the added configuration.
1175
586
  """
1176
- sail_node = super().add_to_graph(graph) # Get the basic node
1177
- delegate_node = self.config_params["delegate"].to_rdf(graph)
1178
- graph.add((sail_node, CONFIG.delegate, delegate_node))
1179
-
1180
- # Add SHACL-specific parameters
1181
- for key, value in self.config_params.items():
1182
- if key != "delegate": # Delegate is already handled
1183
- if isinstance(value, bool):
1184
- graph.add(
1185
- Quad(
1186
- sail_node,
1187
- CONFIG[key],
1188
- Literal(str(value).lower(), datatype=XSD["boolean"]),
1189
- None,
1190
- )
1191
- )
1192
- elif isinstance(value, int) and not isinstance(value, bool):
1193
- graph.add(
1194
- Quad(
1195
- sail_node,
1196
- CONFIG[key],
1197
- Literal(str(value), datatype=XSD["integer"]),
1198
- None,
1199
- )
1200
- )
1201
- else:
1202
- graph.add(
1203
- Quad(
1204
- sail_node,
1205
- CONFIG[key],
1206
- Literal(value),
1207
- None,
1208
- )
1209
- )
1210
- return sail_node
1211
-
1212
- class Builder:
1213
- def __init__(self, delegate: "SailConfig"):
1214
- """
1215
- Initializes a new SHACLSailConfig.Builder.
1216
-
1217
- Args:
1218
- delegate (SailConfig): The delegate configuration for the SHACL Sail.
1219
- """
1220
- self._delegate = delegate
1221
- self._parallel_validation: Optional[bool] = None
1222
- self._undefined_target_validates_all_subjects: Optional[bool] = None
1223
- self._log_validation_plans: Optional[bool] = None
1224
- self._log_validation_violations: Optional[bool] = None
1225
- self._ignore_no_shapes_loaded_exception: Optional[bool] = None
1226
- self._validation_enabled: Optional[bool] = None
1227
- self._cache_select_nodes: Optional[bool] = None
1228
- self._global_log_validation_execution: Optional[bool] = None
1229
- self._rdfs_sub_class_reasoning: Optional[bool] = None
1230
- self._performance_logging: Optional[bool] = None
1231
- self._serializable_validation: Optional[bool] = None
1232
- self._eclipse_rdf4j_shacl_extensions: Optional[bool] = None
1233
- self._dash_data_shapes: Optional[bool] = None
1234
- self._validation_results_limit_total: Optional[int] = None
1235
- self._validation_results_limit_per_constraint: Optional[int] = None
1236
- self._iteration_cache_sync_threshold: Optional[int] = None
1237
- self._default_query_evaluation_mode: Optional[str] = None
1238
-
1239
- def parallel_validation(self, value: bool) -> "SHACLSailConfig.Builder":
1240
- """
1241
- Sets the parallel validation flag for the SHACL Sail configuration.
1242
-
1243
- Args:
1244
- value (bool): The parallel validation flag for the SHACL Sail configuration.
1245
-
1246
- Returns:
1247
- SHACLSailConfig.Builder: The builder instance.
1248
- """
1249
- self._parallel_validation = value
1250
- return self
1251
-
1252
- def undefined_target_validates_all_subjects(
1253
- self, value: bool
1254
- ) -> "SHACLSailConfig.Builder":
1255
- """
1256
- Sets the undefined target validates all subjects flag for the SHACL Sail configuration.
1257
-
1258
- Args:
1259
- value (bool): The undefined target validates all subjects flag for the SHACL Sail configuration.
1260
-
1261
- Returns:
1262
- SHACLSailConfig.Builder: The builder instance.
1263
- """
1264
- self._undefined_target_validates_all_subjects = value
1265
- return self
1266
-
1267
- def log_validation_plans(self, value: bool) -> "SHACLSailConfig.Builder":
1268
- """
1269
- Sets the log validation plans flag for the SHACL Sail configuration.
1270
-
1271
- Args:
1272
- value (bool): The log validation plans flag for the SHACL Sail configuration.
1273
-
1274
- Returns:
1275
- SHACLSailConfig.Builder: The builder instance.
1276
- """
1277
- self._log_validation_plans = value
1278
- return self
1279
-
1280
- def log_validation_violations(self, value: bool) -> "SHACLSailConfig.Builder":
1281
- """
1282
- Sets the log validation violations flag for the SHACL Sail configuration.
1283
-
1284
- Args:
1285
- value (bool): The log validation violations flag for the SHACL Sail configuration.
1286
-
1287
- Returns:
1288
- SHACLSailConfig.Builder: The builder instance.
1289
- """
1290
- self._log_validation_violations = value
1291
- return self
1292
-
1293
- def ignore_no_shapes_loaded_exception(
1294
- self, value: bool
1295
- ) -> "SHACLSailConfig.Builder":
1296
- """
1297
- Sets the ignore no shapes loaded exception flag for the SHACL Sail configuration.
1298
-
1299
- Args:
1300
- value (bool): The ignore no shapes loaded exception flag for the SHACL Sail configuration.
1301
-
1302
- Returns:
1303
- SHACLSailConfig.Builder: The builder instance.
1304
- """
1305
- self._ignore_no_shapes_loaded_exception = value
1306
- return self
1307
-
1308
- def validation_enabled(self, value: bool) -> "SHACLSailConfig.Builder":
1309
- """
1310
- Sets the validation enabled flag for the SHACL Sail configuration.
1311
-
1312
- Args:
1313
- value (bool): The validation enabled flag for the SHACL Sail configuration.
1314
-
1315
- Returns:
1316
- SHACLSailConfig.Builder: The builder instance.
1317
- """
1318
- self._validation_enabled = value
1319
- return self
1320
-
1321
- def cache_select_nodes(self, value: bool) -> "SHACLSailConfig.Builder":
1322
- """
1323
- Sets the cache select nodes flag for the SHACL Sail configuration.
1324
-
1325
- Args:
1326
- value (bool): The cache select nodes flag for the SHACL Sail configuration.
1327
-
1328
- Returns:
1329
- SHACLSailConfig.Builder: The builder instance.
1330
- """
1331
- self._cache_select_nodes = value
1332
- return self
1333
-
1334
- def global_log_validation_execution(
1335
- self, value: bool
1336
- ) -> "SHACLSailConfig.Builder":
1337
- """
1338
- Sets the global log validation execution flag for the SHACL Sail configuration.
1339
-
1340
- Args:
1341
- value (bool): The global log validation execution flag for the SHACL Sail configuration.
1342
-
1343
- Returns:
1344
- SHACLSailConfig.Builder: The builder instance.
1345
- """
1346
- self._global_log_validation_execution = value
1347
- return self
1348
-
1349
- def rdfs_sub_class_reasoning(self, value: bool) -> "SHACLSailConfig.Builder":
1350
- """
1351
- Sets the RDFS sub-class reasoning flag for the SHACL Sail configuration.
1352
-
1353
- Args:
1354
- value (bool): The RDFS sub-class reasoning flag for the SHACL Sail configuration.
1355
-
1356
- Returns:
1357
- SHACLSailConfig.Builder: The builder instance.
1358
- """
1359
- self._rdfs_sub_class_reasoning = value
1360
- return self
1361
-
1362
- def performance_logging(self, value: bool) -> "SHACLSailConfig.Builder":
1363
- """
1364
- Sets the performance logging flag for the SHACL Sail configuration.
1365
-
1366
- Args:
1367
- value (bool): The performance logging flag for the SHACL Sail configuration.
1368
-
1369
- Returns:
1370
- SHACLSailConfig.Builder: The builder instance.
1371
- """
1372
- self._performance_logging = value
1373
- return self
1374
-
1375
- def serializable_validation(self, value: bool) -> "SHACLSailConfig.Builder":
1376
- """
1377
- Sets the serializable validation flag for the SHACL Sail configuration.
1378
-
1379
- Args:
1380
- value (bool): The serializable validation flag for the SHACL Sail configuration.
1381
-
1382
- Returns:
1383
- SHACLSailConfig.Builder: The builder instance.
1384
- """
1385
- self._serializable_validation = value
1386
- return self
1387
-
1388
- def eclipse_rdf4j_shacl_extensions(
1389
- self, value: bool
1390
- ) -> "SHACLSailConfig.Builder":
1391
- """
1392
- Sets the Eclipse RDF4J SHACL extensions flag for the SHACL Sail configuration.
1393
-
1394
- Args:
1395
- value (bool): The Eclipse RDF4J SHACL extensions flag for the SHACL Sail configuration.
1396
-
1397
- Returns:
1398
- SHACLSailConfig.Builder: The builder instance.
1399
- """
1400
- self._eclipse_rdf4j_shacl_extensions = value
1401
- return self
1402
-
1403
- def dash_data_shapes(self, value: bool) -> "SHACLSailConfig.Builder":
1404
- """
1405
- Sets the Dash Data Shapes flag for the SHACL Sail configuration.
1406
-
1407
- Args:
1408
- value (bool): The Dash Data Shapes flag for the SHACL Sail configuration.
1409
-
1410
- Returns:
1411
- SHACLSailConfig.Builder: The builder instance.
1412
- """
1413
- self._dash_data_shapes = value
1414
- return self
1415
-
1416
- def validation_results_limit_total(
1417
- self, value: int
1418
- ) -> "SHACLSailConfig.Builder":
1419
- """
1420
- Sets the validation results limit total flag for the SHACL Sail configuration.
1421
-
1422
- Args:
1423
- value (int): The validation results limit total flag for the SHACL Sail configuration.
1424
-
1425
- Returns:
1426
- SHACLSailConfig.Builder: The builder instance.
1427
- """
1428
- self._validation_results_limit_total = value
1429
- return self
1430
-
1431
- def validation_results_limit_per_constraint(
1432
- self, value: int
1433
- ) -> "SHACLSailConfig.Builder":
1434
- """
1435
- Sets the validation results limit per constraint flag for the SHACL Sail configuration.
1436
-
1437
- Args:
1438
- value (int): The validation results limit per constraint flag for the SHACL Sail configuration.
1439
-
1440
- Returns:
1441
- SHACLSailConfig.Builder: The builder instance.
1442
- """
1443
- self._validation_results_limit_per_constraint = value
1444
- return self
1445
-
1446
- def iteration_cache_sync_threshold(
1447
- self, threshold: int
1448
- ) -> "SHACLSailConfig.Builder":
1449
- """
1450
- Sets the iteration cache sync threshold flag for the SHACL Sail configuration.
1451
-
1452
- Args:
1453
- threshold (int): The iteration cache sync threshold flag for the SHACL Sail configuration.
1454
-
1455
- Returns:
1456
- SHACLSailConfig.Builder: The builder instance.
1457
- """
1458
- self._iteration_cache_sync_threshold = threshold
1459
- return self
1460
-
1461
- def default_query_evaluation_mode(self, mode: str) -> "SHACLSailConfig.Builder":
1462
- """
1463
- Sets the default query evaluation mode flag for the SHACL Sail configuration.
1464
-
1465
- Args:
1466
- mode (str): The default query evaluation mode flag for the SHACL Sail configuration.
1467
-
1468
- Returns:
1469
- SHACLSailConfig.Builder: The builder instance.
1470
- """
1471
- self._default_query_evaluation_mode = mode
1472
- return self
1473
-
1474
- def build(self) -> "SHACLSailConfig":
1475
- """
1476
- Builds the SHACLSailConfig.
1477
-
1478
- Returns:
1479
- SHACLSailConfig: The built SHACLSailConfig.
1480
- """
1481
- return SHACLSailConfig(
1482
- delegate=self._delegate,
1483
- parallel_validation=self._parallel_validation,
1484
- undefined_target_validates_all_subjects=self._undefined_target_validates_all_subjects,
1485
- log_validation_plans=self._log_validation_plans,
1486
- log_validation_violations=self._log_validation_violations,
1487
- ignore_no_shapes_loaded_exception=self._ignore_no_shapes_loaded_exception,
1488
- validation_enabled=self._validation_enabled,
1489
- cache_select_nodes=self._cache_select_nodes,
1490
- global_log_validation_execution=self._global_log_validation_execution,
1491
- rdfs_sub_class_reasoning=self._rdfs_sub_class_reasoning,
1492
- performance_logging=self._performance_logging,
1493
- serializable_validation=self._serializable_validation,
1494
- eclipse_rdf4j_shacl_extensions=self._eclipse_rdf4j_shacl_extensions,
1495
- dash_data_shapes=self._dash_data_shapes,
1496
- validation_results_limit_total=self._validation_results_limit_total,
1497
- validation_results_limit_per_constraint=self._validation_results_limit_per_constraint,
1498
- iteration_cache_sync_threshold=self._iteration_cache_sync_threshold,
1499
- default_query_evaluation_mode=self._default_query_evaluation_mode,
1500
- )
587
+ return super().add_to_graph(graph)