Skip to content
timrdf edited this page Feb 10, 2012 · 55 revisions

What's first

What we'll cover

We'll show typical error messages that we've seen and tell you how to remedy them.

Let's get to it

bin/install-datafaqs-dependencies.sh can be used to install some dependencies.

Hashing modules are deprecated

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/internet/_sslverify.py:5:
 DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import itertools, md5
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python/filepath.py:12:
 DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha

ignore them :-) Or ask Jim to fix it.

rdflib is not installed

Traceback (most recent call last):
  File "/opt/DataFAQs/bin/df-core.py", line 11, in <module>
    from rdflib import *
ImportError: No module named rdflib

http://www.rdflib.net/2.4.0/ and http://code.google.com/p/rdflib/

easy_install -U rdflib==2.4.0

rdfextras not installed

   results = graph.query(queries[type], initNs=prefixes)
 File "build/bdist.macosx-10.7-intel/egg/rdflib/graph.py", line 884, in query
 File "build/bdist.macosx-10.7-intel/egg/rdflib/plugin.py", line 96, in get
 File "build/bdist.macosx-10.7-intel/egg/rdflib/plugin.py", line 59, in getClass
ImportError: No module named rdfextras.sparql.query

(very poor documentation on this)

sudo easy_install rdfextras

SuRF is not installed

Traceback (most recent call last):
 File "/opt/DataFAQs/bin/df-core.py", line 13, in <module>
   from surf import *
ImportError: No module named surf

From http://packages.python.org/SuRF/install.html

easy_install surf

SuRF's sparql_protocol is not installed

  File "/usr/local/lib/python2.6/dist-packages/SuRF-1.1.4_r352-py2.6.egg/surf/store.py", line 85, in __init__
    raise PluginNotFoundException('The <%s> READER plugin was not found' % (reader))
surf.plugin.manager.PluginNotFoundException: The <sparql_protocol> READER plugin was not found

SADI is not installed

$ python tag-dataset.rpy 
Traceback (most recent call last):
  File "tag-dataset.rpy", line 1, in <module>
    import sadi
ImportError: No module named sadi

From http://packages.python.org/SuRF/install.html#installing-surf-plugins

easy_install -U surf.sparql_protocol

See SADI Semantic Web Services framework for the command to the latest install sadi.py in the downloads section:

sudo easy_install http://sadi.googlecode.com/files/sadi-0.1.4-py2.6.egg 

(not sure if the following error matters)

Installed /Library/Python/2.7/site-packages/sadi-0.1.4-py2.6.egg
Processing dependencies for sadi==0.1.4
Searching for sadi==0.1.4
Reading http://pypi.python.org/simple/sadi/
Couldn't find index page for 'sadi' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for sadi==0.1.4
error: Could not find suitable distribution for Requirement.parse('sadi==0.1.4')

pyparsing not installed

Traceback (most recent call last):
  File "/opt/DataFAQs/bin/df-core.py", line 85, in <module>
    results = graph.query(queries[type], initNs=prefixes)
  File "/usr/local/lib/python2.6/dist-packages/rdflib-3.2.0-py2.6.egg/rdflib/graph.py", line 886, in query
    processor = plugin.get(processor, query.Processor)(self)
  File "/usr/local/lib/python2.6/dist-packages/rdflib-3.2.0-py2.6.egg/rdflib/plugin.py", line 96, in get
    return p.getClass()
  File "/usr/local/lib/python2.6/dist-packages/rdflib-3.2.0-py2.6.egg/rdflib/plugin.py", line 59, in getClass
    module = __import__(self.module_path, globals(), locals(), [""])
  File "/usr/local/lib/python2.6/dist-packages/rdfextras-0.1-py2.6.egg/rdfextras/sparql/processor.py", line 2, in <module>
    import rdfextras.sparql.parser
  File "/usr/local/lib/python2.6/dist-packages/rdfextras-0.1-py2.6.egg/rdfextras/sparql/parser.py", line 5, in <module>
    from pyparsing import (Regex, Suppress, Combine, Optional, CaselessKeyword,
ImportError: No module named pyparsing

http://pyparsing.wikispaces.com/Download+and+Installation

sudo easy_install pyparsing

CKAN python client not installed

$ python tag-dataset.rpy 
Traceback (most recent call last):
  File "tag-dataset.rpy", line 12, in <module>
    import ckanclient
ImportError: No module named ckanclient

See CKAN for the command to install CKAN's python client:

sudo easy_install http://pypi.python.org/packages/source/c/ckanclient/ckanclient-0.9.tar.gz#md5=cb6d09eb2e60a01bce60c82c6c3a0c85
*/*
*/*
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
application/x-www-form-urlencoded
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 1402, in rawDataReceived
    self._finishRequestBody(data[self.length:])
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 1337, in _finishRequestBody
    self.allContentReceived()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 1391, in allContentReceived
    req.requestReceived(command, path, version)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 714, in requestReceived
    self.process()
--- <exception caught here> ---
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/server.py", line 150, in process
    self.render(resrc)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/server.py", line 157, in render
    body = resrc.render(self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/resource.py", line 190, in render
    return m(request)
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 257, in render_POST
    graph = self.processGraph(content, request.getHeader("Content-Type"))
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 203, in processGraph
    self.deserialize(inputStore.reader.graph, content, type)
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 127, in deserialize
    format = self.getFormat(mimetype)
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 119, in getFormat
    if type != None: return [type,self.contentTypes[type]]
exceptions.KeyError: ''

DISTINCT does not work in RDFLIB in Python?

predicate_counter = 0
        for row in temp_graph.query('SELECT ?p WHERE {?s ?p ?o.} ORDER BY ?p'):
            predicate_counter = predicate_counter + 1
        dataset['extras']['number of different predicate'] = predicate_counter

returns the same results as :

predicate_counter = 0
        for row in temp_graph.query('SELECT DISTINCT ?p WHERE {?s ?p ?o.} ORDER BY ?p'):
            predicate_counter = predicate_counter + 1
        dataset['extras']['number of different predicate'] = predicate_counter

What's next

Clone this wiki locally