我正在尝试从此https://pythonhosted.org/SuRF/examples/dbpedia.html
运行SURF Dbpedia的示例代码import surf
store = surf.Store(reader = 'sparql_protocol',
endpoint = 'http://dbpedia.org/sparql',
default_graph = 'http://dbpedia.org')
print 'Create the session'
session = surf.Session(store, {})
session.enable_logging = False
PhilCollinsAlbums = session.get_class(surf.ns.YAGO['PhilCollinsAlbums'])
all_albums = PhilCollinsAlbums.all()
print 'Phil Collins has %d albums on dbpedia' % len(all_albums)
提供错误:
Create the session
Traceback (most recent call last):
File "/home/nitin/surf/sample.py", line 16, in <module>
print 'Phil Collins has %d albums on dbpedia' % len(all_albums)
File "/usr/local/lib/python2.7/dist-packages/SuRF-1.1.4_r352-py2.7.egg/surf/resource/result_proxy.py", line 231, in __len__
_, get_by_response = self.__execute_get_by()
File "/usr/local/lib/python2.7/dist-packages/SuRF-1.1.4_r352-py2.7.egg/surf/resource/result_proxy.py", line 211, in __execute_get_by
self.__get_by_response = store.get_by(self.__get_by_args)
File "/usr/local/lib/python2.7/dist-packages/SuRF-1.1.4_r352-py2.7.egg/surf/store.py", line 182, in get_by
return self.reader.get_by(params)
File "/usr/local/lib/python2.7/dist-packages/SuRF-1.1.4_r352-py2.7.egg/surf/plugin/reader.py", line 149, in get_by
return self._get_by(params)
File "/usr/local/lib/python2.7/dist-packages/SuRF-1.1.4_r352-py2.7.egg/surf/plugin/query_reader.py", line 213, in _get_by
for match in table:
TypeError: iteration over non-sequence
任何人都可以帮我解决这个问题。