Skip to main content

Object RDF Mapper

Project description


.. image::


*SuRF* is a Python library for working with RDF data in an Object-Oriented manner. In SuRF, RDF nodes (subjects and
objects) are represented as Python objects and RDF edges (predicates) as their attributes. *SuRF* is an Object RDF
Mapper (ORM), similar in concept to Object Relational Mappers like *SQLAlchemy*.



Install SuRF:

.. code:: sh

$ pip install --upgrade surf

Starting with version **1.1.9** the *surf.rdflib* and *surf.sparql_protocol* plugins are bundled with *SuRF*.

You'll need one of the following plugins (also installable by `pip`):

- *surf.allegro_franz*, for the AllegroGraph RDFStore
- *surf.sesame2*, for stores with a Sesame2 HTTP API


The example below shows how to query a resource using the rdflib in-memory backend:

.. code:: python

>>> from surf import *
>>> store = Store(reader='rdflib',
... writer='rdflib',
... rdflib_store='IOMemory')
>>> session = Session(store)
>>> store.load_triples(source='')
>>> Person = session.get_class(ns.FOAF.Person)
>>> all_persons = Person.all()
>>> for person in all_persons:
... print person.foaf_name.first
Timothy Berners-Lee


You can read the documentation online at

To build the documentation yourself, install sphinx and run the build step:

.. code:: sh

$ pip install sphinx
$ python build_sphinx


*SuRF* uses *tox* and *py.test* for testing:

.. code:: sh

$ tox

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SuRF-1.1.9.tar.gz (55.1 kB view hashes)

Uploaded source

Built Distribution

SuRF-1.1.9-py2-none-any.whl (81.0 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page