0

I'm trying to write an RDF graph and store it on PostgreSQL (using Python's rdflib). I do this by opening the store which I have already created and opening a graph through this store. This process appears to work fine and I can write and query to that graph. However, every time I try and reopen the store it kills everything I previously wrote. This is how I open the store:

store = plugin.get('PostgreSQL', rdflib.store.Store)(identifier = db_id, configuration = configString)    

Is there somewhere in this line where I need to put create = False or something? Is there a way to load a store instead of using plugin.get?

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • I'm not really an RDFLib user, but there was a user having some trouble with PostgreSQL RDF stores who described a problem on the mailing list. His final working code seems to be described in [this Google groups message](https://groups.google.com/d/msg/rdflib-dev/KYde6ECzaSE/MBZdStD8F4gJ). Does it help at all? – Joshua Taylor Jul 06 '13 at 21:31

1 Answers1

1

As you have noticed, create defaults to True. You will want to open the store using code like the following to connect to an existing store. See the README and the code @joshua-taylor references for examples.

g = Graph('PostgreSQL', identifier=db_id)
g.open(configString, create=False) 

RDFLib developers now prefer the RDFLib-SQLAlchemy store and do not maintain the separate postgresql extension. You should consider switching to RDFLib-SQLAlchemy.

Ted Lawless
  • 830
  • 6
  • 6