[foaf-dev] RDF specgen revisited - help needed!

Dan Brickley danbri at danbri.org
Thu Dec 11 15:49:18 CET 2008


Hi folks

I'm looking for some Python-hacking help, to get a new FOAF spec out.

Some of you might know about specgen. I've long used a version of this 
script to re-generate the FOAF spec from sources. Originally in Ruby, 
Uldis Bojars and Chris Schmidt made a Python version and disentangled it 
from the specifics of the FOAF spec/site. Their specgen4.py, as well as 
the earlier specgen.py the last FOAF spec was built from, both require 
the compilation of Redland plus the Python bindings. Although Redland is 
a solid, powerful and mature library, it can be tough to get the Python 
bindings set up. Lately I've failed to manage this either on my Mac 
laptop or under Linux at Dreamhost. Redland is overkill for this task. 
I'd like to be able to rev the FOAF spec with far fewer dependencies.

So I've begun exploring a rewrite of specgen. My first attempt (now 
abandoned as specgen4b.py) was to simply go through and replace calls to 
Redland with similar calls to the librdf library. I found this rather 
error prone, since the RDF logic is tangled up with page-generation code.

Despite my ignorance of Python and rdflib, I'm attempting a fresh start. 
The idea is to have a few core utility classes, Vocab, Term (Class, 
Property) and populate these - as before - from on disk RDF and HTML 
descriptions of an RDF vocabulary.

Everything I have so far is at http://svn.foaf-project.org/foaftown/specgen/

The RDFS/OWL-loader and utility code is in libvocab.py. This does 
nothing fancy; certainly no RDFS or OWL reasoning.

# Test FOAF spec
spec = Vocab( 'examples/foaf/index.rdf' )
spec.uri = 'http://xmlns.com/foaf.0.1/'
spec.index() # slurp info from sources

# spec.raw()
# print spec.report().encode('UTF-8')

for p in spec.properties:
   print "Got a property: " + p
   print p.simple_report().encode('UTF-8')
for c in spec.classes:
   print "Got a class: " + c
   print c.simple_report().encode('UTF-8')

...sample outout:

Got a class: Group
default: 		Group
id:      		Group
uri:     		http://xmlns.com/foaf/0.1/Group
xmlns:   		http://xmlns.com/foaf/0.1/
label:   		Group
comment: 		A class of Agents.


Is anyone interested in helping take this further? The existing 
Redland-based specgen code is useful, but the dependency on configuring 
Redland plus Python bindings is pretty heavy. Librdf (eg. see 
http://www.science.uva.nl/research/air/wiki/RDFlib) seems to contain a 
reasonable SPARQL implementation, and there's an RDFa parser around too 
somewhere I'm sure. The current code at 
http://svn.foaf-project.org/foaftown/specgen/ doesn't quite load up 
enough information for the HTML-generation side of specgen to be 
implemented. I'd love to find a more Python-aware collaborator or two to 
help get this moving. Failing that, I need to get Redland+Python running 
again so I can make a new FOAF spec :)

Thanks for any thoughts or help,

cheers

Dan


ps. if it isn't clear from the code, I've never written anything in 
Python before! Am taking a 'pretend it is Ruby then google when stuff 
breaks' approach...

--
http://danbri.org/






More information about the foaf-dev mailing list