SemWebCentral

pySesame - a Python wrapper for Sesame

Sesame (http://openrdf.org) is an open source RDF Schema-based storage and querying facility.

pySesame is a Python wrapper for Sesame's REST HTTP API, as described in chapter 8 of the Sesame Manual. Now you can easily do the following from your Python script:

RQL, RDQL and SeRQL queries will return results as Python data structures, HTML or RDF.

Download:

pySesame at SemWebCentral.

Example usage:

>>> from pySesame import SesameConnection >>> connection = SesameConnection('feinsteinhs.org:8180', '/sesame/') >>> connection.login('test', 'pySesame') >>> connection.repositories() [{'writeable': u'true', 'readable': u'true', 'id': u'pySesame', 'title': u'pySesame Test Suite'}] >>> connection.uploadURL('pySesame', 'http://burningbird.net/articles/monsters1.rdf') 1 >>> rdqlQuery = """SELECT ?date ... WHERE ... (?resource, <rdf:type>, <pstcn:Movement>), ... (?resource, <pstcn:movementType>,?value), ... (?resource, <dc:date>, ?date) ... AND (?value eq "Add") ... USING pstcn FOR <http://burningbird.net/postcon/elements/1.0/>, ... rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, ... dc for <http://purl.org/dc/elements/1.1/>""" >>> connection.tableQuery('pySesame', 'RDQL', rdqlQuery) {'header': [u'date'], 'tuples': [[{'type': u'literal', 'value': u'1998-01-01T00:00:00-05:00'}]]} >>> connection.logout() Logged out successfully

Status and ToDo:

pySesame should be pretty complete. The test suite covers most, but not all of the functionality.

Outstanding issues:

Prerequisites

Contact

Tom Hoffman, *-pike