skip to navigation
skip to content

OortPub 0.1

An Oort-based, WSGI-enabled toolkit for creating RDF-driven web apps.

OortPub is a toolkit for creating RDF-driven WSGI-compliant web applications.

The purpose of this is to make it easy to create web views of RDF Graphs by using some declarative python programming.

OortPub uses RDFLib, Paste and Genshi for the heaving lifting.

The RDF-to-objects facility comes from the Oort core package, released separately.


The main package is:


Contains classes used for declarative definitions of displays, used for matching resources and rendering a particular output (html, json etc.). By defining aspects, the type (or super-type) of a selected resource is mapped to a particular RdfQuery and an associated template.

One or more displays are put in the context of a resource viewer, which becomes a WSGI application ready to mount in your WSGI environment.


Loads of RDF data like:

<site/main> a :SiteNode;
    dc:title "Main Page"@en, "Huvudsida"@sv;
    dc:altTitle "Main", "Hem"@sv;
    :relations (
    :nodeContent '''<h1 xml:lang="en">Welcome</h1>'''^^rdfs:XMLLiteral,
                 '''<h1 xml:lang="sv">V&#195;&#164;lkommen</h1>'''^^rdfs:XMLLiteral .

<persons/someone> a foaf:Person;
    foaf:name "Some One";
    foaf:knows <otherone> .

A couple of RdfQuerys:

from oort.rdfview import *
SITE = Namespace("")

class Titled(RdfQuery):
    title = localized(DC)
    altTitle = localized(DC.alternative)

class SiteNode(Titled):
    relations = collection(SITE) >> Titled
    nodeContent = localized_xml(SITE)

class Person(RdfQuery):
    name = one(FOAF)
    knows = each(FOAF) >> 'Person'

And a web application:

from oort.sitebase import *
from myapp import queries
from myapp.ns import SITE

class ExampleViewer(ResourceViewer):

    resourceBase = ""
    langOrder = 'en', 'sv'

    class PlainWebDisplay(Display):
        name = "main"
        default = True
        outputMethod = 'xhtml'
        outputEncoding  = 'iso-8859-1'
        templateBase = "view/mainweb"
        globalQueries = {'languages': queries.sitelabels }
        aspects = [
                Aspect(SITE.SiteNode, "sitenode.xhtml",
                        {'node': queries.SiteNode}) ,
                Aspect(FOAF.Person, "person.xhtml",
                        {'person': queries.Person}) ,
                Aspect(RDFS.Resource, "not_found.xhtml")

    class JsonDisplay(Display):
        name = "json"
        contentType = 'application/x-javascript'
        aspects = [
                JsonAspect(SITE.SiteNode, {'node': queries.SiteNode})

But wait, there’s more..


Makes WSGI go down smoothly. ResourceViewers take RDFLib Graph instances in their constructors and become callables adhering to the spec.

To get started quickly, run:

$ paster create -t oort_app
... fill in desired values in the dialogue
$ cd myapp/
$ vim # edit and test..
$ chmod u+x webapp.ini
$ ./webapp.ini


Because RDF is a formidable technology that could revolutionize the way information is treated and shared. Python and WSGI are exemplary technologies to use when building applications dealing with such data.

File Type Py Version Uploaded on Size
OortPub-0.1-py2.5.egg (md5) Python Egg 2.5 2007-10-07 31KB
OortPub-0.1.tar.gz (md5) Source 2007-10-07 12KB