Skip to content

Providing the union-default-graph query parameter #632

Answered by Tpt
JoelBender asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think there is an example with rdflib out there yet. Here it is:

from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore

store = SPARQLUpdateStore(params={'union-default-graph': '', 'using-union-graph': ''}) # using-union-graph is only if you want the union graph for the WHERE part of INSERT/DELETE WHERE updates
store.open(("http://localhost:7878/query", "http://localhost:7878/update"))
store.update("PREFIX ex: <http://example.com/> INSERT DATA { GRAPH ex:g { ex:s ex:p ex:o }}")
print(list(store.query("SELECT * WHERE { ?s ?p ?o }")))

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JoelBender
Comment options

Answer selected by JoelBender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants