Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rdflib plugin: 'ReaderPlugin' object has no attribute 'log' #14

Open
costezki opened this issue Sep 1, 2017 · 1 comment
Open

rdflib plugin: 'ReaderPlugin' object has no attribute 'log' #14

costezki opened this issue Sep 1, 2017 · 1 comment
Labels

Comments

@costezki
Copy link

costezki commented Sep 1, 2017

The code below throws AttributeError: 'ReaderPlugin' object has no attribute 'log'

import surf
from surf.log import setup_logger, set_logger_level
import logging

setup_logger()
set_logger_level(logging.DEBUG)

store = surf.Store(reader="rdflib",
                   writer="rdflib",
                   rdflib_store="IOMemory")

session = surf.Session(store)

print "Load RDF data"
store.load_triples(source="http://www.w3.org/People/Berners-Lee/card.rdf")
print len(store)

Person = session.get_class(surf.ns.FOAF["Person"])

all_persons = Person.all()

print "Found %d persons in Tim Berners-Lee's FOAF document" % (len(all_persons))
for person in all_persons:
    print person.foaf_name.first
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-fffd51a6eb68> in <module>()
     20 all_persons = Person.all()
     21 
---> 22 print "Found %d persons in Tim Berners-Lee's FOAF document" % (len(all_persons))
     23 for person in all_persons:
     24     print person.foaf_name.first

/usr/local/lib/python2.7/dist-packages/surf/resource/result_proxy.pyc in __len__(self)
    233         """ Return count of resources in this collection. """
    234 
--> 235         _, get_by_response = self.__execute_get_by()
    236         return len(get_by_response)
    237 

/usr/local/lib/python2.7/dist-packages/surf/resource/result_proxy.pyc in __execute_get_by(self)
    214 
    215             store = self._params['store']
--> 216             self._get_by_response = store.get_by(self.__get_by_args)
    217 
    218         return self.__get_by_args, self._get_by_response

/usr/local/lib/python2.7/dist-packages/surf/store.pyc in get_by(self, params)
    148     def get_by(self, params):
    149         params["context"] = self.__add_default_context(params.get("context"))
--> 150         return self.reader.get_by(params)
    151 
    152     def execute(self, query):

/usr/local/lib/python2.7/dist-packages/surf/plugin/reader.pyc in get_by(self, params)
    165 
    166     def get_by(self, params):
--> 167         return self._get_by(params)
    168 
    169 

/usr/local/lib/python2.7/dist-packages/surf/plugin/query_reader.pyc in _get_by(self, params)
    249 
    250         # Load just subjects and their types
--> 251         table = self._to_table(self._execute(query))
    252 
    253         # Create response structure, preserve order, don't include

/usr/local/lib/python2.7/dist-packages/surf.rdflib-1.0.0_r338-py2.7.egg/surf_rdflib/reader.pyc in _execute(self, query)
     78     def _execute(self, query):
     79         q_string = unicode(query)
---> 80         self.log.debug(q_string)
     81         return self.__graph.query(q_string)
     82 

AttributeError: 'ReaderPlugin' object has no attribute 'log'
@cosminbasca
Copy link
Owner

@costezki thanks for reporting the issue, I will have a look into it and have a fix soonish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants