@matdata/yasgui-explain-plugin 1.0.0 → 1.1.0

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.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  An **Explain** result view for [YASGUI](https://github.com/TriplyDB/Yasgui) and [MatGUI](https://github.com/Matdata-eu/MatGUI) that shows how a SPARQL query is executed:
8
8
 
9
- - **Execution plan**: the operations the triple store ran for your query, with the rows and the time of each, asked from the endpoint after the query completed. Supported engines: QLever, GraphDB, Stardog, Blazegraph and Amazon Neptune.
9
+ - **Execution plan**: the operations the triple store ran for your query, with the rows and the time of each, asked from the endpoint after the query completed. Supported engines: QLever, GraphDB, Stardog, Blazegraph, Amazon Neptune and TripleTrail.
10
10
  - **Algebra**: the query translated to SPARQL algebra (section 18 of the SPARQL specification), computed in the browser for any endpoint, as a collapsible tree and as the s-expression used by ARQ and the specification.
11
11
 
12
12
  **[Live demo](https://matdata-eu.github.io/yasgui-explain-plugin/)**
@@ -53,10 +53,11 @@ Run a query, then open the **Explain** tab. The algebra is there at once. The pl
53
53
  | Stardog | `/{db}/explain` with `profile=true` | the profiled plan as text: rows, wall time and memory per operator |
54
54
  | Blazegraph | the query with `explain=details` | Blazegraph's explain page, in a sandboxed frame |
55
55
  | Neptune | the query with `explain=details` | Neptune's explain table as text |
56
+ | TripleTrail | `/{ds}/explain` (beside `/{ds}/sparql` or `/{ds}/query`), recognised from a `Server` header naming TripleTrail | the operation tree with the time and rows of each step, the row count, planning time and spatial index decisions |
56
57
 
57
58
  Virtuoso, Jena Fuseki, Oxigraph, RDF4J and Comunica publish no plan over the SPARQL protocol: the view then shows the algebra only.
58
59
 
59
- Only MatGUI's YASR runs the plan request with the authentication and request settings of the tab. In other hosts the plugin sends the request itself, without them. Stardog, Blazegraph and Neptune need extra request parameters, which MatGUI passes on from version 6.9 (`yasr.hostApi.queryRequest`); older hosts send those requests directly too.
60
+ Only MatGUI's YASR runs the plan request with the authentication and request settings of the tab. In other hosts the plugin sends the request itself, without them. Stardog, Blazegraph, Neptune and TripleTrail need extra request parameters, which MatGUI passes on from version 6.9 (`yasr.hostApi.queryRequest`); older hosts send those requests directly too.
60
61
 
61
62
  ## Options
62
63
 
@@ -64,7 +65,7 @@ Options go in the plugin constructor, or in `yasr.config.plugins.Explain.dynamic
64
65
 
65
66
  | Option | Default | Meaning |
66
67
  |---|---|---|
67
- | `engine` | detect | Force an engine (`qlever`, `graphdb`, `stardog`, `blazegraph`, `neptune`) or `none` for every endpoint |
68
+ | `engine` | detect | Force an engine (`qlever`, `graphdb`, `stardog`, `blazegraph`, `neptune`, `tripletrail`) or `none` for every endpoint |
68
69
  | `engines` | all | The engines offered in the list, in order |
69
70
  | `autoFetch` | `true` | Fetch the plan when the view opens; with `false`, the Refresh button does |
70
71
  | `getQuery` | the host's query link | A function returning the query text |
@@ -84,7 +85,7 @@ npm run build # dist/
84
85
  npm run build:demo # demo/dist, published to GitHub Pages
85
86
  ```
86
87
 
87
- The demo opens on a QLever endpoint, with buttons for public QLever, GraphDB, Blazegraph and Stardog endpoints; the sample buttons show recorded plans without an endpoint (`?sample=qlever|graphdb|stardog`).
88
+ The demo opens on a QLever endpoint, with buttons for public QLever, GraphDB, Blazegraph and Stardog endpoints; the sample buttons show recorded plans without an endpoint (`?sample=qlever|graphdb|stardog|tripletrail`).
88
89
 
89
90
  ## License
90
91
 
@@ -4,7 +4,7 @@
4
4
  * A YASR result view with two parts:
5
5
  * - the execution plan of the query, asked from the endpoint's engine with one
6
6
  * background request after the query ran (QLever, GraphDB, Stardog,
7
- * Blazegraph, Neptune), and
7
+ * Blazegraph, Neptune, TripleTrail), and
8
8
  * - the SPARQL algebra of the query, computed in the browser for any endpoint.
9
9
  */
10
10
  import type { ExplainPluginOptions, Yasr } from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH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B,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,QAAQ,GAAG,SAAS,CA8BtB;AAED,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,qFAAqF;IACrF,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;CACnD;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,EAC5B,MAAM,CAAC,EAAE,YAAY,GACpB,cAAc,CAShB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * TripleTrail
3
+ *
4
+ * TripleTrail explains a query on `GET|POST /{ds}/explain`, beside the
5
+ * dataset's `/{ds}/sparql` and `/{ds}/query`, with the same `query`
6
+ * parameter. It runs the query and answers JSON: the row count, the plan it
7
+ * ran under `plan.plan` (each step with its `name`, `number of results`,
8
+ * `duration in seconds` and `children`), the planning time under
9
+ * `plan["planning duration in seconds"]`, and the decisions of its spatial
10
+ * index under `spatial`. A caller who may read only some graphs gets the row
11
+ * count alone, with `restricted: true`.
12
+ */
13
+ import type { Engine, Plan } from '../types';
14
+ /** `https://host/ds/sparql` (or `/query`, `/update`) becomes `https://host/ds/explain` */
15
+ export declare function explainUrl(endpoint: string): string;
16
+ export declare function parseTripleTrailResponse(body: string): Plan;
17
+ export declare const tripletrail: Engine;
18
+ //# sourceMappingURL=tripletrail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tripletrail.d.ts","sourceRoot":"","sources":["../../src/engines/tripletrail.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAY,MAAM,UAAU,CAAC;AAEvD,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASnD;AAkBD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAmC3D;AAED,eAAO,MAAM,WAAW,EAAE,MAWzB,CAAC"}
package/dist/types.d.ts CHANGED
@@ -48,7 +48,7 @@ export interface Yasr {
48
48
  getPluginToolbar?: () => HTMLDivElement;
49
49
  }
50
50
  /** The identifiers of the engines the plugin can ask for a plan */
51
- export type EngineId = 'qlever' | 'graphdb' | 'stardog' | 'blazegraph' | 'neptune';
51
+ export type EngineId = 'qlever' | 'graphdb' | 'stardog' | 'blazegraph' | 'neptune' | 'tripletrail';
52
52
  /** The engine setting of an endpoint: detect it, one of the engines, or no plan at all */
53
53
  export type EngineChoice = 'auto' | EngineId | 'none';
54
54
  /** One operation of an execution plan tree */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC9C,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB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EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACpF"}
@@ -929,9 +929,91 @@ var neptune = {
929
929
  }
930
930
  };
931
931
 
932
+ // src/engines/tripletrail.ts
933
+ function explainUrl2(endpoint) {
934
+ const index = endpoint.search(/[?#]/);
935
+ const [base, suffix] = index < 0 ? [endpoint, ""] : [endpoint.slice(0, index), endpoint.slice(index)];
936
+ const trimmed = base.replace(/\/+$/, "");
937
+ if (/\/(sparql|query|update)$/i.test(trimmed))
938
+ return trimmed.replace(/\/(sparql|query|update)$/i, "/explain") + suffix;
939
+ if (/\/explain$/i.test(trimmed)) return trimmed + suffix;
940
+ return `${trimmed}/explain${suffix}`;
941
+ }
942
+ var isNumber2 = (value) => typeof value === "number" && Number.isFinite(value);
943
+ var ms = (seconds2) => isNumber2(seconds2) ? seconds2 * 1e3 : void 0;
944
+ function toNode(step) {
945
+ return {
946
+ label: String((step == null ? void 0 : step.name) || "step").replace(/\s+/g, " ").trim(),
947
+ rows: isNumber2(step == null ? void 0 : step["number of results"]) ? step["number of results"] : void 0,
948
+ timeMs: ms(step == null ? void 0 : step["duration in seconds"]),
949
+ children: Array.isArray(step == null ? void 0 : step.children) ? step.children.map(toNode) : []
950
+ };
951
+ }
952
+ function parseTripleTrailResponse(body) {
953
+ var _a;
954
+ const text = body.trim();
955
+ if (!text) throw new Error("TripleTrail returned an empty response.");
956
+ let json;
957
+ try {
958
+ json = JSON.parse(text);
959
+ } catch (e) {
960
+ throw new Error("TripleTrail did not return JSON. Is this endpoint a TripleTrail server?");
961
+ }
962
+ if (!json || typeof json !== "object" || json.head || json.results || "boolean" in json)
963
+ throw new Error(
964
+ "The endpoint returned results instead of a plan. Is this endpoint a TripleTrail server?"
965
+ );
966
+ const summary = [];
967
+ if (isNumber2(json.rows)) summary.push(`Result size: ${json.rows.toLocaleString("en-US")} rows`);
968
+ const planning = ms((_a = json.plan) == null ? void 0 : _a["planning duration in seconds"]);
969
+ if (planning !== void 0) summary.push(`Query planning: ${planning.toFixed(2)} ms`);
970
+ const spatial = json.spatial && typeof json.spatial === "object" ? json.spatial : {};
971
+ if (spatial.filters || spatial.joins) {
972
+ const lookup = isNumber2(spatial.lookup_ms) ? `, index lookup ${spatial.lookup_ms.toFixed(1)} ms` : "";
973
+ summary.push(
974
+ `Spatial: ${spatial.filters || 0} filters, ${spatial.joins || 0} joins, ${spatial.candidates || 0} candidates${lookup}`
975
+ );
976
+ }
977
+ if (Array.isArray(spatial.decisions))
978
+ for (const decision of spatial.decisions) summary.push(`Spatial rewrite: ${String(decision)}`);
979
+ const root2 = json.plan && (json.plan.plan || (json.plan.name ? json.plan : void 0));
980
+ if (root2 && typeof root2 === "object") return { kind: "tree", root: toNode(root2), summary };
981
+ if (json.restricted)
982
+ summary.push(
983
+ "The plan is left out: you may read only some of the graphs, and the plan is chosen from all of them."
984
+ );
985
+ return { kind: "text", text: summary.join("\n") || "No plan." };
986
+ }
987
+ var tripletrail = {
988
+ id: "tripletrail",
989
+ label: "TripleTrail",
990
+ description: "The plan TripleTrail ran, with the rows and time of each step.",
991
+ needsRequestOptions: true,
992
+ buildRequest(query2, endpoint) {
993
+ return { query: query2, accept: "application/json", endpoint: explainUrl2(endpoint) };
994
+ },
995
+ parse(body) {
996
+ return parseTripleTrailResponse(body);
997
+ }
998
+ };
999
+
932
1000
  // src/engines/index.ts
933
- var ENGINES = { qlever, graphdb, stardog, blazegraph, neptune };
934
- var ENGINE_IDS = ["qlever", "graphdb", "stardog", "blazegraph", "neptune"];
1001
+ var ENGINES = {
1002
+ qlever,
1003
+ graphdb,
1004
+ stardog,
1005
+ blazegraph,
1006
+ neptune,
1007
+ tripletrail
1008
+ };
1009
+ var ENGINE_IDS = [
1010
+ "qlever",
1011
+ "graphdb",
1012
+ "stardog",
1013
+ "blazegraph",
1014
+ "neptune",
1015
+ "tripletrail"
1016
+ ];
935
1017
  function isEngineId(value) {
936
1018
  return typeof value === "string" && value in ENGINES;
937
1019
  }
@@ -944,6 +1026,7 @@ function detectEngine(endpoint, serverHeader) {
944
1026
  if (server.includes("graphdb")) return "graphdb";
945
1027
  if (server.includes("stardog")) return "stardog";
946
1028
  if (server.includes("blazegraph") || server.includes("bigdata")) return "blazegraph";
1029
+ if (server.includes("tripletrail")) return "tripletrail";
947
1030
  if (!endpoint) return void 0;
948
1031
  let url;
949
1032
  try {
@@ -19838,11 +19921,11 @@ function message(text, kind = "muted") {
19838
19921
  el.textContent = text;
19839
19922
  return el;
19840
19923
  }
19841
- function formatMs2(ms) {
19842
- if (ms >= 1e4) return `${(ms / 1e3).toFixed(1)} s`;
19843
- if (ms >= 100) return `${Math.round(ms)} ms`;
19844
- if (ms >= 10) return `${ms.toFixed(1)} ms`;
19845
- return `${ms.toFixed(2)} ms`;
19924
+ function formatMs2(ms2) {
19925
+ if (ms2 >= 1e4) return `${(ms2 / 1e3).toFixed(1)} s`;
19926
+ if (ms2 >= 100) return `${Math.round(ms2)} ms`;
19927
+ if (ms2 >= 10) return `${ms2.toFixed(1)} ms`;
19928
+ return `${ms2.toFixed(2)} ms`;
19846
19929
  }
19847
19930
  function formatRows(rows) {
19848
19931
  return rows.toLocaleString("en-US");
@@ -20282,7 +20365,7 @@ var ExplainPlugin = class {
20282
20365
  planSection.setStatus("");
20283
20366
  planSection.body.appendChild(
20284
20367
  message(
20285
- resolved.source === "none" ? "No engine recognised for this endpoint. Pick it in the Engine list when it is QLever, GraphDB, Stardog, Blazegraph or Neptune; other engines publish no plan over the SPARQL protocol." : "No plan is asked for this endpoint. Pick an engine in the Engine list to fetch one."
20368
+ resolved.source === "none" ? "No engine recognised for this endpoint. Pick it in the Engine list when it is QLever, GraphDB, Stardog, Blazegraph, Neptune or TripleTrail; other engines publish no plan over the SPARQL protocol." : "No plan is asked for this endpoint. Pick an engine in the Engine list to fetch one."
20286
20369
  )
20287
20370
  );
20288
20371
  return;