From d0f038b14c16a13dc7c1395af169ae69384b52f8 Mon Sep 17 00:00:00 2001 From: Mathias Vanden Auweele Date: Tue, 20 Oct 2026 07:37:30 +0000 Subject: [PATCH 1/3] feat(yasr): pass extra request parameters and an endpoint to plugin queries Host API 2: `yasr.executeQuery` now honours `extraArgs` and `endpoint`, so a result plugin can ask an engine for its execution plan (Blazegraph and Neptune need an `explain` parameter, Stardog its `/explain` path) with the authentication and settings of the tab. Plugins feature-detect it with `hostApi.queryRequest`. Documents the Explain plugin in the user guide. --- docs/developer-guide.md | 3 +- docs/user-guide.md | 53 ++++++++++++++++++++++++++++++++++++ packages/yasgui/src/Tab.ts | 2 ++ packages/yasqe/src/sparql.ts | 16 +++++++++++ packages/yasr/src/index.ts | 15 ++++++++-- 5 files changed, 86 insertions(+), 3 deletions(-) diff --git a/docs/developer-guide.md b/docs/developer-guide.md index 0564e5f3..edccc265 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -3285,7 +3285,7 @@ export default class ChartPlugin implements Plugin { } ``` -### Host API for Result Plugins (yasr hostApi v1) +### Host API for Result Plugins (yasr hostApi v2) YASR exposes a small host API so plugins share one describe panel and one toolbar style. Feature-detect it with `yasr.hostApi`, never with version strings, and keep your own fallback for older hosts: @@ -3302,6 +3302,7 @@ const bar = host?.toolbar && typeof this.yasr.getPluginToolbar === "function" ? - `yasr.describe(iri, { direction?, source?, newHistory? }): Promise` opens the shared describe panel. It runs a CONSTRUCT query through `yasr.executeQuery` with `Accept: text/turtle` and never rejects; errors show in the panel. `newHistory: false` adds to the panel's back/forward history instead of starting a new one. `yasr.closeDescribe()` closes it, `yasr.isDescribeOpen()` reports its state, and YASR emits `"describe"` with `(yasr, iri, direction)` each time a resource is shown. - `yasr.getPluginToolbar()` returns `div.yasr_pluginToolbar`, a full-width bar under the YASR header. YASR empties it before every `draw()` and hides it while it is empty. A plugin that redraws itself must remove its own items first. Build controls inside it with `.yasr_toolbarButton` (toggle with `aria-pressed="true"` or `.is-active`), `.yasr_toolbarSelect` (`