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

Dataset: Deleting default graph #302

Closed
uholzer opened this issue Jun 8, 2013 · 3 comments
Closed

Dataset: Deleting default graph #302

uholzer opened this issue Jun 8, 2013 · 3 comments

Comments

@uholzer
Copy link
Contributor

uholzer commented Jun 8, 2013

I am currently working on support for the SPARQL 1.1 Graph Store Protocol in rdfextras-web. I use rdflib.Dataset and I like to discuss this issue:

The following tries to delete the default graph, once using Dataset.remove_graph and once using the SPARQL update DROP DEFAULT. In both cases I expect all triples to be removed from the default graph, while the default graph itself remains. It turns out, that Dataset.remove_graph(Dataset.DEFAULT) does nothing:

from rdflib import Dataset, URIRef
d = Dataset()
d.add((URIRef('a:a'), URIRef('b:b'), URIRef('c:c')))
print("Before:")
for q in d.quads((None,None,None,None)): print(q)
d.remove_graph(Dataset.DEFAULT)
print("After remove_graph:")
for q in d.quads((None,None,None,None)): print(q)
d.update("DROP DEFAULT")
print("after DROP DEFAULT")
for q in d.quads((None,None,None,None)): print(q)

This yields

(rdflib.term.URIRef(u'a:a'), rdflib.term.URIRef(u'b:b'), rdflib.term.URIRef(u'c:c'), None)
After remove_graph:
(rdflib.term.URIRef(u'a:a'), rdflib.term.URIRef(u'b:b'), rdflib.term.URIRef(u'c:c'), None)
after DROP DEFAULT
@joernhees
Copy link
Member

i agree, this is weird

@gromgull
Copy link
Member

@iherman : you contributed the dataset class - could you have a look at this?

@gromgull
Copy link
Member

This was fixed by the merge on #309, there is also a test for it here:

# removing default graph removes triples but not actual graph

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

No branches or pull requests

3 participants