Skip to content

fix(io): support RFC 3987 Unicode IRIs in N-Quads and N-Triples streaming parsers - #654

Merged
remiceres merged 1 commit into
feature/corese-nextfrom
fix/653-nquads-ntriples-unicode-iri-validation
Oct 27, 2026
Merged

remiceres merged 1 commit into
feature/corese-nextfrom
fix/653-nquads-ntriples-unicode-iri-validation

Conversation

@remiceres

Copy link
Copy Markdown
Contributor

Closes #653

Summary of Changes

  1. RFC 3986/3987 Zero-Allocation Scheme Validation:

    • Replaced new java.net.URI(text).isAbsolute() with isAbsoluteIri(text) in both NQuadsParser.java and NTriplesParser.java.
    • java.net.URI implements RFC 2396 (ASCII-only) and caused URISyntaxException: Illegal character in opaque part on non-ASCII characters in IRIs (such as non-breaking space U+00A0 in W3C RDFC-1.0 test060-in.nq).
    • The new validator scans [A-Za-z][A-Za-z0-9+.-]*: without heap allocation or exceptions, while preserving strict rejection of relative IRIs and malformed schemes.
  2. Non-Regression Unit Tests:

    • Added unit tests in NQuadsParserTest.java and NTriplesParserTest.java covering non-ASCII Unicode characters in IRIs, relative IRI rejection, and invalid scheme rejection.
  3. Validation & Conformance:

    • corese-core: 3,435/3,435 JUnit tests PASSED (100% green), 0 SonarLint alerts.
    • corese-w3c: RDFC-1.0 test060 (nquads_escaping and nquads_escaping_(map_test)) PASSED.
    • ./gradlew enforceW3cRegressions: 2,896 stable passes, 0 regressions detected (OK).

…ming parsers

- Replace new java.net.URI(text).isAbsolute() with a zero-allocation RFC 3986/3987 scheme validator in NQuadsParser and NTriplesParser
- Allow non-ASCII Unicode characters (such as NBSP U+00A0 and mathematical symbols) in IRI paths and opaque identifiers
- Maintain strict rejection of relative IRIs without valid scheme
- Add comprehensive non-regression tests in NQuadsParserTest and NTriplesParserTest
- Fix W3C RDFC-1.0 canonicalization regression on test060-in.nq (0 regressions, 2,896 stable passes)

Fixes #653
@remiceres remiceres self-assigned this Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Overall Project 58.36% 🍏
Files changed 96.51% 🍏

File Coverage
NTriplesParser.java 82.85% -0.25% 🍏
NQuadsParser.java 81.49% -0.24% 🍏

@github-actions

Copy link
Copy Markdown

Test Results

  435 files    435 suites   25s ⏱️
3 435 tests 3 435 ✅ 0 💤 0 ❌
3 469 runs  3 469 ✅ 0 💤 0 ❌

Results for commit 8f050a1.

@remiceres
remiceres merged commit 28c6f39 into feature/corese-next Oct 27, 2026
2 checks passed
@remiceres
remiceres deleted the fix/653-nquads-ntriples-unicode-iri-validation branch October 27, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant