Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Newbie help - Programming the Semantic Web with Python

Reply
Thread Tools

Newbie help - Programming the Semantic Web with Python

 
 
Bruce Whealton
Guest
Posts: n/a
 
      07-10-2011
Hello,
So, I got this book on Programming the Semantic Web about the same time I started learning Python. The code seems to be developed for python 2.7 and not 3, I believe. The code is here:
http://semprog.com/content/the-book/
I tried to run simpletriple.py from inside eclipse with PYDEV. The first thing it has a problem with is this line:
def add(self, (sub, pred, obj)):
I think the problem is with the parentheses before the sub. I removed those and that seemed to fix that error or make it go away. I don’t remember how I figured that out, It should be on the Errata page for sure.
Then it has a problem with this line:
print list(g.triples((None, None, None)))
If I was using python 3, it would require () around the thing that is going to be printed, right? Maybe python 2.7 doesn’t like this line for the same reason.

The book suggests that from IDLE, I can just use
>>>from simplegraph import SimpleGraph

That means it is going to look for a file named simplegraph.py
but where will it be looking? I guess I would have to have it in the same folder as the python interpreter or one of the PATH directories, right?
Thanks,
Bruce

++++++++++++++++++++++++++++++++++++++++++++++++++

Bruce Whealton, Owner Future Wave Designs

FOAF: http://whealton.info/BruceWhealtonJr/foaf.rdf

Vcard: http://whealton.info/BruceWhealtonJr...ltonvcard.html

Web Design and Development http://FutureWaveDesigns.com

http://futurewavedesigns.com/wordpress/

Web Technology wiki: http://futurewavedesigns.com/w/

++++++++++++++++++++++++++++++++++++++++++++++++++


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cypher - Natural Language to RDF/SeRQL for the Semantic Web smonroe Java 0 07-28-2006 12:47 PM
Cypher - Natural Language to RDF/SeRQL for the Semantic Web smonroe XML 0 07-28-2006 12:39 PM
help in creating semantic web atmosphere grpmangr@yahoo.com XML 0 11-14-2005 06:07 AM
[ANN] Workshop on Scripting for the Semantic Web James G. Britt Ruby 1 02-07-2005 09:25 PM
CfP: Workshop on Scripting for the Semantic Web Sren Auer Ruby 0 02-04-2005 02:31 PM



Advertisments