sonagram 0.1.0__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 (355) hide show
  1. sonagram-0.1.0/KGLite/Cargo.toml +37 -0
  2. sonagram-0.1.0/KGLite/crates/kglite/Cargo.toml +144 -0
  3. sonagram-0.1.0/KGLite/crates/kglite/LICENSE +21 -0
  4. sonagram-0.1.0/KGLite/crates/kglite/README.md +179 -0
  5. sonagram-0.1.0/KGLite/crates/kglite/examples/embedded_basic.rs +65 -0
  6. sonagram-0.1.0/KGLite/crates/kglite/examples/embedded_session.rs +88 -0
  7. sonagram-0.1.0/KGLite/crates/kglite/src/bin/bz2_bench.rs +99 -0
  8. sonagram-0.1.0/KGLite/crates/kglite/src/bincode_wire_contract_tests.rs +105 -0
  9. sonagram-0.1.0/KGLite/crates/kglite/src/datatypes/mod.rs +9 -0
  10. sonagram-0.1.0/KGLite/crates/kglite/src/datatypes/values.rs +1619 -0
  11. sonagram-0.1.0/KGLite/crates/kglite/src/error.rs +688 -0
  12. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/centrality.rs +1030 -0
  13. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/clustering.rs +429 -0
  14. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/community.rs +1236 -0
  15. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/graph_algorithms.rs +1935 -0
  16. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/graph_algorithms_tests.rs +892 -0
  17. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/hnsw.rs +945 -0
  18. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/mod.rs +66 -0
  19. sonagram-0.1.0/KGLite/crates/kglite/src/graph/algorithms/vector.rs +992 -0
  20. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/build.rs +1615 -0
  21. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/compute/aggregate.rs +832 -0
  22. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/compute/calendar.rs +631 -0
  23. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/compute/chain.rs +344 -0
  24. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/compute/derive.rs +378 -0
  25. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/compute/filter.rs +274 -0
  26. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/compute/mod.rs +262 -0
  27. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/csv_loader.rs +525 -0
  28. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/expr.rs +1445 -0
  29. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/filter.rs +156 -0
  30. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/geometry.rs +139 -0
  31. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/json_records.rs +231 -0
  32. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/mod.rs +13 -0
  33. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/schema.rs +226 -0
  34. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/timeseries.rs +299 -0
  35. sonagram-0.1.0/KGLite/crates/kglite/src/graph/blueprint/validation.rs +491 -0
  36. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/calculations.rs +741 -0
  37. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/data_retrieval.rs +565 -0
  38. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/filtering.rs +1425 -0
  39. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/iterators.rs +691 -0
  40. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/mod.rs +15 -0
  41. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/pattern_matching/matcher.rs +2181 -0
  42. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/pattern_matching/mod.rs +22 -0
  43. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/pattern_matching/parser.rs +1026 -0
  44. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/pattern_matching/pattern.rs +517 -0
  45. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/statistics.rs +376 -0
  46. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/traversal.rs +1711 -0
  47. sonagram-0.1.0/KGLite/crates/kglite/src/graph/core/value_operations.rs +864 -0
  48. sonagram-0.1.0/KGLite/crates/kglite/src/graph/dir_graph/caches.rs +103 -0
  49. sonagram-0.1.0/KGLite/crates/kglite/src/graph/dir_graph/dir_graph_tests.rs +199 -0
  50. sonagram-0.1.0/KGLite/crates/kglite/src/graph/dir_graph/disk_persistence.rs +433 -0
  51. sonagram-0.1.0/KGLite/crates/kglite/src/graph/dir_graph/independent_copy.rs +84 -0
  52. sonagram-0.1.0/KGLite/crates/kglite/src/graph/dir_graph/mod.rs +2487 -0
  53. sonagram-0.1.0/KGLite/crates/kglite/src/graph/dir_graph/node_write.rs +117 -0
  54. sonagram-0.1.0/KGLite/crates/kglite/src/graph/dir_graph/schema_ops.rs +143 -0
  55. sonagram-0.1.0/KGLite/crates/kglite/src/graph/embedder/fastembed.rs +133 -0
  56. sonagram-0.1.0/KGLite/crates/kglite/src/graph/embedder/mod.rs +64 -0
  57. sonagram-0.1.0/KGLite/crates/kglite/src/graph/embedding_carry.rs +176 -0
  58. sonagram-0.1.0/KGLite/crates/kglite/src/graph/explore.rs +473 -0
  59. sonagram-0.1.0/KGLite/crates/kglite/src/graph/features/equations.rs +758 -0
  60. sonagram-0.1.0/KGLite/crates/kglite/src/graph/features/mod.rs +7 -0
  61. sonagram-0.1.0/KGLite/crates/kglite/src/graph/features/spatial.rs +768 -0
  62. sonagram-0.1.0/KGLite/crates/kglite/src/graph/features/temporal.rs +192 -0
  63. sonagram-0.1.0/KGLite/crates/kglite/src/graph/features/timeseries.rs +518 -0
  64. sonagram-0.1.0/KGLite/crates/kglite/src/graph/handle.rs +677 -0
  65. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/bug_report.rs +225 -0
  66. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/capabilities.rs +355 -0
  67. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/connectivity.rs +239 -0
  68. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/debugging.rs +201 -0
  69. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/describe.rs +2045 -0
  70. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/mod.rs +190 -0
  71. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/reporting.rs +175 -0
  72. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/schema_overview.rs +1032 -0
  73. sonagram-0.1.0/KGLite/crates/kglite/src/graph/introspection/topics.rs +1444 -0
  74. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/export.rs +1095 -0
  75. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/file/metadata_sidecars.rs +265 -0
  76. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/file/vector_persistence.rs +449 -0
  77. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/file.rs +2454 -0
  78. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/file_tests.rs +404 -0
  79. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/load_timing.rs +29 -0
  80. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/mod.rs +16 -0
  81. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/ntriples/column_builder.rs +1465 -0
  82. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/ntriples/label_spill.rs +393 -0
  83. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/ntriples/loader.rs +2342 -0
  84. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/ntriples/mod.rs +122 -0
  85. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/ntriples/parallel_bz2.rs +574 -0
  86. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/ntriples/parser.rs +485 -0
  87. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/ntriples/writer.rs +363 -0
  88. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/open.rs +368 -0
  89. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/rdf/curie.rs +150 -0
  90. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/rdf/fold.rs +260 -0
  91. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/rdf/interner.rs +62 -0
  92. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/rdf/loader.rs +725 -0
  93. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/rdf/mod.rs +24 -0
  94. sonagram-0.1.0/KGLite/crates/kglite/src/graph/io/unified_columns.rs +498 -0
  95. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/ast.rs +931 -0
  96. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/affected_tests.rs +190 -0
  97. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/aggregation/materialized.rs +1020 -0
  98. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/analysis_procedures.rs +26 -0
  99. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/budget.rs +131 -0
  100. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/call_clause.rs +1785 -0
  101. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/call_subquery.rs +443 -0
  102. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/centrality_procedures.rs +147 -0
  103. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/dead_code.rs +130 -0
  104. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/execution_support.rs +234 -0
  105. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/expression/evaluate.rs +763 -0
  106. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/expression.rs +678 -0
  107. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/helpers.rs +1117 -0
  108. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/match_clause/fused_match.rs +2254 -0
  109. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/match_clause.rs +1255 -0
  110. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/match_execution.rs +580 -0
  111. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/mod.rs +839 -0
  112. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/refresh_stats.rs +79 -0
  113. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/regex_cache.rs +187 -0
  114. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/return_clause.rs +901 -0
  115. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/rev_procedures.rs +213 -0
  116. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/rule_procedures.rs +1139 -0
  117. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/collection.rs +189 -0
  118. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/graph.rs +384 -0
  119. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/mod.rs +353 -0
  120. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/numeric.rs +210 -0
  121. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/shared.rs +107 -0
  122. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/spatial.rs +422 -0
  123. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/string.rs +421 -0
  124. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/temporal.rs +311 -0
  125. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/timeseries.rs +168 -0
  126. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/scalar_functions/utility.rs +321 -0
  127. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/schema_procedures.rs +119 -0
  128. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/shortest_path.rs +340 -0
  129. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/spatial_join.rs +147 -0
  130. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/stream/aggregate.rs +699 -0
  131. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/stream/heap_top_k.rs +206 -0
  132. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/stream/mod.rs +88 -0
  133. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/stream/pipeline.rs +174 -0
  134. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/tests.rs +2500 -0
  135. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/transient_index.rs +157 -0
  136. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/where_clause.rs +1413 -0
  137. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/executor/write.rs +2072 -0
  138. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/mod.rs +158 -0
  139. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/parse_cache.rs +177 -0
  140. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/parser/clauses.rs +954 -0
  141. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/parser/expression.rs +976 -0
  142. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/parser/match_pattern.rs +450 -0
  143. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/parser/mod.rs +530 -0
  144. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/parser/parser_tests.rs +813 -0
  145. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/parser/predicate.rs +152 -0
  146. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/plan_cache.rs +174 -0
  147. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/annotations.rs +309 -0
  148. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/cost_model.rs +142 -0
  149. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/fusion/aggregate.rs +1981 -0
  150. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/fusion/count.rs +501 -0
  151. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/fusion/mod.rs +21 -0
  152. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/fusion/spatial.rs +391 -0
  153. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/fusion/topk.rs +451 -0
  154. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/fusion_spatial_tests.rs +115 -0
  155. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/index_selection.rs +1014 -0
  156. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/join_order.rs +810 -0
  157. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/mod.rs +737 -0
  158. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/planner_tests.rs +1719 -0
  159. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/rel_predicate_pushdown.rs +561 -0
  160. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/schema_check.rs +1334 -0
  161. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/planner/simplification.rs +1675 -0
  162. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/result.rs +699 -0
  163. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/tokenizer.rs +925 -0
  164. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/value_codec.rs +644 -0
  165. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/cypher/window.rs +260 -0
  166. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/fluent/filtering.rs +4 -0
  167. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/fluent/mod.rs +11 -0
  168. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/fluent/schema_ops.rs +5 -0
  169. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/fluent/selection.rs +4 -0
  170. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/fluent/traversal.rs +5 -0
  171. sonagram-0.1.0/KGLite/crates/kglite/src/graph/languages/mod.rs +9 -0
  172. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mod.rs +85 -0
  173. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/batch.rs +953 -0
  174. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/extend.rs +476 -0
  175. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/maintain.rs +2468 -0
  176. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/mod.rs +16 -0
  177. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/set_ops.rs +138 -0
  178. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/subgraph.rs +195 -0
  179. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/subgraph_streaming.rs +1307 -0
  180. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/subgraph_streaming_writer.rs +1148 -0
  181. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/validation.rs +594 -0
  182. sonagram-0.1.0/KGLite/crates/kglite/src/graph/mutation/wal_replay.rs +506 -0
  183. sonagram-0.1.0/KGLite/crates/kglite/src/graph/schema.rs +2260 -0
  184. sonagram-0.1.0/KGLite/crates/kglite/src/graph/schema_tests.rs +703 -0
  185. sonagram-0.1.0/KGLite/crates/kglite/src/graph/session/execute.rs +754 -0
  186. sonagram-0.1.0/KGLite/crates/kglite/src/graph/session/mod.rs +88 -0
  187. sonagram-0.1.0/KGLite/crates/kglite/src/graph/session/transaction.rs +778 -0
  188. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/backend.rs +982 -0
  189. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/column_store.rs +2363 -0
  190. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/column_store_tests.rs +592 -0
  191. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/builder.rs +1285 -0
  192. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/csr.rs +145 -0
  193. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/csr_build.rs +340 -0
  194. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/edge_properties.rs +617 -0
  195. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/generation.rs +384 -0
  196. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/graph/bootstrap.rs +324 -0
  197. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/graph.rs +2290 -0
  198. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/graph_persist.rs +1723 -0
  199. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/graph_property_index.rs +325 -0
  200. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/graph_tests.rs +1435 -0
  201. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/id_index.rs +966 -0
  202. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/mod.rs +21 -0
  203. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/property_index.rs +1141 -0
  204. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/segment_summary.rs +447 -0
  205. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/disk/type_index.rs +705 -0
  206. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/impls.rs +1017 -0
  207. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/interner.rs +391 -0
  208. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/lookups.rs +241 -0
  209. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/mapped/column_store.rs +720 -0
  210. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/mapped/mmap_vec.rs +1518 -0
  211. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/mapped/mod.rs +9 -0
  212. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/mapped_graph_impl.rs +230 -0
  213. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/memory/mod.rs +9 -0
  214. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/memory/property_log.rs +472 -0
  215. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/memory_graph_impl.rs +61 -0
  216. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/mod.rs +765 -0
  217. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/mode.rs +120 -0
  218. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/overflow.rs +731 -0
  219. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/packed_codec.rs +63 -0
  220. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/recording.rs +1107 -0
  221. sonagram-0.1.0/KGLite/crates/kglite/src/graph/storage/type_build_meta.rs +161 -0
  222. sonagram-0.1.0/KGLite/crates/kglite/src/graph/wal.rs +880 -0
  223. sonagram-0.1.0/KGLite/crates/kglite/src/graphgen/mod.rs +647 -0
  224. sonagram-0.1.0/KGLite/crates/kglite/src/lib.rs +445 -0
  225. sonagram-0.1.0/KGLite/crates/kglite/src/okf/build.rs +675 -0
  226. sonagram-0.1.0/KGLite/crates/kglite/src/okf/frontmatter.rs +229 -0
  227. sonagram-0.1.0/KGLite/crates/kglite/src/okf/links.rs +316 -0
  228. sonagram-0.1.0/KGLite/crates/kglite/src/okf/mod.rs +356 -0
  229. sonagram-0.1.0/KGLite/crates/kglite/src/okf/model.rs +135 -0
  230. sonagram-0.1.0/KGLite/crates/kglite/src/okf/walk.rs +151 -0
  231. sonagram-0.1.0/KGLite/crates/kglite/src/param/mod.rs +248 -0
  232. sonagram-0.1.0/KGLite/crates/kglite/src/serde_codec/bincode_v1.rs +141 -0
  233. sonagram-0.1.0/KGLite/crates/kglite/src/serde_codec/mod.rs +268 -0
  234. sonagram-0.1.0/KGLite/crates/kglite/src/serde_codec/postcard_v1.rs +43 -0
  235. sonagram-0.1.0/KGLite/crates/kglite/src/serde_codec/tests.rs +242 -0
  236. sonagram-0.1.0/KGLite/crates/kglite/tests/fixtures/master.idx.sample +13 -0
  237. sonagram-0.1.0/KGLite/crates/kglite/tests/loom_session.rs +134 -0
  238. sonagram-0.1.0/LICENSE +21 -0
  239. sonagram-0.1.0/PKG-INFO +155 -0
  240. sonagram-0.1.0/README.md +128 -0
  241. sonagram-0.1.0/pyproject.toml +58 -0
  242. sonagram-0.1.0/python/sonagram/__init__.py +33 -0
  243. sonagram-0.1.0/python/sonagram/__init__.pyi +33 -0
  244. sonagram-0.1.0/python/sonagram/cli.py +32 -0
  245. sonagram-0.1.0/sonagram/Cargo.lock +2519 -0
  246. sonagram-0.1.0/sonagram/Cargo.toml +40 -0
  247. sonagram-0.1.0/sonagram/sonagram/Cargo.toml +30 -0
  248. sonagram-0.1.0/sonagram/sonagram/README.md +128 -0
  249. sonagram-0.1.0/sonagram/sonagram/src/bin/capture_fixtures.rs +145 -0
  250. sonagram-0.1.0/sonagram/sonagram/src/bin/sonagram.rs +12 -0
  251. sonagram-0.1.0/sonagram/sonagram/src/cli.rs +1251 -0
  252. sonagram-0.1.0/sonagram/sonagram/src/config.rs +289 -0
  253. sonagram-0.1.0/sonagram/sonagram/src/enrich/mod.rs +1065 -0
  254. sonagram-0.1.0/sonagram/sonagram/src/enrich/store.rs +391 -0
  255. sonagram-0.1.0/sonagram/sonagram/src/error.rs +53 -0
  256. sonagram-0.1.0/sonagram/sonagram/src/graph/derive.rs +1047 -0
  257. sonagram-0.1.0/sonagram/sonagram/src/graph/mod.rs +1196 -0
  258. sonagram-0.1.0/sonagram/sonagram/src/graph/normalize.rs +263 -0
  259. sonagram-0.1.0/sonagram/sonagram/src/lib.rs +56 -0
  260. sonagram-0.1.0/sonagram/sonagram/src/playlist.rs +1131 -0
  261. sonagram-0.1.0/sonagram/sonagram/src/record.rs +918 -0
  262. sonagram-0.1.0/sonagram/sonagram/src/scan/cache.rs +419 -0
  263. sonagram-0.1.0/sonagram/sonagram/src/scan/hash.rs +275 -0
  264. sonagram-0.1.0/sonagram/sonagram/src/scan/mod.rs +680 -0
  265. sonagram-0.1.0/sonagram/sonagram/src/skill.rs +228 -0
  266. sonagram-0.1.0/sonagram/sonagram/tests/cli_status.rs +126 -0
  267. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/01-intro-ft-king-rell.json +1096 -0
  268. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/01-toxic-armand-van-helden-remix-edit.json +14071 -0
  269. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/04-birthright.json +3808 -0
  270. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/04-marry-you.json +5091 -0
  271. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/05-estranged.json +10588 -0
  272. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/05-on-and-on-and-on.json +4901 -0
  273. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/08-2-unlimited-let-the-beat-control-your-body.json +9326 -0
  274. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/08-/350/226/224/350/226/207/343/201/250/351/233/250.json +3291 -0
  275. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/1-04-coast-ride.json +11560 -0
  276. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/10-jive-talkin.json +4799 -0
  277. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/10-just-like-a-woman.json +5742 -0
  278. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/14-full-of-fire.json +4656 -0
  279. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/14-saint-salens-symphony-organ-maestoso.json +8527 -0
  280. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/15-pure-paradise.json +7674 -0
  281. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/analyses/2-02-2pac-brenda-s-got-a-baby.json +5162 -0
  282. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/lastfm/albums.json +51 -0
  283. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/lastfm/artists.json +68 -0
  284. sonagram-0.1.0/sonagram/sonagram/tests/fixtures/lastfm/tracks.json +108 -0
  285. sonagram-0.1.0/sonagram/sonagram/tests/fixtures_roundtrip.rs +77 -0
  286. sonagram-0.1.0/sonagram/sonagram/tests/golden_graph.rs +613 -0
  287. sonagram-0.1.0/sonagram/sonagram/tests/goldens/library-enriched.canonical.txt +1844 -0
  288. sonagram-0.1.0/sonagram/sonagram/tests/goldens/library-enriched.sha256 +1 -0
  289. sonagram-0.1.0/sonagram/sonagram/tests/goldens/library.canonical.txt +1750 -0
  290. sonagram-0.1.0/sonagram/sonagram/tests/goldens/library.sha256 +1 -0
  291. sonagram-0.1.0/sonagram/sonagram/tests/graph_build.rs +271 -0
  292. sonagram-0.1.0/sonagram/sonagram/tests/graph_derive.rs +511 -0
  293. sonagram-0.1.0/sonagram/sonagram/tests/graph_enriched.rs +259 -0
  294. sonagram-0.1.0/sonagram/sonagram/tests/multi_source.rs +193 -0
  295. sonagram-0.1.0/sonagram/sonagram/tests/p19_bootstrap.rs +235 -0
  296. sonagram-0.1.0/sonagram/sonagram/tests/playlist_export.rs +230 -0
  297. sonagram-0.1.0/sonagram/sonagram/tests/playlist_folder.rs +178 -0
  298. sonagram-0.1.0/sonagram/sonagram/tests/scan_incremental.rs +311 -0
  299. sonagram-0.1.0/sonagram/sonagram/tests/scan_smoke.rs +58 -0
  300. sonagram-0.1.0/sonagram/sonagram/tests/status_probe.rs +160 -0
  301. sonagram-0.1.0/sonagram/sonagram-python/Cargo.toml +20 -0
  302. sonagram-0.1.0/sonagram/sonagram-python/src/lib.rs +482 -0
  303. sonagram-0.1.0/sonara/Cargo.toml +28 -0
  304. sonagram-0.1.0/sonara/sonara/Cargo.toml +51 -0
  305. sonagram-0.1.0/sonara/sonara/README.md +788 -0
  306. sonagram-0.1.0/sonara/sonara/benches/bench_analyze.rs +82 -0
  307. sonagram-0.1.0/sonara/sonara/benches/bench_cqt.rs +47 -0
  308. sonagram-0.1.0/sonara/sonara/benches/bench_sequence.rs +54 -0
  309. sonagram-0.1.0/sonara/sonara/benches/bench_stft.rs +117 -0
  310. sonagram-0.1.0/sonara/sonara/benches/bench_utils.rs +45 -0
  311. sonagram-0.1.0/sonara/sonara/examples/accuracy_eval.rs +442 -0
  312. sonagram-0.1.0/sonara/sonara/examples/test_playlist_100.rs +120 -0
  313. sonagram-0.1.0/sonara/sonara/src/analyze.rs +2626 -0
  314. sonagram-0.1.0/sonara/sonara/src/beat.rs +756 -0
  315. sonagram-0.1.0/sonara/sonara/src/beatgrid.rs +399 -0
  316. sonagram-0.1.0/sonara/sonara/src/core/audio.rs +1315 -0
  317. sonagram-0.1.0/sonara/sonara/src/core/constantq.rs +523 -0
  318. sonagram-0.1.0/sonara/sonara/src/core/convert.rs +721 -0
  319. sonagram-0.1.0/sonara/sonara/src/core/fft.rs +222 -0
  320. sonagram-0.1.0/sonara/sonara/src/core/harmonic.rs +197 -0
  321. sonagram-0.1.0/sonara/sonara/src/core/intervals.rs +182 -0
  322. sonagram-0.1.0/sonara/sonara/src/core/mod.rs +9 -0
  323. sonagram-0.1.0/sonara/sonara/src/core/notation.rs +349 -0
  324. sonagram-0.1.0/sonara/sonara/src/core/pitch.rs +675 -0
  325. sonagram-0.1.0/sonara/sonara/src/core/spectrum.rs +1196 -0
  326. sonagram-0.1.0/sonara/sonara/src/decompose.rs +241 -0
  327. sonagram-0.1.0/sonara/sonara/src/dsp/extrema.rs +114 -0
  328. sonagram-0.1.0/sonara/sonara/src/dsp/iir.rs +295 -0
  329. sonagram-0.1.0/sonara/sonara/src/dsp/mod.rs +3 -0
  330. sonagram-0.1.0/sonara/sonara/src/dsp/windows.rs +305 -0
  331. sonagram-0.1.0/sonara/sonara/src/effects.rs +439 -0
  332. sonagram-0.1.0/sonara/sonara/src/error.rs +52 -0
  333. sonagram-0.1.0/sonara/sonara/src/feature/inverse.rs +160 -0
  334. sonagram-0.1.0/sonara/sonara/src/feature/mod.rs +3 -0
  335. sonagram-0.1.0/sonara/sonara/src/feature/rhythm.rs +442 -0
  336. sonagram-0.1.0/sonara/sonara/src/feature/spectral.rs +793 -0
  337. sonagram-0.1.0/sonara/sonara/src/filters.rs +555 -0
  338. sonagram-0.1.0/sonara/sonara/src/fingerprint.rs +549 -0
  339. sonagram-0.1.0/sonara/sonara/src/genre.rs +936 -0
  340. sonagram-0.1.0/sonara/sonara/src/lib.rs +30 -0
  341. sonagram-0.1.0/sonara/sonara/src/loudness_ext.rs +539 -0
  342. sonagram-0.1.0/sonara/sonara/src/onset.rs +414 -0
  343. sonagram-0.1.0/sonara/sonara/src/perceptual.rs +1100 -0
  344. sonagram-0.1.0/sonara/sonara/src/segment.rs +291 -0
  345. sonagram-0.1.0/sonara/sonara/src/sequence.rs +530 -0
  346. sonagram-0.1.0/sonara/sonara/src/similarity.rs +509 -0
  347. sonagram-0.1.0/sonara/sonara/src/structure.rs +802 -0
  348. sonagram-0.1.0/sonara/sonara/src/tonal.rs +768 -0
  349. sonagram-0.1.0/sonara/sonara/src/types.rs +96 -0
  350. sonagram-0.1.0/sonara/sonara/src/util/matching.rs +169 -0
  351. sonagram-0.1.0/sonara/sonara/src/util/mod.rs +2 -0
  352. sonagram-0.1.0/sonara/sonara/src/util/utils.rs +680 -0
  353. sonagram-0.1.0/sonara/sonara/src/vocal.rs +429 -0
  354. sonagram-0.1.0/sonara/sonara/tests/accuracy.rs +554 -0
  355. sonagram-0.1.0/sonara/sonara/tests/bpm_accuracy.rs +476 -0
@@ -0,0 +1,37 @@
1
+ [workspace]
2
+ members = [
3
+ "crates/kglite",
4
+ "crates/kglite-py",
5
+ "crates/kglite-mcp-server",
6
+ "crates/kglite-bolt-server",
7
+ "crates/kglite-c",
8
+ "crates/kglite-cli",
9
+ ]
10
+ resolver = "2"
11
+
12
+ # Single source of truth for the crate version. Every member crate sets
13
+ # `version.workspace = true`, so a release bumps this one line instead of
14
+ # six. All published crates ship in lockstep at the same version.
15
+ [workspace.package]
16
+ version = "0.14.0"
17
+
18
+ # Phase G.4 — workspace root is now virtual (no `[package]`).
19
+ # Polars-style layout: each crate has its own home under
20
+ # `crates/`. The `kglite` Python wheel is built by maturin from
21
+ # `crates/kglite-py/` (see `pyproject.toml`'s `[tool.maturin]
22
+ # manifest-path`).
23
+
24
+ [profile.release]
25
+ lto = "thin"
26
+ codegen-units = 1
27
+ strip = "symbols"
28
+
29
+ # Same codegen as release but keeps line tables + symbols so samply
30
+ # / `cargo flamegraph` / Instruments can attribute hot frames. Use
31
+ # with `maturin develop --profile profiling` for Python-driven
32
+ # profiling, or `cargo build --profile profiling --bin bz2_bench`
33
+ # for native binaries.
34
+ [profile.profiling]
35
+ inherits = "release"
36
+ debug = "line-tables-only"
37
+ strip = "none"
@@ -0,0 +1,144 @@
1
+ [package]
2
+ # Pure-Rust core, polars-style. The Python wheel is built by
3
+ # maturin from `crates/kglite-py/` (which depends on this crate).
4
+ # Rust embedders depend on this crate directly:
5
+ # kglite = { path = "..." } # pre-publish
6
+ # kglite = "0.10" # post-crates.io-publish
7
+ name = "kglite"
8
+ version.workspace = true
9
+ edition = "2021"
10
+ authors = ["Kristian dF Kollsgård <kkollsg@gmail.com>"]
11
+ license = "MIT"
12
+ description = "Pure-Rust embedded Cypher knowledge graph engine with in-memory, mmap, and disk storage, and agent-facing schema introspection"
13
+ readme = "README.md"
14
+ repository = "https://github.com/kkollsga/kglite"
15
+ homepage = "https://github.com/kkollsga/kglite"
16
+ documentation = "https://docs.rs/kglite"
17
+ keywords = ["cypher", "knowledge-graph", "graph-database", "embedded-database", "rust"]
18
+ categories = ["database", "data-structures"]
19
+
20
+ [lib]
21
+ # `[lib] name = "kglite"` matches the `[package] name` so
22
+ # dependent crates do the natural `use kglite::api::*`. The
23
+ # kglite-py wrapper uses `[lib] name = "kglite_py"` to avoid
24
+ # producing the same rlib filename as this crate (they're different
25
+ # artifact types — rlib here, cdylib over there — but cargo still
26
+ # requires distinct filenames).
27
+ name = "kglite"
28
+ doctest = false
29
+
30
+ # Standalone perf microbench for the bz2 decoder. Requires the
31
+ # `parallel-bz2` feature because it calls the optional decoder directly. Run
32
+ # with `cargo run -p kglite --bin bz2_bench --release --features
33
+ # parallel-bz2 -- <path>`.
34
+ [[bin]]
35
+ name = "bz2_bench"
36
+ path = "src/bin/bz2_bench.rs"
37
+ required-features = ["parallel-bz2"]
38
+
39
+ [features]
40
+ default = []
41
+ # Rust-native embedder backend behind the `fastembed` Cargo feature.
42
+ # Downloads ONNX model weights on first use (cached at
43
+ # `~/.cache/fastembed/`). Off by default — the Python wheel relies
44
+ # on user-provided Python embedder classes via `PyEmbedderAdapter`,
45
+ # and we don't want to pull a 100-200 MB ONNX runtime into every
46
+ # wheel build. The `kglite-mcp-server` binary enables this feature
47
+ # so the Rust-only deployment path supports `text_score()` semantic
48
+ # search without a Python embedder.
49
+ fastembed = ["dep:fastembed"]
50
+ # Block-level parallel decoder for single-stream `.bz2` files (the
51
+ # Wikidata `latest-truthy.nt.bz2` shape). With this feature off the loader
52
+ # still parallelises multi-stream pbzip2-produced files; only the
53
+ # single-stream block-level path falls back to sequential
54
+ # `bzip2::read::MultiBzDecoder`. Wikidata-scale ingest is the only
55
+ # workload that actually benefits — opt in if you're decompressing
56
+ # > 50 GB single-stream files. The `bz2_bench` binary requires this
57
+ # feature.
58
+ parallel-bz2 = ["dep:parallel-bz2-redux"]
59
+
60
+ # OKF (Open Knowledge Format) bundle loader — parses a directory of
61
+ # markdown files with YAML frontmatter, cross-linked by markdown links,
62
+ # into a knowledge graph (read-only ingestion, like `code_tree` but for
63
+ # OKF / memory / skills / Obsidian bundles). Off by default so the bare
64
+ # crate pulls no YAML parser; the Python wheel enables it. `regex` (link
65
+ # extraction) and `walkdir` (tree walk) are already non-optional deps.
66
+ okf = ["dep:yaml-rust2"]
67
+ # General-purpose RDF loader (Turtle / N-Triples / N-Quads / TriG via
68
+ # the oxttl parser family). Off by default so the bare crate pulls no
69
+ # RDF parser; `oxttl` + `oxrdf` are only in the dep tree when `rdf` is
70
+ # enabled. Phase 1 covers the in-memory (Default) backend only.
71
+ rdf = ["dep:oxttl", "dep:oxrdf"]
72
+
73
+ # `--cfg loom` is set manually when running the loom interleaving model
74
+ # (tests/loom_session.rs); register it so normal builds don't warn (and
75
+ # `make lint`'s `-D warnings` doesn't fail) on the `#[cfg(loom)]` gate.
76
+ [lints.rust]
77
+ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)'] }
78
+
79
+ [dependencies]
80
+ petgraph = { version = "0.8.3", features = ["serde-1"] }
81
+ fastembed = { version = "5", optional = true, default-features = false, features = ["ort-download-binaries-native-tls", "hf-hub-native-tls"] }
82
+ serde = { version = "1.0.228", features = ["derive"] }
83
+ serde_json = "1.0.149"
84
+ bincode = "1.3"
85
+ postcard = { version = "1.1.3", default-features = false, features = ["use-std"] }
86
+ chrono = { version = "0.4.43", features = ["serde"] }
87
+ geo = "0.33"
88
+ rstar = "0.12"
89
+ wkt = "0.14"
90
+ regex = "1"
91
+ rayon = "1.10"
92
+ flate2 = "1"
93
+ zstd = "0.13"
94
+ memmap2 = "0.9"
95
+ libc = "0.2"
96
+ bzip2 = "0.6"
97
+ # Published, bounded-memory block-parallel decoder for both ordinary
98
+ # single-stream and concatenated `.bz2` data. Optional so graph-only users do
99
+ # not pull its scanner/pipeline dependencies.
100
+ parallel-bz2-redux = { version = "1.1.1", optional = true }
101
+ walkdir = "2.5.0"
102
+ tempfile = "3"
103
+ fs2 = "0.4"
104
+ sha2 = "0.10"
105
+ memchr = "2"
106
+ rustc-hash = "2"
107
+ csv = "1.3"
108
+ geojson = "0.24"
109
+ indexmap = { version = "2", features = ["serde"] }
110
+
111
+ # OKF loader YAML frontmatter parser — gated behind the `okf` feature.
112
+ # `yaml-rust2` is a pure-Rust, actively-maintained YAML 1.2 parser (no
113
+ # `unsafe`/libyaml, no unmaintained advisory); only pulled when `okf` is
114
+ # enabled (the wheel enables it; bare builds don't).
115
+ yaml-rust2 = { version = "0.10", optional = true }
116
+
117
+ # RDF loader deps — gated behind the `rdf` feature. `oxttl` is the
118
+ # Oxigraph family's standalone Turtle/N-Triples/N-Quads/TriG parser;
119
+ # it re-exports `oxrdf` term types (Triple / Quad / Term / Literal).
120
+ # oxttl 0.2.3 resolves oxrdf 0.3.x — pin oxrdf to the version oxttl
121
+ # pulls so they agree on the term types.
122
+ oxttl = { version = "0.2", optional = true }
123
+ oxrdf = { version = "0.3", optional = true }
124
+
125
+ [target.'cfg(windows)'.dependencies]
126
+ same-file = "1"
127
+
128
+ [dev-dependencies]
129
+ tempfile = "3"
130
+
131
+ # loom — exhaustive interleaving model-checker for the Session commit/snapshot
132
+ # lock pattern. Only pulled in under `--cfg loom` (the loom test is
133
+ # `#![cfg(loom)]`), so normal `cargo test` / `cargo build` never compile it.
134
+ # Run: RUSTFLAGS="--cfg loom" cargo test -p kglite --test loom_session
135
+ [target.'cfg(loom)'.dev-dependencies]
136
+ loom = "0.7"
137
+
138
+ # docs.rs builds with these features so the published API page covers
139
+ # the optional loaders + fastembed adapter, which would otherwise be
140
+ # missing (defaults are intentionally empty). `rustdoc-args` enables doc-cfg
141
+ # annotations so feature-gated APIs are visually marked on the page.
142
+ [package.metadata.docs.rs]
143
+ features = ["fastembed", "okf", "rdf", "parallel-bz2"]
144
+ rustdoc-args = ["--cfg", "docsrs"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Kristian de Figueiredo Kollsgård
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,179 @@
1
+ # kglite
2
+
3
+ [![crates.io](https://img.shields.io/crates/v/kglite)](https://crates.io/crates/kglite)
4
+ [![docs.rs](https://img.shields.io/docsrs/kglite)](https://docs.rs/kglite)
5
+ [![License: MIT](https://img.shields.io/crates/l/kglite)](https://github.com/kkollsga/kglite/blob/main/LICENSE)
6
+
7
+ **Pure-Rust knowledge graph engine** — Cypher pipeline,
8
+ snapshot/working CoW transactions, columnar / mmap / disk storage
9
+ backends, optional RDF / OKF format loaders. Pre-packaged domain
10
+ dataset loaders (SEC EDGAR, Sodir, Wikidata) live in the separate
11
+ kglite-datasets project. Zero PyO3 in the dependency tree; embed
12
+ directly from any Rust binary.
13
+
14
+ > Looking for the Python wheel? `pip install kglite` — the wheel
15
+ > is a separate PyO3 wrapper (`kglite-py`) built on top of this
16
+ > crate. See the [workspace README] for the Python story; this
17
+ > page is the crates.io-side documentation.
18
+
19
+ [workspace README]: https://github.com/kkollsga/kglite#kglite--knowledge-graph-for-python-built-for-llm-agents
20
+
21
+ ## Quick start
22
+
23
+ ```toml
24
+ [dependencies]
25
+ kglite = "0.10"
26
+ ```
27
+
28
+ ```rust
29
+ use kglite::api::{load_file, session, Value};
30
+ use std::collections::HashMap;
31
+
32
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
33
+ // Load any .kgl file — same format the Python wheel writes.
34
+ let graph = load_file("graph.kgl")?;
35
+
36
+ let params = HashMap::new();
37
+ let opts = session::ExecuteOptions {
38
+ params: &params,
39
+ deadline: None,
40
+ max_rows: None,
41
+ lazy_eligible: false,
42
+ disabled_passes: None,
43
+ embedder: None,
44
+ };
45
+ let outcome = session::execute_read(
46
+ &graph,
47
+ "MATCH (n:Person) RETURN n.name LIMIT 10",
48
+ &opts,
49
+ )?;
50
+
51
+ for row in &outcome.result.rows {
52
+ if let Some(Value::String(name)) = row.first() {
53
+ println!("{}", name);
54
+ }
55
+ }
56
+ Ok(())
57
+ }
58
+ ```
59
+
60
+ Verify no Python dep leaked in:
61
+
62
+ ```bash
63
+ cargo tree -p your-crate | grep pyo3 # → (empty)
64
+ ```
65
+
66
+ ## What's in it
67
+
68
+ | Surface | Purpose |
69
+ |---|---|
70
+ | `kglite::api::DirGraph` | The in-memory graph. Owned by your binding's graph handle. |
71
+ | `kglite::api::Value` | The Cypher value type — scalars, `List`, `Map`, `Node`, `Relationship`, `Path`. |
72
+ | `kglite::api::KgError`, `KgErrorCode` | Typed error enum (16 variants) for binding-friendly error mapping. |
73
+ | `kglite::api::session::Session` / `Transaction` | Snapshot/working CoW transaction model with optimistic concurrency control. |
74
+ | `kglite::api::session::execute_read` / `execute_mut` | The canonical Cypher pipeline — parse, validate, optimise, execute. |
75
+ | `kglite::api::cypher::*` | Lower-level pipeline primitives for building custom orchestrations. |
76
+ | `kglite::api::load_file` / `save_graph` | `.kgl` portable graph snapshots — copy, share, reload across bindings. |
77
+ | `kglite::api::compute_description` / `compute_schema` | Schema introspection: XML for LLM system prompts, structured types for programmatic use. |
78
+
79
+ ## Transactions
80
+
81
+ The `Session` / `Transaction` types wrap the snapshot/working CoW
82
+ + optimistic concurrency control. Pattern: begin, mutate, commit.
83
+ On a concurrent-writer conflict, the second commit returns
84
+ `CommitOutcome::ConflictDetected` and the binding surfaces it to
85
+ its caller as a retryable error.
86
+
87
+ ```rust
88
+ use kglite::api::session::{CommitOutcome, ExecuteOptions, Session};
89
+ use kglite::api::DirGraph;
90
+ use std::collections::HashMap;
91
+ use std::sync::Arc;
92
+
93
+ let session = Arc::new(Session::new(DirGraph::new()));
94
+ let params: HashMap<String, kglite::api::Value> = HashMap::new();
95
+ let opts = ExecuteOptions {
96
+ params: &params, deadline: None, max_rows: None,
97
+ lazy_eligible: false, disabled_passes: None, embedder: None,
98
+ };
99
+
100
+ let mut tx = session.begin();
101
+ kglite::api::session::execute_mut(
102
+ tx.working_mut()?,
103
+ "CREATE (:Person {id: 1, name: 'Alice'})",
104
+ &opts,
105
+ )?;
106
+
107
+ match session.commit(tx, /* check_occ = */ true) {
108
+ CommitOutcome::Committed { new_version } => {
109
+ println!("committed at version {}", new_version);
110
+ }
111
+ CommitOutcome::ConflictDetected { current_version, base_version } => {
112
+ eprintln!("conflict: base={} current={}", base_version, current_version);
113
+ }
114
+ CommitOutcome::NoWritesNoOp => {}
115
+ }
116
+ ```
117
+
118
+ ## Examples
119
+
120
+ Three runnable examples ship with the crate:
121
+
122
+ ```bash
123
+ cargo run --example embedded_basic -- graph.kgl
124
+ cargo run --example embedded_session
125
+ cargo run --example embedded_blueprint
126
+ ```
127
+
128
+ - `embedded_basic` — load + query. Smallest embedder.
129
+ - `embedded_session` — two concurrent transactions; OCC catches
130
+ the conflict.
131
+ - `embedded_blueprint` — parse the kglite source tree itself,
132
+ query the resulting graph.
133
+
134
+ ## Feature flags
135
+
136
+ Polars-io style: opt in only to what you use.
137
+
138
+ | Feature | What it pulls in |
139
+ |---|---|
140
+ | `default` | The engine. No optional loaders. (Domain dataset loaders live in the kglite-datasets project; code-graph building in the codingest crate.) |
141
+ | `rdf` | RDF loader (Turtle / N-Triples / N-Quads / TriG via oxttl). |
142
+ | `okf` | Open Knowledge Format bundle loader (markdown + YAML frontmatter). |
143
+ | `fastembed` | Rust-native ONNX embedder for `text_score()` semantic search. |
144
+
145
+ ```toml
146
+ [dependencies]
147
+ kglite = { version = "0.13", features = ["rdf", "okf"] }
148
+ ```
149
+
150
+ ## Documentation
151
+
152
+ - **[Rust quickstart](https://kglite.readthedocs.io/en/latest/rust/index.html)**
153
+ — load + query + transaction examples.
154
+ - **[Embedding guide](https://kglite.readthedocs.io/en/latest/rust/embedding.html)**
155
+ — workspace layout, the `kglite::api::*` surface tour, sketches
156
+ for cgo / napi / JNI wrappers if you're building a binding in
157
+ another language.
158
+ - **[Session abstraction](https://kglite.readthedocs.io/en/latest/rust/session.html)**
159
+ — binding-implementer reference for the canonical Cypher pipeline
160
+ + CoW transaction model.
161
+ - **[API manifest](https://kglite.readthedocs.io/en/latest/rust/api-reference.html)**
162
+ — curated inventory of `kglite::api::*` items + semver rules.
163
+ - **Per-symbol docs at [docs.rs/kglite](https://docs.rs/kglite).**
164
+
165
+ The full kglite docs site at
166
+ [kglite.readthedocs.io](https://kglite.readthedocs.io) has more
167
+ on the Cypher subset, design rationale, and the protocol-server
168
+ binaries that ship alongside this crate.
169
+
170
+ ## Semver
171
+
172
+ `kglite::api::*` items get semver guarantees within a minor
173
+ release. Anything outside that surface — `kglite::graph::*`,
174
+ `kglite::datatypes::*`, raw module paths — is internal and may
175
+ move freely between minor releases.
176
+
177
+ ## License
178
+
179
+ MIT — see [LICENSE](https://github.com/kkollsga/kglite/blob/main/LICENSE).
@@ -0,0 +1,65 @@
1
+ //! Smallest possible kglite embedder: load a `.kgl` file from disk
2
+ //! and run a Cypher query against it. Zero PyO3 in the dep tree.
3
+ //!
4
+ //! Run with:
5
+ //!
6
+ //! ```bash
7
+ //! # From the workspace root, against any kgl in your environment:
8
+ //! cargo run -p kglite --example embedded_basic -- path/to/graph.kgl
9
+ //!
10
+ //! # Verify the dep tree is pyo3-free:
11
+ //! cargo tree -p kglite --example embedded_basic | grep pyo3
12
+ //! # → (empty)
13
+ //! ```
14
+ //!
15
+ //! The single .kgl file produced by Python (`kg.save("graph.kgl")`)
16
+ //! is the same file this Rust binary reads. The on-disk format is
17
+ //! the engine's portable contract; it travels across any kglite
18
+ //! binding.
19
+
20
+ use kglite::api::io::load_file;
21
+ use kglite::api::{session, Value};
22
+ use std::collections::HashMap;
23
+
24
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
25
+ let path = std::env::args()
26
+ .nth(1)
27
+ .ok_or("Usage: embedded_basic <path/to/graph.kgl>")?;
28
+
29
+ // ── 1. Load the graph from disk ───────────────────────────────
30
+ //
31
+ // `load_file` returns an `Arc<DirGraph>` — the engine type. No
32
+ // pyo3 wrapping (`KnowledgeGraph` is a pyo3 concern; it lives
33
+ // in the kglite-py wrapper crate, not here).
34
+ let graph = load_file(&path)?;
35
+ println!(
36
+ "Loaded {}: {} bytes resident",
37
+ path,
38
+ std::mem::size_of_val(&*graph)
39
+ );
40
+
41
+ // ── 2. Count nodes via Cypher ─────────────────────────────────
42
+ //
43
+ // The session module is the canonical query pipeline — same
44
+ // path Python, Bolt, and MCP all flow through (Phase E).
45
+ let params = HashMap::new();
46
+ let opts = session::ExecuteOptions::eager(&params);
47
+ let outcome = session::execute_read(&graph, "MATCH (n) RETURN count(n) AS total", &opts)?;
48
+ for row in &outcome.result.rows {
49
+ if let Some(Value::Int64(n)) = row.first() {
50
+ println!("Total nodes: {}", n);
51
+ }
52
+ }
53
+
54
+ // ── 3. Sample a few node titles ───────────────────────────────
55
+ let outcome =
56
+ session::execute_read(&graph, "MATCH (n) RETURN n.title AS title LIMIT 5", &opts)?;
57
+ println!("\nSample nodes:");
58
+ for row in &outcome.result.rows {
59
+ if let Some(Value::String(s)) = row.first() {
60
+ println!(" - {}", s);
61
+ }
62
+ }
63
+
64
+ Ok(())
65
+ }
@@ -0,0 +1,88 @@
1
+ //! Demonstrates the snapshot/working CoW transaction model from
2
+ //! `kglite::api::session` — including OCC conflict handling.
3
+ //!
4
+ //! Two transactions race to mutate the same graph: A wins, B's
5
+ //! commit detects the conflict and is rejected. This is the
6
+ //! pattern bindings (Bolt server, etc.) use to surface
7
+ //! "Transaction conflict — retry the transaction" errors.
8
+ //!
9
+ //! Run with:
10
+ //!
11
+ //! ```bash
12
+ //! cargo run -p kglite --example embedded_session
13
+ //! ```
14
+
15
+ use kglite::api::session::{CommitOutcome, ExecuteOptions, Session};
16
+ use kglite::api::DirGraph;
17
+ use std::collections::HashMap;
18
+ use std::sync::Arc;
19
+
20
+ fn opts<'a>(params: &'a HashMap<String, kglite::api::Value>) -> ExecuteOptions<'a> {
21
+ ExecuteOptions::eager(params)
22
+ }
23
+
24
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
25
+ let session = Arc::new(Session::new(DirGraph::new()));
26
+ let params: HashMap<String, kglite::api::Value> = HashMap::new();
27
+
28
+ // ── Tx A: begin, create a node ────────────────────────────────
29
+ let mut tx_a = session.begin();
30
+ let working_a = tx_a.working_mut()?;
31
+ kglite::api::session::execute_mut(
32
+ working_a,
33
+ "CREATE (:Person {id: 1, name: 'Alice'})",
34
+ &opts(&params),
35
+ )?;
36
+ println!("Tx A: created Person(id=1, name='Alice') in working copy");
37
+
38
+ // ── Tx B: begin (sees pre-A snapshot), create a different node ─
39
+ let mut tx_b = session.begin();
40
+ let working_b = tx_b.working_mut()?;
41
+ kglite::api::session::execute_mut(
42
+ working_b,
43
+ "CREATE (:Person {id: 2, name: 'Bob'})",
44
+ &opts(&params),
45
+ )?;
46
+ println!("Tx B: created Person(id=2, name='Bob') in working copy");
47
+
48
+ // ── Commit A: succeeds, graph version bumps to 1 ──────────────
49
+ let outcome_a = session.commit(tx_a, /* check_occ = */ true);
50
+ match outcome_a {
51
+ CommitOutcome::Committed { new_version } => {
52
+ println!("\n✓ Tx A committed → version {}", new_version);
53
+ }
54
+ other => panic!("expected Committed, got {:?}", other),
55
+ }
56
+
57
+ // ── Commit B: OCC detects stale snapshot (base 0, current 1) ──
58
+ let outcome_b = session.commit(tx_b, /* check_occ = */ true);
59
+ match outcome_b {
60
+ CommitOutcome::ConflictDetected {
61
+ current_version,
62
+ base_version,
63
+ } => {
64
+ println!(
65
+ "✗ Tx B rejected (OCC): base_version={} but current_version={}",
66
+ base_version, current_version
67
+ );
68
+ println!(" Client retry pattern: re-run the transaction against a fresh snapshot.");
69
+ }
70
+ other => panic!("expected ConflictDetected, got {:?}", other),
71
+ }
72
+
73
+ // ── Verify final state: only Alice landed ─────────────────────
74
+ let snap = session.snapshot();
75
+ let outcome = kglite::api::session::execute_read(
76
+ &snap,
77
+ "MATCH (p:Person) RETURN p.name AS name ORDER BY p.id",
78
+ &opts(&params),
79
+ )?;
80
+ println!("\nFinal graph:");
81
+ for row in &outcome.result.rows {
82
+ if let Some(kglite::api::Value::String(s)) = row.first() {
83
+ println!(" - {}", s);
84
+ }
85
+ }
86
+
87
+ Ok(())
88
+ }
@@ -0,0 +1,99 @@
1
+ //! Parallel bzip2 throughput microbench. Decompresses `<path>` to a
2
+ //! `/dev/null` sink with **zero parsing or scanning overhead** — tells
3
+ //! us the raw ceiling we're up against vs. the loader's observed rate.
4
+ //!
5
+ //! Usage:
6
+ //! cargo run --bin bz2_bench --release -- <path-to-bz2> [decompressed-cap-mb]
7
+ //!
8
+ //! decompressed-cap-mb — stop after this many MB of decompressed output
9
+ //! (default: read the whole file)
10
+ //!
11
+ //! We call `parallel_bz2_redux::ParBz2Decoder` directly instead of going
12
+ //! through `parallel_bz2::open` so we sidestep the stream-boundary
13
+ //! pre-scan — that's a separate concern, and we want the steady-state
14
+ //! number, not startup time.
15
+ use std::io::{self, Read, Write};
16
+ use std::path::Path;
17
+ use std::time::Instant;
18
+
19
+ fn main() {
20
+ let args: Vec<String> = std::env::args().collect();
21
+ if args.len() < 2 {
22
+ eprintln!("usage: bz2_bench <path-to-bz2> [decompressed-cap-mb=full]");
23
+ std::process::exit(2);
24
+ }
25
+ let path = Path::new(&args[1]);
26
+
27
+ let cap_bytes: Option<u64> = args
28
+ .get(2)
29
+ .and_then(|s| s.parse::<u64>().ok())
30
+ .map(|mb| mb * 1024 * 1024);
31
+
32
+ let file_size = std::fs::metadata(path).map(|m| m.len()).unwrap_or(0);
33
+
34
+ eprintln!(
35
+ "bz2_bench: {} ({:.2} GB compressed)",
36
+ path.display(),
37
+ file_size as f64 / 1e9,
38
+ );
39
+ if let Some(c) = cap_bytes {
40
+ eprintln!(" cap: {:.2} GB decompressed", c as f64 / 1e9);
41
+ }
42
+
43
+ let mut decoder = parallel_bz2_redux::ParBz2Decoder::open(path).expect("open decoder");
44
+
45
+ let start = Instant::now();
46
+ let mut buf = vec![0u8; 8 * 1024 * 1024];
47
+ let mut total: u64 = 0;
48
+ let mut last_log = start;
49
+
50
+ loop {
51
+ let n = match decoder.read(&mut buf) {
52
+ Ok(0) => break,
53
+ Ok(n) => n,
54
+ Err(e) => {
55
+ eprintln!("read error after {} bytes: {}", total, e);
56
+ std::process::exit(1);
57
+ }
58
+ };
59
+ total += n as u64;
60
+ if let Some(cap) = cap_bytes {
61
+ if total >= cap {
62
+ break;
63
+ }
64
+ }
65
+ if last_log.elapsed().as_secs_f64() >= 2.0 {
66
+ let elapsed = start.elapsed().as_secs_f64();
67
+ let mb_s = (total as f64 / 1e6) / elapsed;
68
+ eprintln!(
69
+ " {:.2} GB decompressed in {:.1}s = {:.1} MB/s",
70
+ total as f64 / 1e9,
71
+ elapsed,
72
+ mb_s,
73
+ );
74
+ let _ = io::stderr().flush();
75
+ last_log = Instant::now();
76
+ }
77
+ }
78
+
79
+ let elapsed = start.elapsed().as_secs_f64();
80
+ let mb_decompressed_per_sec = (total as f64 / 1e6) / elapsed;
81
+ let triples_per_sec = mb_decompressed_per_sec / 80.0; // ~80 bytes/triple
82
+
83
+ println!();
84
+ println!("=== BZ2 BENCHMARK ===");
85
+ println!(
86
+ " decompressed: {:.2} GB ({:.0} bytes)",
87
+ total as f64 / 1e9,
88
+ total as f64
89
+ );
90
+ println!(" wall time: {:.2} s", elapsed);
91
+ println!(
92
+ " decompress rate: {:.1} MB/s decompressed",
93
+ mb_decompressed_per_sec
94
+ );
95
+ println!(
96
+ " triple-rate eq: {:.2} M tri/s (assuming ~80 bytes/triple)",
97
+ triples_per_sec
98
+ );
99
+ }