maplib 0.18.18__tar.gz → 0.19.5__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.18 → maplib-0.19.5}/Cargo.lock +1 -1
  2. {maplib-0.18.18 → maplib-0.19.5}/Cargo.toml +1 -1
  3. {maplib-0.18.18 → maplib-0.19.5}/PKG-INFO +2 -2
  4. {maplib-0.18.18 → maplib-0.19.5}/README.md +1 -1
  5. {maplib-0.18.18 → maplib-0.19.5}/lib/datalog/src/inference.rs +1 -2
  6. maplib-0.19.5/lib/datalog/src/python.rs +19 -0
  7. {maplib-0.18.18 → maplib-0.19.5}/lib/fts/src/lib.rs +2 -2
  8. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/lib.rs +0 -1
  9. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/model/constant_terms.rs +1 -1
  10. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/model/default.rs +3 -3
  11. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/model/expansion.rs +3 -2
  12. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/model.rs +40 -4
  13. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/cats.rs +45 -42
  14. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/errors.rs +2 -0
  15. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/expressions/functions.rs +1 -1
  16. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/expressions.rs +71 -15
  17. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/base_rdf_type.rs +2 -0
  18. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/cats/decode.rs +8 -15
  19. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/cats/encode.rs +35 -39
  20. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/cats/globalize.rs +16 -8
  21. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/cats/image.rs +10 -27
  22. maplib-0.19.5/lib/representation/src/cats/maps/in_memory.rs +185 -0
  23. maplib-0.19.5/lib/representation/src/cats/maps/on_disk.rs +70 -0
  24. maplib-0.19.5/lib/representation/src/cats/maps.rs +167 -0
  25. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/cats/re_encode.rs +12 -69
  26. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/cats.rs +37 -37
  27. {maplib-0.18.18/lib/templates → maplib-0.19.5/lib/representation}/src/constants.rs +3 -1
  28. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/dataset.rs +15 -1
  29. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/lib.rs +2 -0
  30. {maplib-0.18.18/lib/maplib → maplib-0.19.5/lib/representation}/src/prefixes.rs +6 -4
  31. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/python.rs +11 -3
  32. {maplib-0.18.18 → maplib-0.19.5}/lib/shacl/src/lib.rs +2 -1
  33. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/lib.rs +1 -1
  34. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/parser.rs +18 -24
  35. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/ast.rs +217 -40
  36. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/dataset.rs +63 -1
  37. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/lib.rs +0 -1
  38. maplib-0.19.5/lib/templates/src/python/owl.rs +413 -0
  39. maplib-0.19.5/lib/templates/src/python/rdf.rs +105 -0
  40. maplib-0.19.5/lib/templates/src/python/rdfs.rs +95 -0
  41. maplib-0.19.5/lib/templates/src/python/xsd.rs +219 -0
  42. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/python.rs +8 -103
  43. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/cats.rs +8 -2
  44. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/dblf.rs +2 -3
  45. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/lib.rs +192 -33
  46. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/query_solutions.rs +45 -0
  47. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/delete.rs +14 -3
  48. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/insert.rs +5 -2
  49. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_expressions.rs +1 -0
  50. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/extend.rs +1 -0
  51. maplib-0.19.5/lib/triplestore/src/sparql/lazy_graph_patterns/graph.rs +45 -0
  52. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/join.rs +1 -3
  53. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/path.rs +189 -213
  54. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/pvalues.rs +2 -1
  55. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/values.rs +2 -1
  56. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns.rs +15 -7
  57. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql.rs +3 -2
  58. maplib-0.19.5/lib/triplestore/src/storage/deduplication.rs +138 -0
  59. maplib-0.19.5/lib/triplestore/src/storage/so_index.rs +94 -0
  60. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/storage.rs +168 -187
  61. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/triples_read.rs +41 -16
  62. maplib-0.19.5/lib/triplestore/src/triples_write/pretty_turtle.rs +161 -0
  63. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/triples_write.rs +1 -0
  64. {maplib-0.18.18 → maplib-0.19.5}/maplib/__init__.py +9 -1
  65. {maplib-0.18.18 → maplib-0.19.5}/maplib/__init__.pyi +186 -71
  66. {maplib-0.18.18/py_maplib → maplib-0.19.5}/maplib/template_generator/generate.py +4 -5
  67. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/Cargo.toml +1 -1
  68. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/README.md +1 -1
  69. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/maplib/__init__.py +9 -1
  70. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/maplib/__init__.pyi +186 -71
  71. {maplib-0.18.18 → maplib-0.19.5/py_maplib}/maplib/template_generator/generate.py +4 -5
  72. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/src/lib.rs +66 -174
  73. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_basics.py +18 -13
  74. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_blank_nodes_multi.py +3 -3
  75. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_data_validation.py +29 -30
  76. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_integration.py +18 -0
  77. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_multi_expressions.py +14 -14
  78. maplib-0.19.5/py_maplib/tests/test_named_graphs.py +134 -0
  79. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_pizza_example.py +2 -2
  80. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_programmatic_pizza_example.py +19 -14
  81. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_stottr.py +3 -2
  82. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_validate_iris.py +1 -1
  83. maplib-0.18.18/lib/datalog/src/python.rs +0 -19
  84. {maplib-0.18.18 → maplib-0.19.5}/LICENSE +0 -0
  85. {maplib-0.18.18 → maplib-0.19.5}/lib/cimxml/Cargo.toml +0 -0
  86. {maplib-0.18.18 → maplib-0.19.5}/lib/cimxml/src/export.rs +0 -0
  87. {maplib-0.18.18 → maplib-0.19.5}/lib/cimxml/src/lib.rs +0 -0
  88. {maplib-0.18.18 → maplib-0.19.5}/lib/datalog/Cargo.toml +0 -0
  89. {maplib-0.18.18 → maplib-0.19.5}/lib/datalog/src/ast.rs +0 -0
  90. {maplib-0.18.18 → maplib-0.19.5}/lib/datalog/src/lib.rs +0 -0
  91. {maplib-0.18.18 → maplib-0.19.5}/lib/datalog/src/parser.rs +2 -2
  92. {maplib-0.18.18 → maplib-0.19.5}/lib/file_io/Cargo.toml +0 -0
  93. {maplib-0.18.18 → maplib-0.19.5}/lib/file_io/src/lib.rs +0 -0
  94. {maplib-0.18.18 → maplib-0.19.5}/lib/fts/Cargo.toml +0 -0
  95. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/Cargo.toml +0 -0
  96. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/errors.rs +0 -0
  97. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/model/errors.rs +0 -0
  98. {maplib-0.18.18 → maplib-0.19.5}/lib/maplib/src/model/expansion/validation.rs +0 -0
  99. {maplib-0.18.18 → maplib-0.19.5}/lib/pydf_io/Cargo.toml +0 -0
  100. {maplib-0.18.18 → maplib-0.19.5}/lib/pydf_io/LICENSE +0 -0
  101. {maplib-0.18.18 → maplib-0.19.5}/lib/pydf_io/README.md +0 -0
  102. {maplib-0.18.18 → maplib-0.19.5}/lib/pydf_io/licensing/POLARS_LICENSE +0 -0
  103. {maplib-0.18.18 → maplib-0.19.5}/lib/pydf_io/src/lib.rs +0 -0
  104. {maplib-0.18.18 → maplib-0.19.5}/lib/pydf_io/src/to_python.rs +0 -0
  105. {maplib-0.18.18 → maplib-0.19.5}/lib/pydf_io/src/to_rust.rs +0 -0
  106. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/Cargo.toml +0 -0
  107. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/LICENSE +0 -0
  108. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/README.md +0 -0
  109. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/aggregates.rs +0 -0
  110. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/constants.rs +0 -0
  111. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/exists_helper.rs +0 -0
  112. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/expressions/comparisons.rs +0 -0
  113. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/expressions/operations.rs +0 -0
  114. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/find_query_variables.rs +0 -0
  115. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/graph_patterns/cats.rs +0 -0
  116. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/graph_patterns/group.rs +0 -0
  117. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/graph_patterns/join.rs +0 -0
  118. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/graph_patterns/order.rs +0 -0
  119. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/graph_patterns/union.rs +0 -0
  120. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/graph_patterns/values.rs +0 -0
  121. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/graph_patterns.rs +0 -0
  122. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/lib.rs +0 -0
  123. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/pushdowns.rs +0 -0
  124. {maplib-0.18.18 → maplib-0.19.5}/lib/query_processing/src/type_constraints.rs +0 -0
  125. {maplib-0.18.18 → maplib-0.19.5}/lib/report_mapping/Cargo.toml +0 -0
  126. {maplib-0.18.18 → maplib-0.19.5}/lib/report_mapping/src/lib.rs +0 -0
  127. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/Cargo.toml +0 -0
  128. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/LICENSE +0 -0
  129. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/README.md +0 -0
  130. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/debug.rs +0 -0
  131. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/errors.rs +0 -0
  132. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/formatting.rs +0 -0
  133. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/literals.rs +0 -0
  134. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/multitype.rs +0 -0
  135. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/polars_to_rdf.rs +0 -0
  136. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/query_context.rs +0 -0
  137. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/rdf_state.rs +0 -0
  138. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/rdf_to_polars.rs +0 -0
  139. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/rdf_type.rs +0 -0
  140. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/solution_mapping.rs +0 -0
  141. {maplib-0.18.18 → maplib-0.19.5}/lib/representation/src/subtypes.rs +0 -0
  142. {maplib-0.18.18 → maplib-0.19.5}/lib/shacl/Cargo.toml +0 -0
  143. {maplib-0.18.18 → maplib-0.19.5}/lib/shacl/src/errors.rs +0 -0
  144. {maplib-0.18.18 → maplib-0.19.5}/lib/shacl/src/storage.rs +0 -0
  145. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/Cargo.toml +0 -0
  146. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/LICENSE +0 -0
  147. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/README.md +0 -0
  148. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/algebra.rs +0 -0
  149. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/query.rs +0 -0
  150. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/query_context.rs +0 -0
  151. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/remove_sugar.rs +0 -0
  152. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/term.rs +0 -0
  153. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/treehouse.rs +0 -0
  154. {maplib-0.18.18 → maplib-0.19.5}/lib/spargebra/src/update.rs +0 -0
  155. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/Cargo.toml +0 -0
  156. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/compatible.rs +0 -0
  157. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/dataset/errors.rs +0 -0
  158. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/document.rs +0 -0
  159. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/parsing.rs +0 -0
  160. {maplib-0.18.18 → maplib-0.19.5}/lib/templates/src/subtypes_ext.rs +0 -0
  161. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/Cargo.toml +0 -0
  162. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/errors.rs +0 -0
  163. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/io_funcs.rs +0 -0
  164. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/native_parquet_write.rs +0 -0
  165. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/rdfs_inferencing.rs +0 -0
  166. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/debug.rs +0 -0
  167. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/errors.rs +0 -0
  168. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_aggregate.rs +0 -0
  169. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/distinct.rs +0 -0
  170. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/filter.rs +0 -0
  171. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/group.rs +0 -0
  172. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/left_join.rs +0 -0
  173. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/minus.rs +0 -0
  174. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/order_by.rs +0 -0
  175. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/project.rs +0 -0
  176. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/triple.rs +0 -0
  177. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/triples_ordering.rs +0 -0
  178. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_graph_patterns/union.rs +0 -0
  179. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/lazy_order.rs +0 -0
  180. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/rewrite/rewrite_cse.rs +0 -0
  181. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/rewrite/rewrite_pushdown.rs +0 -0
  182. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/sparql/rewrite.rs +0 -0
  183. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/triples_write/fast_ntriples.rs +0 -0
  184. {maplib-0.18.18 → maplib-0.19.5}/lib/triplestore/src/triples_write/serializers.rs +0 -0
  185. {maplib-0.18.18 → maplib-0.19.5}/lib/utils/Cargo.toml +0 -0
  186. {maplib-0.18.18 → maplib-0.19.5}/lib/utils/src/lib.rs +0 -0
  187. {maplib-0.18.18 → maplib-0.19.5}/lib/utils/src/polars.rs +0 -0
  188. {maplib-0.18.18 → maplib-0.19.5}/maplib/adding_triples.py +0 -0
  189. {maplib-0.18.18 → maplib-0.19.5}/maplib/py.typed +0 -0
  190. {maplib-0.18.18 → maplib-0.19.5}/maplib/template_generator/__init__.py +0 -0
  191. {maplib-0.18.18 → maplib-0.19.5}/maplib/template_generator/ordering.py +0 -0
  192. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/LICENSE +0 -0
  193. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/maplib/.gitignore +0 -0
  194. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/maplib/adding_triples.py +0 -0
  195. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/maplib/py.typed +0 -0
  196. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/maplib/template_generator/__init__.py +0 -0
  197. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/maplib/template_generator/ordering.py +0 -0
  198. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/src/error.rs +0 -0
  199. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/src/shacl.rs +0 -0
  200. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/.gitignore +0 -0
  201. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/__init__.py +0 -0
  202. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/out.ttl +0 -0
  203. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/requirements.txt +0 -0
  204. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_exceptions.py +0 -0
  205. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_rdf_parser.py +0 -0
  206. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/test_read_write.py +0 -0
  207. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/expected_easy_case.ttl +0 -0
  208. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/iterated_property_path_constant_object_query.csv +0 -0
  209. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/iterated_property_path_constant_subject_query.csv +0 -0
  210. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/iterated_property_path_query.csv +0 -0
  211. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/iterated_property_path_query_with_bug.csv +0 -0
  212. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/larger_ordered_query.csv +0 -0
  213. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/larger_query.csv +0 -0
  214. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_concat.csv +0 -0
  215. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_join_query.csv +0 -0
  216. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_join_query_two_vars.csv +0 -0
  217. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_leftjoin_query.csv +0 -0
  218. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_query.csv +0 -0
  219. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_query_sorting.csv +0 -0
  220. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_union_query.csv +0 -0
  221. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_union_query_native_df.parquet +0 -0
  222. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_union_sort_desc1_query.csv +0 -0
  223. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_datatype_union_sort_query.csv +0 -0
  224. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/multi_many_comp.csv +0 -0
  225. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/property_path_query.csv +0 -0
  226. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/rdf_parser/date_panic.nt +0 -0
  227. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/read_ntriples.csv +0 -0
  228. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/read_ntriples.nt +0 -0
  229. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/read_ntriples2.csv +0 -0
  230. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/simple_construct_query_nothing.csv +0 -0
  231. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/simple_construct_query_something.csv +0 -0
  232. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/simple_insert_query_nothing.csv +0 -0
  233. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/simple_insert_query_something.csv +0 -0
  234. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/simple_property_path_query.csv +0 -0
  235. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/simple_query.csv +0 -0
  236. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/stringfuncs.csv +0 -0
  237. {maplib-0.18.18 → maplib-0.19.5}/py_maplib/tests/testdata/templates.ttl +0 -0
  238. {maplib-0.18.18 → maplib-0.19.5}/pyproject.toml +0 -0
@@ -2451,7 +2451,7 @@ dependencies = [
2451
2451
 
2452
2452
  [[package]]
2453
2453
  name = "py_maplib"
2454
- version = "0.18.18"
2454
+ version = "0.19.5"
2455
2455
  dependencies = [
2456
2456
  "chrono",
2457
2457
  "cimxml",
@@ -12,7 +12,7 @@ polars = { version = "0.52.0", features = ["simd", "nightly", "new_streaming", "
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.18
3
+ Version: 0.19.5
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,
@@ -11,8 +11,7 @@ pub enum DatalogError {
11
11
  }
12
12
 
13
13
  #[derive(Clone)]
14
- pub struct InferenceResult {
15
- }
14
+ pub struct InferenceResult {}
16
15
 
17
16
  pub fn infer(
18
17
  _triplestore: &mut Triplestore,
@@ -0,0 +1,19 @@
1
+ use crate::inference::InferenceResult;
2
+ use pyo3::{pyclass, pymethods, PyResult};
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
 
@@ -31,7 +31,7 @@ impl FtsIndex {
31
31
  unimplemented!("Contact Data Treehouse to enable full text search")
32
32
  }
33
33
 
34
- pub fn commit(&mut self, _drop_writer:bool) -> Result<(), FtsError> {
34
+ pub fn commit(&mut self, _drop_writer: bool) -> Result<(), FtsError> {
35
35
  unimplemented!("Contact Data Treehouse to enable full text search")
36
36
  }
37
37
 
@@ -3,4 +3,3 @@ extern crate chrono_tz;
3
3
 
4
4
  pub mod errors;
5
5
  pub mod model;
6
- mod prefixes;
@@ -8,13 +8,13 @@ use polars::prelude::{
8
8
  };
9
9
  use rayon::iter::ParallelIterator;
10
10
  use rayon::prelude::IntoParallelIterator;
11
+ use representation::constants::{OTTR_BLANK_NODE, OTTR_IRI};
11
12
  use representation::rdf_to_polars::{
12
13
  polars_literal_values_to_series, rdf_named_node_to_polars_literal_value,
13
14
  rdf_term_to_polars_expr,
14
15
  };
15
16
  use representation::BaseRDFNodeType;
16
17
  use std::ops::Deref;
17
- use templates::constants::{OTTR_BLANK_NODE, OTTR_IRI};
18
18
 
19
19
  const BLANK_NODE_SERIES_NAME: &str = "blank_node_series";
20
20
 
@@ -1,12 +1,12 @@
1
1
  use super::Model;
2
2
  use crate::model::errors::MappingError;
3
3
  use crate::model::MapOptions;
4
+ use representation::constants::{DEFAULT_PREFIX_IRI, OTTR_IRI, OTTR_TRIPLE};
4
5
  use std::collections::HashMap;
5
6
  use templates::ast::{
6
7
  Argument, ConstantTerm, ConstantTermOrList, Instance, ListExpanderType, PType, Parameter,
7
8
  Signature, StottrTerm, Template,
8
9
  };
9
- use templates::constants::{DEFAULT_PREFIX, OTTR_IRI, OTTR_TRIPLE};
10
10
  use tracing::warn;
11
11
 
12
12
  use crate::errors::MaplibError;
@@ -121,7 +121,7 @@ impl Model {
121
121
  list_expand: false,
122
122
  term: StottrTerm::ConstantTerm(ConstantTermOrList::ConstantTerm(
123
123
  ConstantTerm::Iri(
124
- NamedNode::new(format!("{DEFAULT_PREFIX}{c}"))
124
+ NamedNode::new(format!("{DEFAULT_PREFIX_IRI}{c}"))
125
125
  .map_err(MappingError::IriParseError)?,
126
126
  ),
127
127
  )),
@@ -137,7 +137,7 @@ impl Model {
137
137
 
138
138
  let template_name = format!(
139
139
  "{}default_template_{}",
140
- DEFAULT_PREFIX, &self.default_template_counter
140
+ DEFAULT_PREFIX_IRI, &self.default_template_counter
141
141
  );
142
142
  self.default_template_counter += 1;
143
143
  let template = Template {
@@ -12,6 +12,7 @@ use polars::prelude::{
12
12
  NamedFrom, Series,
13
13
  };
14
14
  use rayon::iter::{IndexedParallelIterator, ParallelDrainRange, ParallelIterator};
15
+ use representation::constants::OTTR_TRIPLE;
15
16
  use representation::dataset::NamedGraph;
16
17
  use representation::multitype::split_df_multicols;
17
18
  use representation::rdf_to_polars::rdf_named_node_to_polars_literal_value;
@@ -24,7 +25,6 @@ use std::time::Instant;
24
25
  use templates::ast::{
25
26
  ConstantTerm, ConstantTermOrList, Instance, ListExpanderType, PType, Signature, StottrTerm,
26
27
  };
27
- use templates::constants::OTTR_TRIPLE;
28
28
  use templates::MappingColumnType;
29
29
  use tracing::debug;
30
30
  use triplestore::TriplesToAdd;
@@ -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;
@@ -25,9 +25,9 @@ use triplestore::sparql::errors::SparqlError;
25
25
  use triplestore::sparql::{QueryResult, QuerySettings, UpdateResult};
26
26
  use triplestore::{IndexingOptions, NewTriples, Triplestore};
27
27
 
28
- use crate::prefixes::get_default_prefixes;
29
28
  use datalog::ast::DatalogRuleset;
30
29
  use representation::dataset::NamedGraph;
30
+ use representation::prefixes::get_default_prefixes;
31
31
  use tracing::instrument;
32
32
 
33
33
  pub struct Model {
@@ -79,7 +79,7 @@ impl Model {
79
79
  if let Some(indexing) = indexing {
80
80
  indexing
81
81
  } else {
82
- IndexingOptions::new(false, None, None)
82
+ IndexingOptions::default()
83
83
  }
84
84
  } else {
85
85
  indexing.unwrap_or_default()
@@ -184,7 +184,16 @@ impl Model {
184
184
  self.truncate_graph(&graph)
185
185
  }
186
186
  self.triplestore
187
- .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
+ )
188
197
  .map_err(MaplibError::TriplestoreError)
189
198
  }
190
199
 
@@ -217,7 +226,16 @@ impl Model {
217
226
  self.truncate_graph(&graph)
218
227
  }
219
228
  self.triplestore
220
- .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
+ )
221
239
  .map_err(MaplibError::TriplestoreError)
222
240
  }
223
241
 
@@ -369,6 +387,7 @@ impl Model {
369
387
  only_shapes: Option<Vec<NamedNode>>,
370
388
  deactivate_shapes: Vec<NamedNode>,
371
389
  dry_run: bool,
390
+ serial: bool,
372
391
  ) -> Result<ValidationReport, MaplibError> {
373
392
  let res = validate(
374
393
  &mut self.triplestore,
@@ -384,6 +403,7 @@ impl Model {
384
403
  deactivate_shapes,
385
404
  dry_run,
386
405
  Some(self.prefixes.clone()),
406
+ serial,
387
407
  );
388
408
  res.map_err(|x| x.into())
389
409
  }
@@ -465,4 +485,20 @@ impl Model {
465
485
  );
466
486
  Ok(res.map_err(|x| MaplibError::DatalogError(x))?)
467
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
+ }
468
504
  }
@@ -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
@@ -16,4 +16,6 @@ pub enum QueryProcessingError {
16
16
  BadNumberOfFunctionArguments(Function, usize, String),
17
17
  #[error("Maximum estimated rows `{}` in result exceeds configured maximum `{}`. You may have a cross join in your query, please double check. Alternatively, try setting the max_rows parameter to a higher value. Left columns: `{}` Right columns: `{}`", .0, .1, .2, .3)]
18
18
  MaxRowsReached(usize, usize, String, String),
19
+ #[error("The function `{}` is not implemented yet", .0)]
20
+ UnimplementedFunction(String),
19
21
  }
@@ -935,7 +935,7 @@ pub fn func_expression(
935
935
  .rdf_node_types
936
936
  .insert(outer_context.as_str().to_string(), t_new);
937
937
  } else {
938
- todo!("Function {nn} is not implemented yet")
938
+ return Err(QueryProcessingError::UnimplementedFunction(nn.to_string()));
939
939
  }
940
940
  }
941
941
  Function::StrBefore | Function::StrAfter => {
@@ -32,7 +32,8 @@ pub fn named_node_local_enc(nn: &NamedNode, global_cats: &Cats) -> (Expr, Option
32
32
  if let Some(enc) = global_cats.encode_iri_slice(&[nn.as_str()]).pop().unwrap() {
33
33
  (lit(enc).cast(DataType::UInt32), None)
34
34
  } else {
35
- let (enc, local) = Cats::new_singular_iri(nn.as_str(), global_cats.get_iri_counter());
35
+ // We do not store these local cats to disk
36
+ let (enc, local) = Cats::new_singular_iri(nn.as_str(), global_cats.get_iri_counter(), None);
36
37
  (lit(enc).cast(DataType::UInt32), Some(local))
37
38
  }
38
39
  }
@@ -46,12 +47,14 @@ pub fn blank_node_local_enc(bl: &BlankNode, global_cats: &Cats) -> (Expr, Option
46
47
  if let Some(enc) = global_cats.encode_blanks(&[bl.as_str()]).pop().unwrap() {
47
48
  (lit(enc).cast(DataType::UInt32), None)
48
49
  } else {
49
- let (enc, local) = Cats::new_singular_blank(bl.as_str(), global_cats.get_iri_counter());
50
+ // Local cats not stored to disk, hence None path
51
+ let (enc, local) =
52
+ Cats::new_singular_blank(bl.as_str(), global_cats.get_iri_counter(), None);
50
53
  (lit(enc).cast(DataType::UInt32), Some(local))
51
54
  }
52
55
  }
53
56
 
54
- pub fn maybe_literal_enc(l: &Literal, global_cats: &Cats) -> (Expr, BaseRDFNodeType, BaseCatState) {
57
+ pub fn literal_enc(l: &Literal, global_cats: &Cats) -> (Expr, BaseRDFNodeType, BaseCatState) {
55
58
  let bt = BaseRDFNodeType::Literal(l.datatype().into_owned());
56
59
  if literal_is_cat(l.datatype()) {
57
60
  if let Some(enc) = global_cats
@@ -67,7 +70,8 @@ pub fn maybe_literal_enc(l: &Literal, global_cats: &Cats) -> (Expr, BaseRDFNodeT
67
70
  } else {
68
71
  let dt = l.datatype().into_owned();
69
72
  let offset = global_cats.get_literal_counter(&dt);
70
- let (enc, local) = Cats::new_singular_literal(l.value(), dt, offset);
73
+ // Local cats are not stored to disk, hence None
74
+ let (enc, local) = Cats::new_singular_literal(l.value(), dt, offset, None);
71
75
  (
72
76
  lit(enc).cast(DataType::UInt32),
73
77
  bt,
@@ -106,7 +110,7 @@ pub fn literal(
106
110
  context: &Context,
107
111
  global_cats: &Cats,
108
112
  ) -> Result<SolutionMappings, QueryProcessingError> {
109
- let (e, bt, bs) = maybe_literal_enc(lit, global_cats);
113
+ let (e, bt, bs) = literal_enc(lit, global_cats);
110
114
  solution_mappings.mappings = solution_mappings
111
115
  .mappings
112
116
  .with_column(e.alias(context.as_str()));
@@ -361,23 +365,75 @@ pub fn if_expression(
361
365
  middle_context: &Context,
362
366
  right_context: &Context,
363
367
  outer_context: &Context,
368
+ global_cats: LockedCats,
364
369
  ) -> Result<SolutionMappings, QueryProcessingError> {
370
+ //
371
+ let mut exploded: Vec<_> = create_compatible_cats(
372
+ vec![
373
+ Some(col(middle_context.as_str())),
374
+ Some(col(right_context.as_str())),
375
+ ],
376
+ vec![
377
+ Some(
378
+ solution_mappings
379
+ .rdf_node_types
380
+ .get(middle_context.as_str())
381
+ .unwrap()
382
+ .clone(),
383
+ ),
384
+ Some(
385
+ solution_mappings
386
+ .rdf_node_types
387
+ .get(right_context.as_str())
388
+ .unwrap()
389
+ .clone(),
390
+ ),
391
+ ],
392
+ global_cats,
393
+ )
394
+ .into_iter()
395
+ .map(|x| x.unwrap())
396
+ .collect();
397
+ assert_eq!(exploded.len(), 2);
398
+
399
+ let right_exploded = exploded.pop().unwrap();
400
+ let mid_exploded = exploded.pop().unwrap();
401
+
402
+ let mut mid_exprs = vec![];
403
+ let mut right_exprs = vec![];
404
+
405
+ let mut base_type_map = HashMap::new();
406
+ for (t, (exprs, base_state)) in right_exploded {
407
+ base_type_map.insert(t, base_state);
408
+ right_exprs.extend(exprs);
409
+ }
410
+ for (_, (exprs, _)) in mid_exploded {
411
+ mid_exprs.extend(exprs);
412
+ }
413
+ let mid_expr = if mid_exprs.len() > 1 {
414
+ as_struct(mid_exprs)
415
+ } else {
416
+ mid_exprs.pop().unwrap()
417
+ };
418
+
419
+ let right_expr = if right_exprs.len() > 1 {
420
+ as_struct(right_exprs)
421
+ } else {
422
+ right_exprs.pop().unwrap()
423
+ };
424
+
365
425
  solution_mappings.mappings = solution_mappings.mappings.with_column(
366
426
  (Expr::Ternary {
367
427
  predicate: Arc::new(col(left_context.as_str())),
368
- truthy: Arc::new(col(middle_context.as_str())),
369
- falsy: Arc::new(col(right_context.as_str())),
428
+ truthy: Arc::new(mid_expr),
429
+ falsy: Arc::new(right_expr),
370
430
  })
371
431
  .alias(outer_context.as_str()),
372
432
  );
373
- //Todo: generalize..
374
- let existing_type = solution_mappings
375
- .rdf_node_types
376
- .get(middle_context.as_str())
377
- .unwrap();
378
- solution_mappings
379
- .rdf_node_types
380
- .insert(outer_context.as_str().to_string(), existing_type.clone());
433
+ solution_mappings.rdf_node_types.insert(
434
+ outer_context.as_str().to_string(),
435
+ RDFNodeState::from_map(base_type_map),
436
+ );
381
437
  solution_mappings = drop_inner_contexts(
382
438
  solution_mappings,
383
439
  &vec![left_context, middle_context, right_context],
@@ -212,9 +212,11 @@ fn literal_type(
212
212
  xsd::UNSIGNED_INT => DataType::UInt32,
213
213
  xsd::UNSIGNED_LONG => DataType::UInt64,
214
214
  xsd::UNSIGNED_SHORT => DataType::UInt16,
215
+ xsd::UNSIGNED_BYTE => DataType::UInt8,
215
216
  xsd::INTEGER | xsd::LONG => DataType::Int64,
216
217
  xsd::INT => DataType::Int32,
217
218
  xsd::SHORT => DataType::Int16,
219
+ xsd::BYTE => DataType::Int8,
218
220
  xsd::DOUBLE | xsd::DECIMAL => DataType::Float64,
219
221
  xsd::FLOAT => DataType::Float32,
220
222
  xsd::BOOLEAN => DataType::Boolean,
@@ -8,30 +8,20 @@ use polars::frame::column::ScalarColumn;
8
8
  use polars::frame::DataFrame;
9
9
  use polars::prelude::{col, Column, Expr, IntoColumn, IntoLazy, NamedFrom, SeriesSealed};
10
10
  use polars::series::Series;
11
- use rayon::iter::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterator};
11
+ use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
12
12
  use std::borrow::Cow;
13
13
 
14
14
  impl CatEncs {
15
- pub fn decode(&self, ser: &Series) -> Series {
15
+ pub fn decode_series(&self, ser: &Series) -> Series {
16
16
  let original_name = ser.name().clone();
17
17
  let uch: Vec<_> = ser.u32().unwrap().iter().collect();
18
- let decoded_vec_iter = uch
19
- .into_par_iter()
20
- .map(|x| x.map(|x| self.rev_map.get(&x).unwrap()));
21
-
22
- let decoded_vec: Vec<_> = decoded_vec_iter.map(|x| x.map(|x| x.as_str())).collect();
18
+ let decoded_vec = self.maps.decode_batch(uch.as_ref());
23
19
  let new_ser = Series::new(original_name, decoded_vec);
24
- //
25
- // let mut new_ser = if let CatType::Prefix(pre) = cat_type {
26
- // Series::from_iter(decoded_ser.map(|x| x.map(|x| format!("{}{}", pre.as_str(), x))))
27
- // } else {
28
- // Series::from_iter(decoded_ser.map(|x| x.map(|x| x.as_str())))
29
- // };
30
20
  new_ser
31
21
  }
32
22
 
33
23
  pub fn maybe_decode_string(&self, u: &u32) -> Option<&str> {
34
- self.rev_map.get(u).map(|x| x.as_str())
24
+ self.maps.maybe_decode(u)
35
25
  }
36
26
  }
37
27
 
@@ -68,7 +58,7 @@ impl Cats {
68
58
  pub fn decode_of_type(&self, ser: &Series, bt: &BaseRDFNodeType) -> Series {
69
59
  let ct = CatType::from_base_rdf_node_type(bt);
70
60
  if let Some(enc) = self.cat_map.get(&ct) {
71
- enc.decode(ser)
61
+ enc.decode_series(ser)
72
62
  } else {
73
63
  unreachable!("Should never be called when type does not exist")
74
64
  }
@@ -120,6 +110,9 @@ impl Cats {
120
110
  local_cats: Option<LockedCats>,
121
111
  ) -> Series {
122
112
  let local = local_cats.as_ref().map(|x| x.read().unwrap());
113
+ if ser.dtype() != &DataType::UInt32 {
114
+ panic!("Series should have datatype UInt32 {:?}", ser);
115
+ }
123
116
  let u32s = ser.u32().unwrap();
124
117
  let us: Vec<_> = u32s.iter().collect();
125
118