fix: add opt-in formula-only blank node scoping in N3 mode - #615
Draft
jeswr wants to merge 2 commits into
Draft
Conversation
Entering a list or blank node property list no longer rescopes labels, so `_:a` inside a top-level list co-references `_:a` outside it instead of producing an invalid `_:.a` label. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jeswr
commented
Jul 2, 2026
The default keeps the released behaviour of rescoping blank node labels in lists and blank node property lists; the new formulaScopedBlankNodes option enables formula-only scoping until the default flips in a next major version. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 2, 2026
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.
In N3 mode,
_saveContextrescopes blank node labels and quantifiers on every context push — including lists and blank node property lists, not just formulae. Entering a top-level list resets the label prefix to., so<s> <p> (_:a).produces the invalid label_:.aand no longer co-references_:aelsewhere in the document.As this changes observable output, the fix is opt-in: the new
formulaScopedBlankNodesparser option (name open to bikeshedding) rescopes labels and quantifiers only when entering a formula, matching N3's formula-scoped blank node semantics. The default preserves the released behaviour exactly, now pinned by explicit tests; #630 tracks flipping the default in the next major version.With the option enabled, blank nodes inside
<</<<(contexts in N3 mode also share the enclosing scope, which matches their non-formula semantics — flagging this in case it needs separate discussion.Closes #332 (via the option; the default flips in #630).
cc @jeswr
Closes #660