fix: let Turtle preprocessing own namespace discovery - #58
Merged
Conversation
jdsika
force-pushed
the
fix/serializer-owned-namespace-discovery
branch
from
September 11, 2026 07:32
5768472 to
6f0c9fe
Compare
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
jdsika
force-pushed
the
fix/serializer-owned-namespace-discovery
branch
from
September 11, 2026 07:36
6f0c9fe to
455f6aa
Compare
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.
Stacked on #57; merge that first and this diff reduces to its own commit.
Summary
term position, instead of forcing a QName split on every IRI in the graph.
Splitting unconditionally invented
http://a.example/%as the namespace ofthe valid IRI
<http://a.example/%25>, and that declaration is not readable,so
deterministic_turtlerefused valid graphs whose subject, object ordatatype IRI has no prefixed name.
generated
ns1,ns2, … names stay a function of the graph rather than ofits insertion order, and present every triple exactly once so the reference
counts that decide blank-node and collection layout are unchanged.
namespaces while traversing: RDF/XML output is byte-identical.
insertion-order and cross-process cases, and document the presentation change.
Presentation change
Turtle-family output no longer declares a namespace that only a subject, object
or datatype used; those terms are written as complete IRIs, so
"42"^^ns2:integerbecomes
"42"^^<http://www.w3.org/2001/XMLSchema#integer>unless the callerbound the namespace. One-time diff, documented in the changelog with the
remedy: bind the namespaces you want compact.
Boundary this does not cross
A predicate whose split is not a valid IRI is still refused. The namespace
there is the RDFLib serializer's own choice, reproduced on rdflib 6.3.2 and
7.6.0, and
canonicalize_rdf_graph, which writes predicates in full,serializes those graphs. No dependency grammar is patched locally.
Verification
pyoxigraph 0.5.4 and on rdflib 7.6.0 with pyoxigraph 0.5.11.
position raised at the previous base and now serialize and reparse
isomorphically through every Turtle-family alias, normal and degraded.
degraded graphs: RDF/XML, JSON-LD, N-Triples and pyoxigraph Turtle bytes
unchanged; the Turtle-family delta is only the removed declarations.
No public signature, dependency requirement or version changes.