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

Draft: Dataset add named graph #2592

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Murloc6
Copy link

@Murloc6 Murloc6 commented Sep 12, 2023

This is a draft PR to add to the discussion from #2591

Copy link
Member

@aucampia aucampia left a comment

Choose a reason for hiding this comment

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

Thanks for the draft PR @Murloc6 - I'm not sure that the setter for identifier will interface properly with the backing store.

I'm also not entirely sure about named graph, I think we need to ensure the semantics is clear for this in terms of pre and post conditions, but if it will ensure all triples in g will go into the graph named named_graph_identifier then it is good.

@@ -2522,6 +2530,13 @@ def add_graph(
"""alias of graph for consistency"""
return self.graph(g)

def add_named_graph(
self, named_graph_identifier: IdentifiedNode, g: Optional[Union[_ContextIdentifierType, _ContextType, str]]
Copy link
Member

@aucampia aucampia Sep 12, 2023

Choose a reason for hiding this comment

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

Suggested change
self, named_graph_identifier: IdentifiedNode, g: Optional[Union[_ContextIdentifierType, _ContextType, str]]
self, identifier: IdentifiedNode, graph: Optional[Union[_ContextIdentifierType, _ContextType, str]]

I'm not sure why g/graph is not of type Graph though, which it ideally should be. It could also maybe be worth it to take Iterable[_TripleType] as type.

@namedgraph
Copy link

Can we add graphs: Dict[IdentifiedNod, Graph] to Dataset instead of using Graph.identifier?

@aucampia
Copy link
Member

Can we add graphs: Dict[IdentifiedNod, Graph] to Dataset instead of using Graph.identifier?

We should get rid of Graph.identifier but Dataset.graphs that would have to probably be a property and I would start with making it read only, it would have to interface with the store somehow.

@nicholascar nicholascar added the awaiting feedback More feedback is needed from the author of the PR or Issue. label Jul 25, 2024
@coveralls
Copy link

coveralls commented Jul 25, 2024

Coverage Status

coverage: 90.636% (-0.01%) from 90.65%
when pulling 761e79d on Murloc6:dataset_add_named_graph
into 14d1006 on RDFLib:main.

@nicholascar
Copy link
Member

Maintainers will try to incorporate all these changes into a new Dataset API scheduled for RDFLib 8.x due for release in late 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback More feedback is needed from the author of the PR or Issue. RDFLib8
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants