Skip to content

feat(parser): support N3 IRI property lists - #695

Merged
jeswr merged 2 commits into
rdfjs:mainfrom
jeswr:codex/n3-iri-property-lists
Aug 25, 2026
Merged

feat(parser): support N3 IRI property lists#695
jeswr merged 2 commits into
rdfjs:mainfrom
jeswr:codex/n3-iri-property-lists

Conversation

@jeswr

@jeswr jeswr commented Aug 24, 2026

Copy link
Copy Markdown
Member

Implements the current N3 iriPropertyList production used by the W3C parser manifest:

:s :p [id :identified :name "value"] .

The supplied IRI replaces the provisional blank node in the enclosing subject, predicate, or object context before properties are emitted. Nested IRI property lists therefore preserve both inner and outer references. The parser requires an actual IRI after id, requires a predicate-object list, and keeps the suite's illegal-semicolon, multiple-ID, and blank-node-ID cases negative.

The lexer recognizes id only in N3 mode, waits across stream chunks, and preserves id:p as a normal prefixed name.

This makes all five positive IRI-property-list cases in #640 pass.

Tests: full Jest suite (6,825 tests, 100% coverage); ESLint; W3C parser manifest improves from 173/222 to 178/222 on this branch alone.

Closes #689

@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 Aug 24, 2026
@jeswr
jeswr marked this pull request as ready for review August 24, 2026 20:27
Copilot AI lite review requested due to automatic review settings August 24, 2026 20:27
@jeswr

jeswr commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

LGTM - just awaiting copilot comment

@jeswr jeswr removed the needs-author-review Awaiting author review; agent has done its part (author removes if follow-ups remain) label Aug 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for the N3 iriPropertyList ([id <iri> ...]) construct so that the supplied IRI replaces the provisional blank node in the enclosing subject/predicate/object context before emitting the property list’s triples. This aligns N3.js parsing behavior with the W3C N3 parser manifest cases referenced in #689 (and improves the suite results referenced in #640).

Changes:

  • Extend the parser to recognize id immediately after [ and replace the property list’s placeholder blank node with the supplied IRI before reading predicates.
  • Extend the lexer to tokenize id as a dedicated token in N3 mode only, including when split across stream chunks, while preserving id:p as a normal prefixed name.
  • Add positive and negative Jest coverage for IRI property list parsing/tokenization behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/N3Parser-test.js Adds parse/negative tests for IRI property lists in subject/object/predicate positions, including nesting and invalid forms.
test/N3Lexer-test.js Adds tokenization tests for id in N3 mode (including chunk boundaries) and ensures id:p remains a prefixed name.
src/N3Parser.js Implements IRI property list ID handling by swapping the placeholder blank node with the provided IRI and enforcing predicate presence after the ID.
src/N3Lexer.js Introduces an N3-only id token via a new regex + switch branch, including stream-friendly behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/N3Parser.js
jeswr and others added 2 commits August 25, 2026 00:47
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jeswr
jeswr force-pushed the codex/n3-iri-property-lists branch from ef3b61b to 31a0a14 Compare August 24, 2026 23:48
@jeswr jeswr added the needs-author-review Awaiting author review; agent has done its part (author removes if follow-ups remain) label Aug 24, 2026
@jeswr
jeswr merged commit d7dc042 into rdfjs:main Aug 25, 2026
54 checks passed
@jeswr
jeswr deleted the codex/n3-iri-property-lists branch August 25, 2026 10:55
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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) released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

N3 parser does not support IRI property lists

2 participants