docs: add sparql-quirks.md with the GRAPH/OPTIONAL gotcha#107
Merged
Conversation
Captures the RDF4J semantics for `GRAPH ?x { OPTIONAL { ... } }` —
it returns zero solutions when the inner pattern is unmatched, so the
surrounding row is filtered out even though the inner pattern is
optional. Workaround: `OPTIONAL { GRAPH ?x { ... } }`.
Bit a nanodash spaces-repo consumer twice
(see knowledgepixels/nanodash#468). Putting the note here so the next
person doesn't lose an afternoon to the same trap.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
For complex consumer queries (multiple cross-graph joins + a UNION inside GRAPH ?g), resolving the npa:hasCurrentSpaceState pointer with a variable ?g can trigger an RDF4J planner blow-up that 504s — where the same query with a hardcoded state-graph IRI runs in under a second. The materialiser doesn't hit this because it formats the IRI as a Java string, not a SPARQL variable; the trap is specific to consumers that follow the documented pointer-resolution pattern verbatim. Documents the workaround (resolve once, inline the constant) without proposing a server-side fix — the planner behaviour is what it is, and the recommended pattern still works for the simple cases that dominate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 1.14.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Summary
Adds
doc/sparql-quirks.mdwith two RDF4J/SPARQL traps encountered while building consumer queries against/repo/spacesfor nanodash (knowledgepixels/nanodash#468):GRAPH ?x { OPTIONAL { ... } }drops the row when the inner pattern is unmatched — pull the OPTIONAL outside. Bit nanodash twice.npa:hasCurrentSpaceStatepointer pattern can blow up the planner when the pattern underGRAPH ?ghas multiple cross-graph joins + a UNION — same query with a hardcoded state-graph IRI runs in well under a second; the variable-?g form 504s after 60s. Materialiser code isn't affected (it formats the IRI as a Java string), but consumers that follow the documented pattern verbatim can hit it.Happy to move the file or restructure if there's a better spot —
CONTRIBUTING.md? A "Consumer notes" section indesign-space-repositories.md?Test plan
🤖 Generated with Claude Code