Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

edmondchuc
Copy link
Contributor

@edmondchuc edmondchuc commented Oct 20, 2025

Summary of changes

Fixes: #3160

Affected serializers:

  • turtle
  • longturtle
  • n3
  • trig

The serializer creates two auto-generated prefix names (ns1, ns2, etc) for the same IRI because the relativize method in the superclass returns a "new" IRI. This indirectly creates another prefix name for the same term, but for its relative form. We override the relative method to prevent it from creating these relative terms unless the base namespace matches exactly.

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Checked that all tests and type checking passes.
  • If the change adds new features or changes the RDFLib public API:
    • Created an issue to discuss the change and get in-principle agreement.
    • Considered adding an example in ./examples.
  • If the change has a potential impact on users of this project:
    • Added or updated tests that fail without the change.
    • Updated relevant documentation to avoid inaccuracies.
    • Considered adding additional documentation.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

@edmondchuc edmondchuc changed the title fix: turtle, longturtle, and n3 serializers - outputs undeclared prefix for predicates that contains the base as a substring fix: RecursiveSerializer- outputs undeclared prefix for predicates that contains the base as a substring Oct 20, 2025
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