Can't get RDFlib to work with windows
I have installed RDFlib 3.0 and whatever is needed, but when I run the following code, I get an error. Code below: http://code.google.com/p/rdflib/wiki/IntroSparql . I've been trying to fix this for hours now, but with no success. Can anyone please help?
import rdflib
rdflib.plugin.register('sparql', rdflib.query.Processor,
'rdfextras.sparql.processor', 'Processor')
rdflib.plugin.register('sparql', rdflib.query.Result,
'rdfextras.sparql.query', 'SPARQLQueryResult')
from rdflib import ConjunctiveGraph
g = ConjunctiveGraph()
g.parse("http://bigasterisk.com/foaf.rdf")
g.parse("http://www.w3.org/People/Berners-Lee/card.rdf")
from rdflib import Namespace
FOAF = Namespace("http://xmlns.com/foaf/0.1/")
g.parse("http://danbri.livejournal.com/data/foaf")
[g.add((s, FOAF['name'], n)) for s,_,n in g.triples((None, FOAF['member_name'], None))]
for row in g.query(
"""SELECT ?aname ?bname
WHERE {
?a foaf:knows ?b .
?a foaf:name ?aname .
?b foaf:name ?bname .
}""",
initNs=dict(foaf=Namespace("http://xmlns.com/foaf/0.1/"))):
print "%s knows %s" % row
The error I am getting:
Traceback (most recent call last):
File "...", line 18 in <module>
initNs=dict(foaf=Namespace("http://xmlns.com/foaf/0.1/"))):
TypeError: query() got an unexpected keyword argument 'initNS'
+2
a source to share
2 answers
Ok I finally found the answer. You can read it here: http://blog.eddsn.com/2010/05/unable-to-find-vcvarsall-bat/
+1
a source to share
In the meantime, I found a workaround which is to install minGW32 and compile with that. So for anyone with a similar problem:
- Download the minGW32 installer from sourceforge
- When you install the tool and you get a screen asking which components to install, select "MinGW Core Tools", "g ++ compiler" and "MingW make".
- After installing MinGW, add C: \ MinGW \ bin to the Path environment. variable
from http://code.google.com/p/rdflib/issues/detail?id=104#c4
+2
a source to share