maplib 0.18.14__tar.gz → 0.19.3__tar.gz

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.
Files changed (238) hide show
  1. {maplib-0.18.14 → maplib-0.19.3}/Cargo.lock +2 -1
  2. {maplib-0.18.14 → maplib-0.19.3}/Cargo.toml +2 -2
  3. {maplib-0.18.14 → maplib-0.19.3}/PKG-INFO +2 -2
  4. {maplib-0.18.14 → maplib-0.19.3}/README.md +1 -1
  5. {maplib-0.18.14 → maplib-0.19.3}/lib/datalog/src/inference.rs +6 -4
  6. {maplib-0.18.14 → maplib-0.19.3}/lib/datalog/src/lib.rs +1 -0
  7. {maplib-0.18.14 → maplib-0.19.3}/lib/datalog/src/parser.rs +3 -0
  8. maplib-0.19.3/lib/datalog/src/python.rs +19 -0
  9. {maplib-0.18.14 → maplib-0.19.3}/lib/fts/src/lib.rs +1 -1
  10. {maplib-0.18.14 → maplib-0.19.3}/lib/maplib/src/errors.rs +1 -1
  11. {maplib-0.18.14 → maplib-0.19.3}/lib/maplib/src/lib.rs +2 -1
  12. {maplib-0.18.14/lib/maplib/src/mapping → maplib-0.19.3/lib/maplib/src/model}/constant_terms.rs +2 -2
  13. {maplib-0.18.14/lib/maplib/src/mapping → maplib-0.19.3/lib/maplib/src/model}/default.rs +3 -3
  14. {maplib-0.18.14/lib/maplib/src/mapping → maplib-0.19.3/lib/maplib/src/model}/errors.rs +1 -1
  15. {maplib-0.18.14/lib/maplib/src/mapping → maplib-0.19.3/lib/maplib/src/model}/expansion/validation.rs +1 -1
  16. {maplib-0.18.14/lib/maplib/src/mapping → maplib-0.19.3/lib/maplib/src/model}/expansion.rs +5 -4
  17. maplib-0.18.14/lib/maplib/src/mapping.rs → maplib-0.19.3/lib/maplib/src/model.rs +99 -20
  18. maplib-0.19.3/lib/maplib/src/prefixes.rs +22 -0
  19. {maplib-0.18.14 → maplib-0.19.3}/lib/pydf_io/src/to_python.rs +4 -1
  20. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/cats.rs +45 -42
  21. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/expressions.rs +51 -13
  22. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/pushdowns.rs +1 -1
  23. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/type_constraints.rs +2 -4
  24. {maplib-0.18.14 → maplib-0.19.3}/lib/report_mapping/src/lib.rs +1 -1
  25. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/cats/decode.rs +8 -15
  26. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/cats/encode.rs +37 -44
  27. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/cats/globalize.rs +16 -8
  28. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/cats/image.rs +10 -27
  29. maplib-0.19.3/lib/representation/src/cats/maps/in_memory.rs +185 -0
  30. maplib-0.19.3/lib/representation/src/cats/maps/on_disk.rs +70 -0
  31. maplib-0.19.3/lib/representation/src/cats/maps.rs +167 -0
  32. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/cats/re_encode.rs +42 -99
  33. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/cats.rs +46 -56
  34. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/dataset.rs +15 -1
  35. maplib-0.19.3/lib/representation/src/debug.rs +92 -0
  36. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/lib.rs +1 -0
  37. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/python.rs +22 -3
  38. {maplib-0.18.14 → maplib-0.19.3}/lib/shacl/src/lib.rs +3 -0
  39. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/README.md +1 -1
  40. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/lib.rs +1 -1
  41. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/parser.rs +44 -30
  42. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/query.rs +9 -4
  43. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/update.rs +9 -4
  44. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/dataset.rs +7 -3
  45. maplib-0.19.3/lib/templates/src/document.rs +23 -0
  46. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/parsing.rs +15 -20
  47. maplib-0.19.3/lib/templates/src/python/owl.rs +413 -0
  48. maplib-0.19.3/lib/templates/src/python/rdf.rs +105 -0
  49. maplib-0.19.3/lib/templates/src/python/rdfs.rs +95 -0
  50. maplib-0.19.3/lib/templates/src/python/xsd.rs +219 -0
  51. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/python.rs +7 -102
  52. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/cats.rs +8 -2
  53. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/dblf.rs +5 -4
  54. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/lib.rs +173 -25
  55. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/query_solutions.rs +60 -5
  56. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/rdfs_inferencing.rs +11 -2
  57. maplib-0.19.3/lib/triplestore/src/sparql/debug.rs +340 -0
  58. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/delete.rs +23 -12
  59. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/insert.rs +5 -2
  60. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_expressions.rs +1 -0
  61. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/extend.rs +1 -0
  62. maplib-0.19.3/lib/triplestore/src/sparql/lazy_graph_patterns/graph.rs +45 -0
  63. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/join.rs +5 -6
  64. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/path.rs +191 -215
  65. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/pvalues.rs +3 -2
  66. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/triple.rs +1 -3
  67. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/values.rs +2 -1
  68. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns.rs +17 -9
  69. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql.rs +112 -111
  70. maplib-0.19.3/lib/triplestore/src/storage/deduplication.rs +138 -0
  71. maplib-0.19.3/lib/triplestore/src/storage/so_index.rs +91 -0
  72. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/storage.rs +168 -188
  73. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/triples_read.rs +41 -16
  74. maplib-0.19.3/lib/triplestore/src/triples_write/pretty_turtle.rs +161 -0
  75. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/triples_write.rs +1 -0
  76. {maplib-0.18.14 → maplib-0.19.3}/maplib/__init__.py +11 -1
  77. {maplib-0.18.14 → maplib-0.19.3}/maplib/__init__.pyi +234 -74
  78. {maplib-0.18.14/py_maplib → maplib-0.19.3}/maplib/adding_triples.py +4 -4
  79. maplib-0.19.3/maplib/template_generator/__init__.py +1 -0
  80. maplib-0.19.3/maplib/template_generator/generate.py +234 -0
  81. maplib-0.19.3/maplib/template_generator/ordering.py +40 -0
  82. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/Cargo.toml +3 -2
  83. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/README.md +1 -1
  84. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/maplib/__init__.py +11 -1
  85. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/maplib/__init__.pyi +234 -74
  86. {maplib-0.18.14 → maplib-0.19.3/py_maplib}/maplib/adding_triples.py +4 -4
  87. maplib-0.19.3/py_maplib/maplib/template_generator/__init__.py +1 -0
  88. maplib-0.19.3/py_maplib/maplib/template_generator/generate.py +234 -0
  89. maplib-0.19.3/py_maplib/maplib/template_generator/ordering.py +40 -0
  90. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/src/lib.rs +218 -212
  91. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/src/shacl.rs +4 -2
  92. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_basics.py +11 -9
  93. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_blank_nodes_multi.py +3 -3
  94. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_data_validation.py +29 -30
  95. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_integration.py +105 -0
  96. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_multi_expressions.py +14 -14
  97. maplib-0.19.3/py_maplib/tests/test_named_graphs.py +134 -0
  98. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_pizza_example.py +2 -2
  99. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_programmatic_pizza_example.py +4 -4
  100. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_stottr.py +32 -3
  101. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_validate_iris.py +1 -1
  102. maplib-0.19.3/py_maplib/tests/testdata/templates.ttl +10 -0
  103. maplib-0.18.14/lib/templates/src/document.rs +0 -15
  104. {maplib-0.18.14 → maplib-0.19.3}/LICENSE +0 -0
  105. {maplib-0.18.14 → maplib-0.19.3}/lib/cimxml/Cargo.toml +0 -0
  106. {maplib-0.18.14 → maplib-0.19.3}/lib/cimxml/src/export.rs +0 -0
  107. {maplib-0.18.14 → maplib-0.19.3}/lib/cimxml/src/lib.rs +0 -0
  108. {maplib-0.18.14 → maplib-0.19.3}/lib/datalog/Cargo.toml +0 -0
  109. {maplib-0.18.14 → maplib-0.19.3}/lib/datalog/src/ast.rs +0 -0
  110. {maplib-0.18.14 → maplib-0.19.3}/lib/file_io/Cargo.toml +0 -0
  111. {maplib-0.18.14 → maplib-0.19.3}/lib/file_io/src/lib.rs +0 -0
  112. {maplib-0.18.14 → maplib-0.19.3}/lib/fts/Cargo.toml +0 -0
  113. {maplib-0.18.14 → maplib-0.19.3}/lib/maplib/Cargo.toml +0 -0
  114. {maplib-0.18.14 → maplib-0.19.3}/lib/pydf_io/Cargo.toml +0 -0
  115. {maplib-0.18.14 → maplib-0.19.3}/lib/pydf_io/LICENSE +0 -0
  116. {maplib-0.18.14 → maplib-0.19.3}/lib/pydf_io/README.md +0 -0
  117. {maplib-0.18.14 → maplib-0.19.3}/lib/pydf_io/licensing/POLARS_LICENSE +0 -0
  118. {maplib-0.18.14 → maplib-0.19.3}/lib/pydf_io/src/lib.rs +0 -0
  119. {maplib-0.18.14 → maplib-0.19.3}/lib/pydf_io/src/to_rust.rs +0 -0
  120. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/Cargo.toml +0 -0
  121. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/LICENSE +0 -0
  122. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/README.md +0 -0
  123. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/aggregates.rs +0 -0
  124. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/constants.rs +0 -0
  125. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/errors.rs +0 -0
  126. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/exists_helper.rs +0 -0
  127. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/expressions/comparisons.rs +0 -0
  128. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/expressions/functions.rs +0 -0
  129. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/expressions/operations.rs +0 -0
  130. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/find_query_variables.rs +0 -0
  131. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/cats.rs +0 -0
  132. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/group.rs +0 -0
  133. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/join.rs +0 -0
  134. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/order.rs +0 -0
  135. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/union.rs +0 -0
  136. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/values.rs +0 -0
  137. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/graph_patterns.rs +0 -0
  138. {maplib-0.18.14 → maplib-0.19.3}/lib/query_processing/src/lib.rs +0 -0
  139. {maplib-0.18.14 → maplib-0.19.3}/lib/report_mapping/Cargo.toml +0 -0
  140. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/Cargo.toml +0 -0
  141. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/LICENSE +0 -0
  142. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/README.md +0 -0
  143. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/base_rdf_type.rs +0 -0
  144. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/errors.rs +0 -0
  145. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/formatting.rs +0 -0
  146. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/literals.rs +0 -0
  147. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/multitype.rs +0 -0
  148. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/polars_to_rdf.rs +0 -0
  149. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/query_context.rs +0 -0
  150. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/rdf_state.rs +0 -0
  151. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/rdf_to_polars.rs +0 -0
  152. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/rdf_type.rs +0 -0
  153. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/solution_mapping.rs +0 -0
  154. {maplib-0.18.14 → maplib-0.19.3}/lib/representation/src/subtypes.rs +0 -0
  155. {maplib-0.18.14 → maplib-0.19.3}/lib/shacl/Cargo.toml +0 -0
  156. {maplib-0.18.14 → maplib-0.19.3}/lib/shacl/src/errors.rs +0 -0
  157. {maplib-0.18.14 → maplib-0.19.3}/lib/shacl/src/storage.rs +0 -0
  158. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/Cargo.toml +0 -0
  159. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/LICENSE +0 -0
  160. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/algebra.rs +0 -0
  161. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/query_context.rs +0 -0
  162. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/remove_sugar.rs +0 -0
  163. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/term.rs +0 -0
  164. {maplib-0.18.14 → maplib-0.19.3}/lib/spargebra/src/treehouse.rs +0 -0
  165. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/Cargo.toml +0 -0
  166. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/ast.rs +0 -0
  167. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/compatible.rs +0 -0
  168. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/constants.rs +0 -0
  169. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/dataset/errors.rs +0 -0
  170. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/lib.rs +0 -0
  171. {maplib-0.18.14 → maplib-0.19.3}/lib/templates/src/subtypes_ext.rs +0 -0
  172. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/Cargo.toml +0 -0
  173. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/errors.rs +0 -0
  174. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/io_funcs.rs +0 -0
  175. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/native_parquet_write.rs +0 -0
  176. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/errors.rs +0 -0
  177. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_aggregate.rs +0 -0
  178. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/distinct.rs +0 -0
  179. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/filter.rs +0 -0
  180. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/group.rs +0 -0
  181. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/left_join.rs +0 -0
  182. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/minus.rs +0 -0
  183. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/order_by.rs +0 -0
  184. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/project.rs +0 -0
  185. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/triples_ordering.rs +0 -0
  186. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/union.rs +0 -0
  187. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_order.rs +0 -0
  188. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/rewrite/rewrite_cse.rs +0 -0
  189. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/rewrite/rewrite_pushdown.rs +0 -0
  190. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/sparql/rewrite.rs +0 -0
  191. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/triples_write/fast_ntriples.rs +0 -0
  192. {maplib-0.18.14 → maplib-0.19.3}/lib/triplestore/src/triples_write/serializers.rs +0 -0
  193. {maplib-0.18.14 → maplib-0.19.3}/lib/utils/Cargo.toml +0 -0
  194. {maplib-0.18.14 → maplib-0.19.3}/lib/utils/src/lib.rs +0 -0
  195. {maplib-0.18.14 → maplib-0.19.3}/lib/utils/src/polars.rs +0 -0
  196. {maplib-0.18.14 → maplib-0.19.3}/maplib/py.typed +0 -0
  197. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/LICENSE +0 -0
  198. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/maplib/.gitignore +0 -0
  199. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/maplib/py.typed +0 -0
  200. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/src/error.rs +0 -0
  201. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/.gitignore +0 -0
  202. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/__init__.py +0 -0
  203. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/out.ttl +0 -0
  204. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/requirements.txt +0 -0
  205. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_exceptions.py +0 -0
  206. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_rdf_parser.py +0 -0
  207. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/test_read_write.py +0 -0
  208. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/expected_easy_case.ttl +0 -0
  209. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_constant_object_query.csv +0 -0
  210. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_constant_subject_query.csv +0 -0
  211. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_query.csv +0 -0
  212. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_query_with_bug.csv +0 -0
  213. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/larger_ordered_query.csv +0 -0
  214. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/larger_query.csv +0 -0
  215. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_concat.csv +0 -0
  216. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_join_query.csv +0 -0
  217. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_join_query_two_vars.csv +0 -0
  218. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_leftjoin_query.csv +0 -0
  219. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_query.csv +0 -0
  220. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_query_sorting.csv +0 -0
  221. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_query.csv +0 -0
  222. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_query_native_df.parquet +0 -0
  223. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_sort_desc1_query.csv +0 -0
  224. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_sort_query.csv +0 -0
  225. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/multi_many_comp.csv +0 -0
  226. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/property_path_query.csv +0 -0
  227. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/rdf_parser/date_panic.nt +0 -0
  228. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/read_ntriples.csv +0 -0
  229. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/read_ntriples.nt +0 -0
  230. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/read_ntriples2.csv +0 -0
  231. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/simple_construct_query_nothing.csv +0 -0
  232. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/simple_construct_query_something.csv +0 -0
  233. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/simple_insert_query_nothing.csv +0 -0
  234. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/simple_insert_query_something.csv +0 -0
  235. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/simple_property_path_query.csv +0 -0
  236. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/simple_query.csv +0 -0
  237. {maplib-0.18.14 → maplib-0.19.3}/py_maplib/tests/testdata/stringfuncs.csv +0 -0
  238. {maplib-0.18.14 → maplib-0.19.3}/pyproject.toml +0 -0
@@ -2451,10 +2451,11 @@ dependencies = [
2451
2451
 
2452
2452
  [[package]]
2453
2453
  name = "py_maplib"
2454
- version = "0.18.14"
2454
+ version = "0.19.3"
2455
2455
  dependencies = [
2456
2456
  "chrono",
2457
2457
  "cimxml",
2458
+ "datalog",
2458
2459
  "maplib",
2459
2460
  "mimalloc",
2460
2461
  "oxrdf",
@@ -8,11 +8,11 @@ rust-version = "1.88.0"
8
8
  [workspace.dependencies]
9
9
  pyo3 = {version = "0.25", features = ["py-clone"] }
10
10
  #Moment is there to work around a feature toggle bug
11
- polars = { version = "0.52.0", features = ["simd", "nightly", "new_streaming", "performant", "cse", "fmt", "parquet", "moment"] }
11
+ polars = { version = "0.52.0", features = ["simd", "nightly", "new_streaming", "performant", "cse", "fmt", "parquet", "moment", "timezones"] }
12
12
  polars-core = { version = "0.52.0" }
13
13
  rayon = "1.10.0"
14
14
  regex = "1.11.1"
15
- oxrdf = { version="0.2.4" }
15
+ oxrdf = { version = "0.2.4" }
16
16
  oxrdfio = { version = "0.1.7" }
17
17
  oxttl = { version="0.1.7" }
18
18
  oxiri = "0.2.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maplib
3
- Version: 0.18.14
3
+ Version: 0.19.3
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: License :: OSI Approved :: Apache Software License
6
6
  Classifier: Programming Language :: Python :: 3 :: Only
@@ -81,7 +81,7 @@ template = Template(
81
81
  Parameter(variable=ings_var, rdf_type=RDFType.Nested(RDFType.IRI()))
82
82
  ],
83
83
  instances= [
84
- Triple(p_var, a(), pi.suf("Pizza")),
84
+ Triple(p_var, a, pi.suf("Pizza")),
85
85
  Triple(p_var, pi.suf("fromCountry"), c_var),
86
86
  Triple(
87
87
  p_var,
@@ -55,7 +55,7 @@ template = Template(
55
55
  Parameter(variable=ings_var, rdf_type=RDFType.Nested(RDFType.IRI()))
56
56
  ],
57
57
  instances= [
58
- Triple(p_var, a(), pi.suf("Pizza")),
58
+ Triple(p_var, a, pi.suf("Pizza")),
59
59
  Triple(p_var, pi.suf("fromCountry"), c_var),
60
60
  Triple(
61
61
  p_var,
@@ -1,8 +1,5 @@
1
1
  use crate::ast::DatalogRuleset;
2
- use oxrdf::NamedNode;
3
2
  use representation::dataset::NamedGraph;
4
- use representation::solution_mapping::EagerSolutionMappings;
5
- use std::collections::HashMap;
6
3
  use thiserror::*;
7
4
  use triplestore::sparql::errors::SparqlError;
8
5
  use triplestore::Triplestore;
@@ -13,6 +10,10 @@ pub enum DatalogError {
13
10
  SparqlError(SparqlError),
14
11
  }
15
12
 
13
+ #[derive(Clone)]
14
+ pub struct InferenceResult {
15
+ }
16
+
16
17
  pub fn infer(
17
18
  _triplestore: &mut Triplestore,
18
19
  _graph: Option<&NamedGraph>,
@@ -21,6 +22,7 @@ pub fn infer(
21
22
  _max_results: Option<usize>,
22
23
  _include_transient: bool,
23
24
  _max_rows: Option<usize>,
24
- ) -> Result<Option<HashMap<NamedNode, EagerSolutionMappings>>, DatalogError> {
25
+ _debug_no_results: bool,
26
+ ) -> Result<InferenceResult, DatalogError> {
25
27
  unimplemented!("Contact data treehouse to try")
26
28
  }
@@ -1,3 +1,4 @@
1
1
  pub mod ast;
2
2
  pub mod inference;
3
3
  pub mod parser;
4
+ pub mod python;
@@ -1,9 +1,12 @@
1
+ use std::collections::HashMap;
2
+ use oxrdf::NamedNode;
1
3
  use crate::ast::DatalogRuleset;
2
4
  use thiserror::*;
3
5
 
4
6
  pub fn parse_datalog_ruleset(
5
7
  _datalog_ruleset: &str,
6
8
  _base_iri: Option<&str>,
9
+ _prefixes: Option<&HashMap<String, NamedNode>>,
7
10
  ) -> Result<DatalogRuleset, DatalogSyntaxError> {
8
11
  unimplemented!("Contact Data Treehouse to try")
9
12
  }
@@ -0,0 +1,19 @@
1
+ use pyo3::{pyclass, pymethods, PyResult};
2
+ use crate::inference::InferenceResult;
3
+
4
+ #[derive(Clone)]
5
+ #[pyclass(name = "InferenceResult")]
6
+ pub struct PyInferenceResult {
7
+ pub inner: InferenceResult,
8
+ }
9
+
10
+ #[pymethods]
11
+ impl PyInferenceResult {
12
+ fn __repr__(&self) -> PyResult<String> {
13
+ Ok("Contact Data Treehouse to try".to_string())
14
+ }
15
+
16
+ fn __str__(&self) -> PyResult<String> {
17
+ Ok("Contact Data Treehouse to try".to_string())
18
+ }
19
+ }
@@ -14,7 +14,7 @@ pub enum FtsError {}
14
14
  pub struct FtsIndex {}
15
15
 
16
16
  impl FtsIndex {
17
- pub fn new(_path: &Path, uuid:&str) -> Result<FtsIndex, FtsError> {
17
+ pub fn new(_path: &Path, _uuid:&str) -> Result<FtsIndex, FtsError> {
18
18
  unimplemented!("Contact Data Treehouse to enable full text search")
19
19
  }
20
20
 
@@ -1,4 +1,4 @@
1
- use crate::mapping::errors::MappingError;
1
+ use crate::model::errors::MappingError;
2
2
  use cimxml::export::CIMXMLError;
3
3
  use datalog::inference::DatalogError;
4
4
  use oxiri::IriParseError;
@@ -2,4 +2,5 @@ extern crate chrono;
2
2
  extern crate chrono_tz;
3
3
 
4
4
  pub mod errors;
5
- pub mod mapping;
5
+ pub mod model;
6
+ mod prefixes;
@@ -1,5 +1,5 @@
1
- use crate::mapping::errors::MappingError;
2
- use crate::mapping::{MappingColumnType, RDFNodeState};
1
+ use crate::model::errors::MappingError;
2
+ use crate::model::{MappingColumnType, RDFNodeState};
3
3
  use templates::ast::{ConstantTerm, ConstantTermOrList, PType};
4
4
 
5
5
  use oxrdf::{NamedNode, Term};
@@ -1,6 +1,6 @@
1
1
  use super::Model;
2
- use crate::mapping::errors::MappingError;
3
- use crate::mapping::MapOptions;
2
+ use crate::model::errors::MappingError;
3
+ use crate::model::MapOptions;
4
4
  use std::collections::HashMap;
5
5
  use templates::ast::{
6
6
  Argument, ConstantTerm, ConstantTermOrList, Instance, ListExpanderType, PType, Parameter,
@@ -10,7 +10,7 @@ use templates::constants::{DEFAULT_PREFIX, OTTR_IRI, OTTR_TRIPLE};
10
10
  use tracing::warn;
11
11
 
12
12
  use crate::errors::MaplibError;
13
- use crate::mapping::expansion::validation::infer_type_from_column;
13
+ use crate::model::expansion::validation::infer_type_from_column;
14
14
  use oxrdf::{NamedNode, Variable};
15
15
  use polars::prelude::{col, DataFrame, DataType, IntoLazy};
16
16
  use templates::MappingColumnType;
@@ -133,7 +133,7 @@ impl Display for MappingError {
133
133
  write!(f, "Template error: {x}")
134
134
  }
135
135
  MappingError::TriplestoreError(x) => {
136
- write!(f, "Error storing mapping results in triplestore: {x}")
136
+ write!(f, "Error storing model results in triplestore: {x}")
137
137
  }
138
138
  MappingError::IriParseError(x) => {
139
139
  write!(f, "IRI parse error: {x}")
@@ -1,4 +1,4 @@
1
- use crate::mapping::errors::MappingError;
1
+ use crate::model::errors::MappingError;
2
2
  use oxiri::Iri;
3
3
  use oxrdf::vocab::{rdfs, xsd};
4
4
  use oxrdf::NamedNode;
@@ -2,9 +2,9 @@ pub mod validation;
2
2
 
3
3
  use super::{MapOptions, Model, OTTRTripleInstance, StaticColumn};
4
4
  use crate::errors::MaplibError;
5
- use crate::mapping::constant_terms::{constant_blank_node_to_series, constant_to_expr};
6
- use crate::mapping::errors::MappingError;
7
- use crate::mapping::expansion::validation::validate;
5
+ use crate::model::constant_terms::{constant_blank_node_to_series, constant_to_expr};
6
+ use crate::model::errors::MappingError;
7
+ use crate::model::expansion::validation::validate;
8
8
  use oxrdf::vocab::rdf;
9
9
  use oxrdf::{NamedNode, Variable};
10
10
  use polars::prelude::{
@@ -302,6 +302,7 @@ impl Model {
302
302
  subject_type: subject_type,
303
303
  object_type: object_type,
304
304
  predicate: predicate.clone(),
305
+ graph: graph.clone(),
305
306
  subject_cat_state: subject_state,
306
307
  object_cat_state: object_state,
307
308
  predicate_cat_state: predicate_state,
@@ -310,7 +311,7 @@ impl Model {
310
311
  }
311
312
 
312
313
  self.triplestore
313
- .add_triples_vec(all_triples_to_add, false, graph)
314
+ .add_triples_vec(all_triples_to_add, false)
314
315
  .map_err(MappingError::TriplestoreError)?;
315
316
 
316
317
  self.blank_node_counter = new_blank_node_counter;
@@ -4,9 +4,9 @@ pub mod errors;
4
4
  pub mod expansion;
5
5
 
6
6
  use crate::errors::MaplibError;
7
- use crate::mapping::errors::MappingError;
7
+ use crate::model::errors::MappingError;
8
8
  use cimxml::export::{cim_xml_write, FullModelDetails};
9
- use datalog::inference::infer;
9
+ use datalog::inference::{infer, InferenceResult};
10
10
  use datalog::parser::parse_datalog_ruleset;
11
11
  use oxrdf::NamedNode;
12
12
  use oxrdfio::RdfFormat;
@@ -22,9 +22,10 @@ use templates::dataset::TemplateDataset;
22
22
  use templates::document::document_from_str;
23
23
  use templates::MappingColumnType;
24
24
  use triplestore::sparql::errors::SparqlError;
25
- use triplestore::sparql::{QueryResult, QuerySettings};
25
+ use triplestore::sparql::{QueryResult, QuerySettings, UpdateResult};
26
26
  use triplestore::{IndexingOptions, NewTriples, Triplestore};
27
27
 
28
+ use crate::prefixes::get_default_prefixes;
28
29
  use datalog::ast::DatalogRuleset;
29
30
  use representation::dataset::NamedGraph;
30
31
  use tracing::instrument;
@@ -35,6 +36,7 @@ pub struct Model {
35
36
  pub blank_node_counter: usize,
36
37
  pub default_template_counter: usize,
37
38
  pub indexing: IndexingOptions,
39
+ pub prefixes: HashMap<String, NamedNode>,
38
40
  }
39
41
 
40
42
  #[derive(Clone, Default)]
@@ -70,6 +72,7 @@ impl Model {
70
72
  template_dataset: Option<&TemplateDataset>,
71
73
  storage_folder: Option<String>,
72
74
  indexing: Option<IndexingOptions>,
75
+ prefixes: Option<HashMap<String, NamedNode>>,
73
76
  ) -> Result<Model, MaplibError> {
74
77
  let use_disk = storage_folder.is_some();
75
78
  let indexing = if use_disk {
@@ -86,6 +89,10 @@ impl Model {
86
89
  } else {
87
90
  TemplateDataset::new_empty()?
88
91
  };
92
+ let mut use_prefixes = get_default_prefixes();
93
+ if let Some(prefixes) = prefixes {
94
+ use_prefixes.extend(prefixes)
95
+ };
89
96
  Ok(Model {
90
97
  template_dataset,
91
98
  triplestore: Triplestore::new(storage_folder, Some(indexing.clone()))
@@ -93,6 +100,7 @@ impl Model {
93
100
  blank_node_counter: 0,
94
101
  default_template_counter: 0,
95
102
  indexing,
103
+ prefixes: use_prefixes,
96
104
  })
97
105
  }
98
106
 
@@ -101,34 +109,35 @@ impl Model {
101
109
  recursive: bool,
102
110
  storage_folder: Option<String>,
103
111
  ) -> Result<Model, MaplibError> {
104
- let dataset =
105
- TemplateDataset::from_folder(path, recursive).map_err(MaplibError::TemplateError)?;
106
- Model::new(Some(&dataset), storage_folder, None)
112
+ let dataset = TemplateDataset::from_folder(path, recursive, Some(&get_default_prefixes()))
113
+ .map_err(MaplibError::TemplateError)?;
114
+ Model::new(Some(&dataset), storage_folder, None, None)
107
115
  }
108
116
 
109
117
  pub fn from_file<P: AsRef<Path>>(
110
118
  path: P,
111
119
  storage_folder: Option<String>,
112
120
  ) -> Result<Model, MaplibError> {
113
- let dataset = TemplateDataset::from_file(path).map_err(MaplibError::TemplateError)?;
114
- Model::new(Some(&dataset), storage_folder, None)
121
+ let dataset = TemplateDataset::from_file(path, Some(&get_default_prefixes()))
122
+ .map_err(MaplibError::TemplateError)?;
123
+ Model::new(Some(&dataset), storage_folder, None, None)
115
124
  }
116
125
 
117
126
  pub fn from_str(s: &str, storage_folder: Option<String>) -> Result<Model, MaplibError> {
118
- let doc = document_from_str(s)?;
127
+ let doc = document_from_str(s, Some(&get_default_prefixes()))?;
119
128
  let dataset =
120
129
  TemplateDataset::from_documents(vec![doc]).map_err(MaplibError::TemplateError)?;
121
- Model::new(Some(&dataset), storage_folder, None)
130
+ Model::new(Some(&dataset), storage_folder, None, None)
122
131
  }
123
132
 
124
133
  pub fn from_strs(ss: Vec<&str>, storage_folder: Option<String>) -> Result<Model, MaplibError> {
125
134
  let mut docs = vec![];
126
135
  for s in ss {
127
- let doc = document_from_str(s)?;
136
+ let doc = document_from_str(s, Some(&get_default_prefixes()))?;
128
137
  docs.push(doc);
129
138
  }
130
139
  let dataset = TemplateDataset::from_documents(docs).map_err(MaplibError::TemplateError)?;
131
- Model::new(Some(&dataset), storage_folder, None)
140
+ Model::new(Some(&dataset), storage_folder, None, None)
132
141
  }
133
142
 
134
143
  pub fn add_template(&mut self, template: Template) -> Result<(), MaplibError> {
@@ -140,7 +149,7 @@ impl Model {
140
149
 
141
150
  #[instrument(skip_all)]
142
151
  pub fn add_templates_from_string(&mut self, s: &str) -> Result<Option<NamedNode>, MaplibError> {
143
- let doc = document_from_str(s).map_err(MaplibError::TemplateError)?;
152
+ let doc = document_from_str(s, Some(&self.prefixes)).map_err(MaplibError::TemplateError)?;
144
153
  let mut dataset =
145
154
  TemplateDataset::from_documents(vec![doc]).map_err(MaplibError::TemplateError)?;
146
155
  let return_template_iri = if !dataset.templates.is_empty() {
@@ -175,10 +184,32 @@ impl Model {
175
184
  self.truncate_graph(&graph)
176
185
  }
177
186
  self.triplestore
178
- .read_triples_from_path(p, rdf_format, base_iri, transient, parallel, checked, graph)
187
+ .read_triples_from_path(
188
+ p,
189
+ rdf_format,
190
+ base_iri,
191
+ transient,
192
+ parallel,
193
+ checked,
194
+ graph,
195
+ &self.prefixes,
196
+ )
179
197
  .map_err(MaplibError::TriplestoreError)
180
198
  }
181
199
 
200
+ #[allow(clippy::too_many_arguments)]
201
+ pub fn read_template(&mut self, p: &Path) -> Result<(), MaplibError> {
202
+ let mut dataset = TemplateDataset::from_file(p, Some(&self.prefixes))
203
+ .map_err(MaplibError::TemplateError)?;
204
+ self.template_dataset
205
+ .prefix_map
206
+ .extend(dataset.prefix_map.drain());
207
+ for t in dataset.templates {
208
+ self.add_template(t)?
209
+ }
210
+ Ok(())
211
+ }
212
+
182
213
  #[allow(clippy::too_many_arguments)]
183
214
  pub fn reads(
184
215
  &mut self,
@@ -195,7 +226,16 @@ impl Model {
195
226
  self.truncate_graph(&graph)
196
227
  }
197
228
  self.triplestore
198
- .read_triples_from_string(s, rdf_format, base_iri, transient, parallel, checked, graph)
229
+ .read_triples_from_string(
230
+ s,
231
+ rdf_format,
232
+ base_iri,
233
+ transient,
234
+ parallel,
235
+ checked,
236
+ graph,
237
+ &self.prefixes,
238
+ )
199
239
  .map_err(MaplibError::TriplestoreError)
200
240
  }
201
241
 
@@ -208,6 +248,7 @@ impl Model {
208
248
  streaming: bool,
209
249
  include_transient: bool,
210
250
  max_rows: Option<usize>,
251
+ debug_no_results: bool,
211
252
  ) -> Result<QueryResult, MaplibError> {
212
253
  let query_settings = QuerySettings {
213
254
  include_transient,
@@ -215,7 +256,15 @@ impl Model {
215
256
  strict_project: false,
216
257
  };
217
258
  self.triplestore
218
- .query(query, parameters, streaming, &query_settings, graph)
259
+ .query(
260
+ query,
261
+ parameters,
262
+ streaming,
263
+ &query_settings,
264
+ graph,
265
+ Some(&self.prefixes),
266
+ debug_no_results,
267
+ )
219
268
  .map_err(|x| x.into())
220
269
  }
221
270
 
@@ -227,14 +276,23 @@ impl Model {
227
276
  streaming: bool,
228
277
  include_transient: bool,
229
278
  max_rows: Option<usize>,
230
- ) -> Result<(), MaplibError> {
279
+ debug_no_results: bool,
280
+ ) -> Result<UpdateResult, MaplibError> {
231
281
  let query_settings = QuerySettings {
232
282
  include_transient,
233
283
  max_rows,
234
284
  strict_project: false,
235
285
  };
236
286
  self.triplestore
237
- .update(update, parameters, streaming, &query_settings, graph)
287
+ .update(
288
+ update,
289
+ parameters,
290
+ streaming,
291
+ &query_settings,
292
+ graph,
293
+ Some(&self.prefixes),
294
+ debug_no_results,
295
+ )
238
296
  .map_err(|x| x.into())
239
297
  }
240
298
 
@@ -329,6 +387,7 @@ impl Model {
329
387
  only_shapes: Option<Vec<NamedNode>>,
330
388
  deactivate_shapes: Vec<NamedNode>,
331
389
  dry_run: bool,
390
+ serial: bool,
332
391
  ) -> Result<ValidationReport, MaplibError> {
333
392
  let res = validate(
334
393
  &mut self.triplestore,
@@ -343,6 +402,8 @@ impl Model {
343
402
  only_shapes,
344
403
  deactivate_shapes,
345
404
  dry_run,
405
+ Some(self.prefixes.clone()),
406
+ serial,
346
407
  );
347
408
  res.map_err(|x| x.into())
348
409
  }
@@ -396,13 +457,14 @@ impl Model {
396
457
  graph: Option<&NamedGraph>,
397
458
  include_transient: bool,
398
459
  max_rows: Option<usize>,
399
- ) -> Result<Option<HashMap<NamedNode, EagerSolutionMappings>>, MaplibError> {
460
+ debug_no_results: bool,
461
+ ) -> Result<InferenceResult, MaplibError> {
400
462
  if rulesets.is_empty() {
401
463
  return Err(MaplibError::MissingDatalogRuleset);
402
464
  }
403
465
  let mut ruleset: Option<DatalogRuleset> = None;
404
466
  for r in rulesets {
405
- let new_ruleset = parse_datalog_ruleset(&r, None)
467
+ let new_ruleset = parse_datalog_ruleset(&r, None, Some(&self.prefixes))
406
468
  .map_err(|x| MaplibError::DatalogSyntaxError(x.to_string()))?;
407
469
  if let Some(orig_ruleset) = &mut ruleset {
408
470
  orig_ruleset.extend(new_ruleset);
@@ -419,7 +481,24 @@ impl Model {
419
481
  max_results,
420
482
  include_transient,
421
483
  max_rows,
484
+ debug_no_results,
422
485
  );
423
486
  Ok(res.map_err(|x| MaplibError::DatalogError(x))?)
424
487
  }
488
+
489
+ pub fn detach_graph(
490
+ &mut self,
491
+ graph: &NamedGraph,
492
+ preserve_name: bool,
493
+ ) -> Result<Model, MaplibError> {
494
+ let triplestore = self.triplestore.detach_graph(graph, preserve_name)?;
495
+ Ok(Model {
496
+ template_dataset: self.template_dataset.clone(),
497
+ triplestore,
498
+ blank_node_counter: self.blank_node_counter,
499
+ default_template_counter: self.default_template_counter,
500
+ indexing: self.indexing.clone(),
501
+ prefixes: self.prefixes.clone(),
502
+ })
503
+ }
425
504
  }
@@ -0,0 +1,22 @@
1
+ use oxrdf::NamedNode;
2
+ use std::collections::HashMap;
3
+ use templates::constants::{
4
+ OTTR_PREFIX, OTTR_PREFIX_IRI, OWL_PREFIX, OWL_PREFIX_IRI, RDFS_PREFIX, RDFS_PREFIX_IRI,
5
+ RDF_PREFIX, RDF_PREFIX_IRI, SHACL_PREFIX, SHACL_PREFIX_IRI, XSD_PREFIX, XSD_PREFIX_IRI,
6
+ };
7
+
8
+ pub fn get_default_prefixes() -> HashMap<String, NamedNode> {
9
+ let predefined = [
10
+ (RDFS_PREFIX, RDFS_PREFIX_IRI),
11
+ (RDF_PREFIX, RDF_PREFIX_IRI),
12
+ (XSD_PREFIX, XSD_PREFIX_IRI),
13
+ (OTTR_PREFIX, OTTR_PREFIX_IRI),
14
+ (OWL_PREFIX, OWL_PREFIX_IRI),
15
+ (SHACL_PREFIX, SHACL_PREFIX_IRI),
16
+ ];
17
+ HashMap::from_iter(
18
+ predefined
19
+ .into_iter()
20
+ .map(|(x, y)| (x.to_string(), NamedNode::new_unchecked(y))),
21
+ )
22
+ }
@@ -12,6 +12,7 @@ use pyo3::prelude::*;
12
12
  use pyo3::types::PyList;
13
13
  use pyo3::IntoPyObjectExt;
14
14
  use representation::cats::LockedCats;
15
+ use representation::debug::DebugOutputs;
15
16
  use representation::formatting::{format_columns, format_native_columns};
16
17
  use representation::multitype::compress_actual_multitypes;
17
18
  use representation::python::PySolutionMappings;
@@ -84,6 +85,7 @@ pub fn to_py_df(
84
85
  pub fn df_to_py_df(
85
86
  mut df: DataFrame,
86
87
  rdf_node_states: HashMap<String, RDFNodeState>,
88
+ debug_outputs: Option<DebugOutputs>,
87
89
  pushdown_paths: Option<Vec<Context>>,
88
90
  include_datatypes: bool,
89
91
  py: Python,
@@ -102,11 +104,12 @@ pub fn df_to_py_df(
102
104
  let pyarrow = PyModule::import(py, "pyarrow")?;
103
105
  let polars = PyModule::import(py, "polars")?;
104
106
  let py_df = to_py_df(&chunk, names.as_slice(), py, &pyarrow, &polars)?;
105
- if include_datatypes {
107
+ if include_datatypes || debug_outputs.is_some() {
106
108
  Py::new(
107
109
  py,
108
110
  PySolutionMappings {
109
111
  mappings: py_df.into_any(),
112
+ debug: debug_outputs,
110
113
  rdf_node_states,
111
114
  pushdown_paths,
112
115
  },
@@ -25,52 +25,55 @@ pub fn create_compatible_cats(
25
25
  let mut string_cast = HashSet::new();
26
26
 
27
27
  for t in base_types {
28
- let need_native_cat_cast = check_need_native_cat_cast(&t, &states);
29
- if need_native_cat_cast {
30
- let locals = find_all_locals(&t, &states);
31
- let mut cats = Cats::new_empty(Some(global_cats.read().unwrap().deref()));
32
- let renc_local = cats.merge(locals);
33
- let renc_local: HashMap<_, _> = renc_local
34
- .into_iter()
35
- .map(|(uu, map)| {
36
- let mut blank_renc = None;
37
- let mut iri_renc = vec![];
38
- let mut literal_renc_map = HashMap::new();
39
- for (p, renc) in map {
40
- match p {
41
- CatType::IRI => {
42
- iri_renc.push(renc);
43
- }
44
- CatType::Blank => {
45
- blank_renc = Some(renc);
46
- }
47
- CatType::Literal(l) => {
48
- literal_renc_map.insert(l, renc);
49
- }
50
- }
51
- }
52
- let iri_renc = if iri_renc.is_empty() {
53
- None
54
- } else {
55
- let mut renc_map =
56
- HashMap::with_capacity_and_hasher(2, BuildHasherDefault::default());
57
- for renc in iri_renc {
58
- renc_map.extend(renc.cat_map.iter().map(|(x, y)| (*x, *y)))
59
- }
60
- Some(CatReEnc {
61
- cat_map: Arc::new(renc_map),
62
- })
63
- };
64
- (uu, (blank_renc, iri_renc, literal_renc_map))
65
- })
66
- .collect();
67
- let state = BaseCatState::CategoricalNative(false, Some(LockedCats::new(cats)));
68
- native_cat_map.insert(t.clone(), (renc_local, state));
69
- }
70
28
  let need_string_cast = check_need_string_cast(&t, &states);
71
29
  if need_string_cast {
72
30
  string_cast.insert(t.clone());
73
31
  }
32
+ if !need_string_cast {
33
+ let need_native_cat_cast = check_need_native_cat_cast(&t, &states);
34
+ if need_native_cat_cast {
35
+ let locals = find_all_locals(&t, &states);
36
+ let mut cats = Cats::new_empty(Some(global_cats.read().unwrap().deref()));
37
+ // We do not store local cats to disk
38
+ let renc_local = cats.merge(locals, None);
39
+ let renc_local: HashMap<_, _> = renc_local
40
+ .into_iter()
41
+ .map(|(uu, map)| {
42
+ let mut blank_renc = None;
43
+ let mut iri_renc = vec![];
44
+ let mut literal_renc_map = HashMap::new();
45
+ for (p, renc) in map {
46
+ match p {
47
+ CatType::IRI => {
48
+ iri_renc.push(renc);
49
+ }
50
+ CatType::Blank => {
51
+ blank_renc = Some(renc);
52
+ }
53
+ CatType::Literal(l) => {
54
+ literal_renc_map.insert(l, renc);
55
+ }
56
+ }
57
+ }
58
+ let iri_renc = if iri_renc.is_empty() {
59
+ None
60
+ } else {
61
+ let mut renc_map =
62
+ HashMap::with_capacity_and_hasher(2, BuildHasherDefault::default());
63
+ for renc in iri_renc {
64
+ renc_map.extend(renc.cat_map.iter().map(|(x, y)| (*x, *y)))
65
+ }
66
+ Some(CatReEnc {
67
+ cat_map: Arc::new(renc_map),
68
+ })
69
+ };
70
+ (uu, (blank_renc, iri_renc, literal_renc_map))
71
+ })
72
+ .collect();
73
+ let state = BaseCatState::CategoricalNative(false, Some(LockedCats::new(cats)));
74
+ native_cat_map.insert(t.clone(), (renc_local, state));
75
+ }
76
+ }
74
77
  }
75
78
 
76
79
  let mut exploded: Vec<_> = expressions