python - rdflib graph not updated. Why? -


I am trying to understand this behavior. This certainly does not expect me to have two programs, a reader, and an author reader opens an RDFlib graph store, then does a query every 2 seconds

  import rdflib Import rdflib import store import random timing from default_graph_ury = "vase: uuid: a19f9b78-cc43-4866-b9a1- 4b009fe91f52" s = rdflib.plugin.get ('MySQL', store.Store) ('rdfstore') config_string = " Host = localhost, password = foo, user = foo, db = foo "rt = s.open (config_string, make = false) if RT! = Store. VALID_STORE: {{id} id {value} for r in the SELECT rows = }? {Id: id;}; http: // localhost # ha>? Value.} "): Print r [0], r [1] time.sleep (2) print" - - - - second program An author that adds stuff to Triplestore   Import from rdflib import store by rdflib import default_graph_uri = "vase: Uuid: a19f9b78-cc43-4866-b9a1-4b009fe91f52" s = Rdflib.plugin.get ('MySQL', store.Store) ('Rdfstore') config_string = "host = localhost, password = foo, user = foo, db = foo" rt = s.open (config_stri Ng, create = false) if rt! = Store.VALID_STORE: s.open (config_string, Create = true) graph = rdflib.ConjunctiveGraph (S, identifier = rdflib.URIRef (default_graph_uri)) graph.add ((rdflib.URIRF ( "Http: // localhost /" + str (random.randint (0,100)), Rdflib.URIRef ("http: // localhost # ha"), rdflib.Literal (str (random.randint (0,100)))) ) Graph.commit ()  

I hope the reader to see the number of increments, because I present the stuff using the author, but this is not the case. The reader continues to return the same result when it started. If I stop the reader and restart it, then new results are revealed.

Does anyone know what I am doing?

in the reader "graph" = rdflib.ConjunctiveGraph (...) "right after the line" graph. Commit () "is a simple fix, I'm not sure what the reason is and why it works to commit before reading, I'm assuming is assuming is that:

  • When a MySQLdb connection opens, a transaction starts automatically
  • This transaction is the second, the transaction later.
  • "graph.commit ()" Below Bubbles Something "connection.commit ()" Somewhere that denies this transaction and starts a new one.

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -