#!/usr/bin/env python """ GRDDL Demonstration License: GPL 2; share and enjoy! Author: Sean B. Palmer, inamidst.com Service: http://inamidst.com/proj/grddl/demo Source: http://inamidst.com/inside/proj/grddl/demo Requirements: http://inamidst.com/misc/cgiutil.py http://inamidst.com/grddl/garner.py http://infomesh.net/pyrple/ --- GRDDL Demonstration (using Pyrple and garner.py)

GRDDL Demo

This demonstration uses garner.py and Pyrple to GRDDL itself up some RDF.

URI:

Also: the source of this demo. The W3C also maintains a similar service.

Sean B. Palmer
""" import cgitb; cgitb.enable() import sys; sys.path.extend(('/home/sbp/tools', '../../misc')) import garner, pyrple from cgiutil import serve, form, method def demo(): if not form.has_key('format'): format = 'rdfxml' else: format = form('format') if format not in ('rdfxml', 'ntriples'): serve(500, '

Format %s is not supported.

\n' % format) result = garner.garner(form('uri'), format=format) mime = {'ntriples': 'text/plain', 'rdfxml': 'application/rdf+xml'}[format] serve(200, result, mime=mime) def homepage(): i = __doc__.find('---') serve(200, __doc__[i+3:]) def main(): if form.has_key('uri'): demo() elif method == 'GET': homepage() else: serve(501, "

Only GET is supported.

\n") if __name__=="__main__": main()