Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a cbd_subject() method #2366

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Natureshadow
Copy link

Summary of changes

This PR adds a new Graph.cbd_subject() method. It is the counter-part to Graph.cbd(): It checks whether the graph is a CBD for some resource and, if it is, returns the subject of that resource.

I need this for implementing federation between graphs, where incoming pushes shall be ckecked to be CBDs because CBDs are nice to test against ACLs (cf. https://socialhub.activitypub.rocks/t/formalizing-inbox-posts-to-be-cbds/3123)

It also adds a Graph.roots() method returning the roots of the graph, used as a utility in cbd_subject, but also useful otherwise.

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Added tests for any changes that have a runtime impact.
  • Checked that all tests and type checking passes.
  • For changes that have a potential impact on users of this project:
    • Updated relevant documentation to avoid inaccuracies.
    • Considered adding additional documentation.
    • Considered adding an example in ./examples for new features.
    • Considered updating our changelog (CHANGELOG.md).
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

This method determines whether the graph is a
Concise Bounded Description and, if it is, for
what subject
@coveralls
Copy link

Coverage Status

Coverage: 90.865% (+0.01%) from 90.854% when pulling 76fbb4e on Natureshadow:is-cbd into e103078 on RDFLib:main.

@aucampia aucampia added the enhancement New feature or request label May 19, 2023
@aucampia
Copy link
Member

Thanks for the PR @Natureshadow, as this is an enhancement I will want some feedback from other maintainers also, and I will still think about it a bit and maybe extend the docstrings a bit just to make sure I understand the intent.

@aucampia aucampia requested a review from a team May 19, 2023 13:15
@aucampia aucampia added the needs discussion This issue needs further discussion to find an optimal way to resolve it. label May 19, 2023
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Interesting use case, can see your requirement and its potential generality. Also nice to see RDFLib being used to contribute to the development of the fediverse and impressed that Melvin is both taking an interest and endorsing your stance.

@aucampia
Copy link
Member

PRs to V6 is closed until further notice. See this for more details:

@aucampia aucampia added the on hold Progress on this issue is blocked by something. label May 21, 2023
@aucampia
Copy link
Member

PRs to V6 is closed until further notice. See this for more details:

We will be open for PRs again once this is resolved:

@aucampia aucampia removed the on hold Progress on this issue is blocked by something. label Jun 2, 2023
@aucampia
Copy link
Member

aucampia commented Jun 9, 2023

Graph.cbd_subject() is a very special case I think, it may be useful in some select circumstances, but I think it will be the first thing we drop if we ever rework things as the surface area of RDFLib is already way too big for the maintenance resources. I will be open to integrating something like this in rdflib._contrib where we don't have any API guarantees.

I will leave this open but as of right now my main priority is improving quality.

@aucampia aucampia added the feedback wanted Feedback from RDFLib users and contributors is wanted. label Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback wanted Feedback from RDFLib users and contributors is wanted. needs discussion This issue needs further discussion to find an optimal way to resolve it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants