Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install oortpub

How to install OortPub

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install oortpub
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1 Failed View build log
Windows (64-bit)
0.1 Failed View build log
Mac OS X (10.5+)
0.1 Available View build log
Linux (32-bit)
0.1 Available View build log
Linux (64-bit)
0.1 Available View build log
 
License
BSD
Lastest release
version 0.1 on Jan 5th, 2011

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.

Overview

The main package is:

oort.sitebase 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.

How?

Loads of RDF data like:

<site/main> a :SiteNode;

System Message: ERROR/3 (<string>, line 43)

Inconsistent literal block quoting.

dc:title "Main Page"@en, "Huvudsida"@sv; dc:altTitle "Main", "Hem"@sv; :relations ( <site/faq> <site/about> ); :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:

System Message: WARNING/2 (<string>, line 58)

Literal block expected; none found.

from oort.rdfview import * SITE = Namespace("http://example.org/ns/2007/website#")

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:

System Message: WARNING/2 (<string>, line 75)

Literal block expected; none found.

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

class ExampleViewer(ResourceViewer):

resourceBase = "http://example.org/oort/" 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..

Paste!

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

System Message: ERROR/3 (<string>, line 117)

Inconsistent literal block quoting.

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

Why?

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.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.