rete-graph 0.3.6 → 0.3.7

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.
Binary file
package/index.d.ts CHANGED
@@ -27,6 +27,32 @@ export type RawQuad = [string, string, string, string | null];
27
27
  export interface QueryOptions {
28
28
  /** OWL 2 QL entailment by query rewriting. */
29
29
  reason?: boolean;
30
+ /**
31
+ * Run one chunk of a split query (see `Graph.partitionPlan`): only the
32
+ * solutions whose `var` is one of `keys` (term tokens as the plan's keys
33
+ * query returned them), without the query's top-level OFFSET/LIMIT.
34
+ */
35
+ partition?: { var: string; keys: string[] };
36
+ }
37
+
38
+ /** How to run a query as chunks split by one variable — `Graph.partitionPlan`. */
39
+ export interface PartitionPlan {
40
+ /** The variable split on, without its `?`. */
41
+ var: string;
42
+ form: "select" | "construct";
43
+ /** `SELECT DISTINCT ?var …`: a superset of the values the variable takes. */
44
+ keys_query: string;
45
+ /**
46
+ * Where the keys query lists them from: the query's own `VALUES` list on the
47
+ * variable (no read), the cheapest constant pattern on it (one scan), or —
48
+ * when neither exists — the whole WHERE clause (as costly as the query).
49
+ */
50
+ keys_from: "values" | "pattern" | "where";
51
+ /** The query's OFFSET/LIMIT, which the chunks drop: apply them once to the merged rows. */
52
+ offset: number;
53
+ limit: number | null;
54
+ /** Two chunks can yield the same row: deduplicate the merged rows. */
55
+ dedupe: boolean;
30
56
  }
31
57
 
32
58
  /**
@@ -124,6 +150,15 @@ export class Graph {
124
150
  * when there is nothing to report. Results are never changed by them.
125
151
  */
126
152
  lastWarnings(): QueryWarning[];
153
+ /**
154
+ * Plan running `query` as chunks split by the values of `variable`, or throw
155
+ * saying why that would change the answer (ORDER BY, an aggregate not
156
+ * grouped by it, a variable some row leaves unbound, ASK, DESCRIBE). Run
157
+ * `plan.keys_query`, then each chunk of keys with `queryRaw(query,
158
+ * {partition: {var, keys}})`; concatenate in key order, deduplicate if
159
+ * `plan.dedupe`, then apply `plan.offset` / `plan.limit`.
160
+ */
161
+ partitionPlan(query: string, variable: string): PartitionPlan;
127
162
  prefixSearch(prefix: string, limit?: number): { label: string; subject: string }[];
128
163
  textSearch(
129
164
  words: string | string[],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rete-graph",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Query local and remote .rete graph files with SPARQL — WebAssembly client for browsers and Node, with lazy byte-range reads over HTTP and local files.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {