Skip to content

Conversation

@edmondchuc
Copy link
Contributor

Summary of changes

Both ConjunctiveGraph and Dataset's parse method now correctly returns Self like their superclass Graph.

The test confirms that now the return value has the same reference as the original dataset that calls parse.

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.

>>> data = open("test/data/nquads.rdflib/example.nquads", "rb")
>>> g.parse(data, format="nquads") # doctest:+ELLIPSIS
<Graph identifier=... (<class 'rdflib.graph.Graph'>)>
<Graph identifier=... (<class 'rdflib.graph.ConjunctiveGraph'>)>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The doctest is updated to the correct class type now that ConjunctiveGraph's parse method returns Self.

@nicholascar nicholascar merged commit 0f3237d into 7.x Oct 17, 2025
20 checks passed
@nicholascar nicholascar deleted the v7/fix/ds-parse-return branch October 17, 2025 08:29
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.

3 participants