Skip to content

Instantly share code, notes, and snippets.

@nicholsn
Created November 13, 2014 16:24
Show Gist options
  • Select an option

  • Save nicholsn/9ba3ff60970ef57cd035 to your computer and use it in GitHub Desktop.

Select an option

Save nicholsn/9ba3ff60970ef57cd035 to your computer and use it in GitHub Desktop.
Use rdflib to update a graph on virtuoso
# connect to virtuoso
g = rdflib.ConjunctiveGraph('SPARQLUpdateStore', identifier='http://graphtoupdate')
g.open((sparql_uri, update_uri))
g.store.setCredentials(update_usr, update_pwd)
g.store.setHTTPAuth(update_auth)
#​ create a graph to parse update file​
update = rdflib.graph()
update​.parse('file.ttl', format='turtle')
update​.skolemize(new_graph=​g.​store)
#Note the skolemize thing is to deal with bnodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment