Repository navigation
Open
Labels
pluginCould be implemented as a plugin (#206); core/plugin line defined in #564
Description
Why
Right now JSS stores JSON-LD blobs but offers no way to ask questions of them. Every app re-implements its own walker: "fetch the container, parse ldp:contains, fetch each child, scan for the property I want." This is O(N) and brittle, and it's the single biggest reason Solid "feels like a file dump" rather than a database.
A pod with even a thousand resources becomes painful. A pod with serious archival data (photos, transcripts, messages, agent record-of-work) is unusable without query.
Adding a /sparql endpoint plus a write-time index turns every pod into a small queryable knowledge graph. That single addition unlocks:
- Agent grounding — Charlie can
SELECT ?x WHERE { ?x schema:type schema:Photo ; schema:dateCreated ?d FILTER(?d > "2025-01-01") }instead of walking the file tree. - Cross-app reads — vellum can find "all notes mentioning #project-x" without scanning every file.
- Search UI in explorer — the Phase 8 search box becomes a SPARQL query under the hood.
- Federated query — once one pod speaks SPARQL, asking across pods is plumbing rather than reinvention.
- MCP tool — JSS already exposes 16 MCP tools;
sparql_querybecomes the 17th and makes pod data first-class to any agent.
Shape
POST /sparql
Content-Type: application/sparql-query
<query body>
→ application/sparql-results+json
- Index lives at
/.index/inside the pod (writable only by owner). - Populated on every write (
PUT,POST,PATCH,DELETE) — small, synchronous, indexes only the JSON-LD content that was just touched. - Backed by a tiny embedded store. Options:
- SQLite + a tiny triple-table schema — boring, robust, single file, no native deps.
- Quadstore (LevelDB-backed npm package) — SPARQL-aware out of the box.
- N3.js + in-memory store — simplest spike but loses on restart.
- ACL-aware: query results are filtered by the requesting agent's read access. No leaking private resources.
Scope (first cut)
Minimal but useful subset:
SELECTwith BGPs,FILTER,LIMIT,OFFSET,ORDER BYASKCONSTRUCT(optional in v1)OPTIONAL,UNION- No
UPDATEin v1 — writes go through the LDP/HTTP path so the index is always derived - No federation (
SERVICE) in v1 — that's a separate issue
Things explicitly out of scope:
- OWL reasoning / inferencing — a 10× project for marginal value
- Custom function extensions
- Full SPARQL 1.1 surface
Tradeoffs
- ✓ Single addition that elevates "Solid pod" from file dump to knowledge graph
- ✓ Every Solid-native app gets cheap cross-resource query
- ✓ Pod-resident — no external triple store, no separate process
- ✗ Write path slows slightly (index update)
- ✗ Pod size grows (~5-15% overhead for the index)
- ✗ Schema drift risks: if app-A writes weird JSON-LD, queries assuming app-B's shape may miss it. (Mitigation: SHACL at write time — separate future issue.)
Open questions
- Sync vs async indexing: synchronous keeps consistency simple but couples write latency to index size. Async needs a queue + a way to surface "stale" reads.
- Reindex command:
jss reindexfor cold-start or migrations. Walks/.well-known/index-rootsor just everything under/. - Backup story: index is derived data; should
jss backupskip it? Probably yes, with reindex on restore. /sparqlUI: lightweight YASGUI-style endpoint at/sparqlfor humans? Or keep it pure API and let apps ship their own?- ACL filtering granularity: per-resource read check is straightforward but slow for big result sets. Pre-filter the index by access patterns? Cache per-agent views?
- Federation later: once
/sparqlexists,SERVICE <https://other.pod/sparql>is a small step. Worth designing the v1 result format to compose cleanly.
Effort
- Spike on top of quadstore or similar: ~1 week to a working
/sparqlagainst a small pod, no auth. - Real cut with ACL filtering, sync indexing, reindex command, tests: ~3-4 weeks.
Related
- Solid → WebDAV bridge — mount any pod in Nautilus / Finder / Windows #507 / Solid-native filesystem mount — FUSE driver with ACL / notifications / JSON-LD as first-class #508 — filesystem mounts. SPARQL-backed pods give those a
solid-findcompanion that's a real search rather than a tree walk. - Charlie, vellum, explorer, taskify — every one becomes simpler with query as a primitive.
- MCP tool
sparql_query— extends the 16-tool surface to "ask the pod anything."
Metadata
Metadata
Assignees
Labels
pluginCould be implemented as a plugin (#206); core/plugin line defined in #564
Activity