Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A fork of the specgen code from the FOAF project svn (
Python Ruby
Branch: ident
Pull request Compare This branch is 12 commits ahead, 4 commits behind master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


This is an experimental new codebase for specgen tools.

It depends utterly upon rdflib. See

If you're lucky, typing this is enough: 
					easy_install -U rdflib

and if you have problems there, update easy_install etc with: 

					easy_install -U setuptools

(Last time I did all this, I got Python errors but it still works.)

Inputs: RDF, HTML and OWL description(s) of an RDF vocabulary
Output: an XHTML+RDFa specification designed for human users

See and for details. --danbri

To test, see

This is quite flexible. use -h for help, or run all with ./

When working on a specific test, it is faster to use something like: 

	./ testSpecgen.testHTMLazlistExists

See the src for adding more tests (simple and encouraged!), or for
defining collections that can be run together.

"What it does":

The last FOAF spec was built using
This reads an index.rdf, a template.html file plus a set of per-term files, 
eg. 'doc/homepage.en' etc., then generates the main HTML FOAF spec.


See also: (another rewrite)


 - be usable at least for (re)-generating the FOAF spec and similar
 - work well with multi-lingual labels 
 - be based on SPARQL queries against RDFS/OWL vocab descriptions
 - evolve a Python library that supports such tasks
 - keep vocab-specific hackery in scripts that call the library
 - push display logic into CSS
 - use a modern, pure Python RDF library for support


 - we load up and interpret the core RDFS/OWL 
 - we populate Vocab, Term (Class or Property) instances
 - we have *no* code yet for generating HTML spec


 - mine the old implementations to understand what we need to know 
about each class and property.
 - decide how much of OWL we want to represent
 - see what rdflib itself might offer to help with all this


1. librdf doesn't seem to like abbreviations in FILTER clauses.
this worked:

q= 'SELECT ?x ?l ?c ?type WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type .  FILTER (?type = <>)  } '

while this failed:

q= 'PREFIX owl: <> SELECT ?x ?l ?c ?type WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type .  FILTER (?type = owl:ObjectProperty)  } '

(even when passing in bindings)

This forces us to be verbose, ie.
q= 'SELECT distinct ?x ?l ?c WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = <> || ?type = <> || ?type = <> || ?type = <> || ?type = <>) } '

2. Figure out the best way to do tests in Python. assert()? read diveinto...

3. TODO: work out how to do ".encode('UTF-8')" everywhere

4. Be more explicit and careful re defaulting to English, and more robust when
multilingual labels are found.

5. Currently, queries find nothing in SIOC. We need to match various OWL 
and RDF ways of saying "this is a property", and encapsulate this in a 
function. And test it. SIOC should find 20<x<100 properties, etc.
Something went wrong with that request. Please try again.