rdflib with other stores than IOMemory

23 views
Skip to first unread message

Laurens

unread,
Jun 15, 2012, 10:22:28 AM6/15/12
to sur...@googlegroups.com
I'm trying to us surfrdf with another db on background instead of allegrograph or virtuoso and I prefer not to use the in memory version.

So I am now trying the rdflib-postgresql in combination with surfrdf

configString="user=test,password=test,host=localhost,db=test3"
default_graph_uri = "http://example.com/mygraph"

rdflib_store = Store(reader='rdflib',
                     writer='rdflib',
                     rdflib_store='PostgreSQL',
                     rdflib_path=configString,
                     rdflib_identifier=URIRef(default_graph_uri))

but I get some error:

Environment:


Request Method: GET

Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'surf',
 'django.contrib.admin')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "C:\Python27-32\lib\site-packages\django\core\handlers\base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "C:\Python27-32\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view
  20.                 return view_func(request, *args, **kwargs)
File "C:\Users\ldevocht\views.py" in done
  148.         user = persistence.addUserAccountToPerson(person, screenname, mendeley_url)       
File "C:\Users\ldevocht\profiler\persistence.py" in addUserAccountToPerson
  164.     person.load()
File "C:\Python27-32\lib\site-packages\surf-1.1.4_r352-py2.7.egg\surf\resource\__init__.py" in load
  527.         results_d = self.session[self.store_key].load(self, True)
File "C:\Python27-32\lib\site-packages\surf-1.1.4_r352-py2.7.egg\surf\store.py" in load
  161.         return self.reader.load(resource, direct)
File "C:\Python27-32\lib\site-packages\surf-1.1.4_r352-py2.7.egg\surf\plugin\reader.py" in load
  116.         return self._load(subj, direct, resource.context)
File "C:\Python27-32\lib\site-packages\surf-1.1.4_r352-py2.7.egg\surf\plugin\query_reader.py" in _load
  120.         result = self._execute(query)
File "C:\Python27-32\lib\site-packages\surf.rdflib-1.0.0_r338-py2.7.egg\surf_rdflib\reader.py" in _execute
  81.         return self.__graph.query(q_string)
File "C:\Python27-32\lib\site-packages\rdflib-3.2.1-py2.7.egg\rdflib\graph.py" in query
  920.         return result(processorinst.query(query_object, initBindings, initNs, **kwargs))
File "C:\Python27-32\lib\site-packages\rdfextras-0.2-py2.7.egg\rdfextras\sparql\processor.py" in query
  49.                            loadContexts=loadContexts)
File "C:\Python27-32\lib\site-packages\rdfextras-0.2-py2.7.egg\rdfextras\sparql\algebra.py" in TopEvaluate
  412.         result = expr.evaluate(tripleStore,passedBindings,query.prolog)
File "C:\Python27-32\lib\site-packages\rdfextras-0.2-py2.7.egg\rdfextras\sparql\algebra.py" in evaluate
  1062.             top.topLevelExpand(left.constraints, prolog)
File "C:\Python27-32\lib\site-packages\rdfextras-0.2-py2.7.egg\rdfextras\sparql\query.py" in topLevelExpand
  520.             self.expand(constraints)
File "C:\Python27-32\lib\site-packages\rdfextras-0.2-py2.7.egg\rdfextras\sparql\query.py" in expand
  654.             self.expandAtClient(constraints)
File "C:\Python27-32\lib\site-packages\rdfextras-0.2-py2.7.egg\rdfextras\sparql\query.py" in expandAtClient
  755.             for tripleOrQuad in searchRT:
File "C:\Python27-32\lib\site-packages\rdflib-3.2.1-py2.7.egg\rdflib\graph.py" in triples
  1056.         for (s, p, o), cg in self.store.triples((s, p, o), context=context):
File "C:\Python27-32\lib\site-packages\rdflib_postgresql-0.1-py2.7.egg\rdflib_postgresql\PostgreSQL.py" in triples
  321.         c=self._db.cursor()

Exception Type: AttributeError at /done/
Exception Value: 'NoneType' object has no attribute 'cursor'

it seems that there is no connection to the db... any suggestions on how to configure it, guess the issue is there?

However when I connect using the rdflib method, it works (connecting to the store etc.) so the connectionString is 100% correct and db working properly:

#plugin.register(
#        'PostgreSQL', rdflib.store.Store,
#        'rdflib_postgresql.PostgreSQL', 'PostgreSQL')
#store = plugin.get('PostgreSQL', rdflib.store.Store)
#graph = Graph(store="PostgreSQL",identifier = URIRef(default_graph_uri))
#graph.open(configString, create=True) 



Reply all
Reply to author
Forward
0 new messages