SPARQL example: authentication, named graphs, and recent connections in the connection dialog - #172
Open
kvistgaard wants to merge 3 commits into
Open
Conversation
- Optional HTTP Basic authentication via a custom queryFunction; credentials are kept in tab-scoped session storage, keyed to their endpoint, and never enter the URL hash. - Optional restriction of all queries to one or more named graphs via SPARQL Protocol default-graph-uri parameters. - Recently used connections (endpoint, graphs, username) persisted in local storage, refilling the form on click. - Write the URL hash once per save and parse it from location.href, whose fragment is not percent-decoded by Firefox unlike location.hash. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A named connection is pinned: it is never evicted from the list, while unnamed ones rotate through the most recent few. Activating an entry connects directly when no credentials are needed, otherwise it fills the form and focuses the password field. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A connection restored from a bookmarked or shared URL now lands in the saved connections list the same as one submitted through the dialog, which previously was the only way an entry was recorded. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPARQL example: authentication, named graphs, and recent connections in the connection dialog
Summary
Extends the connection dialog in the
sparqlexample (the playground) so anendpoint that is not open and unrestricted can be explored without writing code:
Authorizationheader via the existingSparqlDataProviderOptions.queryFunctionextension point. No library changes.Protocol
default-graph-uriparameters (§2.1.4), so all queries see the mergeof the listed graphs instead of the whole dataset.
username) is remembered in
localStorage, listed in the dialog, and refillsthe form on click. Up to 8, deduplicated, removable.
Motivation for the graph restriction
Exploring a whole endpoint stops working once the endpoint is large: on
knowledge graphs with billions of triples the class tree and statistics queries
aggregate over everything the store holds, which is slow at best and a timeout
at worst — and the result mixes every dataset on the endpoint. Restricting the
dataset to named graphs makes such endpoints usable from the playground:
the union of unrelated graphs;
and property declarations, labels, hierarchy) is stored separately — without
it there are no link types to display;
restricted endpoint per dataset.
Handling of credentials
sessionStorageonly: they survive a reload,die with the tab, and never enter the URL hash or the recent-connections list.
attached only when the hash names that endpoint, so a pasted link to a
different endpoint can never receive them.
empty) password field, so the missing value is visible before Connect.
remains a bookmarkable link. The hash is now written once per save and parsed
from
location.hrefrather thanlocation.hash, whose getter returns apercent-decoded value in Firefox and would corrupt endpoint URLs containing
encoded
&or=. Graph IRIs split on whitespace only, since a comma is alegal IRI character.
Testing
Driven end-to-end in headless Chromium against a mock endpoint requiring Basic
auth (every request carried the header and the graph parameters, before and
after reload, and credentials stored for one endpoint are not attached to
another) and against a Virtuoso 08.03.3332 endpoint holding an 11M-triple named
graph (restriction verified by comparing type-instance counts with and without
the graph parameters).
npm run lint,npm run typecheck, and the examplesbuild pass.
🤖 Generated with Claude Code