Goal and compatibility model
Track a staged implementation of RDF 1.2 support in RDFLib while preserving existing RDF 1.1 behavior.
The compatibility boundary is explicit:
- existing parser and serializer identifiers retain their RDF 1.1 behavior;
- RDF 1.2 syntax support is introduced through explicit RDF 1.2 plugins;
- existing serializers fail clearly when an RDF 1.2-only term cannot be represented, rather than emitting new syntax or losing information;
- each core model change remains independently reviewable and keeps existing RDFLib behavior unchanged outside its documented additions.
Why this is split into multiple pull requests
RDF 1.2 support touches several largely independent parts of RDFLib: the core term model, Literal semantics, blank-node-aware utilities, graph canonicalization, concrete syntax parsers/serializers, and Turtle/TriG reification syntax.
This work is intentionally split into smaller pull requests because RDFLib's contribution guidelines explicitly prefer smaller changes that can be reviewed and merged independently. The split also reduces regression risk and makes it possible to validate backwards compatibility after each stage.
In particular:
TripleTerm and directional language-tagged strings change different parts of the core data model and can be reviewed independently;
- canonicalization/isomorphism is algorithmically high-risk and should not be bundled with basic term construction;
- N-Triples/N-Quads support is substantially simpler than Turtle/TriG support and provides an earlier end-to-end validation of the RDF 1.2 model;
- Turtle/TriG
TripleTerm parsing can be reviewed separately from reified-triple and annotation syntactic sugar;
- existing RDF 1.1 parser and serializer behavior can be regression-tested after every incremental merge.
The goal is one coherent RDF 1.2 milestone implemented through a sequence of small, reviewable, backwards-compatible pull requests rather than one large change set.
Relationship to PR #3447
PR #3447 is an important starting point and contains several good design ideas that this plan intends to preserve, including TripleTerm(Node), structural TripleTerm equality/hashing, nested triple terms, rdf:reifies, a Literal(..., direction=...) API, and awareness that blank-node-sensitive operations must recurse into triple terms.
This implementation plan differs in scope and architecture in several ways:
- The work is split into small, dependency-aware PRs instead of one large PR.
TripleTerm is designed as a truly immutable term because RDFLib stores use RDF terms as dictionary/set keys.
TripleTerm and directional language-tagged strings are separate core PRs, allowing independent review and parallel progress.
rdfs:Proposition is added together with rdf:reifies.
- Recursive triple-term traversal is centralized in shared internal helpers instead of being reimplemented independently across modules.
Literal.direction is propagated through all relevant Literal semantics, including eq(), deterministic ordering, normalization/reconstruction, repr, and pickling, not only __eq__, __hash__, and rendering.
- Canonicalization/isomorphism is isolated into its own high-risk PR with dedicated embedded-blank-node tests rather than bundled with unrelated core changes.
Graph.reify() and CBD changes are not part of the minimum core API.
util.from_n3() does not gain a separate ad-hoc recursive RDF 1.2 tokenizer; parser logic belongs in the actual syntax parsers.
- Existing RDF 1.1 parser/serializer identifiers keep their current behavior. RDF 1.2 syntax is introduced through explicit RDF 1.2 plugins.
- Existing serializers must not silently emit RDF 1.2 syntax or drop directional metadata; unsupported RDF 1.2 terms must fail clearly.
- Turtle 1.2 triple terms (
<<( ... )>>) are kept semantically distinct from reified triples (<< ... >>) and annotation blocks ({| ... |}).
VERSION handling and W3C RDF 1.2 conformance tests are part of the planned end-to-end implementation.
This is an incremental, review-oriented continuation of the RDF 1.2 work started in #3447, with a stronger compatibility boundary and smaller merge units.
Implementation tracking
Core model
Core utilities
Concrete RDF 1.2 syntaxes
Later or separate considerations
Dependencies
| PR |
Scope |
Depends on |
May be reviewed in parallel with |
| PR 1 |
TripleTerm core |
— |
PR 2 |
| PR 2 |
dirLangString core |
— |
PR 1 |
| PR 3 |
recursive utilities and canonicalization |
PR 1 |
late PR 2 work |
| PR 4 |
N-Triples/N-Quads 1.2 |
PR 1 + PR 2 |
PR 5 after dependencies merge |
| PR 5 |
Turtle/TriG 1.2 core syntax |
PR 1 + PR 2 |
PR 4 |
| PR 6 |
Turtle/TriG reification syntax |
PR 5 |
— |
PR 1 and PR 2 are independent branches based directly on main. PRs 3–6 should be proposed against main after their required dependencies have merged, so reviews do not include unrelated predecessor diffs.
Specifications and test suites
Goal and compatibility model
Track a staged implementation of RDF 1.2 support in RDFLib while preserving existing RDF 1.1 behavior.
The compatibility boundary is explicit:
Why this is split into multiple pull requests
RDF 1.2 support touches several largely independent parts of RDFLib: the core term model,
Literalsemantics, blank-node-aware utilities, graph canonicalization, concrete syntax parsers/serializers, and Turtle/TriG reification syntax.This work is intentionally split into smaller pull requests because RDFLib's contribution guidelines explicitly prefer smaller changes that can be reviewed and merged independently. The split also reduces regression risk and makes it possible to validate backwards compatibility after each stage.
In particular:
TripleTermand directional language-tagged strings change different parts of the core data model and can be reviewed independently;TripleTermparsing can be reviewed separately from reified-triple and annotation syntactic sugar;The goal is one coherent RDF 1.2 milestone implemented through a sequence of small, reviewable, backwards-compatible pull requests rather than one large change set.
Relationship to PR #3447
PR #3447 is an important starting point and contains several good design ideas that this plan intends to preserve, including
TripleTerm(Node), structuralTripleTermequality/hashing, nested triple terms,rdf:reifies, aLiteral(..., direction=...)API, and awareness that blank-node-sensitive operations must recurse into triple terms.This implementation plan differs in scope and architecture in several ways:
TripleTermis designed as a truly immutable term because RDFLib stores use RDF terms as dictionary/set keys.TripleTermand directional language-tagged strings are separate core PRs, allowing independent review and parallel progress.rdfs:Propositionis added together withrdf:reifies.Literal.directionis propagated through all relevantLiteralsemantics, includingeq(), deterministic ordering, normalization/reconstruction, repr, and pickling, not only__eq__,__hash__, and rendering.Graph.reify()and CBD changes are not part of the minimum core API.util.from_n3()does not gain a separate ad-hoc recursive RDF 1.2 tokenizer; parser logic belongs in the actual syntax parsers.<<( ... )>>) are kept semantically distinct from reified triples (<< ... >>) and annotation blocks ({| ... |}).VERSIONhandling and W3C RDF 1.2 conformance tests are part of the planned end-to-end implementation.This is an incremental, review-oriented continuation of the RDF 1.2 work started in #3447, with a stronger compatibility boundary and smaller merge units.
Implementation tracking
Core model
Add RDF 1.2 TripleTerm core model #3525 RDF 1.2
TripleTermcore model — openTripleTermrdf:reifiesrdfs:PropositionAdd RDF 1.2 directional language-tagged strings #3526 RDF 1.2 directional language-tagged strings — open
Literal(..., direction="ltr"|"rtl")rdf:dirLangStringCore utilities
Concrete RDF 1.2 syntaxes
PR 4: N-Triples 1.2 and N-Quads 1.2
nt12andnquads12VERSION "1.2"PR 5: Turtle 1.2 and TriG 1.2 core syntax
turtle12andtrig12<<( ... )>>VERSIONand@versionPR 6: Turtle/TriG RDF 1.2 reification syntax
<< s p o >>{| ... |}Later or separate considerations
version=1.2dispatchfrom_n3()RDF 1.2 integrationDependencies
TripleTermcoredirLangStringcorePR 1 and PR 2 are independent branches based directly on
main. PRs 3–6 should be proposed againstmainafter their required dependencies have merged, so reviews do not include unrelated predecessor diffs.Specifications and test suites