Skip to content

Conversation

edmondchuc
Copy link
Contributor

@edmondchuc edmondchuc commented Oct 19, 2025

Summary of changes

Fixes #3080

SPARQL Updates now insert statements into the default graph correctly. Previous behaviour would use the Dataset's identifier (a generated blank node) as the graph name and insert it there.

Dataset.parse's return type has also been updated from the broader Graph to Dataset.

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.


for c in list(res):
dg = ctx.graph
dg = ctx.graph if type(ctx.graph) is Graph else ctx.dataset.default_context
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit of a weird logic. Wouldn't it be better to have ctx.dataset.default_context as ctx.graph when running on a Dataset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. However, since ConjunctiveGraph is still supported in v7, checking for Graph works correctly for both ConjunctiveGraph and Dataset.

I was hoping to avoid adding more explicit references to ConjunctiveGraph (since it’s deprecated), but if doing so improves readability, I’m happy to update it.

Copy link
Contributor

@Tpt Tpt Oct 20, 2025

Choose a reason for hiding this comment

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

Make sense to do it this way then, maybe with a TODO for when we will be free of ConjunctiveGraph. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your feedback! I've added a TODO comment in 6c2e17a.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

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.

2 participants