Skip to content

fix: add opt-in formula-only blank node scoping in N3 mode - #615

Draft
jeswr wants to merge 2 commits into
rdfjs:mainfrom
jeswr:fix/n3-list-blank-node-scope
Draft

fix: add opt-in formula-only blank node scoping in N3 mode#615
jeswr wants to merge 2 commits into
rdfjs:mainfrom
jeswr:fix/n3-list-blank-node-scope

Conversation

@jeswr

@jeswr jeswr commented Jul 2, 2026

Copy link
Copy Markdown
Member

In N3 mode, _saveContext rescopes 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 _:.a and no longer co-references _:a elsewhere in the document.

As this changes observable output, the fix is opt-in: the new formulaScopedBlankNodes parser 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

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>
Comment thread src/N3Parser.js
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>
@jeswr jeswr changed the title fix: scope blank node labels to formulas only in N3 mode fix: add opt-in formula-only blank node scoping in N3 mode Jul 2, 2026
@jeswr jeswr added ai-generated Authored or prepared by an AI coding agent needs-author-review Awaiting author review; agent has done its part (author removes if follow-ups remain) labels Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Authored or prepared by an AI coding agent needs-author-review Awaiting author review; agent has done its part (author removes if follow-ups remain)

Projects

None yet

1 participant